
이 작업을 수행할 수 있는지 확실하지 않지만 동일한 작업에 +를 \titlesec
사용하여 대체하는 데 사용하고 싶습니다 .\lettrine
\addtocontents
내가 원하는 것은 다음과 같아야 합니다.
을 사용하는 데에는 문제가 없습니다 \lettrine
. 동일하고 반복되는 스타일에 대한 것이라면 제가 원하는 것보다 훨씬 더 많은 수동 코드일 뿐입니다. 나는 항상 매크로를 만들 수 있다고 생각하지만 여전히 그렇습니다.
편집: 나는 그것이 분명하다고 생각했지만 명확히 하기 위해 챕터 번호인 숫자 1이 있습니다. 현재 이는 다음과 같습니다.
\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.
그러나 내가 하고 싶은 \lettrine[lines=2,nindent=0pt,findent=2pt]{\textbf{1}}{}%
것은 \section{}
.
titlesec 문서에서 제목의 예 중 하나는 다음과 같습니다.
\titleformat{\section}[wrap]
{\normalfont\fontseries{b}\selectfont\filright}
{\thesection.}{.5em}{}
\titlespacing{\section}
{12pc}{1.5ex plus .1ex minus .2ex}{1pc}
이렇게 \section{}
하면 섹션 주위에 텍스트가 배치되고 맨 아래에 빈 줄이 배치되도록 가 수정됩니다. 나는 \lettrine
그것을 어떻게 해야 할지 확신할 수 없지만 내가 했던 것과 비슷한 것을 하고 싶습니다 .
답변1
이 같은?
\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}
업데이트: 2021년 6월 LaTeX2e에 도입된 단락 후크를 사용하면 더욱 강력하게 달성할 수 있습니다(다른 패키지/설정과 호환되지 않을 가능성이 적음). 에 대해 더 작은 after-sep를 설정할 수 있습니다 \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}