部分文本对齐

部分文本对齐

我需要定义自定义标题级别。编号部分的换行文本缩进应该被删除。

下面提到的图片是我需要的输出:

在此处输入图片描述

梅威瑟:

\documentclass[twocolumn]{article}

\usepackage{lipsum}

\setcounter{secnumdepth}{0}

\def\numbered{\setcounter{secnumdepth}{5}}

\numbered


\makeatletter

\renewcommand\section{\@startsection {section}{1}{\z@}%
                                   {-3.5ex \@plus -1ex \@minus -.2ex}%
                                   {8.25pt}%
                                   {\normalfont\Large\bfseries}}
\renewcommand\subsection{\@startsection{subsection}{2}{\z@}%
                                     {-3.25ex\@plus -1ex \@minus -.2ex}%
                                     {.1ex}%.0001ex
                                     {\normalfont\large\bfseries}}
\renewcommand\subsubsection{\@startsection{subsubsection}{3}{\z@}%
                                     {-3.25ex\@plus -1ex \@minus -.2ex}%
                                     {.1ex}%11.5pt
                                     {\normalfont\normalsize\bfseries}}
\renewcommand\paragraph{\@startsection{paragraph}{4}{\z@}%
                                {-3.5ex \@plus -1ex \@minus -.2ex}%3.25ex \@plus1ex \@minus.2ex
                                    {.1ex}%
                                    {\normalfont\normalsize\bfseries}}
\renewcommand\subparagraph{\@startsection{subparagraph}{5}{\z@}%
                              {-3.5ex \@plus -1ex \@minus -.2ex}%3.25ex \@plus1ex \@minus .2ex
                                       {.1ex}%
                                      {\normalfont\normalsize\bfseries}}
\makeatother



\begin{document}

\section{Anatomically and geometrically accurate representations of the
cortex are needed for realistic modeling of SD}

\lipsum[1-5]

\subsection{Anatomically and geometrically accurate representations of the
cortex are needed for realistic modeling of SD}

\lipsum[6]

\subsubsection{Anatomically and geometrically accurate representations of the
cortex are needed for realistic modeling of SD}

\lipsum[7]

\paragraph{Anatomically and geometrically accurate representations of the
cortex are needed for realistic modeling of SD}

\lipsum[8]

\subparagraph{Anatomically and geometrically accurate representations of the
cortex are needed for realistic modeling of SD}

\lipsum[9]

\end{document}

请指教如何获得上述图片“正确的”输出。

请提供解决方案,如何调整空间之间的章节编号和章节文本?

答案1

你可以局部禁用悬挂缩进

在此处输入图片描述

\makeatletter
\renewcommand\section{\@startsection {section}{1}{\z@}%
                                   {-3.5ex \@plus -1ex \@minus -.2ex}%
                                   {8.25pt}%
                                   {\let\hangindent\dimen@\normalfont\Large\bfseries}}
\renewcommand\subsection{\@startsection{subsection}{2}{\z@}%
                                     {-3.25ex\@plus -1ex \@minus -.2ex}%
                                     {.1ex}%.0001ex
                                     {\let\hangindent\dimen@\normalfont\large\bfseries}}
\renewcommand\subsubsection{\@startsection{subsubsection}{3}{\z@}%
                                     {-3.25ex\@plus -1ex \@minus -.2ex}%
                                     {.1ex}%11.5pt
                                     {\let\hangindent\dimen@\normalfont\normalsize\bfseries}}
\renewcommand\paragraph{\@startsection{paragraph}{4}{\z@}%
                                {-3.5ex \@plus -1ex \@minus -.2ex}%3.25ex \@plus1ex \@minus.2ex
                                    {.1ex}%
                                    {\normalfont\normalsize\bfseries}}
\renewcommand\subparagraph{\@startsection{subparagraph}{5}{\z@}%
                              {-3.5ex \@plus -1ex \@minus -.2ex}%3.25ex \@plus1ex \@minus .2ex
                                       {.1ex}%
                                      {\normalfont\normalsize\bfseries}}
\makeatother

答案2

样式block就是titlesec这样做的。要消除章节标题后第一段的缩进,请使用以下命令\titlespacing*(注意星号):

\documentclass[twocolumn]{article}

\usepackage{lipsum}

\setcounter{secnumdepth}{0}

\def\numbered{\setcounter{secnumdepth}{5}}

\numbered

\usepackage{titlesec}

\titleformat{\section}[block]{\normalfont\large\bfseries}{\thesection}{0.333em}{}
\titlespacing*{\section}{0pt}{3.5ex}{8.25pt}%
%
\titleformat{\subsection}[block]{\normalfont\large\bfseries}{\thesubsection}{0.333em}{}
\titlespacing*{\subsection}{0pt}{3.25ex}{.1ex}%
%
\titleformat{\subsubsection}[block]{\normalfont\normalsize\bfseries}{\thesubsubsection}{0.333em}{}
\titlespacing*{\subsubsection}{0pt}{3.25ex}{1ex}%
%
\titleformat{\paragraph}[block]{\normalfont\normalsize\bfseries}{\theparagraph}{0.333em}{}
\titlespacing*{\paragraph}{0pt}{3.5ex}{1ex}%

\titleformat{\subparagraph}[block]{\normalfont\normalsize\bfseries}{\theparagraph}{0.333em}{}
\titlespacing*{\subparagraph}{0pt}{3.5ex}{1ex}%
%
\begin{document}

\section{Anatomically and geometrically accurate representations of the
cortex are needed for realistic modeling of SD}

\lipsum[1-5]

\subsection{Anatomically and geometrically accurate representations of the
cortex are needed for realistic modeling of SD}

\lipsum[6]

\subsubsection{Anatomically and geometrically accurate representations of the
cortex are needed for realistic modeling of SD}

\lipsum[7]

\paragraph{Anatomically and geometrically accurate representations of the
cortex are needed for realistic modeling of SD}

\lipsum[8]

\subparagraph{Anatomically and geometrically accurate representations of the
cortex are needed for realistic modeling of SD}

\lipsum[9]

\end{document} 

在此处输入图片描述

在此处输入图片描述

相关内容