Explanation of LaTeX Code for Fancy First Letters
This LaTeX code defines a custom command called \firstletter
that creates a decorative dropped capital (or initial capital) at the beginning of chapters or sections using the lettrine
package.
Breaking down the code:
\providecommand{\firstletter}[1]{%
\lettrine[lines=2, lhang=0.05, loversize=0.1]{#1}{}%
}
\providecommand
: This defines a new command only if it doesn’t already exist. If\firstletter
is already defined, this won’t override it.\firstletter[1]
: Creates a command named\firstletter
that takes one parameter (the letter to be styled).\lettrine[options]{letter}{text}
: This is the command from thelettrine
package that creates the fancy first letter effect.- The options specified are:
lines=2
: The large initial letter will span 2 lines of normal textlhang=0.05
: Sets the letter to hang to the left slightly (5% of its width)loversize=0.1
: Makes the letter 10% larger than the default size
{#1}
: The first parameter in the\lettrine
command is the letter to be styled (whatever was passed to\firstletter
){}
: The second parameter in\lettrine
is left empty, meaning no text will follow the initial capital in the same special styling
Usage example:
\chapter{Introduction}
\firstletter{O}nce upon a time, there was a beautiful kingdom...
This would render “Once upon a time…” with a fancy dropped capital “O” spanning two lines.
Enhance your lettrines with decorative fonts, along with several attractive options.
Expanded Code with Font Selection
% Define a command for fancy first letter of chapters with font selection
\providecommand{\firstletter}[1]{%
\lettrine[lines=2, lhang=0.05, loversize=0.1, font=\fontfamily{<fontcode>}\selectfont]{#1}{}%
}
The key addition is the font=\fontfamily{<fontcode>}\selectfont
parameter, which lets you specify a different font for the dropped capital.
Specific Font Examples
Here are several decorative font options for your lettrines:
1. Uncial Font
\providecommand{\firstletter}[1]{%
\lettrine[lines=2, lhang=0.05, loversize=0.1, font=\fontfamily{uncl}\selectfont]{#1}{}%
}
The Uncial font provides a medieval, manuscript-like appearance.
2. Calligraphic Font
\providecommand{\firstletter}[1]{%
\lettrine[lines=2, lhang=0.05, loversize=0.1, font=\fontfamily{pzc}\selectfont]{#1}{}%
}
This uses Zapf Chancery, a flowing calligraphic font.
3. Decorative Gothic
\providecommand{\firstletter}[1]{%
\lettrine[lines=2, lhang=0.05, loversize=0.1, font=\fontfamily{ygoth}\selectfont]{#1}{}%
}
A gothic-style font that gives a striking medieval appearance.
4. Old English Style
\providecommand{\firstletter}[1]{%
\lettrine[lines=2, lhang=0.05, loversize=0.1, font=\fontfamily{yswab}\selectfont]{#1}{}%
}
Provides a blackletter/old English style.
Using Custom Fonts
For even more options, you can use custom fonts with the fontspec
package in XeLaTeX or LuaLaTeX:
% In preamble
\usepackage{fontspec}
\newfontfamily\lettrinefont{Goudy Initialen} % Or any decorative font installed on your system
% Then define the command
\providecommand{\firstletter}[1]{%
\lettrine[lines=2, lhang=0.05, loversize=0.1, font=\lettrinefont]{#1}{}%
}
Making Font Packages Available
To use these fonts, you’ll need to include the appropriate packages:
% In your preamble
\usepackage{lettrine} % Base package for drop caps
\usepackage{pzc} % For Zapf Chancery
\usepackage{yfonts} % For Gothic (ygoth) and Schwabacher (yswab)
\usepackage{uncial} % For Uncial font
Color and Additional Styling
You can also add color to your lettrines:
\usepackage{xcolor}
\providecommand{\firstletter}[1]{%
\lettrine[lines=2, lhang=0.05, loversize=0.1,
font=\fontfamily{pzc}\selectfont,
textcolor=darkred]{#1}{}%
}
Complete Example
\documentclass{book}
\usepackage{lettrine}
\usepackage{pzc}
\usepackage{xcolor}
% Define a command for fancy calligraphic first letters in dark red
\providecommand{\firstletter}[1]{%
\lettrine[lines=2, lhang=0.05, loversize=0.15,
font=\fontfamily{pzc}\selectfont,
textcolor=darkred]{#1}{}%
}
\begin{document}
\chapter{Introduction}
\firstletter{O}nce upon a time, in a land far away, there lived a wise king...
\end{document}
Each of these font options creates a different mood and aesthetic for your document, from medieval to elegant to formal.
#LaTeX
#lettrine
#typography
#font
#formatting
#dropped_cap
#initial_capital
#decorative_fonts
#xcolor
#fontspec
#Uncial
#Calligraphic
#Gothic
#Old_English