平均能量损失
\RequirePackage{luatex85}
\documentclass[
tikz,
border=0cm,
class=scrbook,
]{standalone}
\usetikzlibrary{backgrounds}
\pagecolor{lightgray}
% \KOMAoptions are actually included via a shared file
\KOMAoptions{
paper=a4,
fontsize=10pt,
% INCORRECT CROP APPEARS WITH ANY OF FOLLOWING OPTIONS
BCOR=10mm,
% twoside,
% DIV=14,
% headinclude=false,
}
% \recalctypearea % THIS CAN ALSO BE RESPONSIBLE FOR AN INCORRECT CROP
\usepackage{layouts}
\begin{document}%
\begin{tikzpicture}[framed]
\draw[rectangle, use as bounding box] (-4,-8.5) |- (8,6.3) |- cycle;
\node[text width=8cm] at (0,0) {\pagevalues};
\end{tikzpicture}%
\end{document}
如您所见,文档裁剪不正确。评论BCOR
将导致裁剪正确。
我该怎么做才能获得正确裁剪的图片?
离开这个包standalone
将意味着我的实际文档和我的 latex 项目组织会发生相当大的变化(有关详细信息,请参阅Luatex v0.95+standalone:\RequirePackage{luatex85} 不能在外包的 tikz 中使用)。我可能还应该注意,我想使用 tikzpicture 中的 \textwidth 等值来根据可用的文本区域自动放置内容。
答案1
除了使用类选项之外,您还可以在使用 KOMA 键后将布局值重置为独立所需的值:
\RequirePackage{luatex85}
\documentclass[
tikz,
border=0cm,
class=scrbook,
]{standalone}
\usetikzlibrary{backgrounds}
\pagecolor{lightgray}
\KOMAoptions{
paper=a4,
fontsize=10pt,
BCOR=10mm,
% twoside,
% DIV=14,
% headinclude=false,
}
\makeatletter
\ifsa@crop
\pagestyle{empty}
\hoffset=-72.27pt
\voffset=-72.27pt
\topmargin=0pt
\headheight=0pt
\headsep=0pt
\marginparsep=0pt
\marginparwidth=0pt
\footskip=0pt
\marginparpush=0pt
\oddsidemargin=0pt
\evensidemargin=0pt
\topskip=0pt
\fi
\makeatother
\usepackage{layouts}
\begin{document}%
\begin{tikzpicture}[framed]
\draw[rectangle, use as bounding box] (-4,-8.5) |- (8,6.3) |- cycle;
\node[text width=8cm] at (0,0) {\pagevalues};
\end{tikzpicture}%
\end{document}