大家下午好,有人能帮忙解决以下问题吗?
我有一个任务,在目录中列出一个列表,列表和标题中有数字,文本中只有数字。因此,该部分的文本应该放在数字后面,而不是下一行。
为了解决这个问题,我使用新命令的定义
\makeatletter
\renewcommand\subsection{%
\@startsection{subsection}{1}{\z@}%
{3.5ex \@plus -1ex \@minus -.2ex}%
{2.3ex \@plus.2ex}%
{\centering\normalfont\large\bfseries}
{\makeatother}
在这种情况下,目录本身中章节名称前数字末尾的点缺失。
完整的代码清单如下所示。
\documentclass[12pt]{article}
\usepackage{cmap}
\usepackage[T1]{fontenc}
\usepackage[utf8]{inputenc}
\usepackage[english]{babel}
\usepackage{concrete, eulervm}
\usepackage[a4paper, total={170mm, 257mm},
left=2cm, right=1cm,
top=1cm, bottom=1.5cm, bindingoffset=0cm]{geometry}
\usepackage{xpatch}
\usepackage[titletoc]{appendix}
\patchcmd{\appendices}{\quad}{. }{}{}
\usepackage{titletoc}
\usepackage{misccorr}
\usepackage{indentfirst}
\makeatletter
\renewcommand{\l@section}{\@dottedtocline{1}{0em}{2.0em}}
\renewcommand{\l@subsection}{\@dottedtocline{1}{0.5em}{2.5em}}
\renewcommand{\l@subsubsection}{\@dottedtocline{1}{1em}{3.0em}}
\def\@sect#1#2#3#4#5#6[#7]#8{%
\ifnum #2>\c@secnumdepth
\let\@svsec\@empty
\else
\refstepcounter{#1}%
\protected@edef\@svsec{\@seccntformat{#1}\relax}%
\fi
\@tempskipa #5\relax
\ifdim \@tempskipa>\z@
\begingroup
#6{%
\@hangfrom{\hskip #3\relax\@svsec}%
\interlinepenalty \@M #8\@@par}%
\endgroup
\csname #1mark\endcsname{#7}%
\addcontentsline{toc}{#1}{%
\ifnum #2>\c@secnumdepth \else
\protect\numberline{\csname the#1\endcsname.}%
\fi
#7}%
\else
\def\@svsechd{%
#6{\hskip #3\relax
\@svsec #8}%
\csname #1mark\endcsname{#7}%
\addcontentsline{toc}{#1}{%
\ifnum #2>\c@secnumdepth \else
\protect\numberline{\csname the#1\endcsname}%
\fi
#7}}%
\fi
\@xsect{#5}}
\makeatother
\makeatletter
\newcommand\runinsubsection{%
\@startsection{subsection}%
{2}% level
{\z@}% indentation of heading from the left margin
{-3.25ex\@plus -1ex \@minus -.2ex}% absolute value = beforeskip
{-0.5em \@plus -.1em}% when negative, opposite = skip to leave right of a
% run-in heading.
{\normalfont\bfseries}% style
}
\makeatother
\begin{document}
\tableofcontents
\section[Section 1]{Text Section 1}
\runinsubsection[Subsection 1]{}
Text in Subsection 1.
\subsection[Subsection 2]{}
Text in Subsection 2.
\end{document}