LaTeX forum ⇒ GeneralFloat text and front/color Topic is solved

LaTeX specific issues not fitting into one of the other forums of this category.
Jchen066
Posts: 13
Joined: Tue Aug 28, 2018 12:50 am

Float text and front/color

Postby Jchen066 » Wed Sep 12, 2018 5:35 pm

hi all,

Is anyone can tell me how to change the font/size/color/effect of the text in the float text book? prefer to use Neutra Display Titling as font. 36pt for the right box and 24pt for the left box. Attached the picture of the final outcome for reference

Below is the code I used:

  1. \documentclass[12pt,english]{article}
  2.  
  3. %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
  4. % PACKAGES
  5. %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
  6.  
  7. % GEOMETRY - Provide the geometry settings of document
  8. \usepackage{geometry}
  9. \geometry{
  10. left = 28mm,
  11. right = 28mm,
  12. top = 50mm,
  13. bottom = 28mm,
  14. bindingoffset = 0mm,
  15. headheight = 103pt,
  16. headsep = 15mm,
  17. footskip = 0mm
  18. }
  19.  
  20.  
  21. % TIKS & PGFPLOTS - Allows the creation of graphics
  22. \usepackage{tikz}
  23. \usepackage{pgfplots}
  24.  
  25. % ESO-PIC - Allows floating text (and perhaps pictures) to be placed in either the foreground or backgrounds
  26. \usepackage[pscoord]{eso-pic}
  27.  
  28. %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
  29. % COMMANDS
  30. %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
  31.  
  32. \newcommand{\titleTextBox}[3]{% {horizontal pos}{vertical pos}{text}
  33.  
  34. \setbox0=\hbox{#3}% Put <stuff> in a box
  35. \AddToShipoutPictureFG*{\put(\LenToUnit{#1\paperwidth},\LenToUnit{#2\paperheight}){\makebox[0pt][c]{\textbf{\huge\textcolor{white}{\begin{tabular}{c}#3\end{tabular}}}}}
  36. }
  37.  
  38. }
  39.  
  40. % CREATETITLEPAGE: Creates the title page.
  41.  
  42. \newcommand{\createTitlePage}{
  43.  
  44. % Background picture
  45.  
  46. \tikz[remember picture,overlay]
  47. \node[opacity=1,inner sep=0pt] at (current page.center){
  48. \includegraphics[
  49. width=\paperwidth,
  50. height=\paperheight
  51. ]
  52. {C:/Users/jiech/Documents/Tuition/pictures/pictures/title_background.jpg}
  53. };
  54.  
  55. % Floating text boxes
  56.  
  57. \titleTextBox{0.78}{0.475}{Year 11 \\ Mathematics \\ Extension 1}
  58. \titleTextBox{0.3}{0.17}{Volume (i) \\ Term 1 Week 7 \\ Theory Book}
  59.  
  60. \thispagestyle{empty} % Clear all additional styles including page numbers
  61. \clearpage % Clear additional contents
  62. \setcounter{page}{1} % Start couting from the second page
  63. }
  64.  
  65.  
  66.  
  67. \begin{document}
  68.  
  69. % Create title page
  70.  
  71. \createTitlePage
  72.  
  73.  
  74.  
  75. \end{document}
Attachments
Title Page.PNG
Title Page.PNG (134.75 KiB) Viewed 4065 times

User avatar
Stefan Kottwitz
Site Admin
Posts: 9154
Joined: Mon Mar 10, 2008 9:44 pm

Postby Stefan Kottwitz » Wed Sep 12, 2018 6:12 pm

Hi!

In this \titleTextBox command, there are already some text formatting commands, such as \huge\textcolor{white}. Your own formatting commands can go there. To be flexible (different sizes or styles), you could use further parameters. Here, I change to 6 parameters and use them in the macro as #4, #5, and #6.

  1. \newcommand{\titleTextBox}[6]{% {horizontal pos}{vertical pos}{text}
  2. \setbox0=\hbox{#3}% Put <stuff> in a box
  3. \AddToShipoutPictureFG*{\put(\LenToUnit{#1\paperwidth},\LenToUnit{#2\paperheight}){\makebox[0pt][c]{\textbf{#4\fontsize{#5}{#6}\selectfont\textcolor{white}{\begin{tabular}{c}#3\end{tabular}}}}}
  4. }
  5. }


Later on, one could call it by

  1. \titleTextBox{0.78}{0.475}{Year 11 \\ Mathematics \\ Extension 1}{\sffamily}{36}{42}
  2. \titleTextBox{0.3}{0.17}{Volume (i) \\ Term 1 Week 7 \\ Theory Book}{\itshape}{24}{30}


Those options mean horizontal position, vertical position, text (as before), and font type, font height, base line height.

Instead of \sffamily or \itshape you could use another font selection command, such as for the desired title font.

Stefan
Site admin

Jchen066
Posts: 13
Joined: Tue Aug 28, 2018 12:50 am

Postby Jchen066 » Thu Sep 13, 2018 2:16 pm

Thanks Stefan.

When I increased the number for #5 and #6... The text size hasn't increased accordingly. Is that because font 36 is the larges one available

User avatar
Stefan Kottwitz
Site Admin
Posts: 9154
Joined: Mon Mar 10, 2008 9:44 pm

Postby Stefan Kottwitz » Thu Sep 13, 2018 4:59 pm

It seems to depend on the font.

When I add

  1. \usepackage{lmodern}


I can use 80 and 90 and more and it gets bigger.

Stefan
Site admin

Jchen066
Posts: 13
Joined: Tue Aug 28, 2018 12:50 am

Postby Jchen066 » Fri Sep 14, 2018 3:37 pm

Stefan Kottwitz wrote:It seems to depend on the font.

When I add

  1. \usepackage{lmodern}


I can use 80 and 90 and more and it gets bigger.

Stefan


thanks a lot. it works


Return to “General”

Who is online

Users browsing this forum: No registered users and 13 guests