我是 LaTeX 的新用户。我想用符号在数学问题的答案下划线\rightharpoondown
。如果可能的话,我想要一个\rightharpoondown
可变大小的符号,如下图所示。我该如何实现呢?
答案1
这里有三个宏:(1) 用钩子划下划线,(2) 用椭圆圈出答案,(3) 在右下角放置两条对角线。请注意,我使用该siunitx
包来编写答案;该包用于正确编写值的单位。
\documentclass[border=5pt]{standalone}
\usepackage{amsmath}
\usepackage{siunitx}
\usepackage{tikz}
\usetikzlibrary{calc}
\usetikzlibrary{shapes.geometric}
\newcommand{\answer}[1]{
\tikz[baseline=(answer.base)]{
\node[inner sep=3pt] (answer) {#1};
\draw[line cap=round] (answer.south west) -- (answer.south east) -- ++(-0.1,-0.1);
}}
\newcommand{\answercircled}[1]{
\tikz[baseline=(answer.base)]{
\node[ellipse,draw,inner sep=3pt] (answer) {#1};
}}
\newcommand{\answerside}[1]{
\tikz[baseline=(answer.base)]{
\node[inner sep=3pt] (answer) {#1};
\draw[double, double distance=2pt] ($(answer.south east) + (45:0.2)$) -- ($(answer.south east) - (45:0.2)$);
}}
\begin{document}
$x = \answer{\SI{5}{Volts}} = \answercircled{\SI{5}{Volts}}= \answerside{\SI{5}{Volts}}$
\end{document}
结果是
答案2
在我教授的榜样之后,再次感谢Frédéric。
\documentclass[border=5pt]{standalone}
\usepackage{amsmath}
\usepackage{siunitx}
\usepackage{tikz}
\usepackage{color}
\usetikzlibrary{calc}
\usetikzlibrary{shapes.geometric}
\newcommand{\answer}[1]{
\tikz[baseline=(answer.base)]{
\node[inner sep=3pt] (answer) {#1};
\color{red}
\draw[line width=1pt,color=red][line cap=round] {[rounded corners](answer.south west) -- (answer.south east) } -- ++(-0.5,-0.5);
}}
\begin{document}
$x = \answer{\SI{5.977}{Volts}}$
\end{document}
结果是