Allinea all'interno di align

Sep 30 2020

Devo scrivere equazioni in questo formato:

    (1) A  → (*some terms*)
                   A.a = (*some terms*)
                   A.b = (*some terms*)
                   ...
                   A.z = (*some terms*)

    (2) B  → (*some terms*)
                   B.a = (*some terms*)
                   B.b = (*some terms*)
                   ...
                   B.z = (*some terms*)

    ...

    (5) E  → (*some terms*)
                   E.a = (*some terms*)
                   E.b = (*some terms*)
                   ...
                   E.z = (*some terms*)

I numeri ((1), (2), ecc.) Devono essere a sinistra, il simbolo "→" deve essere allineato e tutti i simboli "=" devono essere allineati. Inoltre, Aa, Ab ecc. Devono iniziare a destra di "→".

Come posso fare questo? Sono un principiante in LateX.

Risposte

4 egreg Sep 30 2020 at 00:37

Puoi usare flalign; con \lefteqnla larghezza dell'argomento viene ignorato.

\documentclass{article}
\usepackage{amsmath}

\begin{document}

Some text before the display just to see where the margins of the type block
are, some more to be sure
\begin{flalign*}
(1)\quad A &\to \lefteqn{(*some terms*)} &&& \\
& & A.a &= (*some terms*) \\
& & A.b &= (*some terms*) \\
& & A.c &= (*some terms*) \\
(2)\quad B &\to \lefteqn{(*some terms*)} \\
& & B.a &= (*some terms*) \\
& & B.b &= (*some terms*) \\
& & B.c &= (*some terms*) \\
(3)\quad C &\to \lefteqn{(*some terms*)} \\
& & C.a &= (*some terms*) \\
& & C.b &= (*some terms*) \\
& & C.c &= (*some terms*)
\end{flalign*}
Some text before the display just to see where the margins of the type block
are, some more to be sure

\end{document}

3 Werner Sep 30 2020 at 01:20

Puoi sempre utilizzare le funzionalità di eqparboxper fornire larghezze di dimensioni simili tra gli elementi del documento (come enumerateo align):

\documentclass{article}

\usepackage{amsmath,eqparbox,enumitem}

\begin{document}

Some text before the display just to see where the margins of the type block
are, some more to be sure:
\begin{enumerate}[label={(\arabic*)}]
  \item
  $\eqmakebox[LHSitem][r]{$A$} \to text{(*some terms*)}$
  \begin{align*}
    \eqmakebox[LHS][r]{$A.a$} &= \text{(*some terms*)} \\
    \eqmakebox[LHS][r]{$A.b$} &= \text{(*some terms*)} \\
    \eqmakebox[LHS][r]{$A.c$} &= \text{(*some terms*)}
  \end{align*}
  
  \item
  $\eqmakebox[LHSitem][r]{$AB$} \to \text{(*some terms*)}$
  \begin{align*}
    \eqmakebox[LHS][r]{$AB.a$} &= \text{(*some terms*)} \\
    \eqmakebox[LHS][r]{$AB.b$} &= \text{(*some terms*)} \\
    \eqmakebox[LHS][r]{$AB.c$} &= \text{(*some terms*)}
  \end{align*}
  
  \item
  $\eqmakebox[LHSitem][r]{$ABC$} \to \text{(*some terms*)}$
  \begin{align*}
    \eqmakebox[LHS][r]{$ABC.a$} &= \text{(*some terms*)} \\
    \eqmakebox[LHS][r]{$ABC.b$} &= \text{(*some terms*)} \\
    \eqmakebox[LHS][r]{$ABC.c$} &= \text{(*some terms*)}
  \end{align*}
\end{enumerate}
Some text before the display just to see where the margins of the type block
are, some more to be sure.

\end{document}