
xlop
スタイルがテキストに設定されている場合はサポートされますresultstyle
。サポートされていない場合は、スタイルをテキストに設定して結果を非表示にする方法はありますか。
\documentclass{article}
\usepackage{xcolor}
\usepackage{xlop}
\usepackage{pstricks}
\begin{document}
\opadd[style=text,resultstyle=\color{white}]{1}{2}
\end{document}
答え1
キーはテキスト スタイルには影響しません。別の方法で同じことを実行するresultstyle
パッチを提供できます。\op@textoperation
\documentclass{article}
\usepackage{xlop}
\usepackage{regexpatch}
\newif\ifshowresult
\newcommand{\showornot}[1]{%
\ifshowresult#1\else\phantom{#1}\fi
}
\makeatletter
\xpatchcmd*{\op@textoperation}{\Op@@r}{\showornot{\Op@@r}}{}{}
\makeatother
\begin{document}
X\opadd[style=text]{1}{2}X
\showresulttrue
X\opadd[style=text]{1}{2}X
\end{document}
' X
s は、結果のためのスペースが残っていることを示すためにあります。