如何获取显示样式中除图表标题和脚注之外的所有数学运算?

如何获取显示样式中除图表标题和脚注之外的所有数学运算?

我想告诉 LaTeX 排版displaystyle 中的所有内联数学表达式,脚注和标题除外。 有没有办法做到这一点?

我知道\displaystyle不建议到处使用(在 SE 上甚至可能极力劝阻),但这不是重点。我想保留对默认样式的控制权,原因与这个问题无关。

这是一个愚蠢的 MWE 尝试:

\documentclass[11pt,letterpaper,twoside]{book}
\usepackage[T1]{fontenc}
\usepackage{lmodern}
\usepackage[total={6in,10in},left=1.5in,top=0.5in,includehead,includefoot]{geometry}
\usepackage{microtype}
\usepackage{amsmath}
\usepackage{amsfonts}
\usepackage{mathtools}
\usepackage{tensor}
\usepackage{graphicx}
\usepackage{float}
\usepackage[nodisplayskipstretch]{setspace}
\setstretch{1.1}
\everymath{\displaystyle} % To be changed.
\thinmuskip=1\thinmuskip
\medmuskip=1\medmuskip
\thickmuskip=1\thickmuskip

\begin{document}

\noindent
This is a dumb text $\tensor{r}{_{+}} \ne r_{+}$ and $r_0^{+}$ is not ($\vartheta_1 \ne \tensor{\vartheta}{_1} = 0$ and $\vartheta = \pi$).  Another nonsense text for $\tensor{r}{_{-}}$ or $r_{-}$ and this $r_0^{-}$.  Or we have this $\mathcal{H}^{+}$ where we impose $r > r_0^{+}$, then else for $\tensor{g}{_{00}}$ which gives this $r < r_0^{-}$ but else we get $\rho^2 = 0$.  A change of component $\tensor{g}{_{00}}$ shows that we get $r < r_0^{-}$.  Dumb text again $\tensor{g}{_{11}}$ just to see the result $\mathcal{H}^{+}$ or else they have $\mathcal{H}^{-}$.  Should I write poetry $\tensor{x}{^1} \equiv r$ wich is not $\frac{1}{2}$ or $\tfrac{1}{2}$, especially when we say $\mathcal{H}^{+}$ and this is again nonsense ($\tensor{r}{_{\textsf{S}}} = 2 G M$) when the thing isn't rotatings ($a = 0$).  I may fall ill by writing $\tensor{r}{_{-}}$ or this $r_0^{-}$.  Oh well this stupid text.\footnote{This is a footnote test $r^2 = x^2 + y^2 + z^2$, or this $x_1^2$:
\begin{equation*}
    ds^2 = dx^2 + dy^2 + dz^2.
\end{equation*}
Or that thing $\tensor{g}{^{\mu \nu}}$ and $\eta^{ab}$ or $\tensor{\gamma}{^a}$, which is not  $\frac{1}{2}$ or $\tfrac{1}{2}$.}

\bigskip

\begin{figure}
    \centering
    \includegraphics[height=5cm]{example-image}
    \caption{Title.  \textup{This $a \equiv S / M$ is just a test $r_0^{-}$.  Or this dumb text again $\mathcal{H}^{-}$ with radius $\tensor{r}{_{-}}$) and that word is neat $\mathcal{H}^{+}$ (or radius $\tensor{r}{_{+}}$).  Then, we have this $r_0^{+}$, which is not  $\frac{1}{2}$ or $\tfrac{1}{2}$.}}
\end{figure}

\end{document}

另外:除了分数和根号之外,还有其他情况 LaTeX 会从显示样式中更改数学样式吗?

答案1

(重写答案以使其可用于所有 TeX 引擎)

这是一个通过本地更改为来重新定义\footnote和的解决方案。\caption\everymath{\displaystyle}\everymath{}

在此处输入图片描述

\documentclass[11pt,letterpaper,twoside]{book}
\usepackage{amsmath} % for '\tfrac' macro
\usepackage[vmargin=4.75in]{geometry} % just for this example

\everymath{\displaystyle} % <-- for most inline math situations

\usepackage{letltxmacro} % for '\LetLtxMacro' macro
\let\oldfootnote\footnote % save definition of '\footnote'
\renewcommand\footnote[1]{\begingroup\everymath{}\oldfootnote{#1}\endgroup}
\LetLtxMacro{\oldcaption}{\caption} % save definition of '\caption'
\renewcommand\caption[2][]{\begingroup\everymath{}\oldcaption[#1]{#2}\endgroup}

\begin{document}

\noindent
Either $\sum$ or $\prod$ or $\int$ or $\frac{1}{2}$ or $\tfrac{1}{2}$. Here comes a
footnote.\footnote{Either $\sum$ or $\prod$ or $\int$ or $\frac{1}{2}$ or $\tfrac{1}{2}$.}

\begin{figure}[h]
\caption{Either $\sum$ or $\prod$ or $\int$ or $\frac{1}{2}$ or $\tfrac{1}{2}$.}
\end{figure}
\end{document}

相关内容