我创建了一个命令,用于在双面文档的右侧空白处显示一些符号。问题是,它们总是在我的日志中显示一个水平盒子过满的警告,而它却混淆了真正的水平盒子过满。
因此,我希望不要报告这些错误/预期警告,因为我使用这个命令数百次,所以有数百个这样的警告。
这是 MWE
\documentclass[10pt,, twoside, a4paper]{article}
\usepackage[utf8]{inputenc}
\usepackage{blindtext}
\usepackage{showframe}
\newlength{\widthtxt}
%\setlength\widthtxt{0cm}
\setlength\widthtxt{\textwidth}
\addtolength{\widthtxt}{\marginparsep}
\addtolength{\widthtxt}{\marginparwidth}
\addtolength{\widthtxt}{0.5\marginparsep}
\newcommand{\qq}{%
\marginpar[{\hspace*{\widthtxt}\makebox[0pt][c]{$\oplus$}}]{%
\hspace*{-0.5\marginparsep}%
\makebox[0pt][c]{$\oplus$}%
}
}
\begin{document}
iueriuwe
\qq
\blindtext[5]
werrewew
\qq
\end{document}
答案1
将超大尺寸的盒子放在零宽度盒子中:
\newcommand{\qq}{%
\marginpar[%
{\makebox[0pt][l]{\hspace*{\largeurtexte}\makebox[0pt][c]{$\oplus$}}}%
]{%
\hspace*{-0.5\marginparsep}%
\makebox[0pt][c]{$\oplus$}%
}%
}
这是宏的一个简化版本(我假设它\marginparsep
比\oplus
符号更宽)。如你所见,计算量更少。
\documentclass[10pt, twoside, a4paper]{article}
\usepackage[utf8]{inputenc}
\usepackage{blindtext}
\usepackage{showframe}
\newcommand{\qq}{%
\marginpar[{% the brace for being able to use brackets
\hfill % push the material to the right boundary of the margin par region
\makebox[0pt][l]{% no width
\hspace*{\marginparsep}% go to the left boundary of the text block
\hspace*{\textwidth}% go to the right boundary of the text block
\makebox[\marginparsep]{$\oplus$}%
}%
}]{%
\hspace*{-\marginparsep}% go to the right boundary of the text block
\makebox[\marginparsep]{$\oplus$}%
}%
}
\begin{document}
iueriuwe\qq
\blindtext[5]
werrewew\qq
\end{document}