4

First, I would like to say that I have read all related questions. For instance, question 1, question 2, question 3, question 4. None of which has solved my problem though.

My code is this

\documentclass[12pt,a4paper,portuguese,brazil,openany,twoside]{book}
\pagestyle{plain}

\usepackage[top=3.0cm,left=3.0cm,right=2.5cm,bottom=2.5cm]{geometry}
\usepackage{graphicx,amssymb,stackengine}
\usepackage{amsmath,amsthm,amsfonts}
\usepackage{pgf}
\begin{document}
\begin{equation} \begin{aligned} &1.\  \ol{ax + by} = a\ol x + b \ol y; \\ &2.\ \ol {(\ol x)} = x;\\ &3.\  |\ol x| = |x|;\\ &4.\  |a x| = |a| |x|; \\ &5.\  \ol {xy} = \ol y \> \ol x; \\ &6.\  |xy| = |x| |y|; \\ &7.\  2\mathrm {Re} (x\bar y)= 2\mathrm{Re} (y\bar x); \\ &8.\  \mathrm{Im} (x\bar y) = - \mathrm{Im} (y \bar x).\end{aligned}
\end{equation}
\end{document}

And I simply wanted it to be aligned to the left and not centered. I've tried flalign, flaligned, flalign* and it keeps showing the same error

Enviroment flaligned undefined. 

Is there anything I can do?

9
  • Did you try adding fleqn to the documentclass options? Dec 30, 2016 at 20:21
  • also why do you have the alignment point at the start of each row? the more normal place would be as &= Dec 30, 2016 at 20:36
  • do you really want the by hand numbering 1., 2. and the automatic number from equation ? Dec 30, 2016 at 20:38
  • @TorbjørnT. Yes I did. Dec 30, 2016 at 21:08
  • @DavidCarlisle Yes, I was thinking of using numbers to identifiy each equation. Dec 30, 2016 at 21:09

3 Answers 3

2

It's much simpler, with enumerate (and the help of enumitem).

In the example I removed all the unnecessary packages, except those for the language. Note that you don't need to load both portuguese and brazil.

\documentclass[12pt,a4paper,openany,twoside]{book}
\usepackage[T1]{fontenc}
\usepackage[utf8]{inputenc}
\usepackage[brazil]{babel}

\usepackage{amsmath}
\usepackage{enumitem}
\usepackage{lipsum} % for some context

\newcommand{\ol}[1]{\overline{#1}}
\let\Re\relax\let\Im\relax % undefine them
\DeclareMathOperator{\Re}{Re}
\DeclareMathOperator{\Im}{Im}

\begin{document}

\lipsum*[2]
\begin{flalign}
&\begin{minipage}{.8\displaywidth}
\begin{enumerate}[itemsep=1ex,leftmargin=*]
\item $\ol{ax + by} = a\bar{x} + b \bar{y}$; 
\item $\ol{(\bar{x})} = x$;
\item $|\bar{x}| = |x|$;
\item $|ax| = |a|\,|x|$;
\item $\ol{xy} = \bar{y}\bar{x}$;
\item $|xy| = |x|\,|y|$;
\item $\Re(x\bar{y})= \Re(y\bar{x})$;
\item $\Im(x\bar{y}) = -\Im(y\bar{x})$.
\end{enumerate}
\end{minipage}&&
\end{flalign}
\lipsum[3]

\end{document}

enter image description here

Other possibilities (which I'd prefer, especially the second one).

\documentclass[12pt,a4paper,openany,twoside]{book}
\usepackage[T1]{fontenc}
\usepackage[utf8]{inputenc}
\usepackage[brazil]{babel}

\usepackage{amsmath}
\usepackage{enumitem}
\usepackage{lipsum} % for some context

\newcommand{\ol}[1]{\overline{#1}}
\let\Re\relax\let\Im\relax % undefine them
\DeclareMathOperator{\Re}{Re}
\DeclareMathOperator{\Im}{Im}

\begin{document}

\lipsum*[2]
\begin{subequations}
\begin{align}
& \ol{ax + by} = a\bar{x} + b \bar{y}; \\
& \ol{(\bar{x})} = x; \\
& |\bar{x}| = |x|; \\
& |ax| = |a|\,|x|; \\
& \ol{xy} = \bar{y}\bar{x}; \\
& |xy| = |x|\,|y|; \\
& \Re(x\bar{y})= \Re(y\bar{x}); \\
& \Im(x\bar{y}) = -\Im(y\bar{x}).
\end{align}
\end{subequations}
\lipsum*[3]
\begin{subequations}
\begin{gather}
\ol{ax + by} = a\bar{x} + b \bar{y}; \\
\ol{(\bar{x})} = x; \\
|\bar{x}| = |x|; \\
|ax| = |a|\,|x|; \\
\ol{xy} = \bar{y}\bar{x}; \\
|xy| = |x|\,|y|; \\
\Re(x\bar{y})= \Re(y\bar{x}); \\
\Im(x\bar{y}) = -\Im(y\bar{x}).
\end{gather}
\end{subequations}
\lipsum[4]

\end{document}

enter image description here

1

Are you maybe looking to create an enumerated list (using an enumerate environment, say) inside an equation environment? If so, encase the enumerate material in a minipage environment and encase the minipage inside the equation.

The following code uses the itemsep=0pt option to create a tightly spaced list. To create really tight spacing, replace itemsep=0pt with nosep. And, if you want the item numbers to show as (1), (2), etc. instead of 1., 2., etc., add label=(\arabic*) to the list of optional arguments of the enumerate environment.

enter image description here

\documentclass[12pt,a4paper]{book}
\usepackage{enumitem,mathtools}
\DeclarePairedDelimiter{\abs}{\lvert}{\rvert}
\let\Im\relax  % undefine \Im and \Re first
\let\Re\relax
\DeclareMathOperator{\Im}{Im}
\DeclareMathOperator{\Re}{Re}
\let\ol\overline
\usepackage[top=3cm,left=3cm,right=2.5cm,bottom=2.5cm]{geometry}

\begin{document}
\begin{equation} 
\begin{minipage}{0.5\textwidth}
\begin{enumerate}[wide,itemsep=0pt] % medium-tight spacing
\item $\ol{ax + by} = a\ol x + b \ol y$
\item $\ol{(\ol x)} = x$
\item $\abs{\ol x} = \abs{x}$
\item $\abs{a x} = \abs{a}\abs{x}$
\item $\ol{xy} = \ol y \, \ol x$
\item $\abs{xy} = \abs{x}\abs{y}$
\item $2\Re(x\bar y)= 2\Re (y\bar x)$
\item $\Im(x\bar y) = -\Im (y\bar x).$
\end{enumerate}
\end{minipage}
\end{equation}
\end{document}
0

The Least intrusive change I found for the original to get this working was that I added fleqn to the document class as well as wrapped the equation environment in a smaller minipage environment.

Without shrinking the minipage wrapping, I found that the number for the equation group was far right, this reined it in closer to the left aligned group. The code has some comparison text right above the equation to show that it is indeed aligned far left and not centered.

\documentclass[12pt,a4paper,portuguese,brazil,openany,twoside,fleqn]{book}
\pagestyle{plain}
\usepackage[top=3.0cm,left=3.0cm,right=2.5cm,bottom=2.5cm]{geometry}
\usepackage{graphicx,amssymb,stackengine}
\usepackage{amsmath,amsthm,amsfonts}
\usepackage{pgf}
\begin{document}
Comparison Text\\
\begin{minipage}{0.45\textwidth}
\begin{equation} 
\begin{aligned} 
&1.\  \ol{ax + by} = a\ol x + b \ol y; \\ 
&2.\ \ol {(\ol x)} = x;\\ &3.\  |\ol x| = |x|;\\ 
&4.\  |a x| = |a| |x|; \\ 
&5.\  \ol {xy} = \ol y \> \ol x; \\ 
&6.\  |xy| = |x| |y|; \\ 
&7.\  2\mathrm {Re} (x\bar y)= 2\mathrm{Re} (y\bar x); \\ 
&8.\  \mathrm{Im} (x\bar y) = - \mathrm{Im} (y \bar x).\end{aligned}
\end{equation}
\end{minipage}
\end{document}

enter image description here

You can and probably should play with and tweak the minipage's width to suit your aesthetical needs. You can also remove the manual numbering and let the system do it for you by using align to replace both equation and aligned;

\documentclass[12pt,a4paper,portuguese,brazil,openany,twoside,fleqn]{book}
\pagestyle{plain}
\usepackage[top=3.0cm,left=3.0cm,right=2.5cm,bottom=2.5cm]{geometry}
\usepackage{graphicx,amssymb,stackengine}
\usepackage{amsmath,amsthm,amsfonts}
\usepackage{pgf}
\begin{document}
Comparison Text\\
\begin{minipage}{0.45\textwidth}
\begin{align} 
\  \ol{ax + by} = a\ol x + b \ol y; \\ 
\ \ol {(\ol x)} = x;\\ 
\  |\ol x| = |x|;\\ 
\  |a x| = |a| |x|; \\ 
\  \ol {xy} = \ol y \> \ol x; \\ 
\  |xy| = |x| |y|; \\ 
\  2\mathrm {Re} (x\bar y)= 2\mathrm{Re} (y\bar x); \\ 
\  \mathrm{Im} (x\bar y) = - \mathrm{Im} (y \bar x).
\end{align}
\end{minipage}
\end{document}

enter image description here

Since we're left aligning the minipage and not the actual equations this can have an interesting look to it where the right most character of each line is aligned as far left as the longest line can go. Then you just need to adjust the minipage's width to bring the numbers closer in.

3
  • 1
    (i) \ol is not defined; (ii) why one should have equation numbers on the middle of page?
    – Zarko
    Dec 30, 2016 at 21:36
  • (i) I found no issue with the fact that '\ol' is undefined, in TexWorks I could just skip pass them with the enter key. (ii) the number in the center of the page can be suppressed by adding a * to 'equation' I merely went off of what was provided assuming the questioner's install works for them with the original code. Dec 30, 2016 at 21:49
  • I respect your effort to help OP, however your answer doesn't gives anything new in respect to Torbjørn T comment. Frankly said, question is not very clear, maybe is solution (considering OP comments) something like \begin{subequations} \begin{gather} \ol{ax + by} = a\ol x + b \ol y; \\ \ol {(\ol x)} = x;\\ |\ol x| = |x|;\\ |a x| = |a| |x|; \\ \ol {xy} = \ol y \> \ol x; \\ |xy| = |x| |y|; \\ 2\mathrm {Re} (x\bar y)= 2\mathrm{Re} (y\bar x); \\ \mathrm{Im} (x\bar y) = - \mathrm{Im} (y \bar x). \end{gather} \end{subequations} with fleqn option in \documentclas[...]{...}
    – Zarko
    Dec 30, 2016 at 21:56

You must log in to answer this question.

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