我无法将格式(章节标题)选项应用于报告类文档

我无法将格式(章节标题)选项应用于报告类文档

由于我的研究课题,我想用 LaTeX 写我的博士论文。我的一个朋友去年通过了论文答辩,他把他的代码(.tex 文件)发给了我——他已经设置了我们博士学院要求的所有格式。去年(五月/六月)使用时,没有问题。但是,当我想现在使用它时,它列出了几个错误。我昨天已经问了一个关于这些问题的问题(没有删除它,而是问了一个新问题而不是编辑它),感谢收到的评论和进一步阅读,我能够修复错误。最新的问题是格式化章节标题。我不明白为什么我不能将我想要的更改应用于编号章节。让我通过屏幕截图向您展示我的问题。

如果我使用 scrrept 类,章节标题的格式将符合要求,但部分和小节的格式将不正确 - 将显示几个错误。根据我昨天收到的评论,应避免结合使用 scrrept 和 titlesec,因此我改用 report。

如果我使用 scrrept 类,章节标题的格式将符合要求,但部分和小节的格式将不正确 - 将显示几个错误。根据我昨天收到的评论,应避免结合使用 scrrept 和 titlesec,因此我改用 report。

就报告而言,章节和小节标题的格式非常完美,但章节标题却不符合预期。我尝试寻找解决方案,但还是没有成功,尽管我尝试了论坛/用户手册中提供的所有方法。

就报告而言,章节和小节标题的格式非常完美,但章节标题却不符合预期。我尝试寻找解决方案,但还是没有成功,尽管我尝试了论坛/用户手册中提供的所有方法。

然而,对于未编号的章节标题,格式化可以完美地运行。

然而,对于未编号的章节标题,格式化可以完美地运行。

我的朋友使用了 scrreprt,因为这个文档类默认省略了“章节”一词。一年前他可以使用这个方法,但现在对我来说已经不行了。我不是专家,所以如果这个错误很明显,我很抱歉,但我自己就是搞不清楚。

我现在使用的代码的简单版本:

\documentclass[12pt,a4paper,numbers=enddot,listof=totoc]{scrreprt}

\usepackage[magyar]{babel}
\usepackage{newtxmath,newtxtext}

\frenchspacing
\linespread{1.3}

\usepackage[top=2.5cm, bottom=2.5cm, outer=2.5 cm, inner=3.5cm]{geometry}
\usepackage[font=large]{caption}
\captionsetup{labelsep=colon}
\captionsetup{labelfont=bf}
\counterwithout{figure}{chapter}
\counterwithout{equation}{section}
\counterwithout{table}{chapter}

%\makeatletter
%\newcommand{\addcolonandeatperiod}{\@ifnextchar.{:\@gobble}\relax}
%\makeatother

% without titlesec and indentfirst
\renewcommand*{\chapterformat}{\thechapter\autodot\enskip\hspace{1em}}
\RedeclareSectionCommand[
  font=\normalfont\fontfamily{phv}\fontsize{16}{19}\bfseries,
  beforeskip=24pt plus 4pt minus 2pt,
  afterskip=24pt plus 4pt minus 2pt,
%  afterindent=true
  afterindent=true,
  tocentryformat=\bfseries,
  tocpagenumberformat=\bfseries% <- if the page number should be bold, too
]{chapter}
\RedeclareSectionCommand[
  font=\fontsize{14}{14}\itshape,
  indent=6pt,
  beforeskip=24pt plus 4pt minus 2pt,
  afterskip=24pt plus 4pt minus 2pt,
  afterindent=true
]{section}
\RedeclareSectionCommand[
  font=\normalsize\bfseries,
  indent=12pt,
  beforeskip=18pt plus 4pt minus 2pt,
  afterskip=18pt plus 4pt minus 2pt,
  afterindent=true
]{subsection}

%\usepackage[titles]{tocloft}
%\renewcommand{\contentsname}{Table of contents}
%\renewcommand{\cftchapfont}{\normalfont\bfseries}% titles in bold
%\renewcommand{\cftchappagefont}{\normalfont\bfseries}% page numbers in bold
%\renewcommand{\cftdotsep}{1}
%%\renewcommand{\cftchapleader}{\bfseries\cftdotfill{\cftsecdotsep}}% dot leaders in bold

\setkomafont{disposition}{\normalfont}

\begin{document}

\pagenumbering{Roman}
\tableofcontents
\newpage

\listoftables
\begingroup
\let\clearpage\relax
\listoffigures
\endgroup
\newpage

\addchap{Köszönetnyilvánítás}

Lorem ipsum dolor sit amet, consectetur adipiscing elit. Nullam a neque vel urna fermentum rutrum quis sed nulla. Vestibulum ante ipsum primis in faucibus orci luctus et ultrices posuere cubilia curae; Phasellus non facilisis arcu. Etiam imperdiet odio vitae sem vulputate viverra. Fusce auctor risus vitae ex malesuada, vel hendrerit turpis finibus. Suspendisse molestie ligula a fermentum eleifend. 

Suspendisse potenti. Etiam consectetur id enim vel commodo. Etiam lectus felis, consequat ut metus a, sagittis egestas libero. Quisque sed dignissim risus. Mauris non mi porttitor, rhoncus neque ac, gravida metus. Quisque tempus nisl sit amet mattis consectetur. Donec nec ornare enim, sit amet molestie nunc. 

\newpage

\pagenumbering{arabic}    

\chapter{Főszöveg}    

Lorem ipsum dolor sit amet, consectetur adipiscing elit. Nullam a neque vel urna fermentum rutrum quis sed nulla. Vestibulum ante ipsum primis in faucibus orci luctus et ultrices posuere cubilia curae; Phasellus non facilisis arcu. Etiam imperdiet odio vitae sem vulputate viverra. Fusce auctor risus vitae ex malesuada, vel hendrerit turpis finibus. Suspendisse molestie ligula a fermentum eleifend. 

\section{Fejezet}

Suspendisse potenti. Etiam consectetur id enim vel commodo. Etiam lectus felis, consequat ut metus a, sagittis egestas libero. Quisque sed dignissim risus. Mauris non mi porttitor, rhoncus neque ac, gravida metus. Quisque tempus nisl sit amet mattis consectetur. Donec nec ornare enim, sit amet molestie nunc. 

\subsection{Alfejezet}

Suspendisse potenti. Etiam consectetur id enim vel commodo. Etiam lectus felis, consequat ut metus a, sagittis egestas libero. Quisque sed dignissim risus. Mauris non mi porttitor, rhoncus neque ac, gravida metus. Quisque tempus nisl sit amet mattis consectetur. Donec nec ornare enim, sit amet molestie nunc.    

 \begin{table}[h]
    \centering
    \caption{\textbf{Mintatábla}}
    \label{mintatabla}
    \begin{tabular}{ll}
        11 & 12 \\
        21 & 22 
    \end{tabular}
\end{table}

\end{document}

我正在使用 TeXstudio 2.12.22(git 2.12.22)和 PDFLaTeX。

我将非常感激任何帮助、评论和想法!谢谢!

附带tocloft包装:

(Táblázatok jegyzéke - 表格清单;Ábrák jegyzéke - 图表清单)

托克洛夫特

没有tocloft

(Táblázatok jegyzéke - 表格清单;Ábrák jegyzéke - 图表清单)

您的更新

答案1

不要将该包titlesec与 KOMA-Script 类一起使用。它们不兼容。

titlesec不带和的建议indentfirst

\documentclass[12pt,a4paper,numbers=enddot]{scrreprt}
%\usepackage[utf8]{inputenc}% only needed with older TeX-distributions
\usepackage[T1]{fontenc}
\usepackage[magyar]{babel}
\usepackage{newtxmath,newtxtext}

\frenchspacing
\linespread{1.3}

\usepackage[top=2.5cm, bottom=2.5cm, outer=2.5 cm, inner=3.5cm]{geometry}
\usepackage[font=large]{caption}
\captionsetup{labelsep=colon}
\captionsetup{labelfont=bf}
\counterwithout{figure}{chapter}
\counterwithout{equation}{section}
\counterwithout{table}{chapter}

%\makeatletter
%\newcommand{\addcolonandeatperiod}{\@ifnextchar.{:\@gobble}\relax}
%\makeatother

\renewcommand*{\chapterformat}{\thechapter\autodot\enskip\hspace{1em}}
\RedeclareSectionCommand[
  font=\normalfont\fontfamily{phv}\fontsize{16}{19}\bfseries,
  beforeskip=24pt plus 4pt minus 2pt,
  afterskip=24pt plus 4pt minus 2pt,
  afterindent=true,
  tocentryformat=\bfseries,
  tocpagenumberformat=\bfseries% <- if the page number should be bold, too
]{chapter}
\RedeclareSectionCommand[
  font=\fontsize{14}{14}\itshape,
  indent=6pt,
  beforeskip=24pt plus 4pt minus 2pt,
  afterskip=24pt plus 4pt minus 2pt,
  afterindent=true
]{section}
\RedeclareSectionCommand[
  font=\normalsize\bfseries,
  indent=12pt,
  beforeskip=18pt plus 4pt minus 2pt,
  afterskip=18pt plus 4pt minus 2pt,
  afterindent=true
]{subsection}

\setkomafont{disposition}{\normalfont}

\begin{document}
\pagenumbering{Roman}
\tableofcontents

\addchap{Köszönet}
Lorem ipsum dolor sit amet, consectetur adipiscing elit. Nullam a neque vel urna fermentum rutrum quis sed nulla. Vestibulum ante ipsum primis in faucibus orci luctus et ultrices posuere cubilia curae; Phasellus non facilisis arcu. Etiam imperdiet odio vitae sem vulputate viverra. Fusce auctor risus vitae ex malesuada, vel hendrerit turpis finibus. Suspendisse molestie ligula a fermentum eleifend. 

Suspendisse potenti. Etiam consectetur id enim vel commodo. Etiam lectus felis, consequat ut metus a, sagittis egestas libero. Quisque sed dignissim risus. Mauris non mi porttitor, rhoncus neque ac, gravida metus. Quisque tempus nisl sit amet mattis consectetur. Donec nec ornare enim, sit amet molestie nunc. 

\cleardoubleoddpage% <- changed
\pagenumbering{arabic}
\chapter{Főszöveg}
Lorem ipsum dolor sit amet, consectetur adipiscing elit. Nullam a neque vel urna fermentum rutrum quis sed nulla. Vestibulum ante ipsum primis in faucibus orci luctus et ultrices posuere cubilia curae; Phasellus non facilisis arcu. Etiam imperdiet odio vitae sem vulputate viverra. Fusce auctor risus vitae ex malesuada, vel hendrerit turpis finibus. Suspendisse molestie ligula a fermentum eleifend.

\section{Fejezet}
Suspendisse potenti. Etiam consectetur id enim vel commodo. Etiam lectus felis, consequat ut metus a, sagittis egestas libero. Quisque sed dignissim risus. Mauris non mi porttitor, rhoncus neque ac, gravida metus. Quisque tempus nisl sit amet mattis consectetur. Donec nec ornare enim, sit amet molestie nunc.

\subsection{Alfejezet}
Suspendisse potenti. Etiam consectetur id enim vel commodo. Etiam lectus felis, consequat ut metus a, sagittis egestas libero. Quisque sed dignissim risus. Mauris non mi porttitor, rhoncus neque ac, gravida metus. Quisque tempus nisl sit amet mattis consectetur. Donec nec ornare enim, sit amet molestie nunc. 
\end{document}

在此处输入图片描述

目录:

在此处输入图片描述


更新

您可以使用

\AfterTOCHead[lof]{\def\autodot{}}
\AfterTOCHead[lot]{\def\autodot{}}

删除figuretable条目的第二个点。

\documentclass[12pt,a4paper,numbers=enddot,listof=totoc]{scrreprt}
\AfterTOCHead[lof]{\def\autodot{}}% <- added
\AfterTOCHead[lot]{\def\autodot{}}% <- added
\usepackage[magyar]{babel}
\usepackage{newtxmath,newtxtext}

\frenchspacing
\linespread{1.3}

\usepackage[top=2.5cm, bottom=2.5cm, outer=2.5 cm, inner=3.5cm]{geometry}
\usepackage[font=large]{caption}
\captionsetup{labelsep=colon}
\captionsetup{labelfont=bf}
\counterwithout{figure}{chapter}
\counterwithout{equation}{section}
\counterwithout{table}{chapter}

%\makeatletter
%\newcommand{\addcolonandeatperiod}{\@ifnextchar.{:\@gobble}\relax}
%\makeatother

% without titlesec and indentfirst
\renewcommand*{\chapterformat}{\thechapter\autodot\enskip\hspace{1em}}
\RedeclareSectionCommand[
  font=\normalfont\fontfamily{phv}\fontsize{16}{19}\bfseries,
  beforeskip=24pt plus 4pt minus 2pt,
  afterskip=24pt plus 4pt minus 2pt,
%  afterindent=true
  afterindent=true,
  tocentryformat=\bfseries,
  tocpagenumberformat=\bfseries% <- if the page number should be bold, too
]{chapter}
\RedeclareSectionCommand[
  font=\fontsize{14}{14}\itshape,
  indent=6pt,
  beforeskip=24pt plus 4pt minus 2pt,
  afterskip=24pt plus 4pt minus 2pt,
  afterindent=true
]{section}
\RedeclareSectionCommand[
  font=\normalsize\bfseries,
  indent=12pt,
  beforeskip=18pt plus 4pt minus 2pt,
  afterskip=18pt plus 4pt minus 2pt,
  afterindent=true
]{subsection}

%\usepackage[titles]{tocloft}
%\renewcommand{\contentsname}{Table of contents}
%\renewcommand{\cftchapfont}{\normalfont\bfseries}% titles in bold
%\renewcommand{\cftchappagefont}{\normalfont\bfseries}% page numbers in bold
%\renewcommand{\cftdotsep}{1}
%%\renewcommand{\cftchapleader}{\bfseries\cftdotfill{\cftsecdotsep}}% dot leaders in bold

\setkomafont{disposition}{\normalfont}

\begin{document}

\pagenumbering{Roman}
\tableofcontents
\newpage
\listoftables

\begingroup
\let\clearpage\relax
\listoffigures
\endgroup
\newpage

\addchap{Köszönetnyilvánítás}

Lorem ipsum dolor sit amet, consectetur adipiscing elit. Nullam a neque vel urna fermentum rutrum quis sed nulla. Vestibulum ante ipsum primis in faucibus orci luctus et ultrices posuere cubilia curae; Phasellus non facilisis arcu. Etiam imperdiet odio vitae sem vulputate viverra. Fusce auctor risus vitae ex malesuada, vel hendrerit turpis finibus. Suspendisse molestie ligula a fermentum eleifend. 

Suspendisse potenti. Etiam consectetur id enim vel commodo. Etiam lectus felis, consequat ut metus a, sagittis egestas libero. Quisque sed dignissim risus. Mauris non mi porttitor, rhoncus neque ac, gravida metus. Quisque tempus nisl sit amet mattis consectetur. Donec nec ornare enim, sit amet molestie nunc. 

\newpage

\pagenumbering{arabic}    

\chapter{Főszöveg}    

Lorem ipsum dolor sit amet, consectetur adipiscing elit. Nullam a neque vel urna fermentum rutrum quis sed nulla. Vestibulum ante ipsum primis in faucibus orci luctus et ultrices posuere cubilia curae; Phasellus non facilisis arcu. Etiam imperdiet odio vitae sem vulputate viverra. Fusce auctor risus vitae ex malesuada, vel hendrerit turpis finibus. Suspendisse molestie ligula a fermentum eleifend. 

\section{Fejezet}

Suspendisse potenti. Etiam consectetur id enim vel commodo. Etiam lectus felis, consequat ut metus a, sagittis egestas libero. Quisque sed dignissim risus. Mauris non mi porttitor, rhoncus neque ac, gravida metus. Quisque tempus nisl sit amet mattis consectetur. Donec nec ornare enim, sit amet molestie nunc. 

\subsection{Alfejezet}

Suspendisse potenti. Etiam consectetur id enim vel commodo. Etiam lectus felis, consequat ut metus a, sagittis egestas libero. Quisque sed dignissim risus. Mauris non mi porttitor, rhoncus neque ac, gravida metus. Quisque tempus nisl sit amet mattis consectetur. Donec nec ornare enim, sit amet molestie nunc.    

 \begin{table}[h]
    \centering
    \caption{\textbf{Mintatábla}}
    \label{mintatabla}
    \begin{tabular}{ll}
        11 & 12 \\
        21 & 22 
    \end{tabular}
\end{table}

\end{document}

在此处输入图片描述

相关内容