Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Language option doesn't work #757

Closed
Doc73 opened this issue Jun 6, 2018 · 18 comments
Closed

Language option doesn't work #757

Doc73 opened this issue Jun 6, 2018 · 18 comments
Assignees

Comments

@Doc73
Copy link

Doc73 commented Jun 6, 2018

Dear Devs, if I well understand the manual (pag. 48), it seems that language option doens't work as expected.
Here is a MWE with explanations within it:

% !TeX program = xelatex
% !TeX encoding = UTF-8
% !TeX spellcheck = it_IT

\begin{filecontents}{biblio.bib}
@Article{Cufalo2017,
	author          = {Cufalo, Domenico},
	journaltitle    = {Exemplaria Classica},
	pages           = {227--242},
	title           = {{\em Scholia in scholia}: su una nuova edizione di Hermias di Alessandria},
	volume          = {21},
	date            = {2017},
	journalsubtitle = {Journal of Classical Philology},
}

@Book{Cufalo2007,
  Title                    = {Scholia Graeca in Platonem},
  Author                   = {Cufalo, Domenico},
  Location                 = {Roma},
  Publisher                = {Edizioni di Storia e Letteratura},
  Year                     = {2007},
  Number                   = {5.1},
  Series                   = {«Pleiadi»},
  Titleaddon               = {I: Scholia ad dialogos tetralogiarum I--VII continens},
}
\end{filecontents}

\documentclass{article}

\usepackage{polyglossia}
\setmainlanguage{italian}
\setotherlanguage[variant=ancient]{greek}

\usepackage{fontspec}
\setmainfont{Libertinus Serif}

\usepackage{filecontents}

\usepackage[%
	backend=biber,%
	language=italian,%
	style=authoryear,
	]{biblatex}
\addbibresource{biblio.bib}

\begin{document}
\section{Italian}
In this section, according to main language definition, the sigla “pp.” are written in Italian.

\cite[230-231]{Cufalo2017}

\cite[230-231]{Cufalo2007}


\section{Greek}
\begin{greek}
In this section I have instead “σσ.” in Greek. It seems therefore that “language” option of Biblatex is not working.
	
\cite[230-231]{Cufalo2017}

\cite[230-231]{Cufalo2007}
\end{greek}

\end{document}

Many thanks in advance,
DC

@moewew
Copy link
Collaborator

moewew commented Jun 6, 2018

I'll admit that the way the language option works is a bit counter-intuitive. In addition to language you also need to specify an autolang value different from none (presumably other), this is what the

It is also possible to select the package language manually. In this
case, the language chosen will override the langid of entries and you should still
choose a language switching environment with the autolang option to select how
the switch to the manually chosen language is handled.

in the documentation of the language option tries to tell you.

Consequently

% !TeX program = xelatex
% !TeX encoding = UTF-8
% !TeX spellcheck = it_IT

\begin{filecontents}{biblio.bib}
@Article{Cufalo2017,
	author          = {Cufalo, Domenico},
	journaltitle    = {Exemplaria Classica},
	pages           = {227--242},
	title           = {{\em Scholia in scholia}: su una nuova edizione di Hermias di Alessandria},
	volume          = {21},
	date            = {2017},
	journalsubtitle = {Journal of Classical Philology},
}

@Book{Cufalo2007,
  Title                    = {Scholia Graeca in Platonem},
  Author                   = {Cufalo, Domenico},
  Location                 = {Roma},
  Publisher                = {Edizioni di Storia e Letteratura},
  Year                     = {2007},
  Number                   = {5.1},
  Series                   = {«Pleiadi»},
  Titleaddon               = {I: Scholia ad dialogos tetralogiarum I--VII continens},
}
\end{filecontents}

\documentclass{article}

\usepackage{polyglossia}
\setmainlanguage{italian}
\setotherlanguage[variant=ancient]{greek}

\usepackage{fontspec}
\setmainfont{Libertinus Serif}

\usepackage{filecontents}

\usepackage[%
	backend=biber,%
	language=italian,%
	autolang=other,
	style=authoryear,
	]{biblatex}
\addbibresource{biblio.bib}

\begin{document}
\section{Italian}
In this section, according to main language definition, the sigla “pp.” are written in Italian.

\cite[230-231]{Cufalo2017}

\cite[230-231]{Cufalo2007}


\section{Greek}
\begin{greek}
In this section I have instead “σσ.” in Greek. It seems therefore that “language” option of Biblatex is not working.
	
\cite[230-231]{Cufalo2017}

\cite[230-231]{Cufalo2007}
\end{greek}

\end{document}

should do what you want.

@Doc73
Copy link
Author

Doc73 commented Jun 7, 2018

GREAT!
Now I finally understood!

Many thanks,
DC

@moewew
Copy link
Collaborator

moewew commented Jun 7, 2018

Very good. As unintuitive as the situation might be I don't think there is a simple way out. If we force a language we really must use a language switching environment as soon as the surrounding language differs from the forced language. Otherwise hyphenation and possibly other things might be off. So autolang is really necessary.

Is the quoted passage in the documentation clear enough or do you thing it needs to be extended?

@Doc73
Copy link
Author

Doc73 commented Jun 7, 2018

Maybe the problem is due to the myriad of options of this extraordinary tool. 😄

Certainly, the documentation can be expanded.
For example, I'm now reading the langid field and I understand that I can use this field for a better hyphenation, but I fear that in my ancient greek text, where there are notes that contain bibliographic citations, I could obtain "σσ." instead of "pp."; or "herausgegeben" (deutsch) in bibliography instead of "a cura di" (italian). The language options are related not only to hyphenation, but also to other stuff!

In short, there are many obscure points in the documentation, at least for me, and any other clarification would be much appreciated.

@moewew
Copy link
Collaborator

moewew commented Jun 7, 2018

The langid field only becomes important if you use language=auto (or autobib/autocite). If you use language=italian langid is overruled and effectively the value of langid is replaced by italian for all entries. Depending on the value of the autolang option langid can control hyphenation (autolang=hyphen) or everything - including strings - (autolang=other/other*). Normally the bibliography and citation commands are typeset in the currently active language (unless that is prevented with one of the mentioned options).

In you case that means

  • If you want language=italian, langid is useless because it is effectively overruled.
  • If you wanted the hyphenation rules to changed depending on langid you would need language=autobib, autolang=hyphen. But then citations in the Greek bits of your document would be typeset with Greek localisation, you would have to wrap them into and Italian language environment yourself.

So with manual intervention you could do something like this

%\RequirePackage{filecontents}
\begin{filecontents}{\jobname.bib}
@Article{Cufalo2017,
	author          = {Cufalo, Domenico},
	journaltitle    = {Exemplaria Classica},
	pages           = {227--242},
	title           = {{\em Scholia in scholia}: su una nuova edizione di Hermias di Alessandria},
	volume          = {21},
	date            = {2017},
	journalsubtitle = {Journal of Classical Philology},
    langid = {italian},
}

@Book{Cufalo2007,
  Title                    = {Scholia Graeca in Platonem},
  Author                   = {Cufalo, Domenico},
  Location                 = {Roma},
  Publisher                = {Edizioni di Storia e Letteratura},
  Year                     = {2007},
  Number                   = {5.1},
  Series                   = {«Pleiadi»},
  Titleaddon               = {I: Scholia ad dialogos tetralogiarum I--VII continens},
    langid = {latin},
}
\end{filecontents}

\documentclass{article}

\usepackage{polyglossia}
\setmainlanguage{italian}
\setotherlanguage[variant=ancient]{greek}

\usepackage{fontspec}
\setmainfont{Libertinus Serif}

\usepackage{filecontents}

\usepackage[%
	backend=biber,%
	language=autobib,%
	autolang=hyphen,
	style=authoryear,
	]{biblatex}
\addbibresource{\jobname.bib}

\begin{document}
\section{Italian}
In this section, according to main language definition, the sigla “pp.” are written in Italian.

\cite[230-231]{Cufalo2017}

\cite[230-231]{Cufalo2007}


\section{Greek}
\begin{greek}
In this section I have instead “σσ.” in Greek. It seems therefore that “language” option of Biblatex is not working.
	
\textitalian{\cite[230-231]{Cufalo2017}}

\textitalian{\cite[230-231]{Cufalo2007}}
\end{greek}

\printbibliography

\end{document}

@Doc73
Copy link
Author

Doc73 commented Jun 7, 2018

Yes, thank you!
I had guessed the need to specify \textitalian, but in this case is preferable to specify language environment inside bib entries, for example inside titles etc. It would be much more difficult to search for individual citations with linguistic issues.

Anyway, many thanks for your kindly explanations!

moewew added a commit to moewew/biblatex that referenced this issue Jun 8, 2018
- Emphasise default automatic language switching and that the options only
  add an additional layer.
- Zap whitespace at end of lines.
- Tweak (min|max)sortnames docs (plk#755).
@moewew
Copy link
Collaborator

moewew commented Jun 8, 2018

Some clarifications about the language options are in 3b8bbdc?w=1 Does that make the docs easier to understand?

@Doc73
Copy link
Author

Doc73 commented Jun 8, 2018

Yes, this version is by far better!
But... another question: if I'd use autolang=hyphen, I'd obtain hyphenation patterns for bibliographic item according their langid entry. In this case, I will however get "σσ." etc. in the section of my book where the Greek is main language?
Because my bibliography contain books and articles of several languages, it would be very nice if I could obtain hyphenation according language of bibliogrphic item (langid) and localization according a specific language (for ex. Italian, even in chapters where greek is main language).

@moewew
Copy link
Collaborator

moewew commented Jun 8, 2018

That is correct as

%\RequirePackage{filecontents}
\begin{filecontents}{\jobname.bib}
@Article{Cufalo2017,
	author          = {Cufalo, Domenico},
	journaltitle    = {Exemplaria Classica},
	pages           = {227--242},
	title           = {{\em Scholia in scholia}: su una nuova edizione di Hermias di Alessandria},
	volume          = {21},
	date            = {2017},
	journalsubtitle = {Journal of Classical Philology},
    langid = {italian},
}

@Book{Cufalo2007,
  Title                    = {Scholia Graeca in Platonem},
  Author                   = {Cufalo, Domenico},
  Location                 = {Roma},
  Publisher                = {Edizioni di Storia e Letteratura},
  Year                     = {2007},
  Number                   = {5.1},
  Series                   = {«Pleiadi»},
  Titleaddon               = {I: Scholia ad dialogos tetralogiarum I--VII continens},
    langid = {latin},
}
\end{filecontents}

\documentclass{article}

\usepackage{polyglossia}
\setmainlanguage{italian}
\setotherlanguage[variant=ancient]{greek}

\usepackage{fontspec}
\setmainfont{Libertinus Serif}

\usepackage{filecontents}

\usepackage[%
	backend=biber,%
	language=autobib,%
	autolang=hyphen,
	style=authoryear,
	]{biblatex}
\addbibresource{\jobname.bib}

\begin{document}
\section{Italian}
In this section, according to main language definition, the sigla “pp.” are written in Italian.

\cite[230-231]{Cufalo2017}

\cite[230-231]{Cufalo2007}


\section{Greek}
\begin{greek}
In this section I have instead “σσ.” in Greek. It seems therefore that “language” option of Biblatex is not working.
	
\cite[230-231]{Cufalo2017}

\textitalian{\cite[230-231]{Cufalo2007}}
\begin{italian}
\printbibliography
\end{italian}
\end{greek}

\printbibliography

\end{document}

shows.

You can't get what you want fully automatically, unfortunately. You would have to wrap all \cite and \printbibliographys in Greek chapters in an Italian environment. This is shown in the MWE as well.

@Doc73
Copy link
Author

Doc73 commented Jun 8, 2018

Yes, many thanks for all your clarifications! In this case, I'll stay with autolang=other.

Issue solved, for me! 👍

@moewew
Copy link
Collaborator

moewew commented Aug 23, 2018

A similar problem (hyphenation and fonts of one the language of the work and bibliography strings from the main document language) was discussed in https://tex.stackexchange.com/q/444016/35864

If anyone has a good idea how to tackle this, please share ...

@josephwright
Copy link
Collaborator

@moewew I'll have a look

@moewew
Copy link
Collaborator

moewew commented Aug 23, 2018

@josephwright Cool, thank you. No need to hurry, though, I know you have a lot of other things on your plate.

@plk
Copy link
Owner

plk commented Aug 19, 2022

This is probably better closed now and a link from the multiscript issue made?

@moewew
Copy link
Collaborator

moewew commented Aug 19, 2022

Yeah, but it would be great to have an MWE using the multiscript code based on the code from above. I can look into that once the multscript biblatex is in MikTeX (is it on CTAN yet?).

@plk
Copy link
Owner

plk commented Aug 19, 2022

Not released yet as a stand-alone package. I can try to get that done but it needs a biber release too of course. I'll see what I can do.

@moewew
Copy link
Collaborator

moewew commented Aug 19, 2022

No need to hurry for me. It's just more convenient to have the example here and only close the issue when one is available, so things don't get lost in the multiscript megathread.

@plk
Copy link
Owner

plk commented Mar 8, 2023

biblatex-ms and biber-ms are both now in TL to try.

@plk plk closed this as completed Mar 8, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

4 participants