Last active
April 25, 2018 08:52
-
-
Save hyuki/2ef89af7d855e3b37cd741598fdb786f to your computer and use it in GitHub Desktop.
数式でディスプレイスタイルとそれ以外を自動判定するLaTeXマクロはどう書くの?(コメントで解決)
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
\documentclass{jsarticle} | |
\begin{document} | |
\newcommand{\TEST}{(\ifinner \texttt{i} \fi% | |
\ifmmode \texttt{m} \fi)} | |
\section*{1} | |
$\TEST$ | |
\section*{2} | |
$$ | |
\TEST | |
$$ | |
\section*{3} | |
$\begin{array}{c}\TEST\end{array}$ | |
\section*{4} | |
$$ | |
\begin{array}{c}\TEST\end{array} | |
$$ | |
\section*{5} | |
$$ | |
\begin{array}{c}\displaystyle\TEST\end{array} | |
$$ | |
\end{document} | |
\documentclass{jsarticle}
\begin{document}
% See TeXbook, EXERCISE 17.15.
\def\TEST{\mathchoice%
{D}%
{T}%
{S}%
{SS}}%
\section*{1}
$\TEST$
\section*{2}
$$
\TEST
$$
\section*{3}
$\begin{array}{c}\TEST\end{array}$
\section*{4}
$$
\begin{array}{c}\TEST\end{array}
$$
\section*{5}
$$
\begin{array}{c}\displaystyle\TEST\end{array}
$$
\section*{6}
$\TEST^{\TEST^{\TEST}}$
\end{document}
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
できれば 4 で、せめて 5 で (im) ではなく (m) が表示されるようにしたい。