TransWikia.com

How to modify class files of templates to make minor changes

TeX - LaTeX Asked on January 22, 2021

I have a template file for creating resume. However, there are some minor changes that I want to make. These are basic modifications such as changing colour scheme and removing icons. The class file (.cls) does not seem to provide enough options.

Links to the resume template I am trying to work with:

  1. Awesome-cv GitHub repo
  2. Awesome CV Overleaf

Here are the changes I am trying to make:

  1. So what I’ve been trying to do is change the colours of the section heads (ie. Summary, Work Experience) into 1 colour like a dark blue of some sort instead of a mixture of black and red. I can’t seem to find out how to do it. Also the colour of the address from the work experience locations to black.

1. Coloring of section names

  1. Remove the icons that are beside personal information like the email, address, phone number and etc.
    Remove icons from the header

  2. When I try to input my education, I don’t want the extra bullet points underneath the degree. So when I go and erase that section in the source (i.e. in the template, begin{cvitems}... end{cvitems}), it reads the source fine but the whole section in education disappears when I compile it. This code works, note that this has bullet points:

    cvsection{Education}
      begin{cventries}
        cventry
        {B.S. in Computer Science and Engineering} % Degree
        {POSTECH(Pohang University of Science and Technology)} %Institution
        {Pohang, S.Korea} % Location
        {Mar. 2010 - Aug. 2017} % Date(s)
        {
           begin{cvitems} % Description(s) bullet points
               item {Got a Chun Shin-Il Scholarship which is given to promising students in CSE Dept.}
           end{cvitems}
        } 
    end{cventries}
    

Default Education section
But when I try to remove the bullet points, the entire section gets removed:

cvsection{Education}
 begin{cventries}
  cventry
    {B.S. in Computer Science and Engineering} % Degree
    {POSTECH(Pohang University of Science and Technology)} % Institution
    {Pohang, S.Korea} % Location
    {Mar. 2010 - Aug. 2017} % Date(s)
  end{cventries}

3. Education section

The entire template is composed of several files and it would clutter the entire question to post all the files. The template can be opened in OverLeaf or downloaded via GitHub. Note that I have not made any changes to the template, except for in the question 3.

One Answer

A walk-through on how to modify class files for minor changes in LaTeX.

The template does not provide a lot of options to configure. In such situations we need to dig inside the class files and look at the definitions. The .cls files are usually the most relevant ones. So let's dig into it to solve each of your issues.

  1. The command for defining section is cvsection{Section Name}. This command is defined in lines 561--568 in awesome-cv.cls. The lines are below:

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

    This tells us that there is a command called subsectionstyle{#1} to which our section name is sent. So we need to find the definition of this command the the cls file. It is given in line 198:

    newcommand*{sectionstyle}[1]{{fontsize{16pt}{1em}bodyfontbfseriescolor{text}@sectioncolor #1}}
    

    The most relevant command seems to be @sectioncolor as we want colors to change. This is defined in lines 154--157:

    % Awesome section color
    def@sectioncolor#1#2#3{%
    ifbool{acvSectionColorHighlight}{{color{awesome}#1#2#3}}{#1#2#3}%
    }
    

    Now we observe that there is a bool variable that activates the coloring. We can turn it off by placing the following command in our preamble.

    setbool{acvSectionColorHighlight}{false}
    

    Now since we want to change the color of the entire section header, it seems that we will have to redefine the command. Also, notice that there is an @ in the command, so will have to use makeatletter and makeatother. Also, let us first define a nice blue color.

    definecolor{mBlue}{HTML}{1F77B4}
    
    makeatletter
    def@sectioncolor#1#2#3{%
    ifbool{acvSectionColorHighlight}{{color{mBlue}#1#2#3}}{color{awesome}#1#2#3}%
    }
    makeatother
    

    We need to be really careful when we make such changes though. Sometimes they can break commands somewhere else. Looks safe here though.

    You can instead also wrap the cvsection with colorlet to change the color before the section and revert back after the section name:

    colorlet{text}{mBlue}
    cvsection{Section Name}
    colorlet{text}{darkgray}
    

    Colors are defined in lines 123--148.

  2. Similarly, email is defined in lines 280--282:

    % Defines writer's email (optional)
    % Usage: email{<email address>}
    newcommand*{email}[1]{def@email{#1}}
    

    After some digging for @email we find that they are used in lines 466--469:

     {%
       ifbool{isstart}{setbool{isstart}{false}}{acvHeaderSocialSep}%
       href{mailto:@email}{faEnvelopeacvHeaderIconSep@email}%
     }%
    

    Notice the command faEnvelope. These are defined in the file fontawesome.sty. We don't need to bother about it and can simply redefine the command like so. You can redefine for other such icons as well.

    deffaGithubSquare{}
    deffaHome{}
    deffaEnvelope{}
    deffaLinkedinSquare{}
    
  3. I did not have the same issue, so I can't help you out with it. You are probably also deleting the {} before and after the cvitems environment.

Please be careful while modifying class files. Sometimes making such changes can break the entire document.

Answered by Marvin on January 22, 2021

Add your own answers!

Ask a Question

Get help from others!

© 2024 TransWikia.com. All rights reserved. Sites we Love: PCI Database, UKBizDB, Menu Kuliner, Sharing RPP