4

I'm a newbie of Latex, and I'm trying to practice it writing my CV. I would like to write a section where on the left there is the period, and on the right there is what I've done in that period. I would like to have the period aligned with the first row of the right part.

Here is an example of what I'm trying to do: enter image description here

As you can see, "Period" is not perfectly aligned with the right part. In addition, i would like to reduce the vertical spacing between the two "blocks" (i.e.: "Period 1" block, and "Period 2" block), but I wasn't able to do it.

Here is the code I used:

\parbox{0.26\textwidth}{
    \textbf{Period 1}\\[2pt]
    \hfill \\
    \hfill
}
\parbox{0.74\textwidth}{
    \begin{tabbing} 
        \hspace{2.45cm} \= \hspace{4cm} \= \kill 
        This is where I have studied in Period 1\\[2pt]
        \emph{Thesis}\> This is my thesis work \\ 
        \emph{Average grade} \> This is my average grade
    \end{tabbing}
}
\parbox{0.26\textwidth}{
    \textbf{Period 2}\\[2pt]
    \hfill \\
    \hfill \\
}
\parbox{0.74\textwidth}{
    \begin{tabbing} 
        \hspace{2.45cm} \= \hspace{4cm} \= \kill 
        This is where I studied in Period 2 \\[2pt]
        \emph{Thesis}\> This is my thesis work \\ 
        \emph{Average grade} \> This is my average grade \\
    \end{tabbing}
}

Thanks in advance to everybody!

  • You may also have a look to the examples, which are provided by the Koma Script classes. There you'll find a modern style CV. – Harald Lichtenstein Nov 22 at 14:01
4

It is a lot easier to achieve the desired output using a tabular instead of combining parbox with tabbing.

p{0.26\textwidth} makes sure, the first column's width is 0.26\textwidth, >{\bfseries} automatically makes all entries in teh first column bold, while >{\itshape} makes sure, all entries in the second column are italic.

Please keep in mind that you will have to alter the code (and use fixed width columns or tabularx) if the actual contents of the placeholder texts (such as "This is my thesis work ") get longer and need a linebreak in order to fit into the available space.

enter image description here

\documentclass{article}
\usepackage{array}

\begin{document}
\noindent
\begin{tabular}{>{\bfseries}p{0.26\textwidth} 
                >{\itshape}l
                l}
Period 1 & \multicolumn{2}{l}{This is where I have studied in Period 1}\\
         &  Thesis & This is my thesis work \\
         & Average grade & This is my average grade \\[10pt]
         
Period 2 & \multicolumn{2}{l}{This is where I have studied in Period 2}\\
         &  Thesis & This is my thesis work \\
         & Average grade & This is my average grade \\
\end{tabular}
\end{document}

enter image description here

\documentclass{article}
\usepackage{tabularx}

\begin{document}
\noindent
\begin{tabularx}{\textwidth}{>{\bfseries}p{0.26\textwidth} 
                >{\itshape}l
                X}
Period 1 & \multicolumn{2}{l}{This is where I have studied in Period 1}\\
         &  Thesis & This is my thesis work  This is my thesis work   This is my thesis work   This is my thesis work   This is my thesis work   This is my thesis work   This is my thesis work   This is my thesis work  This is my thesis work \\
         & Average grade & This is my average grade \\[10pt]
         
Period 2 & \multicolumn{2}{l}{This is where I have studied in Period 2}\\
         &  Thesis & This is my thesis work \\
         & Average grade & This is my average grade \\
\end{tabularx}
\end{document}
| improve this answer | |
  • Thank you very much for your help! Anyway, i tried something similar to your code before trying with parbox and tabbing, but the problem was exactly the one you stated. When the line get too long I have to manually break it. However this resulted in not having the sentences aligned to the right margin of the page. Maybe there is a command to solve this? – Lorenzo Biroli Nov 21 at 11:52
  • @LorenzoBiroli: I have updated my answer with an example on how you can use tabularx to avoid having to insert maual line braks in the contents get too long. – leandriis Nov 21 at 14:00
  • Thank you very much for your help! – Lorenzo Biroli Nov 24 at 14:09
4

With the xcoffins package you can design your CV in almost the same way as using a graphic design program (no GUI, of course).

https://ctan.org/pkg/xcoffins?lang=en

The idea behind its conception is to divide the content from the relative positions of the elements of the page, for easy design, for example, of a cover page. Coffins are just boxes with several handles that allow to be joined \JoinCoffin one to another in an exact place, for example the lower right part of the first coffin to the upper left part of another and so on. Horizontal or vertical offsets can also be added at the same time.

At the end, it writes \TypesetCoffin the result to the current LaTeX insertion point, usually at the bottom of the baseline on the left side of the text area.

In this case there are seven coffins: the Period, 3 fixed labels (one blank) and 3 with a variable text content.

Therefore, for each Period, only four coffins need to be updated. The geometry is always the same, but it will adjust to the length of the content while maintaining the prescribed alignment.

The 4 coffins must be filled \SetVerticalCoffin before invoking the command \JoinAndPrintAll that does exactly that.

That way it's easy to experiment with changing the geometry, once the final content is established, to allow for a more appropriate design. This is shown in the last image, where the word Affiliation was added and the Thesis label was centered with a multi-line work description.

And in the third where a vertical blue rule was added, with a height equal to the full content plus 10pt.

Correct line breaking, alignment, and hyphenation is done by the magic TeX paragraph algorithm, without human intervention, as seen in longer texts.

\documentclass{article}
\usepackage{xcoffins}

\begin{document}
\setlength{\parindent}{0pt}

\NewCoffin\Pxi
\NewCoffin\TThx
\NewCoffin\TAvGx
\NewCoffin\AvGx
\NewCoffin\Wxi
\NewCoffin\Sxi
\NewCoffin\Fillx

\SetVerticalCoffin\TThx{0.25\textwidth}{\emph{Thesis}}
\SetVerticalCoffin\TAvGx{0.25\textwidth}{\emph{Average grade}}
\SetVerticalCoffin\Fillx{0.25\textwidth}{\phantom{\emph{Affiliation}}}
%\SetVerticalCoffin\Fillx{0.25\textwidth}{\emph{Affiliation}}

\newcommand{\JoinAndPrintAll}{%
    \JoinCoffins\Pxi[r,B]\Fillx[l,B] %label blank
    \JoinCoffins\Pxi[\Fillx-r,\Fillx-B]\Sxi[l,T] %affiliation
    \JoinCoffins\Pxi[\Sxi-l,\Sxi-B]\TThx[l,t](-0.25\textwidth,-0.8\baselineskip) %label th
    \JoinCoffins\Pxi[\TThx-r,\TThx-T]\Wxi[l,T]  %work
    \JoinCoffins\Pxi[\Wxi-l,\Wxi-B]\TAvGx[r,t](0pt,-0.8\baselineskip) %label av gr
    \JoinCoffins\Pxi[\TAvGx-r,\TAvGx-T]\AvGx[l,T] %grade
    \noindent\TypesetCoffin\Pxi
    \vspace{2\baselineskip}
}

\SetVerticalCoffin\Pxi{0.25\textwidth}{Period 1}
\SetVerticalCoffin\Sxi{0.5\textwidth}{This is where I have studied in Period 1}
\SetVerticalCoffin\Wxi{0.5\textwidth}{This is my thesis work P1}
\SetVerticalCoffin\AvGx{0.5\textwidth}{This is my average grade P1}
\JoinAndPrintAll

\SetVerticalCoffin\Pxi{0.25\textwidth}{Period 2}
\SetVerticalCoffin\Sxi{0.75\textwidth}{School of Lost Objects \\ Faculty of Objetivity \\ Hard to Find University} \SetVerticalCoffin\Wxi{0.5\textwidth}{As any dedicated reader can clearly see, the Ideal of practical reason is a representation of, as far as I know, the things in themselves; as I have shown elsewhere, the phenomena should only be
used as a canon for our understanding. }
\SetVerticalCoffin\AvGx{0.5\textwidth}{A}
\JoinAndPrintAll

\SetVerticalCoffin\Pxi{0.25\textwidth}{Period 3}
\SetVerticalCoffin\Sxi{0.5\textwidth}{\raggedleft School of Amenities \\ Faculty of Everything \\ University of the Galaxy}
\SetVerticalCoffin\Wxi{0.5\textwidth}{The Ideal proves the validity of the objects in space  and time. To avoid all misapprehension, it is necessary to explain that our judgements are a representation of, however, the manifold. }
\SetVerticalCoffin\AvGx{0.5\textwidth}{A+}
\JoinAndPrintAll

\end{document}

first

second

Use this code to get the second example

\SetVerticalCoffin\Fillx{0.25\textwidth}{\emph{Affiliation}}    
\newcommand{\JoinAndPrintAll}{%
    \JoinCoffins\Pxi[r,B]\Fillx[l,B] %label blank
    \JoinCoffins\Pxi[\Fillx-r,\Fillx-B]\Sxi[l,T] %affiliation   
    \JoinCoffins\Pxi[\Sxi-l,\Sxi-b]\Wxi[l,t](0pt,-0.8\baselineskip)  %work
    \JoinCoffins\Pxi[\Wxi-l,\Wxi-vc]\TThx[r,vc] % %label thesis
    \JoinCoffins\Pxi[\Wxi-l,\Wxi-B]\TAvGx[r,t](0pt,-0.8\baselineskip) %label av gr
    \JoinCoffins\Pxi[\TAvGx-r,\TAvGx-T]\AvGx[l,T] %grade
    \noindent\TypesetCoffin\Pxi
    \vspace{2\baselineskip}
}

Or for a more adventurous setup

f3

use this code (add calc and xcolor packages)

\NewCoffin\Vrule    
\SetVerticalCoffin\TThx{0.25\textwidth}{\emph{Thesis}}
\SetVerticalCoffin\TAvGx{0.25\textwidth}{\emph{Average grade}}
\SetVerticalCoffin\Fillx{0.25\textwidth}{\emph{Affiliation}}
\newcommand{\JoinAndPrintAll}{%
    \JoinCoffins\Sxi[l,vc]\Fillx[r,vc]
    \JoinCoffins\Wxi[l,vc]\TThx[r,vc]     
    \JoinCoffins\AvGx[l,vc]\TAvGx[r,vc]   
    \JoinCoffins\Sxi[l,b]\Wxi[l,t](0pt,-0.8\baselineskip)
    \JoinCoffins\Sxi[l,b]\AvGx[l,t](0pt,-0.8\baselineskip)
    \SetHorizontalCoffin\Vrule{\color{blue}\rule{2pt}{\CoffinTotalHeight\Sxi +10pt}}        
    \JoinCoffins\Pxi[r,vc]\Vrule[l,vc](-0.1\textwidth, 0pt)     
    \JoinCoffins\Sxi[l,vc]\Pxi[r,vc]      
    \noindent\TypesetCoffin\Sxi
    \vspace{\baselineskip}
}
| improve this answer | |
  • Thank you very much! I expected it was way more easy to achieve such a simple output in Latex, but it resulted quite difficult. Anyway, thanks for your help, it did help me very much! – Lorenzo Biroli Nov 24 at 14:09

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.