Graphics, Figures & TablesFontsize in tikz \node

Information and discussion about graphics, figures & tables in LaTeX documents.
Post Reply
thag1987
Posts: 17
Joined: Sun Jun 14, 2015 11:19 pm

Fontsize in tikz \node

Post by thag1987 »

I hope this is posted in the right forum. Feel free to give advice how to make these requests better.

I'm trying to deconstruct the figgeri-cv and make changes/simplify wherever possible to start learning latex and at the same time build something useful. Any idea why the \fontsize will not be applied, how could I make it work?

Code: Select all

\documentclass[]{article}
\usepackage[utf8]{inputenc}

% xcolor defines document wide colors that can be easily referenced
\RequirePackage{xcolor}
	\definecolor{white}{RGB}{255,255,255}
	\definecolor{black}{RGB}{0,0,0}
	\definecolor{grey}{RGB}{77,77,77}


%%%%%%%%%%
% Header %
%%%%%%%%%%

% TikZ creates PGF (portable graphics) - let's you draw
\RequirePackage{tikz}
	\newcommand{\header}[3]{%
		\begin{tikzpicture}[remember picture,overlay]
			% node[<options>](<name>){<text>}
			% simple shape with text on it
			% [1] creates rectangle 4cm high (grey) box at top of page
			\node [rectangle, 
					fill={grey},
					anchor=north, 
					minimum width=\paperwidth, 
					minimum height=4cm]
					(box) at (current page.north){};
			% [2] text {firstname}{lastname} in center of box
			\node [anchor=center] 
					(name) at (box) {%
		      			\fontsize{99pt}{}\color{white}%
		      			{#1}{#2}
		    		};
		    % [3] text under textbox[2] {job title}
		    \node [anchor=north]
		    		(name) at (name.south) {%
				      	\fontsize{999pt}{}\color{white}%
				      	{#3}%
				    };
		\end{tikzpicture}
	}

\begin{document}
	\header{first}{last}
	{Job Title}
\end{document}
Thanks in advance, I appreciate all comments.

Recommended reading 2024:

LaTeXguide.org • LaTeX-Cookbook.net • TikZ.org

NEW: TikZ book now 40% off at Amazon.com for a short time.

And: Currently, Packt sells ebooks for $4.99 each if you buy 5 of their over 1000 ebooks. If you choose only a single one, $9.99. How about combining 3 LaTeX books with Python, gnuplot, mathplotlib, Matlab, ChatGPT or other AI books? Epub and PDF. Bundle (3 books, add more for higher discount): https://packt.link/MDH5p

Johannes_B
Site Moderator
Posts: 4182
Joined: Thu Nov 01, 2012 4:08 pm

Fontsize in tikz \node

Post by Johannes_B »

Don't use friggeri-cv as a base to learn LaTeX. Use a decent introduction like LaTeX for complete novices to learn and you will make progress fast.

\selectfont
The smart way: Calm down and take a deep breath, read posts and provided links attentively, try to understand and ask if necessary.
User avatar
Stefan Kottwitz
Site Admin
Posts: 10324
Joined: Mon Mar 10, 2008 9:44 pm

Fontsize in tikz \node

Post by Stefan Kottwitz »

Hi thag!

Learning by reverse engineering and hacking is also a nice way to start and to proceed. At least as addition, also I recommend to take a look into a LaTeX introduction, to get to know the concepts. Behind the code, there are interesting thoughts.

Yes, every time when you set a font attribute, such as by
  • \fontencoding{...}
  • \fontfamily{...}
  • \fontseries{...}
  • \fontshape{...}
  • \fontsize{...}{...}
you need to call \selectfont finally, so LaTeX looks for a font that matches the attributes.

But that's not basic LaTeX, such commands are usually used by class authors.

Stefan
LaTeX.org admin
thag1987
Posts: 17
Joined: Sun Jun 14, 2015 11:19 pm

Re: Fontsize in tikz \node

Post by thag1987 »

Thanks guys, \selectfont was the missing part.

I'm looking for the best documentation to learn LaTex, however most beginner resources focus on very basic stuff, like how to create an article and embed some formulas, whereas I'd like to focus a bit more on things beyond that. I'll definitely have a look at the recommended pdf.
User avatar
Johannes_B
Site Moderator
Posts: 4182
Joined: Thu Nov 01, 2012 4:08 pm

Fontsize in tikz \node

Post by Johannes_B »

TikZ is a huge and powerful beast, the docmentation has over a thousand pages. It is so big, that my machine has serious problems displaying the pdf.

You might be interested in the reference manual (unofficial): latex2e.
The smart way: Calm down and take a deep breath, read posts and provided links attentively, try to understand and ask if necessary.
Post Reply