번호가 매겨진 단락 뒤에 텍스트 들여쓰기

번호가 매겨진 단락 뒤에 텍스트 들여쓰기

번호가 매겨진 섹션, 하위 섹션 및 단락이 포함된 60페이지 문서가 있습니다. 모든 단락에는 번호가 매겨져 있습니다. 다음 예제와 같이 번호가 매겨진 paras 뒤에 모든 텍스트를 균일하게 들여쓰기하고 싶습니다.

1.      Section

1.1     Subsection

1.1.1   Lorem ipsum dolor sit amet, consectetur adipiscing elit. 
        Donec rhoncus non ante faucibus tempus. Quisque ex orci, 
        faucibus vitae magna sed, blandit fermentum massa. 

1.1.2   Some numbered paras interrupted by lists: 
        * Item 1
        * Item 2
        * Item 3
        and some text to finish the paragraph

1.1.2   Some numbered paras interrupted by sets of equations using AMSmath: 

            A = B
            C = D

        and some text to finish the paragraph

현재 나는 다음 koma-script 클래스를 기반으로 구축된 약 60페이지의 텍스트(많은 방정식 포함)를 가지고 있습니다.

% -*- program: xelatex -*-
\documentclass[english, parskip=full, fontsize=11, DIV12, toc=left, numbers=noenddot]{scrartcl}
\usepackage{babel}
\usepackage{amsmath}
% just so we can see what is going on for now
\usepackage{showframe}
\usepackage{blindtext}
% tighten up spacing of lists
\usepackage{enumitem}
\setlist{noitemsep}


\setcounter{secnumdepth}{4}
\renewcommand\theparagraph{\thesubsection.\arabic{paragraph}}
\newcommand\p{\paragraph{}}
%
%
% make sure paragraphs reset counting at section and subsections
%
\makeatletter
\@addtoreset{paragraph}{subsection}
\@addtoreset{paragraph}{section}
\makeatother
%
% AND NOW WE BEGIN
%
\begin{document}
\section{Section}
\subsection {Subsection}
\p \blindtext
% an example numbered paragraph with an embedded list
\p \blindtext
\begin{itemize}
\item Item 1
\item Item 2
\item Item 3
\end{itemize}
and some words at the end of this para

% an example numbered paragraph with a simple equation
\p The period is defined by a pair of days ($D_l$, $D_u$) where 
\begin{align*}
D^_{l} & =  \text{the lower date}  \\
D^_{u} & =  \text{the upper date}
\end{align*}
and things happen for all days $d$ where $D_l <= d< D_u$. 
\end{document}

따라서 모든 텍스트는 왼쪽 여백으로 돌아갑니다. koma-script \addmargin명령과 같은 것을 사용하여 왼쪽에서 목록과 수학을 들여쓸 수 있다면 이상적일 것입니다. 그러나 번호 매기기가 왼쪽에서 시작되도록 번호가 매겨진 단락 명령을 조정하십시오 \p. 그러나 상자를 사용하여 번호를 둥글게하여 표준 크기를 지정한 다음 \p para의 나머지 부분에 대해 매달기 명령을 사용하여 나머지 부분과 동일하게 만듭니다. 들여쓰기된 텍스트의

또는 다른 것 ....

그러나 지금까지 이것은 내 LaTeX 기술 수준을 넘어서는 것입니다.

답변1

업데이트:KOMA 스크립트버전 3.17(또는 그 이상)

KOMA-Script 버전에서는 명령이 \othersectionlevelsformat더 이상 사용되지 않습니다. 대신 사용해야 합니다 \sectionformat. \subsectionformat따라서 코드는 다음과 같이 변경됩니다.

% -*- program: xelatex -*-
\documentclass[english, parskip=full, fontsize=11, DIV12, toc=left, numbers=noenddot]{scrartcl}
\usepackage{babel}
\usepackage{amsmath}
% just so we can see what is going on for now
\usepackage{showframe}
\usepackage{blindtext}
% tighten up spacing of lists
\usepackage{enumitem}
\setlist{noitemsep}

\setcounter{secnumdepth}{4}
\newcommand\p{\paragraph{}}

\newcommand\secnumindent{1.5cm}
\RedeclareSectionCommands[indent=-\secnumindent]{section,subsection,paragraph}
\RedeclareSectionCommand[afterskip=0pt,counterwithin=subsection]{paragraph}
\renewcommand\sectionformat{\parbox{\secnumindent}{\thesection\autodot}}
\renewcommand\subsectionformat{\parbox{\secnumindent}{\thesubsection\autodot}}
\renewcommand\subsubsectionformat{\parbox{\secnumindent}{\thesubsubsection\autodot}}
\renewcommand\paragraphformat{\parbox{\secnumindent}{\theparagraph\autodot}}

% from the answer of @Steven:
\addtolength\hoffset{\secnumindent}
\addtolength\textwidth{-\secnumindent}
%
% make sure paragraphs reset counting also at sections    
%
\makeatletter
\@addtoreset{paragraph}{section}
\makeatother
% to reset headwidth and footwidth
\usepackage[
  headwidth=\the\textwidth+\secnumindent:-\secnumindent,
  footwidth=head:-\secnumindent,
  headsepline,% to show the headwidth
  footsepline% to show the footwidth
]{scrlayer-scrpage}
%
% AND NOW WE BEGIN
%
\begin{document}
\section{Section}
\subsection {Subsection}\label{sec:first}
\p \blindtext
% a reference
\p See \ref{sec:first}
% an example numbered paragraph with an embedded list
\p \blindtext
\begin{itemize}
\item Item 1
\item Item 2
\item Item 3
\end{itemize}
and some words at the end of this para

% an example numbered paragraph with a simple equation
\p The period is defined by a pair of days ($D_l$, $D_u$) where 
\begin{align*}
D_{l} & =  \text{the lower date}  \\
D_{u} & =  \text{the upper date}
\end{align*}
and things happen for all days $d$ where $D_l <= d< D_u$. 
\section{Next section}
\subsection{Next subsection}
\p \blindtext
\end{document}

결과는 아래 사진과 같습니다.

버전 3.15 및 3.16에서도 컴파일 가능해야 한다면 다음을 삽입하세요.

\renewcommand\othersectionlevelsformat[3]{\parbox{\secnumindent}{#3\autodot}}
\providecommand\sectionformat{}\providecommand\subsectionformat{}
\providecommand\subsubsectionformat{}\providecommand\paragraphformat{}

재정의 직전 \sectionformat


KOMA 스크립트버전 3.15 및 3.16

새로운 명령 \RedeclareSectionCommand또는 \RedeclareSectionCommands및 재정의를 사용할 수 있습니다 \othersectionlevelsformat. 따라서 다음과 같이 섹션 번호를 참조하는 것이 여전히 가능합니다 \ref.

\setcounter{secnumdepth}{4}
\newcommand\p{\paragraph{}}

\newcommand\secnumindent{1.5cm}
\RedeclareSectionCommands[indent=-\secnumindent]{section,subsection,paragraph}
\RedeclareSectionCommand[afterskip=0pt,counterwithin=subsection]{paragraph}
\renewcommand\othersectionlevelsformat[3]{\parbox{\secnumindent}{#3\autodot}}

% from the answer of @Steven:
\addtolength\hoffset{\secnumindent}
\addtolength\textwidth{-\secnumindent}
%
% make sure paragraphs reset counting also at sections    
%
\makeatletter
\@addtoreset{paragraph}{section}
\makeatother

원래 머리 너비와 발 너비를 재설정하려면 다음을 사용할 수 있습니다.

\usepackage[
  headwidth=\the\textwidth+\secnumindent:-\secnumindent,
  footwidth=head:-\secnumindent,
  headsepline,% to show the headwidth
  footsepline% to show the footwidth
]{scrlayer-scrpage}

여기에 이미지 설명을 입력하세요

암호:

% -*- program: xelatex -*-
\documentclass[english, parskip=full, fontsize=11, DIV12, toc=left, numbers=noenddot]{scrartcl}
\usepackage{babel}
\usepackage{amsmath}
% just so we can see what is going on for now
\usepackage{showframe}
\usepackage{blindtext}
% tighten up spacing of lists
\usepackage{enumitem}
\setlist{noitemsep}

\setcounter{secnumdepth}{4}
\newcommand\p{\paragraph{}}

\newcommand\secnumindent{1.5cm}
\RedeclareSectionCommands[indent=-\secnumindent]{section,subsection,paragraph}
\RedeclareSectionCommand[afterskip=0pt,counterwithin=subsection]{paragraph}
\renewcommand\othersectionlevelsformat[3]{\parbox{\secnumindent}{#3\autodot}}

% from the answer of @Steven:
\addtolength\hoffset{\secnumindent}
\addtolength\textwidth{-\secnumindent}
%
% make sure paragraphs reset counting also at sections    
%
\makeatletter
\@addtoreset{paragraph}{section}
\makeatother
% to reset headwidth and footwidth
\usepackage[
  headwidth=\the\textwidth+\secnumindent:-\secnumindent,
  footwidth=head:-\secnumindent,
  headsepline,% to show the headwidth
  footsepline% to show the footwidth
]{scrlayer-scrpage}
%
% AND NOW WE BEGIN
%
\begin{document}
\section{Section}
\subsection {Subsection}\label{sec:first}
\p \blindtext
% a reference
\p See \ref{sec:first}
% an example numbered paragraph with an embedded list
\p \blindtext
\begin{itemize}
\item Item 1
\item Item 2
\item Item 3
\end{itemize}
and some words at the end of this para

% an example numbered paragraph with a simple equation
\p The period is defined by a pair of days ($D_l$, $D_u$) where 
\begin{align*}
D_{l} & =  \text{the lower date}  \\
D_{u} & =  \text{the upper date}
\end{align*}
and things happen for all days $d$ where $D_l <= d< D_u$. 
\section{Next section}
\subsection{Next subsection}
\p \blindtext
\end{document}

KOMA-Script 버전 3.14(또는 이전)

\othersectionlevelsformat@Steven의 답변을 사용하지만 대신 재정의하는 또 다른 제안이 있습니다 \thesection. 따라서 다음과 같이 섹션 번호를 참조하는 것이 여전히 가능합니다 \ref.

\newcommand\p{\paragraph{}\hspace*{-1em}}

\newcommand\secnumindent{1.5cm}
\renewcommand\othersectionlevelsformat[3]{\makebox[0pt][r]{\parbox{\secnumindent}{#3\autodot}}}
% from the answer of @Steven:
\addtolength\hoffset{\secnumindent}
\addtolength\textwidth{-\secnumindent}

암호:

% -*- program: xelatex -*-
\documentclass[english, parskip=full, fontsize=11, DIV12, toc=left, numbers=noenddot]{scrartcl}
\usepackage{babel}
\usepackage{amsmath}
% just so we can see what is going on for now
\usepackage{showframe}
\usepackage{blindtext}
% tighten up spacing of lists
\usepackage{enumitem}
\setlist{noitemsep}

\setcounter{secnumdepth}{4}
\renewcommand\theparagraph{\thesubsection.\arabic{paragraph}}
\newcommand\p{\paragraph{}\hspace*{-1em}}

\newcommand\secnumindent{1.5cm}
\renewcommand\othersectionlevelsformat[3]{\makebox[0pt][r]{\parbox{\secnumindent}{#3\autodot}}}
% from the answer of @Steven:
\addtolength\hoffset{\secnumindent}
\addtolength\textwidth{-\secnumindent}
% to reset headwidth and footwidth
\usepackage[
  headwidth=\the\textwidth+\secnumindent:-\secnumindent,
  footwidth=head:-\secnumindent,
  headsepline,% to show the headwidth
  footsepline% to show the footwidth
]{scrlayer-scrpage}
%
% make sure paragraphs reset counting at section and subsections
%
\makeatletter
\@addtoreset{paragraph}{subsection}
\@addtoreset{paragraph}{section}
\makeatother
%
% AND NOW WE BEGIN
%
\begin{document}
\section{Section}
\subsection {Subsection}\label{sec:first}
\p \blindtext
% a reference
\p See \ref{sec:first}
% an example numbered paragraph with an embedded list
\p \blindtext
\begin{itemize}
\item Item 1
\item Item 2
\item Item 3
\end{itemize}
and some words at the end of this para

% an example numbered paragraph with a simple equation
\p The period is defined by a pair of days ($D_l$, $D_u$) where 
\begin{align*}
D_{l} & =  \text{the lower date}  \\
D_{u} & =  \text{the upper date}
\end{align*}
and things happen for all days $d$ where $D_l <= d< D_u$. 
\section{Next section}
\subsection{Next subsection}
\p \blindtext
\end{document}

답변2

제가 댓글에서 [대략] 제안한 대로 서문에 다음 줄을 추가하세요.

\let\svthesection\thesection
\def\thesection{\kern-1.5cm\svthesection}
\hoffset=\dimexpr\hoffset + 1.5cm\relax
\textwidth=\dimexpr\textwidth-1.5cm\relax
\paperwidth=\dimexpr\paperwidth -1.5cm\relax

그들이 성취하는 것은: 1) 사본을 저장하는 것입니다 \thesection; 2) \thesection섹션 헤더를 인쇄하기 전에 왼쪽으로 1.5cm 커닝을 재정의합니다. 3) \hoffset전체 문서를 오른쪽으로 1.5cm 이동하도록 수정합니다. 4) 을 \textwidth1.5cm 줄입니다( 와 결합하면 \hoffset오른쪽 여백은 변경되지 않습니다). 5) 수정 사항을 고려하여 용지 너비를 1.5cm 줄입니다 \hoffset.

나는 이 접근법에 관련된 단점이 있음을 지적했는데, 이는 MWE 아래의 그림에서 관찰할 수 있습니다. 머리글/바닥글이 이동되었습니다. 이는 이제 중앙에 있는 페이지 번호가 OP의 원래 코드와 비교하여 오른쪽으로 0.75cm 이동되었음을 의미합니다.

OP는 이 접근 방식이 해당 사용자의 필요에 적합하며 환경만 추가하면 된다고 명시했습니다 \begin{addmargin}. OP가 해당 추가 코드를 어디에 배치했는지 정확히 확신할 수 없기 때문에 해당 코드를 내 MWE에 삽입하려고 시도하지 않았습니다.

컴파일을 용이하게 하기 위해 환경 ^의 OP 코드에서 길 잃은 위 첨자 표시가 제거되었습니다(한 줄에 하나씩 제거됨). align*이 코드는 XeLaTeX로 컴파일되었지만 pdflatex로도 컴파일됩니다.

% -*- program: xelatex -*-
\documentclass[english, parskip=full, fontsize=11, DIV12, toc=left, numbers=noenddot]{scrartcl}
\usepackage{babel}
\usepackage{amsmath}
% just so we can see what is going on for now
\usepackage{showframe}
\usepackage{blindtext}
% tighten up spacing of lists
\usepackage{enumitem}
\setlist{noitemsep}


\setcounter{secnumdepth}{4}
\renewcommand\theparagraph{\thesubsection.\arabic{paragraph}}
\newcommand\p{\paragraph{}}
%
%
% make sure paragraphs reset counting at section and subsections
%
\makeatletter
\@addtoreset{paragraph}{subsection}
\@addtoreset{paragraph}{section}
\makeatother

\let\svthesection\thesection
\def\thesection{\kern-1.5cm\svthesection}
\hoffset=\dimexpr\hoffset + 1.5cm\relax
\textwidth=\dimexpr\textwidth-1.5cm\relax
\paperwidth=\dimexpr\paperwidth -1.5cm\relax
%
% AND NOW WE BEGIN
%
\begin{document}
\section{Section}
\subsection {Subsection}
\p \blindtext
% an example numbered paragraph with an embedded list
\p \blindtext
\begin{itemize}
\item Item 1
\item Item 2
\item Item 3
\end{itemize}
and some words at the end of this para

% an example numbered paragraph with a simple equation
\p The period is defined by a pair of days ($D_l$, $D_u$) where 
\begin{align*}
D_{l} & =  \text{the lower date}  \\
D_{u} & =  \text{the upper date}
\end{align*}
and things happen for all days $d$ where $D_l <= d< D_u$. 
\end{document}

OP의 원래 결과

여기에 이미지 설명을 입력하세요

내가 제안한 변경사항 적용

여기에 이미지 설명을 입력하세요

관련 정보