GeneralFloat text and front/color

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

Float text and front/color

Post by Jchen066 »

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:

Code: Select all

\documentclass[12pt,english]{article}

%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% PACKAGES
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%

% GEOMETRY - Provide the geometry settings of document
\usepackage{geometry}
\geometry{
	left = 28mm,
	right = 28mm,
	top = 50mm,
	bottom = 28mm,
	bindingoffset = 0mm,
	headheight = 103pt,
	headsep = 15mm,
	footskip = 0mm
}


% TIKS & PGFPLOTS - Allows the creation of graphics
\usepackage{tikz}
\usepackage{pgfplots}

% ESO-PIC - Allows floating text (and perhaps pictures) to be placed in either the foreground or backgrounds
\usepackage[pscoord]{eso-pic}

%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% COMMANDS
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%

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

% CREATETITLEPAGE: Creates the title page.

\newcommand{\createTitlePage}{
	
	% Background picture
	
	\tikz[remember picture,overlay]
	\node[opacity=1,inner sep=0pt] at (current page.center){
		\includegraphics[
		width=\paperwidth,
		height=\paperheight
		]
		{C:/Users/jiech/Documents/Tuition/pictures/pictures/title_background.jpg}
	};
	
	% Floating text boxes
	
	\titleTextBox{0.78}{0.475}{Year 11 \\ Mathematics \\ Extension 1}
	\titleTextBox{0.3}{0.17}{Volume (i) \\ Term 1 Week 7 \\ Theory Book}
	
	\thispagestyle{empty} % Clear all additional styles including page numbers
	\clearpage % Clear additional contents
	\setcounter{page}{1} % Start couting from the second page
}



\begin{document} 
	
	% Create title page

	\createTitlePage
	


\end{document}
Attachments
Title Page.PNG
Title Page.PNG (134.75 KiB) Viewed 11839 times

Recommended reading 2024:

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

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

Stefan Kottwitz
Site Admin
Posts: 10345
Joined: Mon Mar 10, 2008 9:44 pm

Float text and front/color

Post by Stefan Kottwitz »

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.

Code: Select all

\newcommand{\titleTextBox}[6]{% {horizontal pos}{vertical pos}{text}
  \setbox0=\hbox{#3}% Put <stuff> in a box
  \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}}}}}
  }
}
Later on, one could call it by

Code: Select all

\titleTextBox{0.78}{0.475}{Year 11 \\ Mathematics \\ Extension 1}{\sffamily}{36}{42}
\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
LaTeX.org admin
Jchen066
Posts: 13
Joined: Tue Aug 28, 2018 12:50 am

Float text and front/color

Post by Jchen066 »

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

Float text and front/color

Post by Stefan Kottwitz »

It seems to depend on the font.

When I add

Code: Select all

\usepackage{lmodern}
I can use 80 and 90 and more and it gets bigger.

Stefan
LaTeX.org admin
Jchen066
Posts: 13
Joined: Tue Aug 28, 2018 12:50 am

Float text and front/color

Post by Jchen066 »

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

When I add

Code: Select all

\usepackage{lmodern}
I can use 80 and 90 and more and it gets bigger.

Stefan
thanks a lot. it works
Post Reply