-
-
Notifications
You must be signed in to change notification settings - Fork 3.5k
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
lang does not set mainlang when using xelatex #2174
Comments
@nickbart1980, sorry if I missing something, but it seems that LaTeX is specially problematic when dealing with languages. First of all, LaTeXt doesn’t share the same values for language identifer names for XML (#1614). I think this should be fixed first to have common values (translating between them). I’m not a LaTeX user myself (anymore), but I don’t know why we need three variables for languages ( @jgm, I don’t think that And when other languages are used in the document, pandoc itself should add this information for BTW, @nickbart1980, just out of curiosity, how do you markup passages that contain foreign languages in your Markdown documents? |
Well, I don't think LaTeX is that problematic. Of course, as you point out quite rightly, pandoc should only use two-letter ISO 639-1 codes (“en-US”, “fr-FR”, “ar”, …) as language identifiers and map these to babel or polyglossia identifiers as appropriate. As to proliferation of variables, mainlang and otherlang are only to be used internally in templates anyway; ideally users would only have to specify, e.g. @ousia, your idea “when other languages are used in the document, pandoc itself should add this information for polyglossia or babel” is intriguing: if pandoc can figure out by itself which other languages are used in a document, we could indeed limit the use of As to markup, for basic testing I have just been using raw LaTeX commands such as |
@nickbart1980, different language codes is only one part in the issue of languages in LaTeX. The other part of the issue is that (it seems that) LaTeX needs to know all languages used in the document before reading the text source. Sorry, but this isn’t a requirement even in ConTeXt. This language list is why we would need three variables in YAML metadata to deal with multilanguage documents. Sorry, but it makes no sense to me. Mainly, because pandoc is mimicing LaTeX. And LaTeX is only a non-standard way of dealing with languages. One of my documents would have to have the following language information In the ePub file, I get the following field: <dc:language>grc, it, fr, en, de, es</dc:language> calibre-2.28 (latest version released) cannot read this language information. And I wonder whether iBooks or any other ePub reader that enables hyphenation can read the list above. (http://dublincore.org/documents/usageguide/elements.shtml#language allows lists, but it doesn’t prescribe which element should be the main language.) HTML conversion would include the following element: <html xmlns="http://www.w3.org/1999/xhtml" lang="grc, it, fr, en, de, es" xml:lang="grc, it, fr, en, de, es"> Well, I would say this is wrong, since HTML elements are supposed to have a single language. Which doesn’t prevent that child or descendant elements may have different language values. Including a new variable (this would make the fourth) The whole reason for having a language list in Language tags can be added like with division and span elements. But this has the same problem as with LaTeX language tagging. HTML tags only work with HTML output (which includes ePub). LaTeX language markup only works with LaTeX. I think we need a special attribute syntax for language (#895), but we need a special syntax for division and span elements to be implemented before (#168). I would ask to comment in the issue for special syntax for languages, if you find it useful. So that there is a more accurate image of the need for this feature. |
FWIW:
Multible instances of of the same element containing a single language declarations in each instance is also my understanding of DC impelmentation in the ePub standard: http://www.idpf.org/epub/30/spec/epub30-publications.html#elemdef-opf-dclanguage |
Let me try and keep this simple:
|
This uses an `otherlang` variable that takes a list of languages. As requseted in #2174.
http://pandoc.org/releases.html: “mainlang is the last of a comma-separated list of languages in lang.”
This does not work as expected when using xelatex and the default.latex template. – Example:
Actual output contains
\usepackage{polyglossia} \setmainlanguage{}
.Only uncommenting
mainlang: english
produces the expected\usepackage{polyglossia} \setmainlanguage{english}
.Additional feature request: Create a variable for the “other” languages (all except the last of a comma-separated list of languages in lang), too (for example, “otherlang”), and add
$if(otherlang)$ \setotherlanguages{$otherlang$}$endif$
to default.latex, after\setmainlanguage{$mainlang$}
.The text was updated successfully, but these errors were encountered: