3

I'm making some figures that must have with a little description in a tabularx environment. I'd like to align the tabularx to the left margin, however it continues appearing in the center.

I'm using the ltablex package for other tasks in the document (e.g. \keepXColumns), but this package appears to be the responsible for my frustration. How can I align a tabularx environment to the left in this conditions and using these packages? There another alternative packages?

\documentclass[12pt,a4paper]{article}
\usepackage[utf8]{inputenc}
\usepackage[T1]{fontenc}
\usepackage{amsmath}
\usepackage{amsfonts}
\usepackage{amssymb}
\usepackage{graphicx,graphics}
\usepackage{ltablex}%<---This package

\begin{document}
\begin{figure}
\centering
\includegraphics[width=\linewidth]{example-image-a}\par
\footnotesize
\raggedright
\begin{tabularx}{\linewidth}{>{\bfseries}rX}
Description 1:&Some text\\
Description 2:&Some text\\
\end{tabularx}
\caption{This is a figure example}
\end{figure}

\begin{figure}
\centering
\includegraphics[width=\linewidth]{example-image-a}\par
\footnotesize
\begin{flushleft}
\begin{tabularx}{\linewidth}{>{\bfseries}rX}
Description 3:&Some text\\
Description 4:&Some text\\
\end{tabularx}
\end{flushleft}
\caption{This is a figure example}
\end{figure}


\begin{tabularx}{\linewidth}{>{\bfseries}rX}
Description 5:&Some text\\
Description 6:&Some text\\
\end{tabularx}
\end{document}

enter image description here

  • Off-topic: Don't load both graphicx and graphics; the former should suffice. – Mico Nov 2 '17 at 5:29
2

you were on right track :-) how you use \keepXColumns? it works fine for me:

\documentclass[12pt,a4paper]{article}
\usepackage[utf8]{inputenc}
\usepackage[T1]{fontenc}
\usepackage{amsmath}
\usepackage{amsfonts}
\usepackage{amssymb}
\usepackage{graphicx,graphics}
\usepackage{ltablex}%<---This package
\keepXColumns % <--- added

\begin{document}
\begin{figure}
\centering
\includegraphics[width=\linewidth]{example-image-a}\par

\footnotesize
\begin{tabularx}{\linewidth}{>{\bfseries}rX}
Description 1:&Some text\\
Description 2:&Some text\\
\end{tabularx}
\caption{This is a figure example}
\end{figure}

\begin{tabularx}{\linewidth}{>{\bfseries}rX}
Description 5:&Some text\\
Description 6:&Some text\\
\end{tabularx}
\end{document}

enter image description here

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.