# How to change the alignment of a tabularx within an easylist?

I'm probably missing something super obvious, but my searching has turned up nothing. I want to put a table in the middle of an outline that I'm making with the easylist package. The table is coming right after text that's 2 levels deep, but since tabularx centers the table by default, the left edge of the table is about a quarter of an inch left of the text, which looks terrible. My current set up looks basically like this.

\usepackage{tabularx}
\usepackage{ltablex}

\begin{document}
\begin{easylist}[articletoc]
\ListProperties(Margin2=.5in,Margin3=1in,Margin4=1.5in)
# Section
## Subsection
\setlength{\extrarowheight}{1.5pt}
\renewcommand{\tabcolsep}{2pt}
\begin{tabularx}{\linewidth}{ | l | >{\raggedright\arraybackslash}X | }
\hline
this & that \\ \hline
\end{tabularx}
\end{easylist}
\end{document}


If somebody can point me towards how to left align the table with a set distance to either the margin or the edge of the page, I can work with that. Bonus points for a way that actually matches it to the level of indentation of the previous text, rather than hard coding the distance.

-
tabularx does not centre anything by default. Please edit ypur question to make a complete document showing all packages used that may be run to show the problem. –  David Carlisle Oct 15 '12 at 21:06
Precede your tabularx with \noindent. This is the default indentation of a paragraph, initiated by tabularx. –  Werner Oct 15 '12 at 21:13
Right you are David. I was using the ltablex package which appears to be responsible for the default centering. I pretty much stopped using that package for what I originally added it for, but removing it breaks things. Time for another round of troubleshooting. :) –  Eric Oct 16 '12 at 14:43

easylist doesn't update \linewidth because it uses a very different way to indent lines. You can emulate it by defining a suitable command.

\documentclass{article}
\usepackage[sharp]{easylist}
\usepackage{tabularx}

\makeatletter
\newcommand\currlinewidth{\dimexpr\textwidth-\el@TotalMargin\relax}
\makeatother

\begin{document}
\hrule
\bigskip

\begin{easylist}[articletoc]
\ListProperties(Margin2=.5in,Margin3=1in,Margin4=1.5in)
# Section
## Subsection

\setlength{\extrarowheight}{1.5pt}
\renewcommand{\tabcolsep}{2pt}
\begin{tabularx}{\currlinewidth}{ | l | >{\raggedright\arraybackslash}X | }
\hline
this & that \\ \hline
\end{tabularx}
\end{easylist}
\end{document}


The \hrule is just to show the line width. Of course if you want to put the tabularx on the same line as "Subsection", you have to measure the word in advance.

-
It looks like ltablex was conflicting (which I forgot to mention I was using), but without it, your code works great. I should be able to remove references to ltablex and roll with what you suggested. How do you figure out bits like \dimexpr\textwidth-\el@TotalMargin\relax? That's clearly tapping into some abilities I'm not familiar with. –  Eric Oct 16 '12 at 14:45
@Eric I looked into easylist and found the parameter that does the analogous thing to \@totalleftmargin for the standard LaTeX lists. Some training in LaTeX programming is necessary, but the site is for finding help by trained programmers, isn't it? –  egreg Oct 16 '12 at 16:01
As I dig into it, I'm thinking I really do need to keep ltablex for a different table which does go for more than a page. Any idea how to get that to work? I find I can hard code it with \setlength{\LTleft}{.86in} \setlength{\LTright}{\LTleft}, but it leaves unnecessary whitespace on top and bottom, as well as needing to be hardcoded. the \currlinewidth rule you created seems to be entirely ignored as soon as ltablex is added. –  Eric Oct 16 '12 at 18:01
Interestingly, tabulary looks to match up with the easylist indents by default. I don't really want to use tabularx and ltablex for the long tables and tabulary for the small inset tables since it feels kludgy, but if it works... –  Eric Oct 16 '12 at 19:03