在单词上画一条对角线

在单词上画一条对角线

我想在 latex 中的单词上画一条对角线(这意味着我现在忽略该单词)这怎么可能?对角箭头呢?

答案1

\documentclass{article}
\usepackage{cancel}
\begin{document}
 Happy New Year! Good bye \cancel{2017}!
\end{document}

enter image description here

至于箭头:

\documentclass{article}
\usepackage{cancel}
\begin{document}
Happy New Year! Good bye \cancel{2017}! 

Forget about $\cancelto{~}{2016}$, and don't even mention \xcancel{2015}!
\end{document}

enter image description here

要将单词放在划掉的单词上方,你可以使用:

\documentclass{article}
\usepackage{cancel}
\usepackage{amsmath}
\usepackage{tikz}
\newcommand{\StrikeAndReplace}[2]{\tikz[baseline=(old.base)]{\node(old){#1};
\draw[-] (old.south west)--(old.north east);
\node[above of=old,node distance=4mm] {#2};}}
\begin{document}
Happy New Year! Good bye \cancel{2017}! 

Forget about $\cancelto{~}{2016}$, and don't even mention \xcancel{2015}!

New Year's resolution: No more $\stackrel{\displaystyle\text{vegetables}}{\cancel{\text{junk food}}}$!

With Ti\emph{k}Z: \StrikeAndReplace{SUV car}{bike}
\end{document}

enter image description here

毫无疑问,还有更多选择,和/或 TiZ 命令可以根据需要进行调整。

相关内容