# Execute Command at Start of Chapter

So i've recently found out about the lettrine-package and want to use it in my reports. The basic usage is:

\lettrine{E}{in} erstes Beispiel...


There can be optional arguments like

\lettrine[lines=4]{E}{in} zweites Beispiel...


Now i'm wondering if i can automate the process of using that package. I want to enlarge the first letter at the start of each chapter! Is there a way to configure LaTeX so that i can fully omit typing \lettrine... and so forth and just start my chapters with Ein erstes Beispiel (referring to the previous examples)?

• well it depends a bit how robust you want to be, you need to find the first letter and first word, which is easy if the text starts Ein erstes but can be arbitrarily hard if it starts \'{E}in erstes or \textbf{Foo bar} zzz or A cat sat on a mat or \somelocallydefinedmacro ... or \section{the next heading} – David Carlisle Dec 4 '18 at 7:47

A stupid version that proofs that it is indeed possible, but breaking for any of the cases mentioned by @DavidCarlisle after "can be arbitrarily hard". Don't really use this!

\documentclass[]{report}

\usepackage{duckuments}
\usepackage{etoolbox}
\makeatletter
\apptocmd\@chapter\firstlettrine{}{}
\apptocmd\@schapter\firstlettrine{}{}
\makeatother

\usepackage{lettrine}

\def\firstlettrine #1#2
{%
\lettrine{#1}{#2}
}

\begin{document}
\chapter{Foo}
This is a first example. \blindduck

\blindduck[2]
\end{document}