如何创建自定义段落?

如何创建自定义段落?

除了编号和未编号的段落(节、小节、小小节)之外,我还想在论文中添加一些缩进和标题段落,但由于paragraph命令不能满足我的需求,我正在寻找另一种解决方案。事实上,paragraph命令不能充分突出我想要强调的文本部分。该段落将以标题开头,例如:“观察 1”,如下图所示:在此处输入图片描述其中,标题后面的段落(“观察 20”)的缩进与文本主体的缩进不同。

有人有什么建议吗?在下面的 mwe 中,我使用未编号的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) 设置一个类似于引号的环境,名为observationobservation标题位于计数器之后,您可以使用\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在本例中)。

相关内容