
我在自動命令標題方面遇到問題\bibliography{}
。
Latex 假定 title 為\section{*}\\ References
, 但是\section*{References}
必需的。
這是樣式文件
\ProvidesPackage{chsu}[2019/08/16 chsu Style Package]
\RequirePackage{amsmath,amssymb,amsfonts,amsthm} %различные математические пакеты
\RequirePackage[utf8]{inputenc} %кодировка символов
\RequirePackage[T1,T2A]{fontenc} %кодировка шрифтов (T1 - латин, T2A - кирил)
\RequirePackage[english,russian]{babel} %русский и английский языки в документе, переносы
\RequirePackage[
left=2.5cm,
right=1.5cm,
top=2cm,
bottom=2cm
]{geometry} %поля страницы
\RequirePackage{setspace} %для разных разметок
\onehalfspacing %полуторный интерлиньяж
\RequirePackage{indentfirst} %первая строка абзаца всегда красная
\parindent = 1.25cm %абзацный отступ
\RequirePackage{enumitem} %пакет для списков
\setlist[enumerate,itemize]{leftmargin=1.87cm,nosep,noitemsep} %списки выравниваются по абзацу
\renewcommand\labelitemi{---} %вместо точки у списков будет тире
\RequirePackage{color} %цвета в pdf (для ссылок)
\RequirePackage[pdfhighlight=/I,colorlinks=true]{hyperref} %ссылки в pdf
\RequirePackage[all]{hypcap} %по ссылке переносит на рисунок, а не название
\RequirePackage[nottoc]{tocbibind} %добавляет библиографию в содержание
\renewcommand{\section}{\@startsection{section}{1}{0pt}
{1.3pt}
{1.3pt}
{\centering\hyphenpenalty=10000\normalfont\bfseries}
} % заголовок по ГОСТ
\renewcommand{\subsection}{\@startsection{subsection}{2}{0pt}
{1.3pt}
{1.3pt}
{\centering\hyphenpenalty=10000\normalfont\bfseries}
} % подзаголовок по ГОСТ
\renewcommand{\subsubsection}{\@startsection{subsubsection}{3}{0pt}
{1.3pt}
{1.3pt}
{\centering\hyphenpenalty=10000\normalfont\bfseries}
} % подподзаголовок по ГОСТ
\def\capfigure{figure} %заменяет знак в названии рисунка точку на тире
\def\captable{table}
\long\def\@makecaption#1#2{%
\vskip\abovecaptionskip
\ifx\@captype\capfigure
\centering #1~---~#2 \par
\else
#1~---~#2 \par
\fi
\vskip\belowcaptionskip}
\addto\captionsrussian{\def\figurename{Рисунок}} %вместо рис. - рисунок (ГОСТ)
\renewcommand{\thefigure}{\thesection.\arabic{figure}} %сквозная нумерация рисунков
\newtheoremstyle{forthm} %стиль для теорем
{0em}
{0em}
{\itshape}
{1.25cm}
{\bfseries}
{ \normalfont{---} }
{0em}
{}
\theoremstyle{forthm} %обозначение, что теоремы будут с этим стилем
\newtheorem{theorem}{Теорема}[section] %команда для теоремы
\newtheorem{lemmma}{Лемма}[section] %команда для леммы
\newtheoremstyle{fordefn} %стиль для определений
{0em}
{0em}
{}
{1.25cm}
{\bfseries}
{ \normalfont{---} }
{0em}
{}
\theoremstyle{fordefn} %обозначение, что определения будут с этим стилем
\newtheorem{definition}{Определение}[section] %команда для определения
\newtheorem{prop}{Утверждение}[section] %команда для утверждения
\newcommand{\hm}[1]{#1\nobreak\discretionary{}{\hbox{\ensuremath{#1}}}{}} %команда делает повторение символа в строчной формуле
\endinput
答案1
減少的 MWE
\documentclass{article}
\usepackage{amsmath}
\makeatletter
\renewcommand{\section}{\@startsection{section}{1}{0pt}
{1.3pt}
{1.3pt}
{\centering\hyphenpenalty=10000\normalfont\bfseries}
}
\makeatother
\begin{document}
\section*{Foo}
\end{document}
重現您所描述的問題
這裡的問題是重新定義的末尾出現了一個假空格\section
。如果您使用加星號的形式,不受保護的行尾字元將產生一個不必要的空格,對您的標題造成嚴重破壞。正確的定義是
\renewcommand{\section}{\@startsection{section}{1}{0pt}
{1.3pt}
{1.3pt}
{\centering\hyphenpenalty=10000\normalfont\bfseries}}
或者
\renewcommand{\section}{\@startsection{section}{1}{0pt}
{1.3pt}
{1.3pt}
{\centering\hyphenpenalty=10000\normalfont\bfseries}%
}
中的所有\section
類似命令chsu
都會受到影響並需要修復。如果可能的話,請將此錯誤回報給類別/包的維護者。
使用固定版本的結果是
正如預期的那樣。