장을 참조한 후 간격을 줄입니다.

장을 참조한 후 간격을 줄입니다.

섹션을 참조하는 것은 문제가 되지 않지만 장을 참조하면 장 번호 뒤에 이상한 공백이 생깁니다. 첨부된 사진을 참조하세요:

여기에 이미지 설명을 입력하세요

이것은 내 코드입니다

\documentclass[12pt,a4paper,twoside,fleqn,openright]{book}

% use quite a lot of packages
\usepackage{amsfonts,amssymb,amsmath,bm}
\usepackage{enumerate}
\usepackage[section]{placeins}
\usepackage{float}
\usepackage[slovene]{babel}
\usepackage[utf8]{inputenc}
\usepackage{graphicx}
\usepackage{ifthen}
\usepackage[customcolors]{hf-tikz}
\usepackage{fancyhdr}
\usepackage{longtable}
\usepackage{hyperref}
\usepackage{ifoddpage}
\usepackage{tikz}
\usepackage{tocloft}
\usepackage{titlesec}
\usepackage{pdfpages}
\usepackage{nameref}
\usepackage{multirow}
\usepackage{caption}
\usepackage{subcaption}
\usepackage{enumitem}
\usepackage[numbib]{tocbibind}
\usepackage{url}
\usepackage{cite}
\usepackage{upgreek}
\usepackage[inner=30mm,
            outer=25mm,
            top=30mm,
            bottom=25mm]{geometry}

% paragraph settings
\setlength\parindent{0pt}
\setlength{\parskip}{1.5ex plus 0.5ex minus 0.5ex}

% set equation environment indentation
\setlength{\mathindent}{0.5cm}%

% set itemize environment whitespacing and left margin
\setlist[itemize]{noitemsep,nolistsep, leftmargin=*}

% set table and figure captions
\captionsetup[table]{skip=10pt,singlelinecheck=false}
\captionsetup[figure]{justification=centering}

% set tablename to Preglednica
\AtBeginDocument{%
  \renewcommand\tablename{Preglednica}
}

% command for multiline cell in table
\newcommand{\minitab}[2][l]{\begin{tabular}{#1}#2\end{tabular}}

\newcommand{\vect}[1]{\boldsymbol{\mathbf{#1}}}


% set section and tableofcontents depth
\setcounter{secnumdepth}{3}
\setcounter{tocdepth}{3}
\def\labelitemi{--}

%  accordingly format a chapter definition
\titleformat{\chapter}[display]
  {\bfseries}{}{0pt}{\Huge\thechapter}

% set fancy_nohead fancy header
\fancypagestyle{fancy_nohead}{
\fancyfoot[LE,RO]{\thepage}
\renewcommand{\headrulewidth}{0pt}
\chead{}
\cfoot{}
}

% assign no_header
\assignpagestyle{\chapter}{fancy_nohead}

% section and chapter formatting
\renewcommand{\thechapter}{\arabic{chapter}.\quad}
\renewcommand{\thesection}{\arabic{chapter}.\arabic{section}.}
\renewcommand{\thesubsection}{\thesection\arabic{subsection}.}
\renewcommand{\thesubsubsection}{\thesubsection\arabic{subsubsection}.}
\renewcommand{\thetable}{\arabic{chapter}.\arabic{table}}
\renewcommand{\thefigure}{\arabic{chapter}.\arabic{figure}}
\renewcommand{\theequation}{\arabic{chapter}.\arabic{equation}}
\renewcommand\labelenumi{(\theenumi)}
\DeclareMathOperator{\E}{\mathbb{E}}
\def\checkmark{\tikz\fill[scale=0.4](0,.35) -- (.25,0) -- (1,.7) -- (.25,.15) -- cycle;} 
\begin{document}
\chapter{Test}\label{cha:test}
Something written here.
\chapter{New test}\label{cha:new_test}
Reference to Chapter \ref{cha:test} \nameref{cha:test}.
\end{document}

그리고 한 줄만 쓰면 문제가 생길 수밖에 없습니다.

\documentclass[12pt,a4paper,twoside,fleqn,openright]{book}
\usepackage[slovene]{babel}
\usepackage[utf8]{inputenc}

\usepackage{hyperref}

\begin{document}
\chapter{Test}\label{cha:test}
Something written here.
\chapter{New test}\label{cha:new_test}
Reference to Chapter \ref{cha:test} \nameref{cha:test}.
\end{document}

더 이상 문제가 되지 않습니다.

어떤 패키지에 문제가 있는지 아는 사람이 있거나 해결 방법을 아는 사람이 있나요?

답변1

카운터가 표시되는 방식을 변경하는 것이 chapter여기서 문제입니다. 즉, 라인

\renewcommand{\thechapter}{\arabic{chapter}.\quad}

\quad참조에 추가 공간(a)이 추가됩니다 . \thechapter실제 장 제목에서 장 번호와 제목 사이에 추가 공간을 원하기 때문에 재정의했을 가능성이 높습니다 . 이는 다음을 사용하여 달성할 수 있습니다.titlesec님의 \titleformat:

\titleformat{\chapter}[display]
  {\bfseries}{}{0pt}{\Huge\thechapter.\quad}

또한 다른 섹션 번호 재정의가 로 끝나므로 .이에 대한 참조에도 마침표가 포함됩니다.. 이는 이상적이지 않습니다. 대신에계층적으로그리고없이후행 기간. 대신 섹션 표시의 일부로 후행 마침표를 추가하세요. 한 가지 방법은 재정의하는 것입니다.\@seccntformat (참조섹션 번호 뒤에 점을 추가하는 방법은 무엇입니까?):

\makeatletter
\renewcommand{\@seccntformat}[1]{#1.}
\makeatother

\the...계층적으로는 하위 카운터 표현에서 상위 카운터를 사용하는 것을 의미합니다 .

\renewcommand{\thechapter}{\arabic{chapter}}
\renewcommand{\thesection}{\thechapter.\arabic{section}}
\renewcommand{\thesubsection}{\thesection.\arabic{subsection}}
\renewcommand{\thesubsubsection}{\thesubsection.\arabic{subsubsection}}

위의 명령 세트는 어쨌든 클래스의 기본값이므로 다소 불필요합니다 book.

답변2

문제는 \quad의 정의에 (수평 공간을 생성하는) 이 있다는 것입니다 \thechapter. 제거하면 완료됩니다. 해당 장의 줄 안에 공간을 추가하고 싶다면 titlesec비슷한 패키지를 사용하세요(또는 다음을 참조하세요).여기).

그리고 명령을 갱신하는 다른 줄은 아마도 a 와 Many \theX로 대체되어야 할 것입니다 .\usepackage{chngcntr}\counterwithin{X}{chapter}

어쩌면 너무 많은 패키지의 사용법을 재고할 수도 있습니다. 아마도 당신은 그것들을 모두 활용하지 못할 것입니다. 불필요한 것을 제거해보십시오. 한 가지 예는 실제로 사용해서는 안 되는 float 옵션을 float제공하는 역할만 하는 것 입니다(참조:H여기).

관련 정보