# How to Align Numbers Horizontally inside Enumeration below Overbraces with LaTeX

I am new to LaTeX and I am trying to get those three parts of the Number horizontally aligned but it seems I can't use {align} around {enumerate}. I tried to play around with {tabulator} a bit but it doesn't help me with aligning the top number with the Overbraces.

Does someone have a smart idea how to solve this the best way?

Below a screenshot and my code belonging to it.

\begin{enumerate}
\item  \begin{tabular}{llcc}
$\overbrace{0}^\text{Vorzeichen}$
&$\overbrace{1000 0000}^\text{Exponent (8Bit)}$
&$\overbrace{1000 0000}^\text{Mantisse}$
&$\longrightarrow + 2^1*(2^0 + 2^{-1}) = 3$
\end{tabular}
\item  \begin{tabular}{rrrcccc}
& 1 &&& 10000001 && 00000000
\end{tabular}
$\longrightarrow + 2^2*(2^0) = 4$
\item  \begin{tabular}{rrrcccc}
& 0 &&& 01111110 && 10000000
\end{tabular}
$\longrightarrow + 2^{-1}*(2^0 + 2^{-1}) = 0,75$
\item  \begin{tabular}{rrrcccc}
& 0 &&& 10000010 && 01000100
\end{tabular}
$\longrightarrow + 2^3*(2^{-2} + 2^{-6}) = 10,125$
\end{enumerate}

• Welcome to TeX.sx! Your post was migrated here from Stack Overflow. Please register on this site, too, and make sure that both accounts are associated with each other (by using the same OpenID), otherwise you won't be able to comment on or accept answers or edit your question.
– Werner
Dec 18, 2014 at 3:22

Here it would be best to define an environment that handles some of the alignment setup. Additionally one should consider using a fixed-width column if you want entries to line up across list elements:

\documentclass{article}
\usepackage{amsmath,array}
\newcolumntype{C}[1]{>{\centering\arraybackslash$}p{#1}<{$}}
\newenvironment{numbers}
{$\begin{array}[b]{C{4em}C{6em}C{5em}>{\longrightarrow{}}l}} {\end{array}$}
\begin{document}

\begin{enumerate}
\item  \begin{tabular}{llcc}
$\overbrace{0}^\text{Vorzeichen}$
&$\overbrace{1000 0000}^\text{Exponent (8Bit)}$
&$\overbrace{1000 0000}^\text{Mantisse}$
&$\longrightarrow + 2^1*(2^0 + 2^{-1}) = 3$
\end{tabular}
\item  \begin{tabular}{rrrcccc}
& 1 &&& 10000001 && 00000000
\end{tabular}
$\longrightarrow + 2^2*(2^0) = 4$
\item  \begin{tabular}{rrrcccc}
& 0 &&& 01111110 && 10000000
\end{tabular}
$\longrightarrow + 2^{-1}*(2^0 + 2^{-1}) = 0,75$
\item  \begin{tabular}{rrrcccc}
& 0 &&& 10000010 && 01000100
\end{tabular}
$\longrightarrow + 2^3*(2^{-2} + 2^{-6}) = 10,125$
\end{enumerate}

\begin{enumerate}
\item  \begin{numbers}
\overbrace{0}^\text{Vorzeichen\vphantom{()}} &
\overbrace{1000 0000}^\text{Exponent (8Bit)} &
\overbrace{1000 0000}^\text{Mantisse\vphantom{()}} &
+ 2^1 \times (2^0 + 2^{-1}) = 3
\end{numbers}
\item  \begin{numbers}
1 & 1000 0001 & 0000 0000 &
+ 2^2 \times (2^0) = 4
\end{numbers}
\item  \begin{numbers}
0 & 0111 1110 & 1000 0000 &
+ 2^{-1} \times (2^0 + 2^{-1}) = 0.75
\end{numbers}
\item  \begin{numbers}
0 & 1000 0010 & 0100 0100 &
+ 2^3 \times (2^{-2} + 2^{-6}) = 10.125
\end{numbers}
\end{enumerate}

\end{document}


Here is a highlight of the modification I suggest:

• Use array to define a new C-style paragraph column, which centres its contents;

• A new environment numbers is defined that sets up the 4-column array;

• \vphantoms ensure that the vertical alignment across the headers for each \overbrace line up; and

• \times looks better than * in math mode.

• thank you so much, it's the perfect solution :) just out of interest: in [b]{C{4em}C{6em}C{5em} what does the [b] and 4em,6em,5em stand for? I assume C stands for "Center".
– Cold_Class
Nov 11, 2014 at 17:20
• @Cold_Class: I've created the C-column. It's the same as a p-column (or paragraph column) of fixed width with \centering added to every cell in that column (that's what the >{\centering\arraybackslash} notation means. [b] makes the array align at the bottom of the last row (usually it is vertically centred; you can also use [t] for top-alignment). The fixed-width columns use widths 4em (roughly the width of 4 m's), 6em (2 m's wider than 4em) and 5em.
– Werner
Nov 11, 2014 at 18:27