2

I am using the resume template using class resume.cls and I want to change the spacing before and after sections. Right now the vertical distance between the heading and the section is too long. I tried the titlesec package, but \titlespacing does not change anything in my document. Can anybody help me with this problem? Thanks in advance!

spacing between section and heading

\documentclass{resume}
\usepackage[left=0.4in,top=0.4in,right=0.4in,bottom=0.4in]{geometry} % Document margins
\usepackage{enumitem}
\usepackage{titlesec}
\newcommand{\tab}[1]{\hspace{.2667\textwidth}\rlap{#1}}
\newcommand{\itab}[1]{\hspace{0em}\rlap{#1}}
\name{XZ} % Your name
\address{123} % Your phone number and email

\usepackage{titlesec}

\begin{document}\small

\begin{rSection}{Education}
\setlength{\parskip}{0.5em}
{\bf xxx} \hfill {XXX} 
\\ Bachelor of Arts
\\Coursework 
{\bf Peking University, Beijing} \hfill {Sept.2013-Jun.2017}
\\ Bachelor of Arts
\\Coursework :  Econometrics
\end{rSection}
\end{document}
Mensch
  • 65,388
Xbeanbi
  • 21
  • Sorry that I didn't make it clear. I want to change the vertical spacing – Xbeanbi Mar 12 '19 at 01:09
  • @Xbeanbi ... no problem... My English are not good enough and possibly your "wide" word was what made me to make the question... Providing the link could help the post ... BUT the link is non-active... please add a working link and not a temporary one that can not be used in the future – koleygr Mar 12 '19 at 01:14
  • @koleygr I am sorry. My bad. I should make it clear... – Xbeanbi Mar 12 '19 at 01:17
  • @Xbeanbi ... The link is active only for you but you can't understand this because it is your project and you have access to it. For anyone else is says "Restricted, sorry you don't have permission to load this page."... You should provide a link to the original page that the documentclass can be found in order to let the post have some possibilities to help future users... Goodnight from me. (If you follow my request you could have an answer some time ... if not tonight....). – koleygr Mar 12 '19 at 01:23
  • @koleygr Thanks for reminder! Just changed it! Goodnight – Xbeanbi Mar 12 '19 at 01:28
  • You answered quick and didn't sleeping yet but will... in the next minutes. 1) the documentclass is really outdated but this is something that you can search about here: https://tex.stackexchange.com/questions/80/latex-template-for-resume-curriculum-vitae . 2) the spaces in the section are provided by the commands... \sectionlineskip: above the horizontal line \sectionskip: before each section heading (says after but...) (you can define any of them line \def\sectionskip{\vspace{0.25cm}}) and \smallskip that separates section's item from its contents but you are not suggested to redefine this. – koleygr Mar 12 '19 at 02:00
  • Since you have some responses below that seem to answer your question, please consider marking one of them as ‘Accepted’ by clicking on the tickmark below their vote count (see How do you accept an answer?). This shows which answer helped you most, and it assigns reputation points to the author of the answer (and to you!). It's part of this site's idea to identify good questions and answers through upvotes and acceptance of answers. – Mensch Aug 27 '19 at 10:14

2 Answers2

1

The relevant code in that class to manipulate the distances is

\usepackage[parfill]{parskip}
\def\sectionlineskip{\medskip} % The space above the horizontal line for each section 
\def\sectionskip{\medskip} % The space after the heading section

% Defines the rSection environment for the large sections within the CV
\newenvironment{rSection}[1]{ % 1 input argument - section name
  \sectionskip
  \MakeUppercase{\bf #1} % Section title
  \sectionlineskip
  \hrule % Horizontal line
  \begin{list}{}{ % List for each individual item in the section
    \setlength{\leftmargin}{1.5em} % Margin within the section
  }
  \item[]
}{
  \end{list}
}

The obvious way to change the distances is to play with the both defined \sectionlineskip and \sectionskip. For example you can define them to be 0cm:

\def\sectionlineskip{\vspace{0cm}}
\def\sectionskip{\vspace{0cm}}

That will give you the (in my eyes not very pretty) result with the following MWE, I changed to make the distances better visuable:

\documentclass{resume}

\usepackage[left=0.4in,top=0.4in,right=0.4in,bottom=0.4in]{geometry} % Document margins
\usepackage{enumitem}

\newcommand{\tab}[1]{\hspace{.2667\textwidth}\rlap{#1}}
\newcommand{\itab}[1]{\hspace{0em}\rlap{#1}}
\name{XZ} % Your name
\address{123} % Your phone number and email


\begin{document}

\small

text before rsection % <================================

\begin{rSection}{Education}
\setlength{\parskip}{0.5em}
{\bf xxx} \hfill {XXX} 
\\ Bachelor of Arts
\\Coursework 
{\bf Peking University, Beijing} \hfill {Sept.2013-Jun.2017}
\\ Bachelor of Arts
\\Coursework :  Econometrics
\end{rSection}

\def\sectionlineskip{\vspace{0cm}} % <==========================
\def\sectionskip{\vspace{0cm}} % <==============================

text before rsection % <========================================

\begin{rSection}{Education}
%\setlength{\parskip}{0.5em}
{\bf xxx} \hfill {XXX} 
\\ Bachelor of Arts
\\Coursework 
{\bf Peking University, Beijing} \hfill {Sept.2013-Jun.2017}
\\ Bachelor of Arts
\\Coursework :  Econometrics
\end{rSection}
\end{document}

and the resulting pdf:

enter image description here

If you need to save more space you could add an \vspace{-0.5\baselineskip} after \end{list} in the code for rSection but that results in a real ugly cv. So I do not show an code to do that ...

Please see that I deleted both calls of package titlesec. Do not load packages twice. Package titlesec is not needed for the changing I did.

At last one remark:

For me it seems you are trying to fit your cv on one single page. Better than changing a given typography (with the result of an ugly looking cv) is to rephrase your cv content. Check once more what you can left out (try to think as the person that should read your cv: what is useful information, what is unintresting for the job).

Mensch
  • 65,388
  • :( I was writing my answer more than an hour and didn't mentioned your answer before finish... But it is too long to delete it now and I will feel terrible while thinking that I just lost more than an hour of my life... The good think is that I am giving some useful information at the end of my message about the link that the OP provided and (so, this is not just an answer that doesn't offer nothing more on the question than yours) and of course that your answer gives the \vspace solution that I forgot to add and it is the first should be mentioned to newcomers for vertical spacing... (+1) – koleygr Mar 12 '19 at 11:08
1

On the point answer:

In the file resume.csv of the template the environment that is used to create these "sections" is defined as:

% Defines the rSection environment for the large sections within the CV
\newenvironment{rSection}[1]{ % 1 input argument - section name
  \sectionskip
  \MakeUppercase{\bf #1} % Section title
  \sectionlineskip
  \hrule % Horizontal line
  \begin{list}{}{ % List for each individual item in the section
    \setlength{\leftmargin}{1.5em} % Margin within the section
  }
  \item[]
}{
  \end{list}
}

As you can see, the environment starts with the command \sectionskip that is defined later with the code:

\def\sectionskip{\medskip}

(just at the end of the file).

To solve the problem you could redefine the \sectionskip command like:

\def\sectionskip{\vspace{1pt}}

(where 1pt is a real small -almost invisible- length).

Even if you place there 0pt or even a negative length, you will discover that the space between the sections will be still big enough because the environment rSection as defined above, will create an invisible list (after reading its argument) and this list will give some extra space.

To control these spaces, you have to:

  1. For the vertical space inside all the sections of the document (and between their items):

Change \parskip length with the command:

\setlength{\parskip}{4pt} % Replace your desired length here

And this has to be done before the command \begin{document} to take effect in the whole document's sections

  1. For the vertical space inside all each specific section (and between their items):

    \parskip 4pt % Replace your desired length here

And this has just after the command \begin{rSection}{<Name of section>} to take effect only in the specific section.

  1. Finally, to control the space between the items of rSubsections you may want to change additionally the length \itemsep by using the command:

    \itemsep 3pt % Replace your desired length here

just after the \begin{rSubsection}{<Name of subsection>}{<Some stuff>}{<Some stuff>}{<Some stuff>}... (the rSubsection environment takes for arguments and its environment is also a list)

Attention: The following part is more important than all the above solutions:

As mentioned in the other answer the documentclass that you used is really outdated and should not be used anymore. You can see it in the template that contains the code code like:

\newenvironment{rSubsection}[4]{ % 4 input arguments - company name, year(s) employed, job title and location
 {\bf #1} \hfill {#2} % Bold company name and date on the right
 \ifthenelse{\equal{#3}{}}{}{ % If the third argument is not specified, don't print the job title and location line
  \\
  {\em #3} \hfill {\em #4} % Italic job title and location
  }\smallskip
  \begin{list}{$\cdot$}{\leftmargin=0em} % \cdot used for bullets, no indentation
   \itemsep -0.5em \vspace{-0.5em} % Compress items in list together for aesthetics
  }{
  \end{list}
  \vspace{0.5em} % Some space after the list of bullet points
}

In this code the usage of \bf and \em commands shows that the template has been created many years before and haven been updated from then. An update on this could be a replacement for these commands with commands like: {\bfseries #1} and \emph{#3}\hfill \emph{#4} but this is not the only problem (not for your choice and not even for the template).

The most important is that you got your CV template from the link that you provided when actually the real template in this site is here:

In overleaf cite the cv templates can be found on the link:

https://www.overleaf.com/latex/templates/tagged/cv

and the link that you used is:

https://www.overleaf.com/gallery/tagged/cv

that is just a place that anyone can add its cv even if doesn't really know how to use the template.

Finally, check inside tex.stackexchange's question about available templates for CVs and keep in mind that in most cases it is more important to use a template that you understand (at least how to use it) than to use a complicated template that sems to give a "beautiful" result but need hacks even to change the smaller property of the output.

Welcome to TeX.SX!

Mensch
  • 65,388
koleygr
  • 20,105
  • Thanks very much!!! Your answer helped to fix the problem as well!!! I am new to Latex, and I don't even know that this document class and these commands are outdated.....I just searched cv template at overleaf and chose the one that looks right... Thanks for your information as well. And I want you to know that you are not just wasting your time. You helped a desperate girl and it is very heartwarming to know that there are strangers out there who are willing to help me. Thanks again!!! – Xbeanbi Mar 12 '19 at 23:39
  • @Xbeanbi... glad that helped! happy TeXing! (You may accept the answer you prefer and you think it will be more helpful to future users. None will have a problem if his answer is not finally the accepted one, but if it is difficult for you to make a choice just accept Kurt's answer that answered first. I think that you can't upvote yet but I am almost sure you can select/accept an answer by clicking the green check-mark style button next to the votes of it), Goodnight. – koleygr Mar 13 '19 at 00:29