![彩色包装干扰部分](https://linux22.com/image/275332/%E5%BD%A9%E8%89%B2%E5%8C%85%E8%A3%85%E5%B9%B2%E6%89%B0%E9%83%A8%E5%88%86.png)
我想使用该color
包来定义列表背景的自定义颜色,但当我包含它时,它会对我的编号部分标题(仅限部分,而不是较低级别)产生令人讨厌的副作用。这是部分标题的样子:
- 包含彩色包装
- 颜色包已被注释 [颜色包已被注释]
我认为问题出在这个包上,因为只有当我包含它时才会发生这种情况。
这是我的序言文件:
\usepackage[margin=2.5cm]{geometry} %postavljanje margine
\usepackage[utf8]{inputenc}
\usepackage[croatian]{babel}
\usepackage[fixlanguage]{babelbib}
\selectbiblanguage{croatian}
\usepackage{graphicx}
\usepackage[hang,small,bf,justification=centering]{caption}
\usepackage{subcaption}
\usepackage{chngcntr}
\usepackage{tocloft} %tablica sadržaja
\renewcommand{\cftsecleader}{\cftdotfill{\cftdotsep}} %točkice na sadržaju
\usepackage{lmodern}
\usepackage{hyperref}
\usepackage{cite}
\usepackage{setspace} %postavi prored
\onehalfspacing %prored 1.5
\usepackage[acronym]{glossaries}
\input{glossary}
\renewcommand{\acronymname}{Oznake i kratice}
\makeglossaries
\usepackage{parskip} %preskakanje paragrafa
%\usepackage{color}
\usepackage{listings} %postavke za pseudokodiranje i umetanje koda
\lstset{
language=C, % choose the language of the code
numbers=left, % where to put the line-numbers
stepnumber=1, % the step between two line-numbers.
numbersep=5pt, % how far the line-numbers are from the code
%backgroundcolor=\color{gray}, % choose the background color. You must add \usepackage{color}
showspaces=false, % show spaces adding particular underscores
showstringspaces=false, % underline spaces within strings
showtabs=false, % show tabs within strings adding particular underscores
tabsize=2, % sets default tabsize to 2 spaces
captionpos=b, % sets the caption-position to bottom
breaklines=true, % sets automatic line breaking
breakatwhitespace=true, % sets if automatic breaks should only happen at whitespace
title=\lstname, % show the filename of files included with \lstinputlisting;
}
%naslovi
\usepackage{titlesec}
\titleformat*{\section}{\scshape\large\bfseries\MakeUppercase}
\titleformat*{\subsection}{\normalsize\bfseries}
\titleformat*{\subsubsection}{\normalsize}
\usepackage{secdot}
\sectiondot{subsection}
\sectiondot{subsubsection}
%brojevi uz podnaslove
\usepackage{chngcntr,tocloft}
\counterwithin*{figure}{section}
\counterwithin*{figure}{subsection}
\counterwithin*{figure}{subsubsection}
\addtolength{\cftfignumwidth}{2em}
\renewcommand{\thefigure}{%
\ifnum\value{subsection}=0
\thesection.\arabic{figure}%
\else
\ifnum\value{subsubsection}=0
\thesubsection.\arabic{figure}%
\else
\thesubsubsection.\arabic{figure}%
\fi
\fi
}
答案1
看起来color
与的“简易界面”不兼容titlesec
;您可以采取以下方法。
\usepackage{titlesec}
\titleformat{\section}
{\large\bfseries}
{\thesection}
{1em}
{\MakeUppercase}
\titleformat{\subsection}
{\normalsize\bfseries}
{\thesubsection. }
{0pt}
{}
\titleformat{\subsubsection}
{\normalsize}
{\thesubsubsection. }
{0pt}
{}
不要加载secdot
包并删除相关调用,因为点可以轻松地与其titlesec
自身相加。
其他几点。添加\usepackage[T1]{fontenc}
对带有变音符号的语言进行排版所必需的内容。将调用移至hyperref
最后加载的包。
\scshape\bfseries
的声明是\section
无用的,因为你的\MakeUppercase
,所以\bfseries
就足够了。