我想要做的是对文档进行更正 - 使用 ulem 包划掉一些文本,然后将“正确”的答案放在其上面。
例如
\dotuline{\fontfamily{augie}\selectfont{nach den}} Türkei
得到虚线上的手写答案。使用\usepackage{ulem}
可以删除该答案:
\dotuline{\sout{\fontfamily{augie}\selectfont{nach den}}} Türkei
但我还想在文本上方放置更正后的答案,最好不必进入数学模式并使用\atop
。
有任何想法吗?
答案1
也可以用简单的表格来完成
\documentclass{article}
\usepackage{xcolor,calc}
\newcommand\strikeout[2][]{%
\begin{tabular}[b]{@{}c@{}}
\makebox(0,0)[cb]{\textcolor{blue}{#1}} \\[-0.2\normalbaselineskip]
\rlap{\color{red}\rule[0.5ex]{\widthof{#2}}{0.5pt}}#2
\end{tabular}}
\begin{document}
Now is the the time for all good \strikeout[citizens]{men} to come to the aid of
their \strikeout{their} country.
\end{document}
答案2
您可能对以下方面感兴趣cancel
包。或者可以在 TikZ 中实现类似的东西。
\documentclass{article}
\usepackage{tikz}
\newcommand{\strikeout}[2][]{%
% usage: \strikeout[bar]{foo} strikes out foo and superimposes bar
% \strikeout{foo} strikes out foo.
\begin{tikzpicture}[baseline=0]
\node[anchor=base,inner sep=0pt,outer sep=0pt] (main) {#2};
\draw[red] ([yshift=0.5ex]main.base west) -- ([yshift=0.5ex]main.base east);
\node[overlay,anchor=south,blue] at (main.north) (correction) {#1};
\end{tikzpicture}%
}
\begin{document}
Now is the the time for all good \strikeout[citizens]{men} to come to the aid of their \strikeout{their} country.
\end{document}