[Tex/LaTex] Align environment error – missing } inserted


When I try to compile my LaTeX file, where begin{align*} environment is to be used, I constantly get an error:

! Missing } inserted.
<inserted text>
 1.164 \end{align*}

My LaTeX snippet:

X^{(0)} = \lbrace \mathsf{PR \ R \ ST0 \ T+ \ TP \ PR \ , \ PR \ R \ ST- \ T- \ TP \ PR \ , \\ \ PR \ rs \ ST0 \ T- \ TP \ PR \ , \ PR \ rS \ ST+ \ T+ \ TP \ PR \ , \\ \ PR \ Rs \ ST+ \ T+ \ TP \ PR} \rbrace

The reason I would like to use align*environment is to make the long math mode line to break. I tried to use different commands (linebreak, allowbreak, //, etc.), but they would not help.

Best Answer

In my comment above I have already pointed out what causes the error message. Beyond that, I'm not convinced that you are on the right track. Pure guessing, but I suppose that each of these letter combinations designates some entity that will occur more frequently. To achieve consistent typesetting I suggest to use macros. E.g., you can rewrite your example as follows.

  X^{(0)} = \lbrace\;
    & \PR\;\R\;\STz\;\Tp\;\TP\;\PR,\;
      \PR\;\R\;\STm\;\Tm\;\TP\;\PR, \\
    & \PR\;\rs\;\STz\;\Tm\;\TP\;\PR,\;
      \PR\;\rS\;\STp\;\Tp\;\TP\;\PR, \\
    & \PR\;\Rs\;\STp\;\Tp\;\TP\;\PR\;\rbrace

This will give the following output.

enter image description here

To avoid to hard-code the formatting of the chains of identifiers (like putting some space inbetween), you can put the definitions

  {\ifx\chainend#1\let\chainy\unskip % at the end, remove the last \;
   \else#1\;\let\chainy\chainx % here \; is inserted between any two items of the chain

into the preamble and then just write


instead of