Text Formattingnewcommand define among others the font size

Information and discussion about LaTeX's general text formatting features (e.g. bold, italic, enumerations, ...)
Post Reply
aurorax
Posts: 1
Joined: Thu Feb 11, 2016 12:37 pm

newcommand define among others the font size

Post by aurorax »

Hello to everybody.

I am defining some new commands related to the color of my word but I want that each time I use it, the text font size get smaller than what it actually is. Could I redefine the font size inside this expression:

Code: Select all

\newcommand{\KeywordTok}[1]{\textcolor[rgb]{0.13,0.29,0.53}{\textbf{{#1}}}}

The easy way would be to use tiny or scalebox each time I use my new commands but then latex doesn't respect the line breaks

Code: Select all

\scalebox{.4}{

\KeywordTok{library}\NormalTok{( }\StringTok{"caret"} \NormalTok{)  }
\KeywordTok{library}\NormalTok{( }\StringTok{"plyr"} \NormalTok{)}
\KeywordTok{set.seed}\NormalTok{( }\DecValTok{23} \NormalTok{)}
\CommentTok{# The data set is named as `df`}

}
Thank you very much for any advice
Last edited by cgnieder on Sat Feb 13, 2016 12:52 am, 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

cgnieder
Site Moderator
Posts: 2000
Joined: Sat Apr 16, 2011 7:27 pm

newcommand define among others the font size

Post by cgnieder »

You can load the package relsize and use its commands \smaller or \textsmaller.

Regards
site moderator & package author
Post Reply