3

I would like to style my CV with TeX. The way I inmagine it is described in that two pictures:

enter image description here project history style (The pages end at the grey party, that's not part of the style).

Now I have been looking around a little bit and started trying to work out with Tikz. I tried to style the upper part and bind it to a command:

% !TeX program = lualatex
\documentclass[a4paper,12pt]{article}

%font encoding
\usepackage[onehalfspacing]{setspace}
\usepackage{fontspec}
\setmainfont{Arial}


%Tikz
\usepackage{tikz}


\tikzset{
    thumb/.style={
        text=blue,
        font=\sffamily\bfseries\Huge
    }
}

\newcommand{\sep}[1]{   
    \HUGE{#1}   

    \begin{tikzpicture}
        \draw [blue, fill=blue, ultra thick] (-2,0.5) circle [radius=0.15];
        \draw [ultra thick, blue] (-2,0.5) -- (10,0.5);
    \end{tikzpicture}
}

\begin{document}

\sep{Test}


\end{document}

Now it still looks ugly and TeX also says "undefined control sequence", but the main question is: When I call that command, he is gonna draw the line to an absolute position. Can I make it relative to the position where my command is used? (I basically need to give it text and below the text he should draw that line, as you see in the image above).

  • 1
    {\Huge #1} instead of \HUGE{#1}, the article class doesn't define \HUGE, and also \Huge is a switch, not a command that takes an argument, hence the rearranging of the braces. – Torbjørn T. Jul 20 '18 at 9:15
  • 1
    Also, the line is not drawn to an absolute position, what your \sep macro does is basically what you say in the last parenthetical remark. First the "title", and below it the tikzpicture. Or I'm misunderstanding what you mean by "absolute" here. – Torbjørn T. Jul 20 '18 at 9:18
  • @TorbjørnT. I thought that these (-2,0.5) -- (10,0.5) are corrdinations where I tell where to draw the line? – Rüdiger Jul 20 '18 at 9:30
  • 2
    Only in relation to other stuff in the tikzpicture, cf. tex.stackexchange.com/questions/442282/shifting-in-tikzpicture/… – Torbjørn T. Jul 20 '18 at 9:31
3

The tikzpagenodes package defines some useful nodes such as current page text area that you can use to draw lines from the current position to the end of the "printed page". To make use of this you need to add remember picture, overlay to your tikzpicture environment, as described in section 17.13 of the 3.0.1a tikz manual. Once you know this it's not hard to produce:

enter image description here

Here's the code:

% !TeX program = lualatex
\documentclass[a4paper,12pt]{article}

%font encoding
\usepackage[onehalfspacing]{setspace}
\usepackage{fontspec}
\setmainfont{Arial}

\parindent=0pt

%Tikz
\usepackage{tikz}
\usepackage{tikzpagenodes}

\tikzset{
    thumb/.style={
        fill=blue,
        circle,
        inner sep=2.5pt,
        outer sep=0,
    },
    thumblabel/.style={
        font=\sffamily\bfseries\Huge,
        text=blue,
        above,
        anchor=south west
    }
}

\newcommand{\sep}[1]{%
  \begin{tikzpicture}[remember picture, overlay]
    \node[thumb, label={[thumblabel]:#1}](#1) at (0,0){};
    \draw [ultra thick, blue] (#1) -- (#1-|current page text area.east);
  \end{tikzpicture}%
}

\begin{document}

\sep{Test}

\bigskip

\qquad\sep{Indented test}

\end{document}

Notice that I have drawn the actual text as a label to the node that draws the dot. The styling for the label is given by thumblabel. Also, the text which is the arguent to \sep, is used as the label for this node so it would be good if every bit of text given to a \sep command was different. If this is not the case then add an optional argument to \sep that can be used to set the label directly (I can add more details if required).

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.