5

I would like to have two versions of my document. The differences depend on whether kpfonts is loaded or not. If it's not loaded I want to disable the\lettrine command and the arguments in the command should appear as normal text. Below is a MWE.

\documentclass{scrreprt}
\usepackage{lettrine}
\usepackage{lipsum}
%\usepackage{kpfonts}

\makeatletter
\@ifpackageloaded{kpfonts}{%
%don't do anything in this MWE
}
{
\renewcommand{\familydefault}{\sfdefault} %just an example
%I also want to disable lettrine here
}
\makeatother

\begin{document}

\chapter{Whatever}

\lettrine[findent=1pt, nindent=1pt]{N}{ow, let lipsum do the job:} \lipsum[1]

%Now, let lipsum do the job: \lipsum[1]. <<Achieve this with the above line

\end{document}

Is there a way of doing this so I wouldn't have to edit the actual text?

1 Answers1

4

Adding \renewcommand{\lettrine}[3][]{#2#3} should do.

\documentclass{scrreprt}
\usepackage{lettrine}
\usepackage{lipsum}
%\usepackage{kpfonts}

\makeatletter
\@ifpackageloaded{kpfonts}
  {%
   %don't do anything in this MWE
  }
  {%
   \renewcommand{\familydefault}{\sfdefault}%just an example
   \renewcommand{\lettrine}[3][]{#2#3}%
  }
\makeatother

\begin{document}

\chapter{Whatever}

\lettrine[findent=1pt, nindent=1pt]{N}{ow, let lipsum do the job:} \lipsum[1]

Now, let lipsum do the job: \lipsum[1].

\end{document}
egreg
  • 1,121,712