我正在尝试编译这个:
\documentclass{minimal}
\usepackage{graphicx}
\usepackage{titleps}
\newpagestyle{mystyle}{
\setfoot{}{}{\includegraphics[width=30mm]{logo}}
}
\pagestyle{mystyle}
\begin{document}
Test.
\end{document}
但失败了:
This is pdfTeX, Version 3.14159265-2.6-1.40.18 (TeX Live 2017) (preloaded format=pdflatex)
restricted \write18 enabled.
entering extended mode
(./mwe.tex
LaTeX2e <2017-04-15>
Babel <3.10> and hyphenation patterns for 84 language(s) loaded.
(/usr/local/texlive/2017/texmf-dist/tex/latex/base/minimal.cls
Document Class: minimal 2001/05/25 Standard LaTeX minimal class
) (/usr/local/texlive/2017/texmf-dist/tex/latex/graphics/graphicx.sty
(/usr/local/texlive/2017/texmf-dist/tex/latex/graphics/keyval.sty)
(/usr/local/texlive/2017/texmf-dist/tex/latex/graphics/graphics.sty
(/usr/local/texlive/2017/texmf-dist/tex/latex/graphics/trig.sty)
(/usr/local/texlive/2017/texmf-dist/tex/latex/graphics-cfg/graphics.cfg)
(/usr/local/texlive/2017/texmf-dist/tex/latex/graphics-def/pdftex.def
(/usr/local/texlive/2017/texmf-dist/tex/generic/oberdiek/infwarerr.sty)
(/usr/local/texlive/2017/texmf-dist/tex/generic/oberdiek/ltxcmds.sty))))
(/usr/local/texlive/2017/texmf-dist/tex/latex/titlesec/titleps.sty
(/usr/local/texlive/2017/texmf-dist/tex/latex/titlesec/ttlps.def))
! LaTeX Error: Missing \begin{document}.
See the LaTeX manual or LaTeX Companion for explanation.
Type H <return> for immediate help.
...
l.8 \pagestyle{mystyle}
?
但是如果我将移动\includegraphics
到的第二个参数\setfoot
,那么它就可以工作:
\setfoot{}{\includegraphics[width=30mm]{logo}}{}
我读了titleps
文档,但没有找到任何可以解释这一点的内容,但我可能忽略了一些显而易见的东西。有什么提示吗?
答案1
由于某些原因, 的可选参数会使\includegraphics
的工作产生混淆\pagestyle
。添加括号:
\newpagestyle{mystyle}{%
\setfoot{}{}{{\includegraphics[width=30mm]{logo}}}%
}