When I try to use pdflatex to compile the following latex code, it throws errors:

[~/] % cat ./bar.tex
% Created 2012-05-02 Wed 20:57

  pdfcreator={Emacs Org-mode version 7.8.09}}



% Org-mode is exporting headings to 3 levels.
\section{This is heading one}

Some text
\subsection{This is heading two}

Some more text

\end{document}%                                                                                                         [steevmi1@phusca-L24500][21:01]
[~/] % pdflatex ./bar.tex
This is pdfTeX, Version 3.1415926-2.3-1.40.12 (TeX Live 2011/MacPorts 2011_5)
 restricted \write18 enabled.
entering extended mode
LaTeX2e <2009/09/24>
Babel <v3.8l> and hyphenation patterns for english, dumylang, nohyphenation, et
hiopic, arabic, farsi, pinyin, croatian, bulgarian, russian, ukrainian, czech, 
slovak, danish, dutch, ukenglish, usenglishmax, finnish, basque, french, german
-x-2009-06-19, ngerman-x-2009-06-19, german, ngerman, swissgerman, monogreek, g
reek, ancientgreek, ibycus, hungarian, assamese, bengali, gujarati, hindi, kann
ada, malayalam, marathi, oriya, panjabi, tamil, telugu, sanskrit, italian, lati
n, latvian, lithuanian, mongolian, mongolianlmc, bokmal, nynorsk, afrikaans, ar
menian, coptic, esperanto, estonian, icelandic, indonesian, interlingua, irish,
 kurmanji, lao, romanian, serbian, serbianc, slovenian, turkish, uppersorbian, 
welsh, polish, portuguese, spanish, catalan, galician, swedish, turkmen, loaded
Document Class: article 2007/10/19 v1.4h Standard LaTeX document class

! LaTeX Error: \andnext undefined.

See the LaTeX manual or LaTeX Companion for explanation.
Type  H <return>  for immediate help.

l.17 \renewcommand*{\andnext}

I'm assuming that this is an issue where it's looking at the "memoir-article-styles.sty" file before it's loaded the actual memoir class, but I'm not sure how to fix it.

The contents of the org-preamble-pdflatex.sty file:

%% Preamble/settings for documents exported from .org files to .tex files when the 
%% tex engine is pdflatex.
%% Usage: \usepackage{org-preamble-pdflatex} in your document
%% preamble. \usepackage[minion]{org-preamble-pdflatex}
%% activates the MinionPro package instead of Times New Roman. The
%% actual Minion Pro font files must be installed first, in accordance
%% with the instructions in the MinionPro package.

%% \usepackage[minted]{org-preamble-xelatex} activates the minted
%% package for code highlighting. Minted requires that pygments be
%% installed (http://pygments.org/) and that \write18 support be
%% enabled in your tex compiler.

%% Kieran Healy

\ProvidesPackage{org-preamble-pdflatex}[2011/02/21 v0.01 Bundling of Preamble items for Org to pdfLaTeX export (including MinionPro)]


\setboolean{@minion}{false} % minion is off by default
\setboolean{@minted}{false} % minted is off by default





%%% If \RequirePackage[minion]{org-preamble-pdflatex} is set,
%%% MinionPro and microtype setup (requires full installation of MinionPro font)
%%% If MinionPro is not specified, use Times instead.
  \renewcommand{\scdefault}{ssc} %% nicer small-caps headings  

\RequirePackage[colorlinks=true, urlcolor=DarkSlateBlue,
citecolor=DarkSlateBlue, filecolor=DarkSlateBlue, plainpages=false,
pdfpagelabels, bookmarksnumbered]{hyperref}

%% Biblatex
% \RequirePackage[authordate, backend=biber, babel=hyphen, bibencoding=inputenc, strict, isbn=false, uniquename=false]{biblatex-chicago} % biblatex setup
            backend=biber, babel=hyphen, bibencoding=inputenc]{biblatex}

%% Fix biblatex's odd preference for using In: by default.

%% Basic bibliography

  %% these tweak the biblatex-chicago format to conform to AJS style.
  \mkbibemph{#1}\isdot} % for books
\DeclareFieldFormat{booktitle}{\mkbibemph{#1}} % for edited volumes

%% bibnamedash: with Minion Pro the three-emdash lines in the
%% bibliogrpaphy end up separated from one another, which is very
%% annoying. Replace them with a line of appropriate size and weight.

%% Pagestyle

%% If [minted] option is chosen, activate minted


For the sake of completeness, the contents of memoir-article-style.sty are at https://github.com/kjhealy/latex-custom-kjh/tree/master/needs-memoir (the file is fairly large at 551 lines, so I'm putting a link to it rather than the actual contents).

  • What is org-preamble-pdflatex? You probably need to post this package as well. – Boris May 3 '12 at 1:14
  • Welcome to TeX.SE. Your code compiles fine if I comment out \usepackage[minted,minion]{org-preamble-pdflatex} and add \usepackage{hyperref}. So your problem is related to what is in org-preamble-pdflatex. Also, since the problem is with a \renewcommand, you could try adding \providecommand{\andnext}{}% and see if that fixes it. – Peter Grill May 3 '12 at 1:18
  • @PeterGrill I added it to bar.tex, but it didn't make a change. I did comment out the addnext section in memoir-article-styles.sty, but it then complained about another undefined control sequence with the next section. – Mike May 3 '12 at 1:42
  • Try adding it immediately after '\documentclass' – Peter Grill May 3 '12 at 4:00
  • 2
    Uh, you're using memoir-article-styles with the article class? Is this supported? Shouldn't you be using memoir? – Stephan Lehmke May 3 '12 at 5:07

The file memoir-article-styles requires that you use the memoir class instead of article. The name of the link says it all, doesn't it? Furthermore, the file memoir-article-styles starts with the following comment:

%%% Some article styles and page layout tweaks for the memoir class
%%% Choose these as article or pagestyles for your memoir document.
%%% Kieran Healy

So, use


instead of

  • Man -- not sure how I missed that one. Now getting errors about a missing .sty file later on in the compile, but that sorts out this problem. Thank you very much for catching that one for me. – Mike May 3 '12 at 12:16

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.