LaTeX forum ⇒ Graphics, Figures & TablesFontsize in tikz \node Topic is solved

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

Fontsize in tikz \node

Postby thag1987 » Fri Nov 20, 2015 5:09 am

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?

  1. \documentclass[]{article}
  2. \usepackage[utf8]{inputenc}
  3.  
  4. % xcolor defines document wide colors that can be easily referenced
  5. \RequirePackage{xcolor}
  6. \definecolor{white}{RGB}{255,255,255}
  7. \definecolor{black}{RGB}{0,0,0}
  8. \definecolor{grey}{RGB}{77,77,77}
  9.  
  10.  
  11. %%%%%%%%%%
  12. % Header %
  13. %%%%%%%%%%
  14.  
  15. % TikZ creates PGF (portable graphics) - let's you draw
  16. \RequirePackage{tikz}
  17. \newcommand{\header}[3]{%
  18. \begin{tikzpicture}[remember picture,overlay]
  19. % node[<options>](<name>){<text>}
  20. % simple shape with text on it
  21. % [1] creates rectangle 4cm high (grey) box at top of page
  22. \node [rectangle,
  23. fill={grey},
  24. anchor=north,
  25. minimum width=\paperwidth,
  26. minimum height=4cm]
  27. (box) at (current page.north){};
  28. % [2] text {firstname}{lastname} in center of box
  29. \node [anchor=center]
  30. (name) at (box) {%
  31. \fontsize{99pt}{}\color{white}%
  32. {#1}{#2}
  33. };
  34. % [3] text under textbox[2] {job title}
  35. \node [anchor=north]
  36. (name) at (name.south) {%
  37. \fontsize{999pt}{}\color{white}%
  38. {#3}%
  39. };
  40. \end{tikzpicture}
  41. }
  42.  
  43. \begin{document}
  44. \header{first}{last}
  45. {Job Title}
  46. \end{document}


Thanks in advance, I appreciate all comments.

Tags:

User avatar
Johannes_B
Site Moderator
Posts: 4104
Joined: Thu Nov 01, 2012 4:08 pm

Postby Johannes_B » Fri Nov 20, 2015 10:18 am

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: 9522
Joined: Mon Mar 10, 2008 9:44 pm

Postby Stefan Kottwitz » Fri Nov 20, 2015 12:33 pm

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
Site admin

thag1987
Posts: 17
Joined: Sun Jun 14, 2015 11:19 pm

Postby thag1987 » Sat Nov 21, 2015 4:58 am

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: 4104
Joined: Thu Nov 01, 2012 4:08 pm

Postby Johannes_B » Sat Nov 21, 2015 10:45 am

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.


Return to “Graphics, Figures & Tables”

Who is online

Users browsing this forum: No registered users and 11 guests