
Não tenho certeza se \titlesec
posso fazer isso, mas gostaria de usá-lo para substituir o \lettrine
+ \addtocontents
pela mesma coisa.
O que eu quero deve ficar assim:
Não há problema em usar \lettrine
, é apenas muito mais código manual do que eu gostaria, se for apenas para o mesmo estilo repetido. Suponho que sempre poderia fazer uma macro, mas ainda assim.
Edit: Achei que estava claro, mas para esclarecer, você tem o número 1, que é o número do capítulo. Atualmente, isso se parece com:
\lettrine[lines=2,nindent=0pt,findent=2pt]{\textbf{1}}{}%
%
In the beginning God creäted the heaven and the earth.
%
$^{2}$And the earth was without form, and void;
%
and darkness \textit{was} upon the face of the deep.
%
And the Spirit of God moved upon the face of the waters.
O que eu gostaria de fazer, no entanto, é substituir \lettrine[lines=2,nindent=0pt,findent=2pt]{\textbf{1}}{}%
por \section{}
.
Na documentação do titlesec, um dos exemplos de títulos é:
\titleformat{\section}[wrap]
{\normalfont\fontseries{b}\selectfont\filright}
{\thesection.}{.5em}{}
\titlespacing{\section}
{12pc}{1.5ex plus .1ex minus .2ex}{1pc}
Isso modifica o texto \section{}
para que ele envolva o texto ao redor da seção e coloque uma linha vazia na parte inferior. Eu gostaria de fazer algo semelhante ao que fiz, \lettrine
embora não tenha certeza de como fazer isso.
Responder1
Algo assim?
\documentclass{article}
\usepackage{lettrine}
\usepackage{titlesec}
\usepackage{xparse}
\titleformat{\section}[wrap]
{\normalfont\fontseries{b}\selectfont\filright}
{}{0pt}{}
\titlespacing{\section}
{12pc}{1.5ex plus .1ex minus .2ex}{1pc}
\NewDocumentCommand\mysection{ O{#2} m }{%
\section[#1]{#2}
\everypar\expandafter{%
\the\everypar
\lettrine[lines=2,nindent=0pt,findent=2pt]{\textbf{\thesection}}{}}
}
\begin{document}
\mysection{Title}
In the beginning God creäted the heaven and the earth.
$^{2}$And the earth was without form, and void;
and darkness \textit{was} upon the face of the deep.
And the Spirit of God moved upon the face of the waters.
In the beginning God creäted the heaven and the earth.
$^{2}$And the earth was without form, and void;
and darkness \textit{was} upon the face of the deep.
And the Spirit of God moved upon the face of the waters.
\end{document}
Atualizar: Com ganchos de parágrafo introduzidos no LaTeX2e junho de 2021, isso pode ser alcançado de forma mais robusta (menos chance de ser incompatível com outros pacotes/configurações). Você pode querer definir um pós-setembro menor para \section
.
\documentclass{article}
\usepackage{lettrine}
\usepackage{titlesec}
%\usepackage{xparse} % since latex2e Oct 2020, xparse is part of the kernel
\titleformat{\section}[hang]
{\normalfont\fontseries{b}\selectfont\raggedright}
{}{0pt}{}
\titlespacing{\section}
{12pc}{1.5ex plus .1ex minus .2ex}{1pc}
\NewDocumentCommand\mysection{ O{#2} m }{%
\section[#1]{#2}
% need latex2e Jun 2021
\AddToHookNext{para/begin}{%
\lettrine[lines=2,nindent=0pt,findent=2pt]{\textbf{\thesection}}{}%
}%
}
\begin{document}
\mysection{Title}
In the beginning God creäted the heaven and the earth.
$^{2}$And the earth was without form, and void;
and darkness \textit{was} upon the face of the deep.
And the Spirit of God moved upon the face of the waters.
In the beginning God creäted the heaven and the earth.
$^{2}$And the earth was without form, and void;
and darkness \textit{was} upon the face of the deep.
And the Spirit of God moved upon the face of the waters.
\end{document}