xlop 套件在 style=text 時控制 resultstyle

xlop 套件在 style=text 時控制 resultstyle

xlopresultstyle樣式設定為文字時支援。如果沒有,有辦法隱藏樣式設定為文字的結果。

\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表示為結果留出了空間。

在此輸入影像描述

相關內容