2

I have a table, that should have l-columns.
Is it possible to divide a table cell into a left-justified and a right-justified part?`

With other words: A left, R right:
enter image description here

\documentclass[a4paper]{article}
\begin{document}
\begin{tabular}{l | l | l}
A Head Longer & B Head & C Head \\
{A {\raggedright  R}} & B  R & C  \\
{A  {\raggedleft   R}} & B  R & C  \\
%{A  {\flushright   R}} & B  R & C  \\ % works not
\end{tabular}
\end{document}

2 Answers 2

1

\hspace{\fill} -- \hfill for short -- is what you're looking for.

enter image description here

\documentclass{article}
\begin{document}
\begin{tabular}{ l | }
    A Head Longer\\ \hline
    A R         \\
    A \hfill R  \\
    \hfill A R  \\
    \multicolumn{1}{r|}{A R}  
\end{tabular}
\end{document}
1
  • Thy. ;) .......................
    – cis
    Commented Jun 8, 2021 at 7:09
1

Because the justifying is done by \hfil primitive in each cell, you can use \hfill which is infinite stretchable glue with higher precedence. In your example:

\documentclass[a4paper]{article}
\begin{document}
\begin{tabular}{l | l | l}
A Head Longer & B Head & C Head \\
A\hfill R & B       R & C  \\
A\hfill R & B\hfill R & C  \\
\end{tabular}
\end{document}
1
  • Thx. ............ ;)
    – cis
    Commented Jun 8, 2021 at 7:08

You must log in to answer this question.

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