jgm / pandoc

Universal markup converter
https://pandoc.org
Other
34.62k stars 3.38k forks source link

\subtitle undefined when converting reStructuredText to PDF #1327

Closed kwohlfahrt closed 10 years ago

kwohlfahrt commented 10 years ago

The following reStructuredText document causes an error (note addition of the subtitle):

===================
Pandoc User's Guide
===================
---------------
Pandoc Subtitle
---------------

:Author: John MacFarlane
:Date:   January 19, 2013

.. contents::
   :depth: 3.0
..

Synopsis
========

Some text.
kwohlahrt@laptop> pandoc pandoc_test.rst -o test.pdf
! Undefined control sequence.
l.46 \subtitle

pandoc: Error producing PDF from TeX source

The rst2latex.py provided by docutils works as expected, the Pandoc User's Guide is generated as a large title, with Pandoc Subtitle below that as a subtitle. Synopsis is then a top-level header.

The issue occurs both with pandoc 1.12 and 1.12.4, installed from gentoo repository.

pandoc --version
pandoc 1.12.4
Compiled with texmath 0.6.6.1, highlighting-kate 0.5.7.
Syntax highlighting is supported for the following languages:
    actionscript, ada, apache, asn1, asp, awk, bash, bibtex, boo, c, changelog,
    clojure, cmake, coffee, coldfusion, commonlisp, cpp, cs, css, curry, d,
    diff, djangotemplate, doxygen, doxygenlua, dtd, eiffel, email, erlang,
    fortran, fsharp, gcc, gnuassembler, go, haskell, haxe, html, ini, isocpp,
    java, javadoc, javascript, json, jsp, julia, latex, lex, literatecurry,
    literatehaskell, lua, makefile, mandoc, markdown, matlab, maxima, metafont,
    mips, modelines, modula2, modula3, monobasic, nasm, noweb, objectivec,
    objectivecpp, ocaml, octave, pascal, perl, php, pike, postscript, prolog,
    python, r, relaxngcompact, restructuredtext, rhtml, roff, ruby, rust, scala,
    scheme, sci, sed, sgml, sql, sqlmysql, sqlpostgresql, tcl, texinfo, verilog,
    vhdl, xml, xorg, xslt, xul, yacc, yaml
mpickering commented 10 years ago

I'm surprised this hasn't popped up before as it looks like the current implementation isn't right. If you want a quick fix then change \documentclass{article} to \documentclass{scrartcl} in the default template. See here for more description about the scrartcl class.

adunning commented 10 years ago

That's quite funny; I just came across the same issue myself (though when defining a subtitle using the YAML block). Thanks for the fix.

It should be noted that one can simply add documentclass: scrartcl to the YAML metadata to override it. Doing this significantly changes the appearance of the document (though its defaults are probably better than the standard article document class).

jgm commented 10 years ago

Rather than depending on KOMA-Script (which provides scrartcl), I think I'd rather just change the default template to something like:

$if(title)$
\title{$title$$if(subtitle)$\\\vspace{1em}{\large $subtitle$}$endif$}
$endif$

+++ mpickering [Jun 09 14 10:05 ]:

I'm surprised this hasn't popped up before as it looks like the current implementation isn't right. If you want a quick fix then change \documentclass{article} to \documentclass{scrartcl} in the default template. See [1]here for more description about the scrartcl class.

— Reply to this email directly or [2]view it on GitHub.

References

  1. http://tex.stackexchange.com/questions/5948/subtitle-doesnt-work-in-article-document-class
  2. https://github.com/jgm/pandoc/issues/1327#issuecomment-45515781
adunning commented 10 years ago

Whatever you think: using \subtitle is certainly more elegant, and it might not be much of an issue, since KOMA-Script is even included with BasicTeX. But I'm still very new to TeX. It would, overall, be really nice to have something that provides better PDFs by default in pandoc (and one that didn't trip so often over Unicode), but scrartcl isn't an incredible improvement over the standard article class.

tomleo commented 9 years ago

pandoc 1.12.2.1

pandoc -f rst document.rst --smart -o document.pdf
pandoc: Error producing PDF from TeX source.
! Undefined control sequence.
l.67 \subtitle
adunning commented 9 years ago

You need to upgrade to 1.13.2 to get the fix.