Text FormattingFontsize modification within the text

Information and discussion about LaTeX's general text formatting features (e.g. bold, italic, enumerations, ...)
Post Reply
gwada74
Posts: 42
Joined: Fri Nov 26, 2010 5:28 pm

Fontsize modification within the text

Post by gwada74 »

Hi,

I have defined centuries number for my book. The editor wants me to get the roman number of the century in a smaller size, I've difined the century as follow (it is in french) :

Code: Select all

\newcommand\seize{\small{XVI}\up{\tiny{e}}\}
My problem is that in my book I have to modify the size of the font for example

Code: Select all

\footnotesize{blabkblbalbablablabl \seize century}
The result is that the font size changed stops at \seize and then the text comes back in the normal font.

How should I do ?
Last edited by gwada74 on Sun Feb 06, 2011 4:56 pm, edited 1 time in total.

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

frabjous
Posts: 2064
Joined: Fri Mar 06, 2009 12:20 am

Fontsize modification within the text

Post by frabjous »

The font commands like \small, \tiny, \footnotesize are not commands with arguments. They apply within the entire scope containing them. If you want to limit their application, you either need to use the environment \begin{small} ... \end{small}, or else put the \small command inside an extra pair of braces, like so: {\small Text}.

So in your case, maybe you want something like this:

Code: Select all

\documentclass{article}
\usepackage{xspace}
\newcommand\seize{{\small XVI}\textsuperscript{\tiny e}\xspace}
\begin{document}
Normal {\footnotesize blabkblbalbablablabl \seize century} Normal 
\end{document}
(I couldn't even the command you gave, however, since I don't know how "\up" is defined, and since you had \} instead of } at the end, the number of braces was mismatched. A true minimal working example is always most helpful.)
User avatar
Stefan Kottwitz
Site Admin
Posts: 10335
Joined: Mon Mar 10, 2008 9:44 pm

Fontsize modification within the text

Post by Stefan Kottwitz »

Hi,

instead of using specific font size commands you could consider to change the size relative to the current font size. The relsize package has been made for this purpose.
Just think of using century numbers also in section or chapter headings where the surrounding text is bigger.

For example:

Code: Select all

\newcommand\seize{{\smaller XVI}\textsuperscript{\smaller\smaller e}\xspace}
or

Code: Select all

\newcommand\seize{\textsmaller{XVI}\textsuperscript{\textsmaller[2]{e}}\xspace}
Stefan
LaTeX.org admin
gwada74
Posts: 42
Joined: Fri Nov 26, 2010 5:28 pm

Re: Fontsize modification within the text

Post by gwada74 »

thank you all, I tried your solutions and everything is working perfectly.
Post Reply