正如我在这里解释的那样问题我希望将我的 QED 符号放在与段落最后一个单词相同的行上,但在页边距中,就像包 lineno 对行号所做的那样。
我尝试使用这个技巧,\rlap
但它不起作用。我不想使用环境定理等等。自己看看吧,
%\RequirePackage{fix-cm}
\documentclass[twoside, a4paper, draft, 11pt]{article}
\usepackage[right,mathlines]{lineno}
\def\qed{\hfill\rlap{\hspace{0cm}$\heartsuit$}}
\def\qedd{\hfill\rlap{\hspace{1cm}$\heartsuit$}}
\setlength{\paperheight}{297mm}
\setlength{\paperwidth}{210mm}
\setlength{\hoffset}{-1in}
\setlength{\voffset}{-1in}
\setlength{\textheight}{237mm}
\setlength{\textwidth}{150mm}
\setlength{\headheight}{10mm}
\setlength{\oddsidemargin}{40mm}
\setlength{\evensidemargin}{\evensidemargin}
\setlength{\topmargin}{20mm}
\setlength{\headsep}{5mm}
\setlength{\footskip}{5mm}
\setlength{\marginparsep}{10mm}
\setlength{\marginparwidth}{10mm}
\setlength{\marginparpush}{0mm}
%\addtolength{\textheight}{0in}
%\addtolength{\textwidth}{0in}
\setlength{\parindent}{0ex}
\setlength{\parskip}{1ex}
\renewcommand{\baselinestretch}{1.1}
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
\begin{document}
\linenumbers[10000]
\textbf{Here the symbol goes where it should, just next to the number line:}\\
Ksjdahf lksjadhfl lasdjhflsad fljsdhaf skjdahl lajsdhl skl lakjhfa klkajhdsfldskfhfd weoew.
\qed
\textbf{Here the qed symbol goes to the next line instead of the right margin because of the E:}\\
Ksjdahf lksjadhfl lasdjhflsad fljsdhaf skjdahl lajsdhl skl lakjhfa klkajhdsfldskfhfd weoewE.
\qed
---------------------------------------------------------------------\\
\textbf{when hspace is set to 1cm, the problem is still present:}
Ksjdahf lksjadhfl lasdjhflsad fljsdhaf skjdahl lajsdhl skl lakjhfa klkajhdsfldskfhfd weoew.
\qedd
Ksjdahf lksjadhfl lasdjhflsad fljsdhaf skjdahl lajsdhl skl lakjhfa klkajhdsfldskfhfd weoewE.
\qedd
\textbf{How to actually set the symbol in the margins, where the line numbers are ?}
\end{document}
答案1
在您的示例文档中,\qed
(和\qedd
)位于句子末尾的空格后面。虽然没有经过广泛测试,但请尝试
\def\qed{\leavevmode\unskip\hfill\rlap{\hspace{0cm}$\heartsuit$}}
\def\qedd{\leavevmode\unskip\hfill\rlap{\hspace{1cm}$\heartsuit$}}
这应该会在继续填充和放置之前恢复任何不需要的空格\heartsuit
。更像 LaTeX 的方式是
\newcommand{\qedd}{%
\leavevmode\unskip\hfill\makebox[0pt][l]{\hspace*{1cm}$\heartsuit$}}
答案2
可能有一个想法,使用marginnote
包将其放入边缘