style=text の場合に resultstyle を制御する xlop パッケージ

style=text の場合に resultstyle を制御する xlop パッケージ

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}​

' Xs は、結果のためのスペースが残っていることを示すためにあります。

ここに画像の説明を入力してください

関連情報