Align text both horizontally and vertically
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.
\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}
\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}
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}
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
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}
}