I have a figure that consists of multiple paragraphs of tabulars and images. At least one of these paragraphs is wider than the text width. How can I center the entire figure so that the widest paragraph is perfectly centered, and the left edge of all other paragraphs is aligned with the left edge of the widest paragraph?
For example, how can I make the following document
\documentclass{article}
\usepackage{lipsum}
\begin{document}
\fbox{\begin{tabular}{lllp{4in}}
a & b & c & \lipsum[4]
\end{tabular}}
\fbox{\begin{tabular}{lllp{3in}}
aaaa & bbbb & cccc & \lipsum[4]
\end{tabular}}
\end{document}
look like:
...**********************************************...
...******************************************.......
where .
is a space and *
is part of the boxed region. I don't know the width of the largest paragraph in advance.
Below is a real example. The goal is to center the entire table at once.
\documentclass{article}
\usepackage{amssymb}
\begin{document}
\begin{table}
{\bf Contexts}\\
\begin{tabular}{lllp{4in}}
{\it Statement} & $\Pi$ & $n$ $\mapsto$ \emph{instr} &
Maps an statement address to an statement.\\
{\it Variable} & $\Delta$ & $id \mapsto \emph{var}$ &Maps
a variable ID to its value.\\
{\it Labels} & $\Lambda$ & $\emph{label\_kind} \mapsto n$ & Maps
a label to the address of the corresponding {\tt label} statement number.
\end{tabular}\\
\newline
{\bf Notation}\\
\begin{tabular}{lp{4.2in}}
$\Delta \vdash e \Downarrow v$ & Expression $e$ evaluates to value
$v$ given variable context $\Delta$ as given by the expression
evaluation rules.\\
$\Delta' = \Delta[x \leftarrow v]$ & $\Delta'$ is the same as
$\Delta$ except extended to map $x$ to $v$.\\
$\Pi \vdash p:s$ & $\Pi$ maps statement address $p$ to statement
$s$. If $p \notin \Pi$, the machine gets stuck.\\
$\Lambda \vdash v:p$ & $\Lambda$ maps statement label $v$ to statement
address $p$. If $v \notin \Lambda$, then machine gets stuck. In
addition, a well-formed machine should have $\Pi \vdash p : s$
where $s = \texttt{label $v$}$, otherwise the machine is stuck.\
$(\Delta, p, s) \leadsto (\Delta', p', s')$ & An
execution step. $p$ and $p'$ are
the pre and post step program counters, $s$ and $s'$ are the pre and
post step statements, and $\Delta$ and $\Delta'$ are the pre and post
step variable contexts. Note $\Lambda$ and $\Pi$ are currently static, thus
for brevity not included in the execution context.\\
\end{tabular}
\caption{Operational Semantics Notation.}
\end{table}
\end{document}
Note: The answers to similar questions such as How can I center a too wide table? do not work for multiple paragraphs.
mwe
package (which includeslipsum
).