编译 Latex 代码时出现“\andnext undefined”错误

编译 Latex 代码时出现“\andnext undefined”错误

当我尝试使用 pdflatex 编译以下乳胶代码时,它会引发错误:

[steevmi1@phusca-L24500][21:01]
[~/] % cat ./bar.tex
% Created 2012-05-02 Wed 20:57
\documentclass[11pt]{article}
\usepackage[utf8]{inputenc}
\usepackage[minted,minion]{org-preamble-pdflatex}
\usepackage{graphicx}
\usepackage{longtable}
\usepackage{float}
\providecommand{\alert}[1]{\textbf{#1}}

\title{bar}
\author{Steeves}
\date{\today}
\hypersetup{
  pdfkeywords={},
  pdfsubject={},
  pdfcreator={Emacs Org-mode version 7.8.09}}

\begin{document}

\maketitle

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

Some text
\subsection{This is heading two}
\label{sec-1-1}

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
(./bar.tex
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
.
(/opt/local/share/texmf-texlive-dist/tex/latex/base/article.cls
Document Class: article 2007/10/19 v1.4h Standard LaTeX document class
(/opt/local/share/texmf-texlive-dist/tex/latex/base/size11.clo))
(/opt/local/share/texmf-texlive-dist/tex/latex/base/inputenc.sty
(/opt/local/share/texmf-texlive-dist/tex/latex/base/utf8.def
(/opt/local/share/texmf-texlive-dist/tex/latex/base/t1enc.dfu)
(/opt/local/share/texmf-texlive-dist/tex/latex/base/ot1enc.dfu)
(/opt/local/share/texmf-texlive-dist/tex/latex/base/omsenc.dfu)))
(/Users/steevmi1/Library/texmf/tex/kjhealy/org-preamble-pdflatex.sty
(/opt/local/share/texmf-texlive-dist/tex/latex/base/ifthen.sty)
(/opt/local/share/texmf-texlive-dist/tex/latex/base/fontenc.sty
(/opt/local/share/texmf-texlive-dist/tex/latex/base/t1enc.def))
(/opt/local/share/texmf-texlive-dist/tex/latex/base/fixltx2e.sty)
(/opt/local/share/texmf-texlive-dist/tex/latex/wrapfig/wrapfig.sty)
(/opt/local/share/texmf-texlive-dist/tex/latex/rotating/rotating.sty
(/opt/local/share/texmf-texlive-dist/tex/latex/graphics/graphicx.sty
(/opt/local/share/texmf-texlive-dist/tex/latex/graphics/keyval.sty)
(/opt/local/share/texmf-texlive-dist/tex/latex/graphics/graphics.sty
(/opt/local/share/texmf-texlive-dist/tex/latex/graphics/trig.sty)
(/opt/local/share/texmf-texlive-dist/tex/latex/latexconfig/graphics.cfg)
(/opt/local/share/texmf-texlive-dist/tex/latex/pdftex-def/pdftex.def
(/opt/local/share/texmf-texlive-dist/tex/generic/oberdiek/infwarerr.sty)
(/opt/local/share/texmf-texlive-dist/tex/generic/oberdiek/ltxcmds.sty)))))
(/Users/steevmi1/Library/texmf/tex/kjhealy/memoir-article-styles.sty

! 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.

org-preamble-pdflatex.sty 文件的内容:

%% 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
%%

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

\RequirePackage{ifthen}
\newboolean{@minion}
\newboolean{@minted}

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

\DeclareOption{minion}{
  \setboolean{@minion}{true}
}

\DeclareOption{minted}{
  \setboolean{@minted}{true}
}

\ProcessOptions

\RequirePackage[T1]{fontenc}
\RequirePackage[utf8]{inputenc}
\RequirePackage{fixltx2e}
\RequirePackage{wrapfig}
\RequirePackage{rotating}
\RequirePackage{memoir-article-styles}
\RequirePackage[american]{babel}
\RequirePackage[babel]{csquotes}
\RequirePackage[svgnames]{xcolor}
\RequirePackage{soul}

%%% 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.
\ifthenelse{\boolean{@minion}}{
  \RequirePackage[fullfamily,opticals,footnotefigures]{MinionPro}
  \RequirePackage[scaled=0.78]{beramono}
  \RequirePackage{microtype}
  \RequirePackage[toc,eqno,enum]{tabfigures}
  \renewcommand{\scdefault}{ssc} %% nicer small-caps headings  
}{
  \RequirePackage{times}
  \RequirePackage[config=mt-ptm]{microtype}
  \RequirePackage[scaled=0.74]{beramono}
}


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

%% Biblatex
% \RequirePackage[authordate, backend=biber, babel=hyphen, bibencoding=inputenc, strict, isbn=false, uniquename=false]{biblatex-chicago} % biblatex setup
\RequirePackage[style=authoryear,
            bibstyle=authoryear,
            citestyle=authoryear-comp,
            uniquename=false,
            hyperref=true,
            backend=biber, babel=hyphen, bibencoding=inputenc]{biblatex}

%% Fix biblatex's odd preference for using In: by default.
\renewbibmacro{in:}{%
  \ifentrytype{article}{}{%
  \printtext{\bibstring{}\intitlepunct}}}

%% Basic bibliography
\addbibresource{/Users/kjhealy/Documents/bibs/socbib.bib}

  %% these tweak the biblatex-chicago format to conform to AJS style.
  \DeclareFieldFormat[article]{title}{\mkbibquote{#1}}
  \DeclareFieldFormat[book]{title}{%
  \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.
\renewcommand{\bibnamedash}{\rule[3.5pt]{3em}{0.5pt}\,}


%% Pagestyle
\pagestyle{kjh}

%% If [minted] option is chosen, activate minted
\ifthenelse{\boolean{@minted}}{
  \RequirePackage{minted}
  \usemintedstyle{tango} 
  \definecolor{bg}{rgb}{0.95,0.95,0.95}
  \setkeys{Gin}{width=1\@textwidth} 
}{}

\endinput

为了完整起见,memoir-article-style.sty 的内容位于https://github.com/kjhealy/latex-custom-kjh/tree/master/needs-memoir(该文件相当大,有 551 行,因此我放了一个链接,而不是实际内容)。

答案1

该文件memoir-article-styles要求您使用memoir类而不是article。链接的名称说明了一切,不是吗?此外,该文件memoir-article-styles以以下注释开头:

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

因此,使用

\documentclass[11pt]{memoir}

代替

\documentclass[11pt]{article}

相关内容