0

Set up

I have 3 Paragraphs separated in different ways using tabular. Here's the :

\documentclass[11pt]{article}
\usepackage[margin=0.5in]{geometry}
\usepackage{titlesec}
\usepackage{lipsum}

%heading
\setlength\parskip{0pt}

\titleformat{\section}
  {\scshape\Large\bfseries}{}{0em}{\vspace{2pt}}[\hrule height 1pt]
\titlespacing*{\section}
  {0pt}{0pt}{10pt} 


%leftbar
\usepackage{array, xcolor, lipsum, bibentry}
\definecolor{lightgray}{gray}{0.8}
\newcolumntype{L}{>{\raggedleft}p{0.10\textwidth}}
\newcolumntype{R}{p{0.86\textwidth}}
\newcommand\VRule{\color{lightgray}\vrule width 0.5pt}

$----------------------------------------------------------------------------
\begin{document} 

%Example 1
\section{Example of text width that is should be}
\lipsum[1]

%Example 2
\bigskip
\section{Example tabular with vRule}

\hspace{-27pt}
\begin{tabular}{L!{\VRule}R}
\textbf{name} - (date)\\&

\lipsum[1] \\
\end{tabular}

%Example 3
\bigskip
\section{Example tabular with textwidth}

\hspace{-11pt}  
\begin{tabular}{r|p{0.80\textwidth}}

\emph{name}&{\bf location}\\\textsc{date}\\&

\lipsum[1] 
\begin{itemize}
\item item 3
\item item 2 
\item item 1

\end{itemize}\\
\end{tabular} 



\end{document}  

enter image description here enter image description here

The Problem (with the second and third paragraphs)

As you can see the first problem is that the text is not lining up with the width of the page, I used \hspace{} to line up the left side by eye, but I can't do the right side.

The second problem is that there is whitespace beneath the text and the vertical line is overflowing beyond the paragraph.

The Goal

Where am I going wrong with the formatting? How to get everything positioned in a "uniform" image like the first paragraph.

Edit: My code above has bullet points to include, the images does not show this

2

This is due to the approximation in calculating the width of the second column, and you didn't take into account theere's some padding between cells (tabcolsep), in particular after the last column. You can have an exact calculation usingtabularx. Also, instead of adding a negative horizontal space before the table, approximately measured, just add\noindent. Last, the vertical line overflow is simply a side effect of using the\lipsum` macro: you don't have this side effect inserting a real text.

Here is a code which doesn't have these drawbacks:

\documentclass[11pt]{article}
\usepackage[margin=0.5in, showframe]{geometry}
\usepackage{titlesec}
\usepackage{enumitem}
\usepackage{lipsum}

%heading
\setlength\parskip{0pt}

\titleformat{\section}
  {\scshape\Large\bfseries}{}{0em}{\vspace{2pt}}[\hrule height 1pt]
\titlespacing*{\section}
  {0pt}{0pt}{10pt}


%leftbar
\usepackage{tabularx, xcolor, lipsum, bigstrut}
\definecolor{lightgray}{gray}{0.8}
\newcolumntype{L}{>{\raggedleft}p{0.10\textwidth}}
\newcolumntype{R}{p{0.86\textwidth}}
\newcommand\VRule{\color{lightgray}\vrule width 0.5pt}

\begin{document}

%Example 1
\section{Example of text width that is should be}
\lipsum[1]

%Example 2
\bigskip
\section{Example tabular with vRule}

\noindent
\begin{tabularx}{\linewidth}{@{}L!{\VRule}X@{}}
\textbf{name} - (date)\\
& \lipsum[1]
\end{tabularx}

%Example 3
\bigskip
\section{Example tabular with textwidth}

\noindent
\begin{tabularx}{\linewidth}{@{}r|X@{}}
\emph{name}&{\bfseries location}\\\textsc{date}\\
&Lorem ipsum dolor sit amet, consectetuer adipiscing elit. Ut purus elit, vestibulum ut, placerat ac,
adipiscing vitae, felis. Curabitur dictum gravida mauris. Nam arcu libero, nonummy eget, consectetuer
id, vulputate a, magna. Donec vehicula augue eu neque. Pellentesque habitant morbi tristique senectus
et netus et malesuada fames ac turpis egestas. Mauris ut leo. Cras viverra metus rhoncus sem. Nulla
et lectus vestibulum urna fringilla ultrices. Phasellus eu tellus sit amet tortor gravida placerat. Integer
sapien est, iaculis in, pretium quis, viverra ac, nunc. Praesent eget sem vel leo ultrices bibendum. Aenean
faucibus. Morbi dolor nulla, malesuada eu, pulvinar at, mollis ac, nulla. Curabitur auctor semper nulla.
Donec varius orci eget risus. Duis nibh mi, congue eu, accumsan eleifend, sagittis quis, diam. Duis eget
orci sit amet orci dignissim rutrum.

\begin{itemize}[wide=0pt, leftmargin=*, after=\vspace{-\baselineskip}]
\item item 3
\item item 2
\item item 1
\end{itemize}
\end{tabularx}

\end{document} 

enter image description here

  • If I may ask 2 questions: 1) In both your second and third paragraph the left hand side of the text with "name" isn't lined up fully to the left as it is with the right. is there no way to correct this? 2) in the third paragraph my actual text has bullet points after the bulk of text `\begin{itemize} , \item item 1, ...\end{itemize}\` how would the code above change to incorporate this? – UniStuffz Sep 13 '17 at 16:00
  • I edited my code above to include bullet points – UniStuffz Sep 13 '17 at 16:05
  • @UniStuffz: I've updated my code to solve these problems. For the problem of lining the left-hand side of the table contents with the left margin, just use @{} in the table preamble to remove the padding on the left. I've also odded the itemize environment, please see my updated answer. – Bernard Sep 13 '17 at 16:25
  • okay great, so before I mark it as the correct answer where/what line of code do I put @{} in example 2 to remove the padding on the left? – UniStuffz Sep 13 '17 at 19:00
  • It's already done in the updated code, line 34: begin{tabularx}{\linewidth}{@{}L!{\VRule}X@{}}. – Bernard Sep 13 '17 at 19:03

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.