Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

\subtitle undefined when converting reStructuredText to PDF #1327

Closed
kwohlfahrt opened this issue Jun 9, 2014 · 6 comments
Closed

\subtitle undefined when converting reStructuredText to PDF #1327

kwohlfahrt opened this issue Jun 9, 2014 · 6 comments

Comments

@kwohlfahrt
Copy link

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
Copy link
Collaborator

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
Copy link
Contributor

adunning commented Jun 9, 2014

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
Copy link
Owner

jgm commented Jun 9, 2014

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. \subtitle undefined when converting reStructuredText to PDF #1327 (comment)

@adunning
Copy link
Contributor

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.

@jgm jgm closed this as completed in e78db3c Jun 10, 2014
@tomleo
Copy link

tomleo commented Mar 12, 2015

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
Copy link
Contributor

You need to upgrade to 1.13.2 to get the fix.

jgm added a commit that referenced this issue Feb 27, 2017
The old code really requires scrartcl from koma-script.
Closes #1327.
jgm pushed a commit that referenced this issue Jan 11, 2019
Addresses closed issues #4675, #3896, #1327.

This renders `\subtitle` using the `etoolbox` package if `\subtitle` is not already
defined by the documentclass (as it is in beamer, KOMA, memoir classes).

 Based on an example from Enrico Gregorio, <https://tex.stackexchange.com/a/50186>.

Update list of LaTeX packages.

Note that `etoolbox` must be loaded outside the command definition.
Putting it inside causes an error if `\title` is placed after `\begin{document}`.
It's already loaded on LuaLaTeX/XeLaTeX in any case.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

5 participants