0

I have a simple document, mainly consisting of sections (not latex sections) consisting of a table followed by some itemized items, and some v space between them.

I have found to have the document display as I would like, I have to manually set the vspace between these 'sections', often at different settings.

An example is here:

\documentclass[letterpaper,11pt]{article}
\usepackage[T1]{fontenc}
\usepackage{kpfonts}
\RequirePackage{fix-cm}
\usepackage{paralist}
\usepackage{fancyhdr}
\setlength{\parskip}{\baselineskip}%
\setlength{\parindent}{0pt}%
\usepackage[hyphenbreaks]{breakurl}
\usepackage[hyphens]{url}
\usepackage{etoolbox}
\usepackage[table,RGB]{xcolor}
\definecolor{darkjunglegreen}{rgb}{0.0, 0.26, 0.15}
\usepackage{booktabs}
\usepackage[
top    = 1.10cm,
bottom = 1.25cm,
left   = 1.4cm,
right  = 1.4cm]{geometry}
\usepackage{titlesec}
\makeatletter 
\newcommand\semilarge{\@setfontsize\semiLarge{12.22}{15.38}}
\newcommand\semiLarge{\@setfontsize\semiLarge{13.22}{17.38}}
\makeatother
\pagestyle{fancy}
\renewcommand{\headrulewidth}{0pt}
\newcommand{\greenuline}[1]{{\color{darkjunglegreen}\uline{{\color{black}#1}}}}

\cfoot{}

\titleformat{\section}
{\normalfont\Large\bfseries}{\thesection}
{1em}{}[\color{darkjunglegreen}{\titlerule[2pt]}]
\titlespacing\section{0pt}{1pt plus 4pt minus 2pt}{-3pt plus 2pt minus 2pt}

\begin{document}
\sloppy

\section*{Section heading 1}

\large{Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo consequat. Duis aute irure dolor in reprehenderit in voluptate velit esse cillum dolore eu fugiat nulla pariatur. }


\section*{Section heading 2}

\vspace{2mm}

\begin{tabular}{@{}p{14.8cm} p{4cm}}
\textbf{Word - Phrase} & 08/2015 - 07/2016
\end{tabular}

\vspace{-3.8mm}
Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo consequat. Duis aute irure dolor in reprehenderit in voluptate velit esse cillum dolore eu fugiat nulla pariatur.

\vspace{0.7mm}
\kern-\parskip\begin{compactitem}\setlength{\itemsep}{0.7mm} 
    \item[--] Lorem ipsum dolor sit amet, consectetur adipiscing elit
    \item[--] Lorem ipsum dolor sit amet, consectetur adipiscing elit
\end{compactitem}\kern-\parskip


\vspace{2mm}

\begin{tabular}{@{}p{14.8cm} p{4cm}}
\textbf{Word - Phrase} & 08/2015 - 07/2016
\end{tabular}

\vspace{-3.8mm}
Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo consequat. Duis aute irure dolor in reprehenderit in voluptate velit esse cillum dolore eu fugiat nulla pariatur dolore eu fugiat nulla pariatur.

\vspace{1.5mm}
\kern-\parskip\begin{compactitem}\setlength{\itemsep}{1mm}  
    \item[--] dolore eu fugiat nulla pariatur dolore eu fugiat nulla pariatur ex ea commodo consequat.
    \item[--] laboris nisi ut aliquip ex ea aliquip ex ea commodo consequat.
    \item[--] eu fugiat nulla pariatur dolore eu fugiat nulla pariatur.
\end{compactitem}\kern-\parskip
\end{document}

In the second 'section' I have more than double the vspace between the itemized items and table than in the previous section. Other times I have to adjust the vspace before and after the table also, to get my document displaying 'nicely'.

I am sure this is not the correct approach to this problem.

Is there a way to set spacing for my 'sections' at the start of the document, without having to adjust it manually throughout the document, and whenever I make a change that increases the size of my table or itemized items?

  • I noticed that, it had the effect I wanted anyway so I just left it as is. – Jake Rankin Jan 8 at 17:17
  • @DavidCarlisle How would setting large where I have affect spacing between tables and itemized lists? Especially when they are all after I already set large? – Jake Rankin Jan 8 at 17:21
  • @DavidCarlisle I know my document isn't perfect, but at the moment I am specifically just trying to see if I can do my spacing between my internal 'sections' better than manually setting vspace at each point. – Jake Rankin Jan 8 at 17:36
  • @DavidCarlisle The things you are pointing out as issue were given as solutions in other answers to help me get the look I have currently, and I am not trying to eliminate or rework all of that at the moment. What is the main vertical list you refer to? I'd like to fix the sole issue causing my current problem, or find a work around if possible. – Jake Rankin Jan 8 at 17:44
  • @JohnKormylo could you clarify what you mean when you say environment? – Jake Rankin Jan 8 at 18:20
5

You may want to adjust the spacings. Every time you find the need of negative spacing, take a break: something is going wrong.

\documentclass[letterpaper,11pt]{article}
\usepackage[T1]{fontenc}
\usepackage{kpfonts}
\usepackage{enumitem}
\usepackage{fancyhdr}
\usepackage[table,RGB]{xcolor}
\usepackage{booktabs}
\usepackage[
  top    = 1.10cm,
  bottom = 1.25cm,
  left   = 1.4cm,
  right  = 1.4cm,
  headheight=13.6pt,
]{geometry}
\usepackage{titlesec}
\usepackage{parskip}

\definecolor{darkjunglegreen}{rgb}{0.0, 0.26, 0.15}

\pagestyle{fancy}
\cfoot{}
\renewcommand{\headrulewidth}{0pt}

\newcommand{\greenuline}[1]{{\color{darkjunglegreen}\uline{{\color{black}#1}}}}
\newcommand{\period}[2]{\par\makebox[\textwidth][s]{\mbox{\bfseries #1}\hfill\mbox{#2}}\par}

\newenvironment{myitemize}{\begin{itemize}[nosep,label=--]}{\end{itemize}}

\titleformat{\section}
  {\normalfont\Large\bfseries}{\thesection}
  {1em}
  {}
  [\color{darkjunglegreen}{\titlerule[2pt]}]
\titlespacing\section
  {0pt}
  {1pt plus 4pt minus 2pt}
  {3pt plus 2pt minus 2pt}

\begin{document}
\sloppy

\section*{Section heading 1}

{\large Lorem ipsum dolor sit amet, consectetur adipiscing elit, 
sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. 
Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris 
nisi ut aliquip ex ea commodo consequat. Duis aute irure dolor in 
reprehenderit in voluptate velit esse cillum dolore eu fugiat nulla 
pariatur.\par}

\section*{Section heading 2}

\period{Word -- Phrase}{08/2015 - 07/2016}

Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod 
tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim 
veniam, quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea 
commodo consequat. Duis aute irure dolor in reprehenderit in voluptate 
velit esse cillum dolore eu fugiat nulla pariatur.

\begin{myitemize}\setlength{\itemsep}{0.7mm} 
    \item Lorem ipsum dolor sit amet, consectetur adipiscing elit
    \item Lorem ipsum dolor sit amet, consectetur adipiscing elit
\end{myitemize}

\period{Word - Phrase}{08/2015 - 07/2016}

Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod 
tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim 
veniam, quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea 
commodo consequat. Duis aute irure dolor in reprehenderit in voluptate 
velit esse cillum dolore eu fugiat nulla pariatur dolore eu fugiat nulla pariatur.

\begin{myitemize}\setlength{\itemsep}{1mm}  
    \item dolore eu fugiat nulla pariatur dolore eu fugiat nulla pariatur 
              ex ea commodo consequat.
    \item laboris nisi ut aliquip ex ea aliquip ex ea commodo consequat.
    \item eu fugiat nulla pariatur dolore eu fugiat nulla pariatur.
\end{myitemize}

\end{document}

enter image description here

ADDITION

After the OP's complaint, I add a new version, using of course the cleaner input method, so we can compare it with the original output. More customizations are possible and much easier because one can work only on the definitions, rather than manually adding spaces and guessing at the output.

\documentclass[letterpaper,11pt]{article}
\usepackage[T1]{fontenc}
\usepackage{kpfonts}
\usepackage{enumitem}
\usepackage{fancyhdr}
\usepackage[table,RGB]{xcolor}
\usepackage{booktabs}
\usepackage[
  top    = 1.10cm,
  bottom = 1.25cm,
  left   = 1.4cm,
  right  = 1.4cm,
  headheight=13.6pt,
]{geometry}
\usepackage{titlesec}

\definecolor{darkjunglegreen}{rgb}{0.0, 0.26, 0.15}

\pagestyle{fancy}
\cfoot{}
\renewcommand{\headrulewidth}{0pt}

\newcommand{\greenuline}[1]{{\color{darkjunglegreen}\uline{{\color{black}#1}}}}

\newcommand{\period}[2]{%
  \par\addvspace{\medskipamount}%
  \makebox[\textwidth][s]{\mbox{\bfseries #1}\hfill\mbox{#2}}%
  \par\addvspace{\medskipamount}%
}

\newenvironment{myitemize}
 {%
  \begin{itemize}[noitemsep,label=--,topsep=\smallskipamount]%
 }
 {\end{itemize}}

\newenvironment{largetext}
 {\par\addvspace{\medskipamount}\large}
 {\par\addvspace{\smallskipamount}}

\setlength{\parindent}{0pt}

\titleformat{\section}
  {\normalfont\Large\bfseries}{\thesection}
  {1em}
  {}
  [\color{darkjunglegreen}{\titlerule[2pt]}]
\titlespacing\section
  {0pt}
  {\baselineskip}
  {3pt plus 2pt minus 2pt}

\begin{document}
\sloppy

\section*{Section heading 1}

\begin{largetext}
Lorem ipsum dolor sit amet, consectetur adipiscing elit, 
sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. 
Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris 
nisi ut aliquip ex ea commodo consequat. Duis aute irure dolor in 
reprehenderit in voluptate velit esse cillum dolore eu fugiat nulla 
pariatur.
\end{largetext}

\section*{Section heading 2}

\period{Word -- Phrase}{08/2015 - 07/2016}

Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod 
tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim 
veniam, quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea 
commodo consequat. Duis aute irure dolor in reprehenderit in voluptate 
velit esse cillum dolore eu fugiat nulla pariatur.

\begin{myitemize}\setlength{\itemsep}{0.7mm} 
    \item Lorem ipsum dolor sit amet, consectetur adipiscing elit
    \item Lorem ipsum dolor sit amet, consectetur adipiscing elit
\end{myitemize}

\period{Word - Phrase}{08/2015 - 07/2016}

Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod 
tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim 
veniam, quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea 
commodo consequat. Duis aute irure dolor in reprehenderit in voluptate 
velit esse cillum dolore eu fugiat nulla pariatur dolore eu fugiat nulla pariatur.

\begin{myitemize}\setlength{\itemsep}{1mm}  
    \item dolore eu fugiat nulla pariatur dolore eu fugiat nulla pariatur 
              ex ea commodo consequat.
    \item laboris nisi ut aliquip ex ea aliquip ex ea commodo consequat.
    \item eu fugiat nulla pariatur dolore eu fugiat nulla pariatur.
\end{myitemize}

\end{document}

enter image description here

output from the unchanged OP's code

enter image description here

| improve this answer | |

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.