mitchelloharawild / vitae

R Markdown Résumés and CVs
https://pkg.mitchelloharawild.com/vitae/
1.23k stars 240 forks source link

Spacing too large before chunk code #106

Closed rikudoukarthik closed 4 years ago

rikudoukarthik commented 4 years ago

I made my CV using the AwesomeCV template, and I was happy with most things except for this small issue; most of the sections in the CV use tibbles or tribbles, which is fine in itself. However, when I have multiple subsections, each with their own tibbles, it creates non-uniformity in spacing. The spacing right before the start of a chunk code is larger than the regular spacing in the standard markdown text and even between the sections and headers.

InkedScreenshot (115)_LI

In the attached screenshot, the green spacing is the regular and ideal spacing, while the dark blue spacing is the excessive spacing seen just before chunk codes. As is evident, this disrupts the uniformity of the document. Even the spacing before '##' formatted H2 headings is less than that of chunk codes.

I wanted to know how to edit this spacing options for chunk codes. I guess that I would have to go for some template-wide setting, but wasn't sure how or where to find it. I found a similar issue on StackOverflow (https://stackoverflow.com/questions/35734525/reduce-space-between-code-chunks-and-code-output-in-rmarkdown-beamer-presentatio?newreg=e60ad40e1854401593e7f73187c8fa3b) but the solution given isn't applicable for me, as they are using beamer presentation and suggest adding a .tex file into the YAML.


# Skills

\begin{tabbing}

\textbf{Piracy skills:} \hspace{1cm} \= Basic knowledge of sailing, combat, looting, fleeing \\
\textbf{Identification skills:} \> Experience with haki 

\end{tabbing}

# Education

```{r}
library(tibble)
tribble(
  ~ Degree, ~ Year, ~ Institution, ~ Where, ~Details, 
  "Senior Secondary Education", "1414-16", "XYZ School", "South Blue", NA,
  "BSc in Piracy", "1416-19", "GDR University", "North Blue", NA,
  "MSc in Cartography", "1419-present", "University of South Blue", "All Blue", NA
) %>% 
  detailed_entries(Degree, Year, Institution, Where, Details)

Publications

Books

tibble(
    title = "A Pictorial Guide to Guiding",
    author = "GD Roger, et al.",
    journal = "",
    number = " ",
    cites = 0,
    year = "1418",
    cid = NA,
    pubid = NA
    ) %>% 
  detailed_entries(
    what = author,
    when = year,
    with = title,
    ) 

Abstracts

  tibble(
    title = "A Study on Studying the Effects of Piracy",
    author = "GD Roger, S Rayleigh",
    journal = "Race to Raftel-1418",
    number = " ",
    cites = 0,
    year = "1418",
    cid = NA,
    pubid = NA
  ) %>% 
  arrange(desc(year)) %>%
  detailed_entries(
    what = author,
    when = year,
    with = title,
    where = journal
  )
mitchelloharawild commented 4 years ago

Generally speaking, the CV styles made available in this package are kept as similar as possible to the original template. The awesomecv template and details on how to change its style can be found here: https://github.com/posquit0/Awesome-CV

To customise a CV style with vitae, you'll need to modify the cls or tex file that is generated after you first knit the document.

The subsection code can be found here: https://github.com/mitchelloharawild/vitae/blob/2ea005addd3445d20b68d153ccc564ca4b902593/inst/rmarkdown/templates/awesomecv/skeleton/awesome-cv.cls#L576-L590

Your changes to the spacing of subsections probably needs to be made in the \subsectionstyle macro.

rikudoukarthik commented 4 years ago

My problem was that it considered regular content and R code content as two different kinds of content, and gave different spacing for each. I noticed that in addition to \acvSectionContentTopSkip and \acvSectionTopSkip values, there was another \vspace{-3mm} in the %Define a subsection for CV and %Define a paragraph for CV options. I chose to remove the -3mm from here, and also changed \acvSectionContentTopSkip from 2.5mm to 0.5mm. Now things seem much better.

My document looks good now, but I don't know if the changes I made to the cls file will have contingencies when I try to make a different document. Could you maybe explain why exactly there was \vspace{\acvSectionContentTopSkip} as well as \vspace{-3mm} in the original code?

% Define a subsection for CV
% Usage: \cvsubsection{<subsection-title>}
\renewcommand{\subsection}[1]{%
    \vspace{\acvSectionContentTopSkip}
%   \vspace{-3mm}
    \subsectionstyle{#1}
    \phantomsection
}

% Define a paragraph for CV
\newenvironment{cvparagraph}{%
  \vspace{\acvSectionContentTopSkip}
%  \vspace{-3mm}
  \paragraphstyle
}{%
  \par
  \vspace{2mm}
}
mitchelloharawild commented 4 years ago

My document looks good now, but I don't know if the changes I made to the cls file will have contingencies when I try to make a different document.

Glad to hear it. Not sure what you mean by cls files, the changes to the cls will only apply to that document as they share the same folder.

Could you maybe explain why exactly there was \vspace{\acvSectionContentTopSkip} as well as \vspace{-3mm} in the original code?

Again, the cls files are taken from the awesomecv repo, where the \vspace{-3mm} is also used: https://github.com/posquit0/Awesome-CV/blob/4be6c213c8631a1fd68d1ad452e88b722b911f78/awesome-cv.cls#L561-L577 You can ask in that repo why both \vspace exist.

rikudoukarthik commented 4 years ago

Not sure what you mean by cls files, the changes to the cls will only apply to that document as they share the same folder.

I meant if I make the same changes to the cls file of a different document. It doesn't seem to bring up a new issue in my current document, but I was wondering if it could in a different one.

You can ask in that repo why both \vspace exist.

Okay, thanks. Will do!

mitchelloharawild commented 4 years ago

I meant if I make the same changes to the cls file of a different document. It doesn't seem to bring up a new issue in my current document, but I was wondering if it could in a different one.

The changes you make here should be self contained, and not create issues in other documents.