2

In a document I am working on, I want to use a table. However, the point at which the table belongs is heavily indented due to multiple enumerations. This results in the table being placed much farther to the left than is visually appealing. How do I make the table's left edge be in line with the left edge of the text directly above it?

I am aware of the ability to center the table, and this option is certainly better than leaving it awkwardly to the left, but I would much prefer having it pleasantly and, if possible, perfectly aligned.

An example of my predicament is as follows:

\documentclass{article}
\usepackage[utf8]{inputenc}
\begin{document}
\noindent I can align a table to the left.
\begin{enumerate}
\item However, it stays as far left as the margin allows.
\begin{enumerate}
\item This looks pretty ugly.
\begin{enumerate}
\item The effect is compounded with indentations such as the ones that result from a list.
\end{enumerate}
\end{enumerate}
\end{enumerate}
\begin{table}[h]
\begin{tabular}{|r|c|c|c|c|c|}
\hline
            & A & B & C & D & E \\ \hline
First Row:  & 1 & 2 & 3 & 4 & 5 \\ \hline
Second Row: & 6 & 7 & 8 & 9 & 10 \\ \hline
Third Row:  & 11 & 12 & 13 & 14 & 15 \\ \hline
\end{tabular}
\end{table}
\end{document}

Thank you in advance for any assistance you can provide.

Disclaimer: I am quite new to using LaTeX, and most of the stuff I am using is already generated for me, with me just filling in the content. As a result, with respect to LaTeX, I rarely know what I'm talking about.

1
  • Welcome to TeX.SX! You can have a look at our starter guide to familiarize yourself further with our format.
    – user11232
    Commented Apr 15, 2014 at 0:19

2 Answers 2

2

I am not sure if this is what you want to achieve:

\documentclass{article}
\usepackage[utf8]{inputenc}

\begin{document}

\noindent I can align a table to the left.
\begin{enumerate}
\item However, it stays as far left as the margin allows.
\begin{enumerate}
\item This looks pretty ugly.
\begin{enumerate}
\item The effect is compounded with indentations such as the ones that result from a list.\par\bigskip
\begin{tabular}{|r|c|c|c|c|c|}
\hline
            & A & B & C & D & E \\ \hline
First Row:  & 1 & 2 & 3 & 4 & 5 \\ \hline
Second Row: & 6 & 7 & 8 & 9 & 10 \\ \hline
Third Row:  & 11 & 12 & 13 & 14 & 15 \\ \hline
\end{tabular}
\end{enumerate}
\end{enumerate}
\end{enumerate}

\end{document}

enter image description here

Don't use table and place the tabular inside the appropriate list to get the desired alignment.

The booktabs package could be of interest for you (to design high quality tables).

2

I'm not sure it's one of these you expect, but you can have your tabular centred with respect to the (innermost) enumerate margin, or left aligned with the left margin of the innermost enumerate environment:

\documentclass{article}
\usepackage[utf8]{inputenc}
\usepackage{float}
\usepackage{caption}
\usepackage{insbox}
\begin{document}
\noindent I can align a table to the left.
\begin{enumerate}
\item However, it stays as far left as the margin allows.
\begin{enumerate}
\item This looks not so ugly.
\begin{enumerate}
\item The effect is compounded with indentations such as the ones that result from a list.\medskip

\begin{center}
\begin{tabular}{|r|c|c|c|c|c|}
\hline
            & A & B & C & D & E \\ \hline
First Row:  & 1 & 2 & 3 & 4 & 5 \\ \hline
Second Row: & 6 & 7 & 8 & 9 & 10 \\ \hline
Third Row:  & 11 & 12 & 13 & 14 & 15 \\ \hline
\end{tabular}
\end{center}
\bigskip

\item One can also have the "tabular" left-aligned on the text of the innermost enumeration: \medskip

\item[]\vspace{-\baselineskip}
\begin{tabular}[t]{|r|c|c|c|c|c|}
\hline
            & A & B & C & D & E \\ \hline
First Row:  & 1 & 2 & 3 & 4 & 5 \\ \hline
Second Row: & 6 & 7 & 8 & 9 & 10 \\ \hline
Third Row:  & 11 & 12 & 13 & 14 & 15 \\ \hline
\end{tabular}
\end{enumerate}
\end{enumerate}
\end{enumerate}
\end{document} 

enter image description here

However, note that \caption cannot be used (it's no more in a table environment and doesn't float). \captionof from the captionpackage, if used, is strangely placed: centred with respect to a shorter line, as though the left indentation of the enumeration had become the right matgin of the text.

You must log in to answer this question.

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