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: Gustavo Barros
Subject: Re: Provide style file for babel support for Brazilian
Date: Sun, 02 May 2021 14:47:56 -0300
User-agent: mu4e 1.4.15; emacs 27.2

Hi Arash,

On Sat, 01 May 2021 at 19:10, Arash Esbati <arash@gnu.org> wrote:


Thank you for your comments.  The next incarnation looks like this:

--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 nil))
   (setq LaTeX-babel-hyphen-language "brazilian")
   (TeX-add-symbols
    '("ord"  0)
    '("ro"   0)
    '("orda" 0)
    '("ra"   0))
   ;; 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 comment.


Looks good to me, but some comments in the light of following.

   (run-hooks 'TeX-language-br-hook))

I have here `TeX-language-pt-BR-hook', and I don't recall why.  Why
did you go with just "br" there?

All other styles use this pattern, this is the reason why I took it.
Have a look over here[1].


That was not my point here. I was just concerned if this language code was coming hardcoded from somewhere else. But, if I understand it, this is actually a convenience hook for language style files, which is not actually being called from or generated elsewhere. Is that correct?

If so, I think "br" is not the best choice here. The language is called "Portuguese". "Brazilian Portuguese" is like a variant, and we wouldn't usually say it this way, unless we are trying to distinguish those and, even then, it feels weird. This is the sort of en_US/en_GB kind of distinction. So, the same way it is not `TeX-language-am-hook' for "american", `TeX-language-br-hook' would be strange. Normally, I see "pt_BR" (as the locale, you also find it in `org-export-dictionary'), or with an hyphen there, also quite common "pt-br". I won't say I've never seen it, but just "br" is rare. For `portuguese.el' just "pt" is the usual. I can lookup a more official source on this, if it'd make you more comfortable.

Also, in that regard, perhaps using `LaTeX-portuguese-mode-syntax-table' for all four babel variants, including `brazilian' might make sense. Though there is a difference in the quote marks usage, there is none on the side of the syntax table. But I'm fine either way, this is just "fine print".


However, quotation marks practices is not something that babel
determines. True, it enables the "< "> guillemots shorthands for all,
but that's actually not what we use in Brazil.

Thanks, I removed that from the Brazilian style; maybe we change it for
Portugues.

Yes, for `portuguese.el' and `portuges.el', it is guillemots to the best of my knowledge. Though I think a "FIXME" comment would be appropriate, as mentioned.


Thanks again.

Best,
Gustavo.




reply via email to

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