I am committed in writing my class for the university and we want the first section of the article to begin with capital from lettrine package and to be entitled "introduction". I must put this in the class and provide a template to the authors. The example I attach works until you don't start with an empty line between the class defined command \introduction and your text.
How to let the \newcommand defined in the last line in MyClass.cls ignore eventual blank lines left from an unaccustomed or lazy author?
I attach minimal working examples for what i must use (so there will be extra features).
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% %% MyClass WORKING EXAMPLE %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% \NeedsTeXFormat{LaTeX2e}[1995/12/01] \ProvidesPackage{MyClass}[2017/08/30 v0.0] \AtEndOfClass{\RequirePackage{microtype}} %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% %%MY CLASS doesn't support twocolumns %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% \DeclareOption*{\PassOptionsToClass{\CurrentOption}{extarticle}} \ProcessOptions* \LoadClass[a4paper,11pt,final]{extarticle} %%%%%%%%%%%%%%%%%%%%%%% %%%%MUST-TO-BE INCLUDED PACKAGES %%%%%%%%%%%%%%%%%%%%%%% \RequirePackage[OT1, OT2, T1]{fontenc}%Font Encoding \RequirePackage[utf8]{inputenc}%UTF-8 Input Encoding (italian keyboard) \RequirePackage[polutonikogreek,italian,english]{babel}%Languages. Last one is the main one. \RequirePackage{authblk}%Affiliations \RequirePackage{amsfonts,amssymb,amsmath,amsthm,marvosym,wasysym,pxfonts,cancel}%All math symbols ever needed \RequirePackage{lipsum}%Dummy text i.e. \lipsum[3-5] \RequirePackage{xcolor}%Adding xcolors %%%%%%%%%%%%%%%%% %%Color scheme %%%%%%%%%%%%%%%%% \definecolor{color0}{RGB}{0,0,0} % Basic Black \definecolor{color1}{RGB}{59,90,198} % Author email %%%%%%%%%%%%%%%%%%% %%PAGE LAYOUT AND TITLEPAGE %%%%%%%%%%%%%%%%%%% \RequirePackage[left=80pt,% right=80pt,% top=70pt,% bottom=80pt,% headheight=15pt,% headsep=10pt,% a4paper,twoside]{geometry}% \RequirePackage[labelfont={bf,sf},% labelsep=period,% figurename=Fig.,% singlelinecheck=off,% justification=RaggedRight]{caption} \renewcommand{\@maketitle}{% \vskip60pt% {\raggedright \titlefont \@title\par}% \vskip12pt {\raggedright \@author\par} \rule{\linewidth}{.3pt} \vskip12pt% }% %%%%%%%%%%%%%%%%% %%NEWCOMMANDS %%%%%%%%%%%%%%%%% \newcommand{\titlefont}{\normalfont\sffamily\bfseries\fontsize{22}{25}\selectfont} \newcommand{\absfont}{\normalfont\rmfamily\bfseries\fontsize{11}{14}\selectfont} %%%%%%%%%%%%%%%%% %%Author/Affiliation Management %%%%%%%%%%%%%%%%% \setlength{\affilsep}{1em} \renewcommand\Authfont{\color{color0}\normalfont\sffamily\bfseries\scshape\fontsize{15}{17}\selectfont} %%%%%%%%%%%% %%%%FIRST LETTER %%%%%%%%%%%% \RequirePackage{ifthen} \RequirePackage{lettrine} \RequirePackage{yfonts} \DeclareFontShape{LYG}{ygoth}{m}{n}{ <-> ygoth}{} %\renewcommand{\LettrineTextFont}{\normalfont} \renewcommand{\LettrineFontHook}{\color[gray]{0.5}} %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% %%By Reed A. Cartwright %%http://dererumnatura.us/archives/2009/02/automatic-usage.html %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% \newcommand*{\ecap}[1]{\begingroup\obeyspaces\etospace{#1}{}} \newcommand*{\etospace}[3]{\ifthenelse{\equal{#3}{\space}}% {\endgroup\lettrine[lines=3, nindent=0em, findent=0.1em]{#1}{#2}#3}{\etospace{#1}{#2#3}}} % Setup environment `entry' to use `entry*' with a drop cap \newenvironment{entry}{\begin{entry*}\ecap}{\end{entry*}} % Setup environment `entry*' so that lettrine can be manually specified if needed \newenvironment{entry*}{}{} %%%%%%%%%%%%%%%% %%%CLASS DEFINITIONS %%%%%%%%%%%%%%%% \newcommand{\introduction}{\section{Introduction}\label{intro}\ecap} And here's the template:
% !TEX encoding = UTF-8 Unicode %%%%%%%%%%%%%%%%%%% %% WORKIN' EXAMPLE %%%%%%%%%%%%%%%%%%% \documentclass{MyClass} \begin{document} \date{} \setcounter{Maxaffil}{0} \renewcommand\Affilfont{\itshape\footnotesize} \title{Title of the publication} \author[a]{Giuseppe Verdi} \author[a, b]{Mario Rossi} \affil[a]{University A, address} \affil[b]{University B, address} \maketitle \begin{abstract} \lipsum[1] \end{abstract} \introduction %<==NO BLANK LINE AFTER THIS LINE!! HELP==> The beginning. \lipsum[2] \end{document} 