*경고* 자동화 - 비머에서 정렬 라인 발견

*경고* 자동화 - 비머에서 정렬 라인 발견

나는 사용하고있다이 답변정렬 라인 발견을 자동화합니다. 그러나 폭로에 대해 경고하고 싶습니다.

나는 expl3을 모르고 위에 언급된 답변을 해킹하려는 시도가 실패했습니다. 해당 답변을 다음과 같이 래핑하기 위해 적용해 \onslide보았습니다 \alert<+>{}.

\alert<+>{\onslide<+->{ ##1 \\ }}

하지만 오류가 발생합니다.

! Extra }, or forgotten \endgroup. 

\alert<+>{}나는 또한 안쪽에 넣어 보았습니다 .

\tl_put_right:Nn \l_tmpa_tl { \onslide<+->{ \alert<+>{ ##1 } } \\ }

하지만 같은 오류가 발생합니다.

! Extra }, or forgotten \endgroup.

내부 하드코딩보다 더 강력한 솔루션은 \alert오버레이 정책을 더 높은 수준으로 설정할 수 있는 것입니다. 아래 예의 주석에서 이것을 언급했습니다. 그러나 이것이 가능하지 않다면 하드코딩된 \alert.

현재 동작을 보여주는 예입니다. 예제의 정렬 동작이 항목별 동작과 유사하길 바랍니다.

\documentclass{beamer}

\let\oldalign\align
\let\endoldalign\endalign

% https://tex.stackexchange.com/a/611688/12212 
\ExplSyntaxOn
\NewDocumentEnvironment{myalign}{+b}
  {
    \tl_set:Nn \l_tmpa_tl { \begin{oldalign} }
    \seq_set_split:Nnn \l_tmpa_seq { \\ } {#1}
    \seq_map_inline:Nn \l_tmpa_seq
      {
        \tl_if_empty:nF { ##1 }
          {
\tl_put_right:Nn \l_tmpa_tl { \onslide<+->{ ##1 \\ } }
          }
      }
    \tl_put_right:Nn \l_tmpa_tl { \notag \end{oldalign} \vskip-1.5em }
    \l_tmpa_tl
  } { }
\ExplSyntaxOff

\newenvironment{overlayalign}
  {
    \renewenvironment{align}{%
        \begin{myalign}
    }{%
        \end{myalign}
    }
  }
  {
  }

\begin{document}

\begin{frame}[<alert@+|+->]
% I generally prefer the alert, but it would be nice to be able to change to
% the following, and align adapts (i.e., would not alert), just like itemize:
%\begin{frame}[<+->]

I would like behavior similar to itemize:

\begin{itemize}
\item one
\item two
\item three
\end{itemize}

\begin{overlayalign}
\begin{align}
abc & = def \\
    & = ghi \\
    & = jkl \\
    & = 0.  \\
\end{align}
\end{overlayalign}
\end{frame}

\end{document}

답변1

L3 프로그래밍 계층을 사용하는 접근 방식은 다음과 같습니다.

\documentclass{beamer}

\ExplSyntaxOn

\seq_new:N \l__myalign_linesin_seq
\seq_new:N \l__myalign_linesout_seq
\seq_new:N \l__myalign_onelinein_seq
\seq_new:N \l__myalign_onelineout_seq

\NewDocumentEnvironment{myalign}{+b}
{
    \exp_after:wN \cs_set_nopar:Npn \cs:w tagform@ \cs_end: ##1
    {
        \cs:w maketag@@@ \cs_end: 
        { 
            \action<.-|alert@.> { ( \ignorespaces ##1 \unskip \cs:w @@italiccorr \cs_end: ) } 
        }
    }
    \seq_set_split:Nnn \l__myalign_linesin_seq { \\ } { #1 }
    \seq_map_inline:Nn \l__myalign_linesin_seq
    {   
        \seq_clear:N \l__myalign_onelineout_seq
        \seq_set_split:Nnn \l__myalign_onelinein_seq { & } { ##1 }
        \seq_map_indexed_inline:Nn \l__myalign_onelinein_seq
        {
            \int_compare:nNnTF { ####1 } = { 1 }
            { \seq_put_right:Nn \l__myalign_onelineout_seq { \action<+-|alert@+> { ####2 } } }
            { \seq_put_right:Nn \l__myalign_onelineout_seq { \action<.-|alert@.> { ####2 } } }
        }
        \seq_put_right:Nx \l__myalign_linesout_seq { \seq_use:Nnnn \l__myalign_onelineout_seq { & } { & } { & } }
    }
    \begin{align}
    \seq_use:Nnnn \l__myalign_linesout_seq { \\ } { \\ } { \\ }
    \end{align}
} { }
\ExplSyntaxOff

\begin{document}
    
    \begin{frame}[<alert@+|+->]
        
        I would like behavior similar to itemize:
        
        \begin{itemize}
            \item one
            \item two
            \item three
        \end{itemize}
        
        \begin{myalign}
            abc & = def  \\
            & = ghi  \\
            & = jkl  \\
            & = 0. 
        \end{myalign}
        
        \visible<+->{test}
        
    \end{frame}
    
\end{document}

답변2

다음을 사용하는 다른 접근 방식 tabularray:

\documentclass{beamer}

\usepackage{tabularray}
\UseTblrLibrary{counter}
\NewDocumentEnvironment{myalign}{+b}{
\begin{tblr}{
  column{1}={co=1},
  column{Z}={co=1},
  column{odd}={halign=r},
  column{even}={halign=l},  
  colsep = 0pt,
  cells={mode=dmath},
  cell{1-Z}{1}={cmd=\action<+-|alert@+>},
  cell{1-Z}{2-Z}={cmd=\action<.-|alert@.>},
  cell{1-Z}{Z}={appto={\hfill \refstepcounter{equation}(\theequation)}}
}
#1
\end{tblr}
}{}

\begin{document}

\begin{frame}[<alert@+|+->]

I would like behavior similar to itemize:

\begin{itemize}
\item one
\item two
\item three
\end{itemize}

\begin{myalign}
abc & = def  \\
    & = ghi  \\
    & = jkl  \\
    & = 0.   \\
\end{myalign}

\visible<+->{test}

\end{frame}

\end{document}

여기에 이미지 설명을 입력하세요

관련 정보