如何建立自訂段落?

如何建立自訂段落?

除了編號和未編號的段落(節、小節、小節)之外,我還想在論文中添加一些縮排和標題段落,但由於paragraph命令不能滿足我的需求,我正在尋找另一種解決方案。事實上,paragraph命令並沒有充分闡明我想強調的文本部分。段落將以以下標題開頭:“觀察 1”,如下圖所示:在此輸入影像描述其中標題後面的段落(“觀察 20”)以與文字主體不同的縮排開頭。

有人有建議嗎?在下面的內容中,我使用未編號的description清單來獲得縮排的段落。

\documentclass[12pt,a4paper,footinclude=true,twoside,headinclude=true]{scrbook}
\usepackage[parts,pdfspacing,dottedtoc]{classicthesis}
\usepackage{fontspec}
\usepackage[applemac]{inputenc}    
\usepackage[frenchb]{babel}
\setmainfont{Minion Pro}
    \usepackage[marginparsep=8pt,left=3.5cm,right=3.5cm,top=3cm,bottom=3cm]{geometry}


    \begin{document}

   \begin{description}
    This is my text
   \end{description}

    \end{document}

答案1

您也可以使用ntheorem套件來做到這一點:它有一個\theoremindent長度,您可以在樣式observ中定義一個定理結構break。這是一種可能性;我必須重新定義break樣式以確保第一段的縮排。如果您不想要這樣的縮進,則無需重新定義。

\documentclass[12pt,a4paper,footinclude=true,twoside,headinclude=true]{scrbook}
\usepackage[parts,pdfspacing,dottedtoc]{classicthesis}
\usepackage{fontspec}
\usepackage[frenchb]{babel}
\setmainfont{Minion Pro}
\usepackage[marginparsep=8pt,left=3.5cm,right=3.5cm,top=3cm,bottom=3cm]{geometry}


\usepackage{ntheorem}
\theoremindent = 3em
\theorempreskip\medskipamount
\theorempostskip\medskipamount
\theoremstyle{break}
\theoremheaderfont{\itshape}
\theorembodyfont{\normalfont}
\makeatletter
\renewtheoremstyle{break}%
 {\item[\rlap{\vbox{\hbox{\hskip\labelsep \theorem@headerfont
 ##1\ ##2\theorem@separator}\hbox{\strut}}}]\hskip\parindent}%
 {\item[\rlap{\vbox{\hbox{\hskip\labelsep \theorem@headerfont
 ##1\ ##2\ (##3)\theorem@separator}\hbox{\strut}}}]\hskip\parindent}
\makeatother
\newtheorem{observ}{Observation}

    \begin{document}

A repetitive text a repetitive text a repetitive text a repetitive text a repetitive text a repetitive text a repetitive text a repetitive text a repetitive text.
   \begin{observ}
    This is my text. This my text This is my text. This my text This is my text. This my text This is my text. This my text This is my text. This my text. This my text This is my text. This my text This is my text. This my text.

    This is my text. This my text This is my text. This my text This is my text. This my text This is my text. This my text This is my text. This my text. This my text This is my text. This my text This is my text. This my text.
   \end{observ}
 Another no less repetitive text. Another no less repetitive text. Another no less repetitive text. Another no less repetitive text. Another no less repetitive text.

    \end{document} 

在此輸入影像描述

答案2

創建您自己的環境以按照您想要的方式設定事情。

下面我用過adjustwidth(來自changepage) 設定一個類似引用的環境,稱為observation.標題observation後面有一個計數器,您可以使用\label-引用該計數器\ref

在此輸入影像描述

\documentclass{article}
\usepackage[margin=1in]{geometry}% Just for this example

\usepackage{changepage,lipsum}

\newcounter{observation}
\newenvironment{observation}
  {\par\medskip
   \begin{adjustwidth}{2em}{2em}
     \setlength{\parindent}{1.5em}% \parindent for Observations
     \small% Font changes (if any)
     \refstepcounter{observation}% Increment counter
     \hspace*{\parindent}% Indent Observation title
     Observation~\theobservation% Print Observation title
    \par\nobreak\smallskip}%
  {\end{adjustwidth}\medskip}
\begin{document}

\lipsum[1]

\begin{observation}
  \lipsum[2-3]
\end{observation}

\lipsum[4]

\begin{observation}
  \lipsum[5]
\end{observation}

\begin{observation}
  \lipsum[6]
\end{observation}

\lipsum[7]

\begin{observation}
  \lipsum[8-10]
\end{observation}

\lipsum[11]

\end{document}

您可以調整\parindent( 1.5em) 和adjustwidth縮排 ( 2em) 以滿足您的需求。這同樣適用於任何字體調整(\small在本例中)。

相關內容