4

I want to make a math enivornment (preferably a customized align/flalign environment) with left-justified/left-aligned equations (as it is possible with the flalign environment) and left-aligned tags (instead of the default right alignment) but with the same indent handling flalign offers when using right-aligned equations with default right-aligned tags.

I've added a screenshot and a MWE for clarification.

I'd appreciate any help :-)

Screenshot of MWE

\documentclass[twoside]{scrbook}
\parindent0pt
\parskip6pt
\usepackage[ngerman]{babel}
\usepackage[utf8]{inputenc}
\usepackage[T1]{fontenc}
\usepackage{amsmath, amssymb, enumitem, color}
\newcommand{\red}{\color{red}}
\newcommand{\set}[1]{\left\lbrace #1 \right\rbrace}
\newcommand{\script}[1]{\mathcal{#1}}
\renewcommand{\complement}{\mathcal{C}}
\makeatletter
\newenvironment{lalign}{\tagsleft@true\flalign}{\endflalign}
\makeatother
\begin{document}

\textbf{Definition} \quad ($\sigma$-field)
\begin{align}
& \Omega \in \script{A} \tag{SF1}\label{SF1} \\
& A \in \script{A} \Rightarrow \complement A \in \script{A} \tag{SF2}\label{SF2} \\
& A_1, A_2, \ldots \in \script{A} \Rightarrow \bigcup_{i=1}^\infty A_i \in \script{A} \tag{SF3}\label{SF3}
\end{align}

\textbf{Exercise} \quad Is $\script{A}$ a $\sigma$-field?
\begin{enumerate}[label=(\roman*)]
\item $\Omega$ arbitrary, $\script{A} = \set{\emptyset, \Omega}$.
\item $\ldots$
\end{enumerate}

\textbf{Solution} \quad

\begin{enumerate}[label=(\roman*)]
\item Let $\Omega$ be arbitrary and $\script{A} = \set{\emptyset, \Omega}$.

{\red It should be like this, but just the other way round:}
\begin{flalign}
&& \Omega \in \script{A} & \tag{\ref{SF1}} \\
&& \emptyset \in \script{A} \Rightarrow \complement \emptyset = \Omega \in \script{A} \tag{\ref{SF2}} \\
&& \Omega \in \script{A} \Rightarrow \complement \Omega = \emptyset \in \script{A} \notag \\
&& \emptyset, \Omega \in \script{A} \Rightarrow \emptyset \cup \Omega = \Omega \in \script{A} \tag{\ref{SF3}}
\end{flalign}
{\red This happens when I set \texttt{tagsleft@true} and use \texttt{flalign} for left-aligned equations:}
\begin{lalign}
& \Omega \in \script{A} & \tag{\ref{SF1}} \\
& \emptyset \in \script{A} \Rightarrow \complement \emptyset = \Omega \in \script{A} \tag{\ref{SF2}} \\
& \Omega \in \script{A} \Rightarrow \complement \Omega = \emptyset \in \script{A} \notag \\
& \emptyset, \Omega \in \script{A} \Rightarrow \emptyset \cup \Omega = \Omega \in \script{A} \tag{\ref{SF3}}
\end{lalign}
{\red I don't want centered equations because it should look like an enumeration:}
\begin{lalign}
& \Omega \in \script{A} \tag{\ref{SF1}} \\
& \emptyset \in \script{A} \Rightarrow \complement \emptyset = \Omega \in \script{A} \tag{\ref{SF2}} \\
& \Omega \in \script{A} \Rightarrow \complement \Omega = \emptyset \in \script{A} \notag \\
& \emptyset, \Omega \in \script{A} \Rightarrow \emptyset \cup \Omega = \Omega \in \script{A} \tag{\ref{SF3}}
\end{lalign}
{\red As it should look like (dirty coded, I want the code to be universally usable):}
\begin{lalign}
& \hspace*{1.2cm} \Omega \in \script{A} & \tag{\ref{SF1}} \\
& \hspace*{1.2cm} \emptyset \in \script{A} \Rightarrow \complement \emptyset = \Omega \in \script{A} \tag{\ref{SF2}} \\
& \hspace*{1.2cm} \Omega \in \script{A} \Rightarrow \complement \Omega = \emptyset \in \script{A} \notag \\
& \hspace*{1.2cm} \emptyset, \Omega \in \script{A} \Rightarrow \emptyset \cup \Omega = \Omega \in \script{A} \tag{\ref{SF3}}
\end{lalign}
\item $\ldots$
\end{enumerate}

\end{document}

I'm afraid my question wasn't 100% clear. So here is a new MWE and screenshot referring to the answers which suggested using enumerations. The problem is: I don't want to make an enumeration which is independent from the defined equation labels. Each item shall get the name of the related equation label from \ref{...}. The equation labels must not be numerated. Here's the updated MWE:

Updated MWE screenshot

\documentclass[twoside]{scrbook}
\parindent0pt
\parskip6pt
\usepackage[ngerman]{babel}
\usepackage[utf8]{inputenc}
\usepackage[T1]{fontenc}
\usepackage{amsmath, amssymb, enumitem, color}
\newcommand{\red}{\color{red}}
\newcommand{\set}[1]{\left\lbrace #1 \right\rbrace}
\newcommand{\script}[1]{\mathcal{#1}}
\renewcommand{\complement}{\mathcal{C}}
\makeatletter
\newenvironment{lalign}{\tagsleft@true\flalign}{\endflalign}
\makeatother
\begin{document}

\textbf{Definition} \quad ($\sigma$-field)
\begin{align}
& \Omega \in \script{A} \tag{SF1}\label{SF1} \\
& A \in \script{A} \Rightarrow \complement A \in \script{A} \tag{Complement}\label{SF2} \\
& A_1, A_2, \ldots \in \script{A} \Rightarrow \bigcup_{i=1}^\infty A_i \in \script{A} \tag{Union}\label{SF3}
\end{align}

\textbf{Exercise}

\begin{enumerate}[label=(\roman*)]
\item Let $\Omega$ be arbitrary and $\script{A} = \set{\emptyset, \Omega}$.

{\red It should be like this, but just the other way round:}
\begin{flalign}
&& \Omega \in \script{A} & \tag{\ref{SF1}} \\
&& \emptyset \in \script{A} \Rightarrow \complement \emptyset = \Omega \in \script{A} \tag{\ref{SF2}} \\
&& \Omega \in \script{A} \Rightarrow \complement \Omega = \emptyset \in \script{A} \notag \\
&& \emptyset, \Omega \in \script{A} \Rightarrow \emptyset \cup \Omega = \Omega \in \script{A} \tag{\ref{SF3}}
\end{flalign}
{\red This happens when I set \texttt{tagsleft@true} and use \texttt{flalign} for left-aligned equations:}
\begin{lalign}
& \Omega \in \script{A} & \tag{\ref{SF1}} \\
& \emptyset \in \script{A} \Rightarrow \complement \emptyset = \Omega \in \script{A} \tag{\ref{SF2}} \\
& \Omega \in \script{A} \Rightarrow \complement \Omega = \emptyset \in \script{A} \notag \\
& \emptyset, \Omega \in \script{A} \Rightarrow \emptyset \cup \Omega = \Omega \in \script{A} \tag{\ref{SF3}}
\end{lalign}
{\red Enumerations aren't an option, because of this false indent handling:}
\begin{enumerate}
\item[(\ref{SF1})] Enumeration with custom item label.
\end{enumerate}
\begin{enumerate}[leftmargin=*]
\item[(\ref{SF2})] Enumeration with custom item label and \texttt{leftmargin=*}
\end{enumerate}
{\red It should be more like this (but it's not the way I want to code it all the time and it isn't 100\% accurate either:}
\begin{flalign*}
&\begin{array}{ll}
(\text{\ref{SF1}}) & \Omega \in \script{A} \\
(\text{\ref{SF2}}) & \emptyset \in \script{A} \Rightarrow \complement \emptyset = \Omega \in \script{A} \\
            & \Omega \in \script{A} \Rightarrow \complement \Omega = \emptyset \in \script{A} \\
(\text{\ref{SF3}}) & \emptyset, \Omega \in \script{A} \Rightarrow \emptyset \cup \Omega = \Omega \in \script{A}
\end{array}&
\end{flalign*}
\item $\ldots$
\end{enumerate}

\end{document}
  • how about a new list (using enumitem to help) and then just use inline math mode; you can use the aligned environment if you have more than one line of equations – cmhughes Aug 25 '13 at 17:40
  • I've already done this, but then I've also got indent problems. I'll update my original post regarding this issue. – Robert Ternes Aug 25 '13 at 18:04
2

This is an enumeration:

\documentclass{scrbook}
\usepackage{amsmath,amssymb,amsthm,enumitem}

\theoremstyle{definition}
\newtheorem*{definition}{Definition}

\newcommand{\set}[1]{\left\lbrace #1 \right\rbrace}
\newcommand{\script}[1]{\mathcal{#1}}
\renewcommand{\complement}{\mathcal{C}}

\begin{document}

\begin{definition}[$\sigma$-field]\mbox{}
\begin{enumerate}[leftmargin=*,label=(SF\arabic*)]
\item\label{SF1} $\Omega \in \script{A}$

\item\label{SF2} $A \in \script{A} \Rightarrow \complement A \in \script{A}$

\item\label{SF3} $A_1, A_2, \dotsc \in \script{A} \Rightarrow
  \bigcup_{i=1}^\infty A_i \in \script{A}$
\end{enumerate}
\end{definition}

\end{document}

I'd not use display style, in order not to spoil the vertical alignment. Note also \dotsc instead of \ldots (see https://tex.stackexchange.com/a/122497/4427). In order to go to a new line, just use \mbox{}.

enter image description here

| improve this answer | |
  • Thank you. But my problem aren't the equations within the definition but those equations referring the definition equations. Therefore I'm not able to use the enumeration and aligned environment trick. Imagine the equations aren't labeled as SF1, SF2, ... but rather like "Tree", "Apples", "Kangaroos". As I mentioned I want to refer those labels, not making a new independent enumeration. Also there don't have to be a numeration within the label (like SF1, SF2, ...). – Robert Ternes Aug 25 '13 at 18:09
1

when the package amsmath is loaded, there is a check for \iftagsleft@ and quite a few settings are changed. (this code takes up about 250 lines, and is quite complex.) if you apply \usepackage[leqno]{amsmath} to your example, the results are quite different, and probably more like what you are looking for.

by bypassing this extra code as you invoke \iftagsleft@ by itself, after amsmath has been totally digested, the calculations for setting the width of the display area are never acted on properly. you need to take that into consideration.

| improve this answer | |

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.