微量元素

微量元素

\visible當其內容被multlinedwhich 依序包含巢狀時如何使用\visible

微量元素

以下 MWE 無法編譯,因為multlined.

\documentclass[12pt,beamer,preview,multi={math},border=12pt]{standalone}
\usefonttheme[onlymath]{serif}
\usepackage{mathtools}
\newcommand{\foo}[1]{\visible<+->{#1}}
\begin{document}
\begin{standaloneframe}
    \begin{math}
        \displaystyle
        \begin{aligned}
        \foo{\int_a^b}\foo{f(x)}\foo{\, \mathrm{d}x}
            \foo{&=}\foo{F(b)}\foo{-F(a)}\\
            \foo{&=}\foo{\cos a}\foo{\sin b}\foo{+}\foo{\sin a }\foo{\cos b}\\
            \foo{&=}
                \foo{\begin{multlined}[t]}
                \foo{ax^4}\foo{+bx^3}\\\foo{+cx^2}\foo{+dx}\foo{+e}\\
                \foo{\end{multlined}}
        \end{aligned}
        \end{math}
\end{standaloneframe}
\end{document}

上面的程式碼是從 Marmot 的想法中竊取的。

編輯

如果我刪除了foo\begin{multlined}\end{multlined}我會插入空白幀,如下面的動畫所示。一些延遲代表空白幀。

\documentclass[12pt,beamer,preview,multi={math},border=12pt]{standalone}
\usefonttheme[onlymath]{serif}
\usepackage{mathtools}
\newcommand{\foo}[1]{\visible<+->{#1}}
\begin{document}
\begin{standaloneframe}
    \begin{math}
        \displaystyle
        \begin{aligned}
        \foo{\int_a^b}\foo{f(x)}\foo{\, \mathrm{d}x}
            \foo{&=}\foo{F(b)}\foo{-F(a)}\\
            \foo{&=}\foo{\cos a}\foo{\sin b}\foo{+}\foo{\sin a }\foo{\cos b}\\
            \foo{&=}
                \begin{multlined}[t]
                \foo{ax^4}\foo{+bx^3}\\\foo{+cx^2}\foo{+dx}\foo{+e}\\
                \end{multlined}
    \end{aligned}
        \end{math}
\end{standaloneframe}
\end{document}

在此輸入影像描述

答案1

這是兩個問題的組合:

  • \begin{}環境的 和必須\end{}位於同一覆蓋層上

  • multiline處理代碼兩次。如果您將其與使用結合起來,就會出現問題,<+->因為創建的覆蓋數量是所需數量的兩倍。

我建議採用以下解決方法:

\documentclass[12pt,beamer,preview,multi={math},border=12pt]{standalone}
\usefonttheme[onlymath]{serif}
\usepackage{mathtools}
\newcommand{\foo}[1]{\visible<+->{#1}}


\begin{document}
\begin{standaloneframe}
    \begin{math}
        \displaystyle
        \begin{aligned}
        \foo{\int_a^b}\foo{f(x)}\foo{\, \mathrm{d}x}
            \foo{=&}\foo{F(b)}\foo{-F(a)}\\
            \foo{=&}\foo{\cos a}\foo{\sin b}\foo{+}\foo{\sin a }\foo{\cos b}\\
            \foo{=& }
            \foo{ ax^4}\foo{+bx^3}\\
            \foo{&+cx^2}\foo{+dx}\foo{+e}\\
        \end{aligned}
        \end{math}
\end{standaloneframe}
\end{document}

在此輸入影像描述

相關內容