0

I'm quite new to latex and need help making my equations in enumerate aligned by "b" for school project.

Right now it looks like: enter image description here

But I need it to look like: enter image description here

My code right now: enter image description here

Thank you for your help!

Fred
  • 31
  • 3
  • 2
    Welcome to TeX.SX! Please do not post code as images. We would appreciate a minimal compilable code example. – TeXnician Dec 17 '17 at 10:39
  • 1
    Do the answers to this question help you? https://tex.stackexchange.com/q/15628/134144 Alternatively, you could use a tabular or an aligned environment instead of the enumerate environment. Additionally, please do not post code as images, but rather put it directly into the question. Please as well extend the code snippet to be a complete minimal working example (MWE) . – leandriis Dec 17 '17 at 10:40

1 Answers1

2

A solution with listliketab in the place of `enumerate:

\documentclass[11pt, a4paper]{article}
\usepackage[utf8]{inputenc}
\usepackage[T1]{fontenc}
\usepackage{lipsum}
\usepackage{listliketab}

\begin{document}

\storestyleof{enumerate}
\newcounter{tabenum}\setcounter{tabenum}{0}
\newcommand{\tabitem}{\refstepcounter{tabenum}\thetabenum)}
\setlength{\tabcolsep}{1em}
\begin{listliketab}
  \begin{tabular}{L*{2}{>{$}l<{$}}}
    \tabitem & a = 5, & b = 3 \,; \\
    \tabitem & a = 4, & b = 6 \,; \\
    \tabitem & a =3{,}2, & b = 2{,}3 \,; \\
    \tabitem & a = 2\sqrt{5}, & b = 3\sqrt{5} \,; \\
    \tabitem & a = \sqrt{3}, & b = \sqrt{7} \,; \\
    \tabitem & a = 1, & b = √{0{,}1}.
  \end{tabular}
\end{listliketab}

\end{document}

enter image description here

Another solution, based on a code by @Werner for switching between left and right equation numbers within the same document, and the fleqn environment from nccmath. The = signs will be aligned in both columns:

\documentclass[11pt, a4paper]{article}
\usepackage[utf8]{inputenc}
\usepackage[T1]{fontenc}
\usepackage{lipsum}

\usepackage{amsmath}
\usepackage{nccmath}
\makeatletter
\newcommand{\leqnomode}{\tagsleft@true}
\newcommand{\reqnomode}{\tagsleft@false}
\makeatother

\begin{document}

\begin{fleqn}[2em]
\leqnomode
\begin{alignat}{2}
a &= 5, & b & = 3 \,; \\
a & = 4, & b & = 6 \,; \\
a & =3{,}2, & b & = 2{,}3 \, ; \\
a & = 2\sqrt{5}, &\qquad b & = 3\sqrt{5} \, ; \\
a & = \sqrt{3}, & b & = \sqrt{7} \, ; \\
a & = 1, & b & = \sqrt{0{,}1}.
\end{alignat}
\end{fleqn}

\begin{align}
  f(x) &= ax^2 + bx + c \\
  g(x) &= dx^2 + ex + f
\end{align}

\end{document}

enter image description here

Bernard
  • 271,350
  • Out of the box, this does not compile. The error:./ListLikeTab-ex.tex:20: Package inputenc Error: Unicode char √ (U+221A) (inputenc) not set up for use with LaTeX. Using MacTeX 2017 updated this morning. – sgmoye Dec 17 '17 at 12:20
  • OOps! Sorry, it's a problem with my editor: it displays maths symbols (but saves as TeX code). I've fixed it. Please try the modified code. – Bernard Dec 17 '17 at 12:24
  • I assumed something of the sort, so glad it's fixed. Thanks. – sgmoye Dec 17 '17 at 12:25
  • @bernard : where is available the listliketab package? Not found in ctan.org right now. – pzorba75 Dec 17 '17 at 13:52
  • @pzorba75 Hmmm, strange, it is there indeed listliketab package. – Cragfelt Dec 17 '17 at 15:27
  • @pzorba75: It is part of the MiKTeX and TeX Live distributions. Other than that, you'll find it in https://ctan.org/tex-archive/macros/latex/contrib, but it's better to install it via your package manager. – Bernard Dec 17 '17 at 18:21