我正在制作一些图形,这些图形必须在环境中带有一些描述tabularx
。我想将其tabularx
与左边距对齐,但它仍然出现在中心。
我正在使用该ltablex
包执行文档中的其他任务(例如\keepXColumns
),但这个包似乎是导致我沮丧的原因。tabularx
在这种情况下,我该如何使用这些包将环境左对齐?还有其他替代包吗?
\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}
答案1
你走在正确的轨道上 :-) 你如何使用\keepXColumns
?对我来说它很好用:
\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}