auctex-devel
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Provide style file for babel support for Brazilian


From: Arash Esbati
Subject: Re: Provide style file for babel support for Brazilian
Date: Thu, 29 Apr 2021 16:50:35 +0200
User-agent: Gnus/5.13 (Gnus v5.13) Emacs/28.0.50

Hi Gustavo,

Gustavo Barros <gusbrs.2016@gmail.com> writes:

> I'm a native Brazilian and noticed AUCTeX has no support for babel
> language `brazilian', in the form of its proper style file.

Yepp, that's true.

> I have one here, which I've been using most satisfactorily for quite
> some time (more than a year now), which handles quotes, babel-hyphen,
> some specific macros provided by `babel' etc.  It is not particularly
> complicated.  I'm not absolutely sure it is exhaustive, but it was
> meant to be thorough when I did it.
>
> Unfortunately, I cannot provide it as a patch, since I don't have
> signed papers, and can't have them (I've tried).

Can you please elaborate this?  Have you started the process and you
don't make progress?

> But I'd be more than glad to provide specific and precise guidance to
> anyone who could provide a patch, and would be willing to take on the
> task.

Thanks for the offer.  The way I see it, an AUCTeX style for Brazilian
language can look like this (which is more or less a copy of
ngerman.el):

--8<---------------cut here---------------start------------->8---
;;; Code:

(require 'tex)
(require 'latex)

;; Silence the compiler:
(declare-function font-latex-add-quotes
                  "font-latex"
                  (quotes))

(declare-function font-latex-add-to-syntax-alist
                  "font-latex"
                  (list))

(defvar LaTeX-brazilian-mode-syntax-table
  (copy-syntax-table LaTeX-mode-syntax-table)
  "Syntax table used in LaTeX mode when using `brazilian' language.")

(modify-syntax-entry ?\" "w" LaTeX-brazilian-mode-syntax-table)

(TeX-add-style-hook
 "brazilian"
 (lambda ()
   (set-syntax-table LaTeX-brazilian-mode-syntax-table)
   (unless (eq (car TeX-quote-language) 'override)
     (setq TeX-quote-language
           `("brazilian" "\"<" "\">" ,TeX-quote-after-quote)))
   (setq LaTeX-babel-hyphen-language "brazilian")
   ;; Fontification
   (when (and (eq TeX-install-font-lock 'font-latex-setup)
              (featurep 'font-latex))
     (font-latex-add-quotes '("\"<" "\">" french))
     ;; Prevent "| from leading to color bleed.
     (font-latex-add-to-syntax-alist (list (cons ?\" "\\"))))
   (run-hooks 'TeX-language-br-hook))
 TeX-dialect)

;;; brazilian.el ends here
--8<---------------cut here---------------end--------------->8---

Please feel free to comment.

> Also, though I'm not Portuguese, as far as `babel' is concerned, I
> believe the requirements are very similar, if not identical.  (I'm not
> sure about quotes standards, though).  I could look that up, and check
> things, so that other Portuguese `babel' variants could be provided
> too, even if provisionally, until a proper Portuguese can review it.

It looks like babel loads the same file for portuguese, brazilian,
portuges and brazil options.

Best, Arash



reply via email to

[Prev in Thread] Current Thread [Next in Thread]