3

I'd like to get rid of the additional empty space on the right between \begin{tabular}{ll} \textsc{place,} & \textsc{date}\\ Place, & \today \end{tabular} % and the right page margin/border:

enter image description here

The title isn't the best I admit, if anyone knows a better one feel free to edit it and this line please.

MWE

\documentclass[
fontsize=12pt,
a4paper,
DIV=15,
parskip=half
]{scrartcl}

\usepackage[utf8]{inputenc}
\usepackage[T1]{fontenc}

\usepackage{
lmodern,
lipsum
}

\listfiles

\begin{document}
%\vspace{0.5cm}
\begin{flushleft}
Words\\
More Words
\end{flushleft}%
\begin{tabular}{@{}l}
\textsc{code}\\
11-22-33-44
\end{tabular}%
\hfill
\begin{tabular}{ll}
\textsc{place,} & \textsc{date}\\
Place, & \today
\end{tabular}
\begin{flushleft}
\bfseries Words
\end{flushleft}
\begin{flushleft}
Something,
\end{flushleft}
\lipsum[3]
\end{document}
  • 1
    Adding a \\ after the \end{tabular} seems to do it, along with @{} after the ll – Steven B. Segletes Jan 9 '14 at 11:11
  • 2
    you need @{} you did it in one table but not the other \begin{tabular}{ll@{}} also never do ar} % which can put a space after the table in some circumstances, do ar}% – David Carlisle Jan 9 '14 at 11:11
3

You need a l@{} so the text has no tabcolsep padding on the right (just as you have already used at the left margin in other tables. Then you need to make sure that the \hfill is not balanced by the \parfillskip glue that is added to the last line of a paragraph. As you want the same effect on both sides, center is an appropriate environment.

enter image description here

\documentclass[
fontsize=12pt,
a4paper,
DIV=15,
parskip=half
]{scrartcl}

\usepackage[utf8]{inputenc}
\usepackage[T1]{fontenc}

\usepackage{
lmodern,
lipsum
}

\listfiles

\begin{document}
\begin{flushleft}
Words\\
More Words
\end{flushleft}%
\begin{center}
\noindent\begin{tabular}{@{}l}
\textsc{code}\\
11-22-33-44
\end{tabular}%
\hfill
\begin{tabular}{ll@{}}
\textsc{place,} & \textsc{date}\\
Place, & \today
\end{tabular}
\end{center}
\begin{flushleft}
\bfseries Words
\end{flushleft}
\begin{flushleft}
Something,
\end{flushleft}
\lipsum[3]
\end{document}
0

Played around a bit and found

\begin{tabular}{ll@{}}
\textsc{place,} & \textsc{date}\\
Place, & \today
\end{tabular}\\

works. => MWE

\documentclass[
fontsize=12pt,
a4paper,
DIV=15,
parskip=half
]{scrartcl}

\usepackage[utf8]{inputenc}
\usepackage[T1]{fontenc}

\usepackage{
lmodern,
lipsum
}

\listfiles

\begin{document}
\begin{flushleft}
Words\\
More Words
\end{flushleft}%
\noindent\begin{tabular}{@{}l}
\textsc{code}\\
11-22-33-44
\end{tabular}%
\hfill
\begin{tabular}{ll@{}}
\textsc{place,} & \textsc{date}\\
Place, & \today
\end{tabular}\\
\begin{flushleft}
\bfseries Words
\end{flushleft}
\begin{flushleft}
Something,
\end{flushleft}
\lipsum[3]
\end{document}

Happy to read other answers, maybe this isn't the only/best solution.

  • No. never end a paragraph with \\ – David Carlisle Jan 9 '14 at 11:14
  • Oh, ok. Well I usually don't but wasn't aware of this "strict" opinion. I was my best next guess. – henry Jan 9 '14 at 11:29
  • 2
    I phrased it strictly there to overcome the slight problem that in this case \\ worked rather well:-) But it's a bad habit to get in to and in most circumstances it does the wrong thing. more discussion at tex.stackexchange.com/questions/82664/when-to-use-par-and-when/… – David Carlisle Jan 9 '14 at 11:34
  • Haha, Isee. :) Was surprised the linked post was relatively short, very interesting, thanks. – henry Jan 9 '14 at 11:39

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.