Horizontal line without indenting

This is the result I want to have (I want to obtain the result that most resembles this mathematical expression):

What I have tried is this:

\begin{aligned} 01\: 1011 \: 0110\\ 11\: 0001 \: 1101\\ \hline 11\: 1011 \: 1111\\ 01\: 0001 \: 0100\\ 10\: 1010 \: 1011 \end{aligned}

Result:

I don't know how to insert the text "bitwise OR", "bitwise AND" and also to reduce the spacing between the numbers.

PD: The font color doesn't matter.

New contributor
R. Morales is a new contributor to this site. Take care in asking for clarification, commenting, and answering. Check out our Code of Conduct.

You can usa a tabular, with booktabs and its prettier rules.

I chose to typeset four columns, so you can decide upon the spacing as you please; I find \thinspace better. You can use \hspace{<length>} as you please instead. Also $\:$ would do, if you prefer that space.

\documentclass{article}
\usepackage{booktabs,array}

\newcolumntype{R}{>{$}r<{$}} % right aligned math

\begin{document}

$\begin{tabular}{ @{} R@{\thinspace} R@{\thinspace} R l @{} } 01 & 1011 & 0110\\ 11 & 0001 & 1101\\ \cmidrule[\lightrulewidth](r){1-3} 11 & 1011 & 1111 & bitwise OR \\ 01 & 0001 & 0100 & bitwise AND \\ 10 & 1010 & 1011 & bitwise XOR \end{tabular}$

\end{document}

• Interesting. The horizontal line goes a little bit outer the column on the right! – Sigur Oct 11 at 20:07

Is this what you want?

\begin{tabular}{@{}ccc@{}c l}
01& 1011 &  0110\\
11& 0001 &  1101\\
\cline{1-3}
11& 1011 &  1111 && bitwise \textit{OR}\\
01& 0001 &  0100 && bitwise \textit{AND} \\
10& 1010 &  1011 && bitwise \textit{XOR}
\end{tabular}

You alse can use the alignedat environment to have full control on the spacing:

\documentclass{article}
\usepackage{mathtools}
\usepackage[svgnames, table]{xcolor}
\usepackage{booktabs, hhline}

\begin{document}

\aboverulesep = -2.5ex\belowrulesep = -1ex\arrayrulecolor{SkyBlue} \begin{alignedat}{4} & 01 & \: & 1011 & \: & 0110\\ & 11 & \: & 0001 & \: & 1101\\ \cmidrule[0.15ex]{1-6} & 11 & \: & 1011 & \: & 1111 &\qquad &\text{\color{SkyBlue}bitwise \emph{OR}} \\ & 01 & \: & 0001 & \: & 0100 & & \text{\color{SkyBlue}bitwise \emph{AND}}\\ & 10 & \: & 1010 & \: & 1011 & & \text{\color{SkyBlue}bitwise \emph{XOR}} \end{alignedat}

\end{document}

Of course, someone needs to show how to do this with a matrix construct in TikZ.

\documentclass[border=6pt]{standalone}

\usepackage{tikz}
\usetikzlibrary{calc}
\usetikzlibrary{matrix}

\begin{document}

\begin{tikzpicture}

\matrix (BINARY)
[matrix of nodes,
row sep=4pt,
nodes={font=\sffamily,}]
{
01  & 1011 & 0110 \\
11  & 0001 & 1101 \\
%% -----------------
11  & 1011 & 1111 \\%% bitwise OR
01  & 0001 & 0100 \\%% bitwise AND
10  & 1010 & 1011 \\%% bitwise XOR
};

\draw ($(BINARY-2-1.south west)!0.5!(BINARY-3-1.north west)$) --
($(BINARY-2-3.south east)!0.5!(BINARY-3-3.north east)$);

\node[anchor=west,blue] at (BINARY-3-3.east) {bitwise OR};
\node[anchor=west,blue] at (BINARY-4-3.east) {bitwise AND};
\node[anchor=west,blue] at (BINARY-5-3.east) {bitwise XOR};

\end{tikzpicture}

\end{document}

For the comments on last three rows you could, alternatively, use a \foreach loop as follows:

\foreach \myn/\myop in {3/OR,4/AND,5/XOR}
{
\node[anchor=west,blue] at (BINARY-\myn-3.east) {bitwise \myop};
}