我的新问题:自从将上一个帖子中的答案与 ExSheets 结合起来后,正确答案周围出现了额外的空格。为什么?
\documentclass[a4paper]{article}
\usepackage{tabularx}
\usepackage{exsheets}
\SetupExSheets{solution/print=true}
\usepackage{amssymb}
\newcolumntype{C}[1]{>{\centering\arraybackslash}m{#1}}
\usepackage{tikz}
\newcommand\circleanswer[1]
{
\PrintSolutionsTF
{
\begin{tikzpicture}[baseline=(word.base)]
\node[inner sep=0pt] (word) {#1};
\begin{pgfinterruptboundingbox}
\node[draw,color=red] at (word) {\phantom{#1}};
\end{pgfinterruptboundingbox}
\end{tikzpicture}
}
{#1}
}
\begin{document}
Proper fractions live on the \circleanswer{LEFT}/RIGHT side of zero.
\end{document}
答案1
您在命令定义中添加了几个显式空格。新行是一个空格。因此,命令中的每个新行都呈现为空格。解决方案很简单,就是不插入空格。
\documentclass[a4paper]{article}
\usepackage{tabularx}
\usepackage{exsheets}
\SetupExSheets{solution/print=true}
\usepackage{amssymb}
\newcolumntype{C}[1]{>{\centering\arraybackslash}m{#1}}
\usepackage{tikz}
\newcommand\circleanswer[1]
{%
\PrintSolutionsTF
{%
\begin{tikzpicture}[baseline=(word.base)]
\node[inner sep=0pt] (word) {#1};
\begin{pgfinterruptboundingbox}
\node[draw,color=red] at (word) {\phantom{#1}};
\end{pgfinterruptboundingbox}
\end{tikzpicture}%
}%
{#1}%
}
\begin{document}
Proper fractions live on the \circleanswer{LEFT}/RIGHT side of zero.
\end{document}