1

I found a problem in that an \hspace does not behave as I expected it to. I gave it -5em, but it only compiled about -4.5em. Changing the font family changes how much error there is, but I think the error within a font family is constant in terms of em units.

\documentclass[extrafontsizes, 48pt]{memoir}
\usepackage[left=7cm, right=0cm]{geometry}

\begin{document}
\ttfamily
\newlength\savetabcolsep\setlength\savetabcolsep\tabcolsep\setlength\tabcolsep{0pt}
\newlength\leftitemspace\setlength\leftitemspace{5em}

Foo

\begin{tabular}{|p{\leftitemspace}|p{\linewidth}}
Foo & Bar\\
Foo 2 & Bar 2\\
Foo 3 & Bar3
\end{tabular}

\rule{1em}{1pt}

\hspace*{-\leftitemspace}      % here is the problem
\begin{tabular}{|p{\leftitemspace}|p{\linewidth}}
Foo & Bar\\
Foo 2 & Bar 2\\
\rule{\leftitemspace}{1pt} & Bar 3
\end{tabular}

\hspace{-\leftitemspace}\rule{\leftitemspace}{1pt}Bar


\setlength\tabcolsep\savetabcolsep
\end{document}

In the following picture, I'm trying to horizontally align the vertical lines of the table:

hspace horizontal alignment problem

ahorn
  • 673

1 Answers1

2
\hspace*{-\leftitemspace}% <<<<<<<<<<<<<<<<< Space removed
\begin{tabular}{|p{\leftitemspace}|p{\linewidth}}

enter image description here

Note that the lines in your sample file are not flush left, since each of them starts a new paragraph. If you want to let the stuff start at the left border of the text area, either add \noindent in each paragraphs or set \parindent=0pt for the whole document by adding it to the preamble.

\noindent
\hspace*{-\leftitemspace}% <<<<<<<<<<<<<<<<< Space removed
\begin{tabular}{|p{\leftitemspace}|p{\linewidth}}

enter image description here

\parindent=0pt
\begin{document}

enter image description here

I recommend to add the option showframe to the geometry package while developing the document layout. Then text/header/footer/margin areas will be indicated.

\usepackage[left=7cm, right=0cm,showframe]{geometry}

enter image description here

gernot
  • 49,614