Discussion:
Pandoc markdown to PDF with sans serif font
ChrisD
2018-04-29 00:28:10 UTC
Permalink
I would like to produce PDF output from Pandoc markdown, and use a sans serif font family for the text

I tried setting
    fontfamily: Arev
in my header block (also tried in the command line options), with a variety of different font names. None of them worked. Some, like Arev, report

     ! pdfTeX error (font expansion): auto expansion is only possible with scalable fonts.

while others report that it can't find the .sty file.

I also tried setting
    fontfamilyoptions: sfdefault
in my header block, but that had no effect.

I'm using
  Win7
  Pandoc 2.2
Miktex

Is there a way to do this? Thanks,

Chris
--
You received this message because you are subscribed to the Google Groups "pandoc-discuss" group.
To unsubscribe from this group and stop receiving emails from it, send an email to pandoc-discuss+***@googlegroups.com.
To post to this group, send email to pandoc-***@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/pandoc-discuss/df89929f-9707-626b-ce70-028fafbd4010%40intielectronics.com.
For more options, visit https://groups.google.com/d/optout.
James AUSTIN
2018-04-29 11:40:47 UTC
Permalink
Have you tried setting your LaTeX engine to XeLaTeX rather than PDFLaTeX? if I remember correctly XeLaTeX can handle a much greater range of fonts than PDFLaTeX.
Post by ChrisD
I would like to produce PDF output from Pandoc markdown, and use a sans serif font family for the text
I tried setting
fontfamily: Arev
in my header block (also tried in the command line options), with a variety of different font names. None of them worked. Some, like Arev, report
! pdfTeX error (font expansion): auto expansion is only possible with scalable fonts.
while others report that it can't find the .sty file.
I also tried setting
fontfamilyoptions: sfdefault
in my header block, but that had no effect.
I'm using
Win7
Pandoc 2.2
Miktex
Is there a way to do this? Thanks,
Chris
--
You received this message because you are subscribed to the Google Groups "pandoc-discuss" group.
To view this discussion on the web visit https://groups.google.com/d/msgid/pandoc-discuss/df89929f-9707-626b-ce70-028fafbd4010%40intielectronics.com.
For more options, visit https://groups.google.com/d/optout.
--
You received this message because you are subscribed to the Google Groups "pandoc-discuss" group.
To unsubscribe from this group and stop receiving emails from it, send an email to pandoc-discuss+***@googlegroups.com.
To post to this group, send email to pandoc-***@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/pandoc-discuss/5FB6914C-FBB1-49BF-B37D-B59A11344054%40gmail.com.
For more options, visit https://groups.google.com/d/optout.
ChrisD
2018-04-29 17:21:22 UTC
Permalink
Thanks for the suggestion, but no success.

If I tell Pandoc to output pdf, and specify --pdf-engine=xelatex, the xelatex steps fails. The message says to check the log files, but all the logs end with the statement "finishing with exit code 0".

If I tell Pandoc to output tex, and then run xelatex as a separate step, there is no error, and from the messages it seems to load the desired font, but the pdf still shows latin modern (or some serif font). I tried arev and opensans as fonts.

Using pdflatex, both of those fonts (arev and opensans) produce the "auto expansion is only possible with scalable fonts" message.




-------- Original Message --------
Subject: Re: Pandoc markdown to PDF with sans serif font
From: James AUSTIN <***@gmail.com>
To: pandoc-***@googlegroups.com
Date: 4/29/2018 4:40 AM
Post by James AUSTIN
Have you tried setting your LaTeX engine to XeLaTeX rather than PDFLaTeX? if I remember correctly XeLaTeX can handle a much greater range of fonts than PDFLaTeX.
Post by ChrisD
I would like to produce PDF output from Pandoc markdown, and use a sans serif font family for the text
I tried setting
fontfamily: Arev
in my header block (also tried in the command line options), with a variety of different font names. None of them worked. Some, like Arev, report
! pdfTeX error (font expansion): auto expansion is only possible with scalable fonts.
while others report that it can't find the .sty file.
I also tried setting
fontfamilyoptions: sfdefault
in my header block, but that had no effect.
I'm using
Win7
Pandoc 2.2
Miktex
Is there a way to do this? Thanks,
Chris
--
You received this message because you are subscribed to the Google Groups "pandoc-discuss" group.
To view this discussion on the web visit https://groups.google.com/d/msgid/pandoc-discuss/df89929f-9707-626b-ce70-028fafbd4010%40intielectronics.com.
For more options, visit https://groups.google.com/d/optout.
--
You received this message because you are subscribed to the Google Groups "pandoc-discuss" group.
To unsubscribe from this group and stop receiving emails from it, send an email to pandoc-discuss+***@googlegroups.com.
To post to this group, send email to pandoc-***@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/pandoc-discuss/3b8f6fa3-ce81-6055-971d-fd7bb356248e%40intielectronics.com.
For more options, visit https://groups.google.com/d/optout.
Pablo Rodríguez
2018-04-29 19:44:28 UTC
Permalink
Post by ChrisD
I would like to produce PDF output from Pandoc markdown, and use a sans serif font family for the text
I tried setting
    fontfamily: Arev
Hi Chris,

I don’t have LaTeX installed on my computer, but according to
https://pandoc.org/MANUAL.html#variables-for-latex, you should use the
"mainfont" variable to get it working with XeLaTeX or LuaLaTeX (and you
have to invoke it).

I hope it helps,

Pablo
--
http://www.ousia.tk
--
You received this message because you are subscribed to the Google Groups "pandoc-discuss" group.
To unsubscribe from this group and stop receiving emails from it, send an email to pandoc-discuss+***@googlegroups.com.
To post to this group, send email to pandoc-***@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/pandoc-discuss/797dd400-b61e-aa22-db59-fd397acdd725%40web.de.
For more options, visit https://groups.google.com/d/optout.
ChrisD
2018-04-29 21:37:23 UTC
Permalink
-------- Original Message --------
Subject: Re: Pandoc markdown to PDF with sans serif font
From: Pablo Rodríguez <***@web.de>
To: pandoc-***@googlegroups.com
Date: 4/29/2018 12:44 PM
Post by Pablo Rodríguez
Post by ChrisD
I would like to produce PDF output from Pandoc markdown, and use a sans serif font family for the text
I tried setting
    fontfamily: Arev
Hi Chris,
I don’t have LaTeX installed on my computer, but according to
https://pandoc.org/MANUAL.html#variables-for-latex, you should use the
"mainfont" variable to get it working with XeLaTeX or LuaLaTeX (and you
have to invoke it).
I hope it helps,
Pablo
Pablo,

Thanks! I had not noticed that fontfamily was pdflatex only, and that I need to use mainfont etc. for xelatex.

So I set:
mainfont: Arial

and xelatex produces my document with Arial font. It doesn't work for fonts that need to be downloaded, but it works for fonts that already exist on my computer.

For what it's worth, this also works for lualatex. And lualatex also accepts a mainfont of LatinModernSans, which is not installed on my computer as far as I know, but I suspect is "built in" to Miktex somehow. LatinModernSans does not work with xelatex.

Thanks for your help,

Chris
--
You received this message because you are subscribed to the Google Groups "pandoc-discuss" group.
To unsubscribe from this group and stop receiving emails from it, send an email to pandoc-discuss+***@googlegroups.com.
To post to this group, send email to pandoc-***@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/pandoc-discuss/1400c804-8a12-d2ba-62c7-59231f997c74%40intielectronics.com.
For more options, visit https://groups.google.com/d/optout.
Pablo Rodríguez
2018-04-30 14:12:37 UTC
Permalink
Post by ChrisD
[...]
Pablo,
Thanks! I had not noticed that fontfamily was pdflatex only, and
that I need to use mainfont etc. for xelatex.
mainfont: Arial
and xelatex produces my document with Arial font. It doesn't work
for fonts that need to be downloaded, but it works for fonts that
already exist on my computer.
Chris,

I don’t know how to use remote fonts with other than CSS. I don’t even
know whether remote font usage is possible with LuaTeX or XeTeX.

Version issues might arise when you use remote fonts.
Post by ChrisD
For what it's worth, this also works for lualatex. And lualatex also
accepts a mainfont of LatinModernSans, which is not installed on my
computer as far as I know, but I suspect is "built in" to Miktex
somehow. LatinModernSans does not work with xelatex.
Latin Modern Sans should be part of your TeX distribution (in your case,
MikTeX).

Doesn’t it work with XeLaTeX when invoked as "mainfont: Latin Modern Sans"?

I hope it helps,

Pablo
--
http://www.ousia.tk
--
You received this message because you are subscribed to the Google Groups "pandoc-discuss" group.
To unsubscribe from this group and stop receiving emails from it, send an email to pandoc-discuss+***@googlegroups.com.
To post to this group, send email to pandoc-***@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/pandoc-discuss/11f8d88a-6a95-53e7-a6c1-e60db115b5d5%40web.de.
For more options, visit https://groups.google.com/d/optout.
ChrisD
2018-04-30 17:12:37 UTC
Permalink
-------- Original Message --------
Subject: Re: Pandoc markdown to PDF with sans serif font
From: Pablo Rodríguez <***@web.de>
To: pandoc-***@googlegroups.com
Date: 4/30/2018 7:12 AM
Post by Pablo Rodríguez
Latin Modern Sans should be part of your TeX distribution (in your case,
MikTeX).
Doesn’t it work with XeLaTeX when invoked as "mainfont: Latin Modern Sans"?
Yes, it does -- thanks again.
Chris
--
You received this message because you are subscribed to the Google Groups "pandoc-discuss" group.
To unsubscribe from this group and stop receiving emails from it, send an email to pandoc-discuss+***@googlegroups.com.
To post to this group, send email to pandoc-***@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/pandoc-discuss/3e160830-ecdc-0084-4ef7-5f9fa0a8f376%40intielectronics.com.
For more options, visit https://groups.google.com/d/optout.
'David Morgan' via pandoc-discuss
2018-11-18 21:46:35 UTC
Permalink
I have exactly the same issue: converting a markdown doc to PDF using
pandoc works but always uses a default font (using pdflatex engine).

I can successfully change margins, link colors, line spacing and other
things using the -V command line option, but -V fontfamily:*somefont *doesn't
work. That is depending on the font name, it either gives an error about
scalable fonts, or about sty file not found, or gives no error but produces
the same default output.

I feel sure I must be missing something simple, but have spent a large part
of this weekend searching and reading, and have seen lots of examples of
changing layout, but nothing about changing fonts.

I'm using Debian stretch, have installed the texlive-full package, also
pandoc of course, but then updated that with the deb file from the pandoc
site:

pandoc 2.4
Compiled with pandoc-types 1.17.5.1, texmath 0.11.1.2, skylighting 0.7.4


Has anyone managed to create PDF files with a font other that the default,
without resorting to using another pdf engine (I did try xelatex but with
no success).

Thanks David
Post by ChrisD
I would like to produce PDF output from Pandoc markdown, and use a sans
serif font family for the text
I tried setting
fontfamily: Arev
in my header block (also tried in the command line options), with a
variety of different font names. None of them worked. Some, like Arev,
report
! pdfTeX error (font expansion): auto expansion is only possible
with scalable fonts.
while others report that it can't find the .sty file.
I also tried setting
fontfamilyoptions: sfdefault
in my header block, but that had no effect.
I'm using
Win7
Pandoc 2.2
Miktex
Is there a way to do this? Thanks,
Chris
--
You received this message because you are subscribed to the Google Groups "pandoc-discuss" group.
To unsubscribe from this group and stop receiving emails from it, send an email to pandoc-discuss+***@googlegroups.com.
To post to this group, send email to pandoc-***@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/pandoc-discuss/69667c98-0558-4401-81d6-85432c3dc547%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.
John Noll
2018-11-19 11:00:28 UTC
Permalink
You could try the 'opensans' font; I successfuly produce san-serif
documents with the following line in the YAML header:

fontfamily: opensans

This works with versions of Pandoc going back at least to 1.6, on Unbuntu
Linux with TeXLive. My colleagues are able to do this on MaxOS as well.

-John Noll
Post by 'David Morgan' via pandoc-discuss
I have exactly the same issue: converting a markdown doc to PDF using
pandoc works but always uses a default font (using pdflatex engine).
I can successfully change margins, link colors, line spacing and other
things using the -V command line option, but -V fontfamily:*somefont *doesn't
work. That is depending on the font name, it either gives an error about
scalable fonts, or about sty file not found, or gives no error but produces
the same default output.
I feel sure I must be missing something simple, but have spent a large
part of this weekend searching and reading, and have seen lots of examples
of changing layout, but nothing about changing fonts.
I'm using Debian stretch, have installed the texlive-full package, also
pandoc of course, but then updated that with the deb file from the pandoc
pandoc 2.4
Compiled with pandoc-types 1.17.5.1, texmath 0.11.1.2, skylighting 0.7.4
Has anyone managed to create PDF files with a font other that the default,
without resorting to using another pdf engine (I did try xelatex but with
no success).
Thanks David
Post by ChrisD
I would like to produce PDF output from Pandoc markdown, and use a sans
serif font family for the text
I tried setting
fontfamily: Arev
in my header block (also tried in the command line options), with a
variety of different font names. None of them worked. Some, like Arev,
report
! pdfTeX error (font expansion): auto expansion is only possible
with scalable fonts.
while others report that it can't find the .sty file.
I also tried setting
fontfamilyoptions: sfdefault
in my header block, but that had no effect.
I'm using
Win7
Pandoc 2.2
Miktex
Is there a way to do this? Thanks,
Chris
--
You received this message because you are subscribed to the Google Groups "pandoc-discuss" group.
To unsubscribe from this group and stop receiving emails from it, send an email to pandoc-discuss+***@googlegroups.com.
To post to this group, send email to pandoc-***@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/pandoc-discuss/a7820340-7831-4fca-acd4-3a7b651bd6fd%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.
John MacFarlane
2018-11-19 19:07:21 UTC
Permalink
You need to have the right latex packages installed
(sounds like you do), and use the right font name.

As examples for 'fontfamily' you might try bookman,
mathpazo, txfonts, fouriernc.

An alternative is to use --pdf-engine=xelatex.
Then, instead of using fontfamily, you can use
mainfont. With this approach you use the font
names of OpenType fonts on your system. For example,

mainfont: Palatino

"'David Morgan' via pandoc-discuss"
Post by 'David Morgan' via pandoc-discuss
I have exactly the same issue: converting a markdown doc to PDF using
pandoc works but always uses a default font (using pdflatex engine).
I can successfully change margins, link colors, line spacing and other
things using the -V command line option, but -V fontfamily:*somefont *doesn't
work. That is depending on the font name, it either gives an error about
scalable fonts, or about sty file not found, or gives no error but produces
the same default output.
I feel sure I must be missing something simple, but have spent a large part
of this weekend searching and reading, and have seen lots of examples of
changing layout, but nothing about changing fonts.
I'm using Debian stretch, have installed the texlive-full package, also
pandoc of course, but then updated that with the deb file from the pandoc
pandoc 2.4
Compiled with pandoc-types 1.17.5.1, texmath 0.11.1.2, skylighting 0.7.4
Has anyone managed to create PDF files with a font other that the default,
without resorting to using another pdf engine (I did try xelatex but with
no success).
Thanks David
Post by ChrisD
I would like to produce PDF output from Pandoc markdown, and use a sans
serif font family for the text
I tried setting
fontfamily: Arev
in my header block (also tried in the command line options), with a
variety of different font names. None of them worked. Some, like Arev,
report
! pdfTeX error (font expansion): auto expansion is only possible
with scalable fonts.
while others report that it can't find the .sty file.
I also tried setting
fontfamilyoptions: sfdefault
in my header block, but that had no effect.
I'm using
Win7
Pandoc 2.2
Miktex
Is there a way to do this? Thanks,
Chris
--
You received this message because you are subscribed to the Google Groups "pandoc-discuss" group.
To view this discussion on the web visit https://groups.google.com/d/msgid/pandoc-discuss/69667c98-0558-4401-81d6-85432c3dc547%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.
--
You received this message because you are subscribed to the Google Groups "pandoc-discuss" group.
To unsubscribe from this group and stop receiving emails from it, send an email to pandoc-discuss+***@googlegroups.com.
To post to this group, send email to pandoc-***@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/pandoc-discuss/yh480k8t1oc2dy.fsf%40johnmacfarlane.net.
For more options, visit https://groups.google.com/d/optout.
Loading...