pandoc-latex-template icon indicating copy to clipboard operation
pandoc-latex-template copied to clipboard

`figureTitle` and `tableTitle` seemingly ignored in XeLaTeX builds

Open thomasWeise opened this issue 3 years ago • 6 comments

I am sorry to disturb your work. First of all, let me thank you for publishing the very nice eisvogel.tex template, which I am using very happily.

It seems that figureTitle and tableTitle may be ignored under XeLaTeX builds. I have two builds, one in German and one in Chinese. For both, figureTitle and tableTitle work completely fine when rendering to HTML, so it does not seem to be a core pandoc issue. When building to pdf using the eisvogel.tex template, I have to select the XeLaTeX pipeline for the Chinese version while using the default engine for the German one. The German version renders completely fine and produces a pdf where the figure and table captions contain the German words. The Chinese version, however, produces a pdf where the figure and table captions are the English terms "Figure" and "Table", respectively.

Maybe I am doing something wrong here?

I have attached for you an archive with all three cases discussed above (xelatex + eisvogel: does not use proper figure caption, latex + eisvogel: uses proper figure captions, xelatex without eisvolge: uses proper figure caption):

problem_with_xelatex_and_captions.zip

(Side note: If figureTitle and tableTitle actually do not work, maybe listingTitle probably won't work either, but I did not test that yet.)

Many thanks for your help. Thomas.

P.S.:

I first thought that this was an issue with pandoc-crossref, but it seems not to be the case, as the figure captions work well if I do not use eisvogel.tex.

thomasWeise avatar Sep 12 '21 02:09 thomasWeise

@thomasWeise I meet the same problem with you, did you solve it ?

ajeep8 avatar Oct 14 '21 08:10 ajeep8

Hi. Sorry, I do not know how to solve it :-( If you find a solution, please post it here ... because I don't know why it doesn't work

thomasWeise avatar Oct 14 '21 11:10 thomasWeise

Can you try to replace the figureTitle entry with this header-includes in the metadata :

header-includes:
- |
  ```{=latex}
  \AtBeginDocument{%
  \addto\captionsenglish{\renewcommand{\figurename}{图}}
  }
  ```

So your "book.md" should look like this :

---
CJKmainfont: Noto Sans CJK SC
header-includes:
- |
  ```{=latex}
  \AtBeginDocument{%
  \addto\captionsenglish{\renewcommand{\figurename}{图}}
  }
  ```
...

![Somefigure](fig.png){#fig:fig}

@fig:fig

supcik avatar Oct 16 '21 23:10 supcik

\AtBeginDocument{% \addto\captionsenglish{\renewcommand{\figurename}{图}} }

Thank you very much, it work. I add the code into templates file directly.

ajeep8 avatar Oct 20 '21 02:10 ajeep8

Great! It also works for me. To fix the same issue also for tables, I do

\AtBeginDocument{%
  \addto\captionsenglish{\renewcommand{\figurename}{图}}%
  \addto\captionsenglish{\renewcommand{\tablename}{表}}% 
  }%  

This workaround solves the problem.

thomasWeise avatar Oct 20 '21 06:10 thomasWeise

This will work as metadata define:

\AtBeginDocument{%
 \addto\captionsenglish{\renewcommand{\figurename}{$figureTitle$}}
\addto\captionsenglish{\renewcommand{\tablename}{$tableTitle$}}
}

ajeep8 avatar Oct 21 '21 02:10 ajeep8