Take the 2-minute tour ×
TeX - LaTeX Stack Exchange is a question and answer site for users of TeX, LaTeX, ConTeXt, and related typesetting systems. It's 100% free, no registration required.

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?

share|improve this question
add comment

1 Answer 1

up vote 4 down vote accepted

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}
share|improve this answer
    
Worked great, you forgot the [] in the code. You can accept an answer in 9 minutes :) –  pythonista Apr 17 '13 at 0:12
    
@AbdulhaqElhouderi Sorry for the mistake. Fixed. –  egreg Apr 17 '13 at 0:14
add comment

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.