我正在寻找如何调整 tikzpicture 的大小,并在这里看到了这个被接受的答案
但那里发布的代码不再起作用。
以下是从上面复制的完全相同的代码
\documentclass [tikz] {standalone}
\begin {document}
\begin {figure}
\centering
\resizebox {\columnwidth} {!} {
\begin {tikzpicture}
\node [draw] (my node 1) {my node 1};
\node [draw, anchor = west] (my node 2) at (my node 1.east) {centro};
\node [draw, anchor = west] at (my node 2.east) {my node 3};
\end {tikzpicture}
}
\end {figure}
\end {document}
当我编译它时,错误是
lualatex foo2.tex
This is LuaTeX, Version 1.10.0 (TeX Live 2019)
restricted system commands enabled.
(./foo2.tex
LaTeX2e <2018-12-01>
.
.
.
(/usr/local/texlive/2019/texmf-dist/tex/generic/oberdiek/etexcmds.sty)))
(/usr/local/texlive/2019/texmf-dist/tex/latex/latexconfig/epstopdf-sys.cfg))
! Improper \prevdepth.
\newpage ...everypar {}\fi \par \ifdim \prevdepth
>\z@ \vskip -\ifdim \prevd...
l.12 }
? X
1704 words of node memory still in use:
29 hlist, 1 rule, 1 disc, 1 local_par, 2 dir, 52 glue, 8 kern, 1 penalty, 22
glyph, 89 attribute, 52 glue_spec, 89 attribute_list, 2 temp, 3 if_stack, 1 wr
ite, 41 pdf_literal, 7 pdf_colorstack nodes
avail lists: 2:2,5:11
warning (pdf backend): no pages of output.
Transcript written on foo2.log.
问题是:需要进行哪些更改才能使其编译?我正在使用lualatex
TL 2019。
答案1
我不确定使用独立(旨在使页面与内容一样宽)然后指定内容与页面一样宽是否有意义,浮动也没有figure
任何用处,standalone
发布的代码自 texlive 2016 以来就没有起作用,我不明白它以前是如何工作的。
像这样缩放文本通常不是一个好主意,但是这个可行
\documentclass{article}
\usepackage{tikz}
\begin {document}
\begin {figure}
\centering
\resizebox {\columnwidth} {!} {%%%%
\begin {tikzpicture}
\node [draw] (my node 1) {my node 1};
\node [draw, anchor = west] (my node 2) at (my node 1.east) {centro};
\node [draw, anchor = west] at (my node 2.east) {my node 3};
\end {tikzpicture}%%%
}
\end {figure}
\end {document}