LaTeX - 约分

2019独角兽企业重金招聘Python工程师标准>>> hot3.png

法I. 使用cancel宏包

\documentclass{article}
\usepackage{amsmath}
\usepackage{cancel}
\usepackage{xcolor}
\newcommand\hcancel[2][black]{\setbox0=\hbox{#2}\rlap{\raisebox{.45\ht0}{\textcolor{#1}{\rule{\wd0}{1pt}}}}#2}
\begin{document}
$f(x)=\dfrac{\left(x^2+1\right)\cancel{(x-1)}}{\cancel{(x-1)}(x+1)}$\\[0.5cm]
$\bcancel{3}\qquad\bcancel{1234567}$\\[0.5cm]
$\xcancel{3}\qquad\xcancel{1234567}$\\[0.5cm]
$\hcancel{3}\qquad\hcancel[red]{1234567}$
\end{document}

LaTeX - 约分_第1张图片

法II. 使用tikz宏包 (67.8 Miscellaneous Shapes) p734

\documentclass{article}
\usepackage{tikz}
\usetikzlibrary{shapes.misc}
\begin{document}
\tikz[baseline]\node[strike out,draw,anchor=text]{me}; 
\tikz[baseline] \node [cross out,draw,anchor=text] {me};
\tikz\node [cross out,draw=red] at (1.5,1) {cross out};
\end{document}

LaTeX - 约分_第2张图片

转载于:https://my.oschina.net/shaodongtang/blog/2874552

你可能感兴趣的:(LaTeX - 约分)