[Tex/LaTex] How to change font size in verse environment

fontsizeverse

How to center a verse horizontally

I am using solution give by @Herbet I try to add desired font size to the verse environment but it did not work for me. my entire document appears at font size 12. I want the verse to appear in font size 18. Rest of the document can stay at size 12.

There is a one line text on top of the verse, I want it to appear in font size 8 bold in red color. I do not know how to create a command for this so that I can use it and be able to change properties later.
I would appreciate your help

Best Answer

You can change the font size using the \fontsize command; using \textcolor you can change the text color. An example (run it with XeLaTeX):

\documentclass[12pt]{article}
\usepackage{fontspec}
\usepackage{xcolor}
\usepackage{varwidth}
\newenvironment{Verse}
  {\center\varwidth{\linewidth}\fontsize{18}{21.6}\selectfont}
  {\endvarwidth\endcenter}    
\usepackage{lipsum}
\begin{document}

\lipsum[1]
\begin{Verse}
\textcolor{red}{\fontsize{8}{9.6}\selectfont\bfseries A line in bold red color}\\
foo bar\\
baz
\end{Verse}

\end{document}

enter image description here

In the preamble of your document, you could define a command to change the font size, color and series for the line of text:

\newcommand\RedLine[1]{%
  \textcolor{red}{\fontsize{8}{9.6}\selectfont\bfseries#1}
}

and then use it in the body of your document like

\RedLine{text with different font attributes}