2

This question already has an answer here:

Let us consider the following scenario.

This is the partial code in the main.tex file and which includes code from other tex files like certificate.tex, abstract.tex etc.,

....................
\include{certificate}
\include{abstract}
\include{introduction}
...................

Now I want to incorporate separate font size and font style to each one of the above. For example let us say I want certificate to be of font size 12pt with font family Arial, abstract to be of font size 11pt with font family Courier. And finally the abstract should follow font size and font family, which I declare globally for whole document.

Is it possible to change for particular chapters without changing remaining document.

I am expecting some code like this

....................
\font{12pt}{Arial}{\include{certificate}}
\font{11pt}{Courier}{\include{abstract}}
\include{introduction}
...................

marked as duplicate by Alan Munn, Heiko Oberdiek, Johannes_B, Svend Tveskæg, Stephen Jun 28 '15 at 13:27

This question has been asked before and already has an answer. If those answers do not fully address your question, please ask a new question.

  • @ChristianHupfer I am not sure, I think its pdflatex. I am writing my code in overleaf.com . – hanugm Jun 28 '15 at 9:40
  • 2
    If it's pdflatex, you can't use Arial or Courier directly, but their equivalents: helvet for example. I personally wouldn't use too much different fonts in a document – user31729 Jun 28 '15 at 9:47
  • @ChristianHupfer For me font family is not particular, I wanna know just how to code to change for a particular section. – hanugm Jun 28 '15 at 9:50
3

Only hints how to change the fonts, although there are other ways, of course. The standard font is Computer Modern, to use a font it's necessary to know it's font family and available shapes/series. Important is the \selectfont command.

\documentclass{article}

\usepackage[scaled=0.92]{helvet}
\usepackage{courier}
\usepackage{blindtext}
\begin{document}
\fontfamily{cmr}\fontseries{m}\fontsize{12}{20}\selectfont % Computer Modern font
\blindtext\par
\fontfamily{phv}\fontsize{12}{20}\selectfont   % Helvetica aka. Arial 
\section{Certificate}
\blindtext\par
\begin{abstract}
 \fontfamily{pcr}\fontseries{m} \fontsize{11}{16}\selectfont % Courier font family pcr
  \blindtext\par
\end{abstract}%
\blindtext\par
\fontfamily{phv}\fontseries{m}\fontshape{n}\fontsize{12}{15}\selectfont % Helvetica again

\end{document}

New version, with nice fonts, just to annoy some people here :-P

\documentclass{article}

\usepackage{fontspec}
\usepackage{kantlipsum}
\setmainfont{orange_juice.ttf}
\begin{document}
\kant[1]
\section{Certificate}
\fontspec{planetbe.ttf}
\kant[1]
\begin{abstract}
\fontspec{orange_juice.ttf}
\kant
\end{abstract}%
\kant
\end{document}

(Fonts downloaded from http://www.1001freefonts.com/comic-cartoon-fonts.php)

  • 3
    For the Helvetica part the font should be scaled or the baselineskip modified. – egreg Jun 28 '15 at 10:09
  • 1
    I will update with a xelatex version, possibly – user31729 Jun 28 '15 at 10:19
  • 1
    the baselineskip is different befor and after abstract, inserting blank line befor abstract environment fix it – touhami Jun 28 '15 at 10:21
  • \blindtext doesn't end with \par. i know this is kind of a "duplicate" comment, but i think it's worth saying why the baselines are so horrid in the certificate: baselines aren't applied until a paragraph break takes effect. hence, a blank line or explicit \par is needed so that the intended value (which is a good one) is actually applied. – barbara beeton Jun 28 '15 at 14:28

Not the answer you're looking for? Browse other questions tagged or ask your own question.