Google Groups no longer supports new Usenet posts or subscriptions. Historical content remains viewable.
Dismiss

Converting markdown to PDF

21 views
Skip to first unread message

Paul M Foster

unread,
Apr 1, 2021, 4:40:04 PM4/1/21
to
I'm trying to use pandoc to convert markdown files to PDF. But when I try,
pandoc dumps out with an error that it needs "pdflatex" or some other
similar converter to do its job. No such "pdflatex" package exists in the
Buster stable archives. I'm sure something does this, but I don't know what
it is. Does anyone else know?

Paul

--
Paul M. Foster
http://noferblatz.com
http://quillandmouse.com

Linux-Fan

unread,
Apr 1, 2021, 4:50:04 PM4/1/21
to
Paul M Foster writes:

> I'm trying to use pandoc to convert markdown files to PDF. But when I try,
> pandoc dumps out with an error that it needs "pdflatex" or some other
> similar converter to do its job. No such "pdflatex" package exists in the
> Buster stable archives. I'm sure something does this, but I don't know what
> it is. Does anyone else know?

pdflatex is provided by package texlive-latex-base.

Some hints about which packages might be needed can be seen in pandoc's
"Suggests":

~$ aptitude show pandoc
Package: pandoc
[...]
Suggests: texlive-latex-recommended, texlive-xetex, texlive-luatex,
pandoc-citeproc, texlive-latex-extra, context, wkhtmltopdf,
librsvg2-bin, groff, ghc, nodejs, php, perl, python, ruby,
r-base-core, libjs-mathjax, node-katex
[...]

I personally have the following texlive packages installed:

~$ aptitude search ~itexlive
i A texlive - TeX Live: A decent selection of the TeX Li
i A texlive-base - TeX Live: Essential programs and files
i A texlive-binaries - Binaries for TeX Live
i A texlive-extra-utils - TeX Live: TeX auxiliary programs
i A texlive-font-utils - TeX Live: Graphics and font utilities
i A texlive-fonts-extra - TeX Live: Additional fonts
i A texlive-fonts-extra-links - TeX Live:
i A texlive-fonts-recommended - TeX Live: Recommended fonts
i A texlive-games - TeX Live: Games typesetting
i A texlive-generic-extra - TeX Live: transitional dummy package
i A texlive-generic-recommended - TeX Live: transitional dummy package
i A texlive-lang-german - TeX Live: German
i A texlive-lang-greek - TeX Live: Greek
i A texlive-latex-base - TeX Live: LaTeX fundamental packages
i A texlive-latex-extra - TeX Live: LaTeX additional packages
i A texlive-latex-recommended - TeX Live: LaTeX recommended packages
i A texlive-pictures - TeX Live: Graphics, pictures, diagrams
i A texlive-plain-generic - TeX Live: Plain (La)TeX packages
i A texlive-pstricks - TeX Live: PSTricks
i A texlive-science - TeX Live: Mathematics, natural sciences, c

I am pretty sure that not all of them are needed. It might be sufficient to
begin with `texlive-latex-base` and only install others if pandoc keeps
complaining.

HTH
Linux-Fan

öö

Tixy

unread,
Apr 1, 2021, 4:50:04 PM4/1/21
to
On Thu, 2021-04-01 at 16:34 -0400, Paul M Foster wrote:
> I'm trying to use pandoc to convert markdown files to PDF. But when I
> try,
> pandoc dumps out with an error that it needs "pdflatex" or some other
> similar converter to do its job. No such "pdflatex" package exists in
> the
> Buster stable archives. I'm sure something does this, but I don't
> know what
> it is. Does anyone else know?
>

I just Google "debian pdflatex" and the top hit was Debian's search
page...

https://packages.debian.org/search?searchon=contents&keywords=pdflatex

I'm sure someone will be along shortly to give an example of how the
search can be done from a commandline using Debian's packaging tools or
similar... :-)

--
Tixy

Celejar

unread,
Apr 1, 2021, 5:20:04 PM4/1/21
to
'apt-file search pdflatex'

'apt-file' is in the 'apt-file' package - it keeps a local database,
which one updates periodically / occasionally via 'apt-file update'.

Celejar

Paul M Foster

unread,
Apr 1, 2021, 5:30:04 PM4/1/21
to
Cute but uncalled for. To wit...

paulf@dudley:~$ uname -a
Linux dudley 4.19.0-13-amd64 #1 SMP Debian 4.19.160-2 (2020-11-28) x86_64
GNU/Linux
paulf@dudley:~$ sudo apt install pdflatex
Reading package lists... Done
Building dependency tree
Reading state information... Done
E: Unable to locate package pdflatex

Paul M Foster

unread,
Apr 1, 2021, 5:40:05 PM4/1/21
to
Thanks. The actual package is texlive-latex-base to provide pdflatex.
Unfortunately, pandoc still balks, but in a different way. I'll have to do
more research.

Paul M Foster

unread,
Apr 1, 2021, 5:50:04 PM4/1/21
to
On Thu, Apr 01, 2021 at 10:46:09PM +0200, Linux-Fan wrote:

> Paul M Foster writes:
>
> > I'm trying to use pandoc to convert markdown files to PDF. But when I try,
> > pandoc dumps out with an error that it needs "pdflatex" or some other
> > similar converter to do its job. No such "pdflatex" package exists in the
> > Buster stable archives. I'm sure something does this, but I don't know what
> > it is. Does anyone else know?
>
> pdflatex is provided by package texlive-latex-base.
>
> Some hints about which packages might be needed can be seen in pandoc's
> "Suggests":
>
> ~$ aptitude show pandoc

[snip]

Thanks. When I used "-t latex" and tried outputting to PDF after installing
some of these dependencies, I did get a PDF. Unfortunately, it looks about
as horrible as most LaTeX docs. I'll keep tweaking it.

David Wright

unread,
Apr 1, 2021, 10:00:04 PM4/1/21
to
On Thu 01 Apr 2021 at 17:22:31 (-0400), Paul M Foster wrote:
> On Thu, Apr 01, 2021 at 09:41:30PM +0100, Tixy wrote:
> > On Thu, 2021-04-01 at 16:34 -0400, Paul M Foster wrote:
> > > I'm trying to use pandoc to convert markdown files to PDF. But when I
> > > try,
> > > pandoc dumps out with an error that it needs "pdflatex" or some other
> > > similar converter to do its job. No such "pdflatex" package exists in
> > > the
> > > Buster stable archives. I'm sure something does this, but I don't
> > > know what
> > > it is. Does anyone else know?
> > >
> >
> > I just Google "debian pdflatex" and the top hit was Debian's search
> > page...
> >
> > https://packages.debian.org/search?searchon=contents&keywords=pdflatex
> >
> > I'm sure someone will be along shortly to give an example of how the
> > search can be done from a commandline using Debian's packaging tools or
> > similar... :-)
>
> Cute but uncalled for. To wit...

In view of what you tried to install, I can only assume that you
didn't actually visit the link, which would give you the name of the
package within the following list:

You have searched for paths that end with pdflatex in suite buster,
all sections, and all architectures. Found 8 results.

File Packages
/usr/bin/bg5+pdflatex latex-cjk-chinese
/usr/bin/bg5pdflatex latex-cjk-chinese
/usr/bin/cef5pdflatex latex-cjk-chinese
/usr/bin/cefpdflatex latex-cjk-chinese
/usr/bin/cefspdflatex latex-cjk-chinese
/usr/bin/gbkpdflatex latex-cjk-chinese
/usr/bin/pdflatex texlive-latex-base ←
/usr/bin/sjispdflatex latex-cjk-japanese

In any case, you might bookmark https://packages.debian.org/,
which gives you the wherewithal to construct your own searches.

> paulf@dudley:~$ uname -a
> Linux dudley 4.19.0-13-amd64 #1 SMP Debian 4.19.160-2 (2020-11-28) x86_64
> GNU/Linux
> paulf@dudley:~$ sudo apt install pdflatex
> Reading package lists... Done
> Building dependency tree
> Reading state information... Done
> E: Unable to locate package pdflatex

I assume that using -o foo.pdf doesn't produce what you want, so
is it the LaTeX code that you're tweaking, or the original markdown?

Cheers,
David.

Ryan Nowakowski

unread,
Apr 2, 2021, 12:00:05 AM4/2/21
to
I like the markdown -> docbook -> formatting objects(fo) -> PDF pipeline. It tends to produce PDF documents that look more "business" and less "academic" than the latex pipeline.

Linux-Fan

unread,
Apr 2, 2021, 9:00:04 AM4/2/21
to
Paul M Foster writes:

> On Thu, Apr 01, 2021 at 10:46:09PM +0200, Linux-Fan wrote:

[...]

> > pdflatex is provided by package texlive-latex-base.
> >
> > Some hints about which packages might be needed can be seen in pandoc's
> > "Suggests":
> >
> > ~$ aptitude show pandoc
>
> [snip]
>
> Thanks. When I used "-t latex" and tried outputting to PDF after installing
> some of these dependencies, I did get a PDF. Unfortunately, it looks about
> as horrible as most LaTeX docs. I'll keep tweaking it.

Yes, I do not like the default style either :)

There are multiple options to change the appearance without digging too
deeply into the generated LaTeX code. E.g. I use a wrapper script for the
following command:

pandoc \
-t latex \
-f markdown+compact_definition_lists+tex_math_single_backslash+link_attributes \
-V papersize=a4 \
-V classoption=DIV10 \
-V fontsize=12pt \
-V documentclass=scrartcl \
-V fontfamily=kpfonts \
-V babel-otherlangs=greek \
-V babel-newcommands=\\usepackage{teubner} \
-V toc-depth=1 \
-V x-masysma-logo=/usr/share/mdvl-d5man2/tplpdf/logo_v2 \
-V x-masysma-icon=/usr/share/mdvl-d5man2/tplpdf/masysmaicon \
--default-image-extension=pdf \
--template=/usr/share/mdvl-d5man2/tplpdf/masysma_d5man.tex \
--resource-path="$(dirname "$1")" \
-o "$(basename "$1").pdf" \
"$1"

Some of the `-V` options improve (IMHO) the output style. The choice of font
already makes a huge difference (but is also a matter of tast!).
Additionally, I use an own “template” file to do some advanced things like
add logos/icons etc. If you are interested in an example, see
https://github.com/m7a/bo-d5man2/tree/master/d5manexportpdf

HTH
Linux-Fan

öö

[...]
0 new messages