Improving Unicode support in the Beamer template #54

Merged
merged 1 commit into from Mar 19, 2014

Projects

None yet

2 participants

@KarolS
Contributor
KarolS commented Feb 26, 2014

The default Beamer template didn't work for a markdown source with Unicode characters. I copied some features from the normal Latex template and it seems to work better.

@jgm
jgm commented on 088fcca Feb 26, 2014

Does the usepackage{lmodern} change the font? Beamer's default uses a sans-serif font, and lmodern is a serif font. I wonder if that change belongs here...

Owner

@jgm
No, all fonts are sans-serif (well, except for the \texttt font, with is still that Courier-esque one). The output file looks like all standard Beamer presentations I have ever seen. I needed to add lmodern because I was getting ! pdfTeX error (font expansion): auto expansion is only possible with scalable fonts. without it.

I have lots of accented (Latin-2) letters and Unicode symbols (like ) both in the main text and in the monospaced text. All of them look okay.

I also rolled my finger over the keyboard while holding the AltGr key and I got some more errors:

! Package inputenc Error: Unicode char \u8:⅞ not set up for use with LaTeX.

but I was getting the exactly same kind of them for ordinary letters (like ś) before my modifications, so I'd still call it a progress.

jgm replied Feb 28, 2014
@KarolS
Contributor
KarolS commented Mar 19, 2014

Xelatex and Lualatex solve nothing.

I did some tests with the following input file:

TEST
====

→→→→ë¥Ęč↑ıžší€↑±€£€↑ źźzź 

In the examples below, old.beamer refers to the original template, and new.beamer refers to the template from this pull request.

$ pandoc o.md -o o.pdf -t beamer --latex-engine=xelatex --template=old.beamer
pandoc: Error producing PDF from TeX source.
! Undefined control sequence.
pandoc: Cannot decode byte '\x86': Data.Text.Internal.Encoding.streamDecodeUtf8With: Invalid UTF-8 stream
$ pandoc o.md -o o.pdf -t beamer --latex-engine=xelatex --template=new.beamer
$ pandoc o.md -o o.pdf -t beamer --latex-engine=lualatex --template=old.beamer
pandoc: Error producing PDF from TeX source.
! 
 ********************************************
 * XeTeX is required to compile this document.
 * Sorry!
 ********************************************.
\RequireXeTeX ...********************************}
                                                  \endgroup \fi 
l.18 \RequireXeTeX

$ pandoc o.md -o o.pdf -t beamer --latex-engine=lualatex --template=new.beamer
pandoc: Error producing PDF from TeX source.
! 
 ********************************************
 * XeTeX is required to compile this document.
 * Sorry!
 ********************************************.
\RequireXeTeX ...********************************}
                                                  \endgroup \fi 
l.18 \RequireXeTeX
$ pandoc o.md -o o.pdf -t beamer --latex-engine=pdflatex --template=old.beamer
pandoc: Error producing PDF from TeX source.
! Package inputenc Error: Unicode char \u8:→ not set up for use with LaTeX.

See the inputenc package documentation for explanation.
Type  H <return>  for immediate help.
 ...                                              

l.47 \end{frame}

Try running pandoc with --latex-engine=xelatex.
$ pandoc o.md -o o.pdf -t beamer --latex-engine=pdflatex --template=new.beamer

So, with the original template no engine worked, and with the new template only lualatex didn't work.

Since people expect pandoc to work out-of-the-box and usually use it because they don't want to worry about Latex quirks, I think my patch at least makes things work.

@jgm
Owner
jgm commented Mar 19, 2014

Thanks!

@jgm jgm merged commit 0ab594b into jgm:master Mar 19, 2014
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment