我想标记文本中在审阅过程中需要特别注意的部分。此标记不会出现在最终文档中,因此我希望能够在不影响文本间距或对齐的情况下添加这些标记。我不想更改文本的颜色或添加突出显示,因为那样会分散注意力。
下面的 MWE 会导致额外的间距,我想避免这种情况。我尝试使用,\kern-\widthof{}
但无法让它工作。
我并没有固守这种方法,所以如果有人有其他方法来做到这一点,那就很好了。
\documentclass{article}
\usepackage{amsmath}
\usepackage{mathabx}
\usepackage{xcolor}
\usepackage{calc}
\DeclareRobustCommand{\MarkStart}{\textcolor{green}{\raisebox{5pt}[0pt][0pt]{$\Rsh$}}}%
\DeclareRobustCommand{\MarkEnd}{\textcolor{green}{\raisebox{5pt}[0pt][0pt]{$\Lsh$}}}%
\newcommand*{\KernMarkStart}{\kern-\widthof{\MarkStart}}%
\newcommand*{\KernMarkEnd}{\kern-\widthof{\MarkEnd}}%
\newcommand*{\MarkStartWithKern}{\MarkStart\KernMarkStart}%
\newcommand*{\MarkEndWithKern}{\MarkEnd\KernMarkEnd}%
\newcommand*{\Mark}[1]{\MarkStart#1\MarkEnd}%
%\newcommand*{\Mark}[1]{\MarkStartWithKern#1\MarkEndWithKern}%
\begin{document}
Without changing the spacing, I want to mark
this word.
Without changing the spacing, I want to mark
\Mark{this} word.
\bigskip
Similary with inline math, I want to mark the $y^2$ term:
$x^2 + y^2 = z^2$.
$x^2 + \Mark{y^2} = z^2$.
\bigskip
With display mode math things should also be marked similarily:
\begin{align*}
a &= b\\
x^2 + y^2 &= z^2\\
x^2 + \Mark{y^2} &= z^2\\
c &= d
\end{align*}
and should be able to mark entire equation as:
\begin{align*}
a &= b\\
\Mark{x^2 + y^2 &= z^2}\\
c &= d
\end{align*}
The above should align with:
\begin{align*}
a &= b\\
x^2 + y^2 &= z^2\\
c &= d
\end{align*}
\end{document}
我正在使用的解决方案指示条件文本位置的 Changbars这样这些标记的位置就很容易找到,所以这些标记不突出也是可以的。
答案1
\DeclareRobustCommand{\MarkStart}{{%
\setbox0=\llap{\raisebox{5pt}{\color{green}$\Rsh$\kern-6pt}}%
\ht0=0pt \dp0=0pt \leavevmode\box0
}}
\DeclareRobustCommand{\MarkEnd}{{%
\setbox0=\rlap{\raisebox{5pt}{\color{green}\kern-6pt$\Lsh$}}%
\ht0=0pt \dp0=0pt \leavevmode\box0
}}
\newcommand*{\Mark}[1]{\MarkStart#1\MarkEnd}
\llap
我将符号放在一个宽度为零(通过或)、高度和深度为零的框中\rlap
,然后进行排版。请注意,在数学模式下,它表现为普通符号,因此会影响间距。