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: Thu, 29 Apr 2021 16:27:52 -0300
User-agent: mu4e 1.4.15; emacs 27.2

Hi Arash,

On Thu, 29 Apr 2021 at 11:50, Arash Esbati <arash@gnu.org> wrote:

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?

I have literally contacted assign@gnu.org twice, once in 2019, another in the past year, trying to sign the papers. The clerks who answer to that email will probably tell you I cannot sign them due to employment restrictions. I see it otherwise. But I really wouldn't like to make an issue out of this, particularly not on the list. If you feel you need more details on that, please write me personally, and I can expand.

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):


Thank you very much for taking up on this! It is a big difference in using some of the fancy features of AUCTeX when the language style file is available. From experience, I got thoroughly confused trying to configure babel-hyphen and quotes when I started. And I only got fully satisfactory results when I finally cooked the said style file, which took me some time.

--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))


Looks good to me.

(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)

Indeed, the inclusion of the quote character to the word syntax is due, since that's an active character for babel, in such things as different kinds of hyphen.

   (unless (eq (car TeX-quote-language) 'override)
     (setq TeX-quote-language
           `("brazilian" "\"<" "\">" ,TeX-quote-after-quote)))

In Brazil we use English quotes, not guillemots. In Portugal it seems to be guillemots, more on that later. For `brazilian.el' and `brazil.el' it should be standard LaTeX quotes, just as is done in `english.el' lines 10-11, resetting `TeX-quote-language`, unless there is the csquotes override, as usual.

   (setq LaTeX-babel-hyphen-language "brazilian")

Perfect.

   ;; Fontification
   (when (and (eq TeX-install-font-lock 'font-latex-setup)
              (featurep 'font-latex))


     (font-latex-add-quotes '("\"<" "\">" french))

Ditto.

     ;; Prevent "| from leading to color bleed.
     (font-latex-add-to-syntax-alist (list (cons ?\" "\\"))))

This is indeed formally due: babel does use "| for ligature inhibition for portuguese/brazilian. However, this is way less frequent in Portuguese (the language) than it is in German, since we don't join the words as is practice in German. So, if there is no side effect from doing so, I'd keep it. I have it here, and have not observed anything undesirable from that.

   (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?

 TeX-dialect)

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

Please feel free to comment.


Besides the above, the only thing I'd have to add is that babel offers some convenience macros for ordinals, namely: `\ro', `\ra', `\ord', and `\orda'. They should thus be added with `TeX-add-symbols'. None of those take any argument.

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.


That's what I recalled. And I just diffed `brazilian.ldf', `brazil.ldf', `portuges.ldf', `portuguese.ldf' against each other, and they are identical except for the filenames. So, yes, as far as babel goes, it does exactly the same thing for each.

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. It seems to be the use in Portugal, and that's the best information I could gather.

What I checked in this regard. I tried my own books, and it turns out I have not a single one from a Portuguese publisher. So I did a search, Google books and the likes, and checked some for this, and found guillemots. Small sample nevertheless. Also, that's what `csquotes.def' uses for outer quotes in `\DeclareQuoteStyle[portuguese]{portuguese}', but marks the setting as "% unsure". All in all, to the best of my knowledge, guillemots it is for `portuguese.el' and `portuges.el'. But perhaps leaving a comment this should best be confirmed by a native Portuguese when possible?

WDYT?

And, again, thank you very much.

Best regards,
Gustavo.



reply via email to

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