0

I'm sorry because there are already a lot of questions on this site with such a title but no one seems to have the same problem as I have. I'm new to LaTeX and to this forum by the way. Here is my issue: without the align* environment, I get no errors, but when I want to align all my lines and use align*, I get "! Missing } inserted. } l.154 \end{align*}"

How to align all my "=" then? My code is just below. Thank you in advance for you feedback.

\begin{align*}
Ker(\psi) &= \{ (\sigma, e) \in \mathfrak A_{n} \rtimes_{\varphi} \{-1, 1\}, \psi(\sigma, e)=~$id$_{\mathfrak S_{n}} \} \\
          &= \{ (\sigma, e) \in \mathfrak A_{n} \rtimes_{\varphi} \{-1, 1\}, i(\sigma)s(e)=~$id$_{\mathfrak S_{n}} \} \\
          &= \{ (\sigma, e) \in \mathfrak A_{n} \rtimes_{\varphi} \{-1, 1\}, i(\sigma)s(e)=~$id$_{\mathfrak S_{n}} \} \\
          &= \{ (\sigma, e) \in \mathfrak A_{n} \rtimes_{\varphi} \{-1, 1\}, i(\sigma)=~$id$_{\mathfrak S_{n}}~$et$~s(e)=~$id$_{\mathfrak S_{n}} \} \\
          &= \{ ($id$_{\mathfrak A_{n}}, 1) \}
\end{align*}

2 Answers 2

1

Your problem is twofold: LaTeX giving you an error and the align environment not fulfilling your alignment needs.

The cause for the former is the use of $ characters to encapsulate what seem to be custom operators (id and Ker, I assume; as pointed out in a previous answer). The solution to this is to declare them as such with the \DeclareMathOperator macro; e.g., \DeclareMathOperator{\id}{id} for the id operator (as per the same previous answer. Note that this macro is preferred over \text and \mathrm for operators since these handle letter spacing differently.

Since you have multiple = signs on each line, to have them all line up you need to use the alignat environment (or, in your case its brother alignat*; also from the amsmath package). Using your example (with some cleanup done to your formatting to make the TeX more readable):

\documentclass{article}
\usepackage{amsmath,amsfonts,amssymb}

\DeclareMathOperator{\id}{id}
\DeclareMathOperator{\Ker}{Ker}

\begin{document}
\begin{alignat*}{3}
\Ker(\psi) &= \{(\sigma,e) \in \mathfrak{A}_n \rtimes_{\varphi} \{-1,1\}, \psi(\sigma,e) &&= \id_{\mathfrak{S}_n}\} \\
           &= \{(\sigma,e) \in \mathfrak{A}_n \rtimes_{\varphi} \{-1,1\}, i(\sigma)s(e)  &&= \id_{\mathfrak{S}_n}\} \\
           &= \{(\sigma,e) \in \mathfrak{A}_n \rtimes_{\varphi} \{-1,1\}, i(\sigma)s(e)  &&= \id_{\mathfrak{S}_n}\} \\
           &= \{(\sigma,e) \in \mathfrak{A}_n \rtimes_{\varphi} \{-1,1\}, i(\sigma)      &&= \id_{\mathfrak{S}_n} \text{et } s(e) &&= \id_{\mathfrak{S}_n}\} \\
           &= \{(\id_{\mathfrak{A}_n}, 1)\}
\end{alignat*}
\end{document}

This environment takes the number of "columns" as argument (the {3}), and the columns are separated using & characters. In this case each = sign beyond the first is preceded by a double && to achieved the desired effect.

1
  • Regarding the double && (since I didn't really explain it well): Counting the first column as 1, the alignat environment makes all odd-numbered columns right-aligned and all even-numbered columns left-aligned. Since the second set of = sign should also be left-aligned (like the first set), we insert a "dummy," right-aligned column with the first & in the double &&.
    – aseyffert
    Apr 28, 2020 at 15:24
2

The problem is not the use of align but rather the use of $ $ inside the align

Some alternatives are to use \text{id}, \mathrm{id}, or (in the preamble) \DeclareMathOperator{\id}{id}

\documentclass{article}
\usepackage{amsmath,amsfonts,amssymb}

\DeclareMathOperator{\id}{id}

\begin{document}


\begin{align*}
Ker(\psi) & = \{ (\sigma, e) \in \mathfrak{A}_n \rtimes_\varphi \{-1, 1\}, \psi(\sigma, e)=~\text{id}_{\mathfrak S_{n}} \} \\
          & = \{ (\sigma, e) \in \mathfrak{A}_{n} \rtimes_{\varphi} \{-1, 1\}, i(\sigma)s(e)=~\mathrm{id}_{\mathfrak S_{n}} \} \\
          & = \{ (\sigma, e) \in \mathfrak A_{n} \rtimes_{\varphi} \{-1, 1\}, i(\sigma)s(e)=~\id_{\mathfrak S_{n}} \} \\
          & = \{ (\sigma, e) \in \mathfrak A_{n} \rtimes_{\varphi} \{-1, 1\}, i(\sigma)=~\id_{\mathfrak S_{n}}~\text{et}~s(e)=~\id_{\mathfrak S_{n}} \} \\
          & = \{ (\id_{\mathfrak A_{n}}, 1) \}
\end{align*}
\end{document}
1
  • Ah, so the use of $ $ make the align not to work because it is math mode by default? the same can be said about other environments then I guess. Thank you for all the alternatives, it is really instructive !
    – Krokodil
    Apr 24, 2020 at 14:43

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .