0

Referring to my previous post, I reopen now the topic saying that I performed a pull request on GitHub (as suggested by @rmano, whom I thank, in the comments), to implement the Italian language support, but I also rearranged the previous code, inserting the customization of the backreferences directly in the definition of the commands \backrefenglish, \backrefgerman, \backreffrench, \backrefspanish, \backrefbrazil, \backrefafrikaans, \backrefitalian, like so:

\def\backrefenglish{% \def\backrefpagesname{pages}% \def\backrefsectionsname{sections}% \def\backrefsep{, }% \def\backreftwosep{ and~}% \def\backreflastsep{, and~}% \renewcommand*{\backref}[1]{}% for backref < 1.33 necessary \renewcommand*{\backrefalt}[4]{[{% \ifcase ##1 No citations% \or Cited in page~##2% \else Cited in pages~##2% \fi% }]}% } \def\backrefitalian{% \def\backrefpagesname{pagine}% \def\backrefsectionsname{sezioni}% \def\backrefsep{, }% \def\backreftwosep{ e~}% \def\backreflastsep{ e~}% \renewcommand*{\backref}[1]{}% for backref < 1.33 necessary \renewcommand*{\backrefalt}[4]{[{% \ifcase ##1 Nessuna citazione% \or Cit. a pagina~##2% \else Cit. alle pagine~##2% \fi% }]}% } 

It would be necessary to extend the translation of the following 3 sentences in the current languages (german, french, spanish, brazil, afrikaans), if you can contribute in my branch backref-multilingual-implemented on GitHub:

  1. No citations
  2. Cited in page
  3. Cited in pages

The code works, generating the Italian or English version of the custom \backrefalt command, based on \backrefenglish or \backrefitalian used command inside \begin{document}, before \bibliographystyle (as shown in the previous post), but it is necessary to comment out the \backrefenglish command after \BR@DeclareLang{italian}{italian}, in the backref.sty file of hyperref package, making it explicit instead with the one in the desired language (\backrefenglish, \backrefgerman, \backreffrench, \backrefspanish, \backrefbrazil, \backrefafrikaans or \backrefitalian) inside \begin{document}, before \bibliographystyle. Maybe the written code could be made cleaner, considering also a backref to sections instead of pages. What do you think?

3
  • I'm not sure that the rearrangement is a good idea. Wouldn't that affect existing documents which set e.g backrefalt? Commented Feb 19, 2023 at 8:08
  • Hello @UlrikeFischer, for now I made a copy of the hyperref's backref.sty file and I put it in the same folder as my .tex document making the above changes and it works. I'm asking if the code can be written in such a way to make it global with the possibility to contemplate a similar scenario of customization with multilingual translation of back-references. It would be nice, I think Commented Feb 19, 2023 at 9:55
  • 1
    sorry no, by defining \backrefalt for all languages you are clearly changing the behaviour. Currently backref tests if \backrefalt is used or not. So I don't think that I would accept a pull request which changes that. Commented Feb 19, 2023 at 10:32

0

You must log in to answer this question.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.