使用 pdflatex 编译以下代码:
\documentclass{article}
\usepackage{tikz}
\begin{document}
\begin{tikzpicture}[remember picture, overlay]
\draw (current page.center) node {
\begin{itemize}
\item test
\end{itemize}
};
\end{tikzpicture}
\end{document}
... 引发编译错误:
! LaTeX Error: Something's wrong--perhaps a missing \item.
我使用的 pdflatex 版本(Debian Wheezy)如下:
pdfTeX 3.1415926-2.4-1.40.13 (TeX Live 2012/Debian)
kpathsea version 6.1.0
Copyright 2012 Peter Breitenlohner (eTeX)/Han The Thanh (pdfTeX).
There is NO warranty. Redistribution of this software is
covered by the terms of both the pdfTeX copyright and
the Lesser GNU General Public License.
For more information about these matters, see the file
named COPYING and the pdfTeX source.
Primary author of pdfTeX: Peter Breitenlohner (eTeX)/Han The Thanh (pdfTeX).
Compiled with libpng 1.2.49; using libpng 1.2.49
Compiled with zlib 1.2.7; using zlib 1.2.7
Compiled with poppler version 0.18.4
我可能做错了什么?
答案1
默认情况下,节点是列表,\mbox
因此不接受列表等显示材料。如果为其指定宽度,则它将使用列表,minipage
因此接受显示材料:
\documentclass{article}
\usepackage{tikz}
\begin{document}
\begin{tikzpicture}[remember picture, overlay]
\draw (current page.center) node[text width=3cm] {
\begin{itemize}
\item test
\end{itemize}
};
\end{tikzpicture}
\end{document}
当然,当使用其他列表时也是如此,例如enumerate
和description
或,在任何情况下,当需要一个段落时。