我尝试减少图表列表标题名称(下图中的“Liste des Figures”)与图表列表之间的间距。
我想对表格列表的标题名称(“Liste des Tables”)执行相同的操作。
我的情况的特殊性是我想在同一页上有图表列表和表格列表。
正如您所看到的,减少标题和列表之间的空间可以让我将所有内容放在一页上。
问题还在于我对章节、目录、图表列表等使用了一种特殊样式(标题上方带有水平线的黑色矩形)。
下面我向你展示我使用的来源:
\documentclass[11pt,french,oneside]{report}
\usepackage[latin1]{inputenc}
\usepackage[T1]{fontenc}
\usepackage[francais]{babel}
\usepackage{indentfirst}
\usepackage{lastpage}
\usepackage{amsmath,amssymb}
\usepackage{fancyhdr}
\usepackage{url}
\usepackage{epsfig}
\usepackage{graphics}
\usepackage{multirow}
\usepackage{vmargin}
\usepackage{float}
\usepackage{psboxit,pstcol}
\usepackage{tabularx}
\usepackage[style=ext-authoryear, backend=biber]{biblatex}
\usepackage[hyperfootnotes=false,colorlinks,allcolors=blue]{hyperref}
\usepackage[nameinlink,noabbrev]{cleveref}
\Crefname{appendix}{l'Appendice}{les Appendices}
\usepackage{setspace}
\usepackage{needspace}
\usepackage{caption}
\usepackage[table,svgnames,dvipsnames]{xcolor}
\usepackage{calc}
\usepackage{geometry}
\setcounter{tocdepth}{3}
\setcounter{secnumdepth}{3}
\DeclareCaptionFont{xbf}{\bfseries\boldmath}
\captionsetup{font=xbf}
\definecolor{jonquil}{rgb}{0.98, 0.85, 0.37}
\definecolor{lavender(web)}{rgb}{0.9, 0.9, 0.98}
\DeclareFixedFont{\ttb}{T1}{txtt}{bx}{n}{9} % for bold
\DeclareFixedFont{\ttm}{T1}{txtt}{m}{n}{9} % for normal
\usepackage{color}
\definecolor{deepblue}{rgb}{0,0,0.5}
\definecolor{deepred}{rgb}{0.6,0,0}
\definecolor{deepgreen}{rgb}{0,0.5,0}
\usepackage{listings}
\newcommand\pythonstyle{\lstset{
language=Python,
basicstyle=\ttm,
otherkeywords={self}, % Add keywords here
keywordstyle=\ttb\color{deepblue},
emph={MyClass,__init__}, % Custom highlighting
emphstyle=\ttb\color{deepred}, % Custom highlighting style
stringstyle=\color{deepgreen},
frame=tb, % Any extra options here
showstringspaces=false,
commentstyle=\ttb\selectfont\itshape,columns=fullflexible],
numbers=left,
stepnumber=1,
}}
\newcolumntype{C}{>{\centering\arraybackslash}X}
\usepackage{colortbl} % for \rowcolor macro
\usepackage{array}
\setlength\extrarowheight{1.5pt} % for a more open "look"
\usepackage[skip=0.5\baselineskip]{caption}
\renewcommand*{\nameyeardelim}{\addcomma\space}
\newcommand*{\x}{\mathsf{x}\mskip1mu}
\DeclareCiteCommand{\cite}[\mkbibparens]
{\usebibmacro{prenote}}
{\usebibmacro{citeindex}%
\printtext[bibhyperref]{\usebibmacro{cite}}}
{\multicitedelim}
{\usebibmacro{postnote}}
\DeclareCiteCommand*{\cite}[\mkbibparens]
{\usebibmacro{prenote}}
{\usebibmacro{citeindex}%
\printtext[bibhyperref]{\usebibmacro{citeyear}}}
{\multicitedelim}
{\usebibmacro{postnote}}
\newcommand{\emptysection}[1]{%
\begingroup\renewcommand\addcontentsline[3]{}%
\section{#1}\endgroup%
}
\makeatletter
\newlength{\chapter@number@width}
\def\@makechapterhead#1{%
{\normalfont
\setlength{\parindent}{0pt}%
\vspace*{10pt}%
\settowidth{\chapter@number@width}{%
\hbox{\color{white}\LARGE\bfseries
\hspace{\dimexpr 1mm+3pt}%
\thechapter
\hspace{\dimexpr 1mm+3pt}%
}}
\hbox{%
\vtop{%
\hsize=\dimexpr\chapter@number@width+\tabcolsep+2\fboxrule+\tabcolsep
\begin{tabular}[t]{@{}c}
\scshape\strut\makebox[0pt]{\hspace{0pt plus 1 fill minus 1 fill}\@chapapp\hspace{0pt plus 1 fill minus 1 fill}} \\
\fboxsep=0pt
\colorbox{black}{\vbox{%
\hbox{\vbox to \dimexpr 1mm+3pt{}}
\hbox{\color{white}\LARGE\bfseries
\hspace{\dimexpr 1mm+3pt}%
\thechapter
\hspace{\dimexpr 1mm+3pt}%
}
\hrule height 0.4pt depth 0pt width 0pt
\hbox{\vbox to 6pt{}}
\hbox{\parbox{0pt}{\Huge\bfseries\vphantom{E}}}
}}%
\end{tabular}%
}%
\vtop{%
\advance\hsize by -\dimexpr\chapter@number@width+2\fboxrule+\tabcolsep
\hspace*{-0.5cm}\begin{tabular}[t]{c}
\scshape\strut\vphantom{\@chapapp} \\
\fboxsep=0pt
\colorbox{white}{\vbox{%
\hbox{\vbox to \dimexpr 1mm+3pt{}}
\hbox{\LARGE\bfseries
\hspace{\dimexpr 1mm+3pt}%
\phantom{\thechapter}
\hspace{\dimexpr 1mm+3pt}%
}
\hrule height 0.4pt depth 0pt width \hsize
\hbox{\vbox to 6pt{}}
\hbox{\hspace*{20pt}\parbox{\dimexpr\textwidth-2mm-6pt-\chapter@number@width-\tabcolsep-2\fboxrule-20pt}{\Huge\bfseries #1}}
}}%
\end{tabular}%
}%
}%
\vspace{50pt}%
}
}
\def\@makeschapterhead#1{%
{\normalfont
\setlength{\parindent}{0pt}%
\vspace*{10pt}%
\settowidth{\chapter@number@width}{%
\hbox{\color{white}\LARGE\bfseries
\hspace{\dimexpr 1mm+3pt}%
\thechapter
\hspace{\dimexpr 1mm+3pt}%
}}
\hbox{%
\vtop{%
\hsize=\dimexpr\chapter@number@width+\tabcolsep+2\fboxrule+\tabcolsep
\begin{tabular}[t]{@{}c}
\scshape\strut\makebox[0pt]{\hspace{0pt plus 1 fill minus 1 fill}\phantom{\@chapapp}\hspace{0pt plus 1 fill minus 1 fill}} \\
\fboxsep=0pt
\colorbox{black}{\vbox{%
\hbox{\vbox to \dimexpr 1mm+3pt{}}
\hbox{\color{white}\LARGE\bfseries
\hspace{\dimexpr 1mm+3pt}%
\phantom{\thechapter}%
\hspace{\dimexpr 1mm+3pt}%
}
\hrule height 0.4pt depth 0pt width 0pt
\hbox{\vbox to 6pt{}}
\hbox{\parbox{0pt}{\Huge\bfseries\vphantom{E}}}
}}%
\end{tabular}%
}%
\vtop{%
\advance\hsize by -\dimexpr\chapter@number@width+2\fboxrule+\tabcolsep
\hspace*{-0.5cm}\begin{tabular}[t]{c}
\scshape\strut\vphantom{\@chapapp} \\
\fboxsep=0pt
\colorbox{white}{\vbox{%
\hbox{\vbox to \dimexpr 1mm+3pt{}}
\hbox{\LARGE\bfseries
\hspace{\dimexpr 1mm+3pt}%
\phantom{\thechapter}
\hspace{\dimexpr 1mm+3pt}%
}
\hrule height 0.4pt depth 0pt width \hsize
\hbox{\vbox to 6pt{}}
\hbox{\hspace*{20pt}\parbox{\dimexpr\textwidth-2mm-6pt-\chapter@number@width-\tabcolsep-2\fboxrule-20pt}{\Huge\bfseries #1}}
}}%
\end{tabular}%
}%
}%
\vspace{50pt}%
}
}
\setlength\parindent{0pt}
\newenvironment{changemargin}[2]{\begin{list}{}{%
\setlength{\topsep}{0pt}%
\setlength{\leftmargin}{0pt}%
\setlength{\rightmargin}{0pt}%
\setlength{\listparindent}{\parindent}%
\setlength{\itemindent}{\parindent}%
\setlength{\parsep}{0pt plus 1pt}%
\addtolength{\leftmargin}{#1}%
\addtolength{\rightmargin}{#2}%
}\item }{\end{list}}
\setmarginsrb{2.3cm}{0.0cm}{2.1cm}{1cm}{1.3cm}{0.5cm}{0.4cm}{1cm}
\pagestyle{fancy}
\renewcommand{\footrulewidth}{0.4pt}
\renewcommand{\headrulewidth}{0.4pt}
\chead{\hspace{-0.3cm}\textit{Rapport de stage M2 Astrophysique, Sciences de l\rq Espace, Plan\'etologie \hspace{-0.3cm}}}
\lhead{\epsfig{file=logo_small.jpg,height=0.8cm,width=2cm}}
\rhead{\epsfig{file=logo_ut3_small.png,height=0.8cm,width=2cm}}
\lfoot{\textit{lisssold riufi}}
\cfoot{\hspace{1.6cm} \textit{ - Performances}}
\rfoot{\thepage/\pageref{LastPage}}
\makeatletter
\g@addto@macro\appendix{%
\cleardoublepage
\hypertarget{appendixstart}{}%
\addtocontents{toc}{
\protect\contentsline{chapter}{\protect\hyperlink{appendixstart}{Appendice}}{}{}%
}%
}
\makeatother
\usepackage[nameinlink,noabbrev]{cleveref}
\renewcommand{\arraystretch}{1.25}
\begin{document}
\renewcommand*\listfigurename{Liste des Figures}
\renewcommand*\listtablename{Liste des Tables}
\tableofcontents
%%%%%% CRITICAL PART TO GET list of figures and list of tables %%%%
%%%%%% ON THE SAME PAGE %%%%%
%%%%%% This is HERE where I would like to reduce space between title
%%%%%% list while keeping the special style of titles (like chapters)
\thispagestyle{plain}
\listoffigures
\begingroup
\let\clearpage\relax
\listoftables
\endgroup
\thispagestyle{plain}
\chapter*{Introduction}
\addcontentsline{toc}{chapter}{Introduction}
如果我只使用:
\setlength{\cftbeforeloftitleskip}{5pt} % LOF: Listing of Figures
\setlength{\cftbeforelottitleskip}{5pt} % LOT: Listing of Tables
这会导致章节和图表目录的特殊格式被删除,而且这也会导致所有内容被推到目录中,即混乱...
如果有人可以帮助我制作一个页面,同时保留两个标题的特殊风格,那就太好了,告诉我怎么做。
问候
答案1
这是一个简单的修复。基本思路是改变在图表和表格列表末尾\@makechapterhead
和本地添加的垂直空间。因此,我做了以下更改:\@makeschapterhead
在定义之前
\@makechapterhead
我为这个底部空间添加了一个新的长度,并将默认值设置为50pt
(示例中的值):\newlength{\chapter@bottom@space} \setlength{\chapter@bottom@space}{50pt}
在
\@make(s)chapterhead
宏的最后两行\vspace{50pt}%
被取代
\vspace{\chapter@bottom@space}%
在“关键部分”,新长度在本地被重新定义为较小的值。如有必要,可将此值调整为更小的值:
\thispagestyle{plain} \begingroup \makeatletter \setlength{\chapter@bottom@space}{15pt} \makeatother \listoffigures \let\clearpage\relax \listoftables \endgroup \thispagestyle{plain}
另一个小修复是在使用参数的地方在宏
\strut
内部添加一个。这是为了让章节标题拥有相等的底部空间,无论文本是否使用带降部的字符(否则“图”中的“g”会产生比表格列表中略大的垂直空间)。\@make(s)chapterhead
#1
\hbox{\hspace*{20pt}\parbox{...}{\Huge\bfseries\strut #1}}
编辑:我还对宏进行了一些代码重构
\@make(s)chapterhead
。由于两个宏使用的代码几乎相同,因此我将两者合并为一个。宏只有两个地方不同:% \scshape\strut\makebox[0pt]{\hspace{0pt plus 1 fill minus 1 fill} \@chapapp \phantom{\@chapapp} % \hspace{0pt plus 1 fill minus 1 fill}} \\
和
% \hbox{\color{white}\LARGE\bfseries % \hspace{\dimexpr 1mm+3pt}% \thechapter \phantom{\thechapter}% % \hspace{\dimexpr 1mm+3pt}% % }
如您所见,唯一的区别是添加了
\phantom
。\@makeschapterhead
新宏现在\@makechapterhead@base
使用#1
来代替\phantom
,而 则#2
成为新的章节标题文本。然后可以通过以下方式轻松定义原始宏\def\@makechapterhead{\@makechapterhead@base\@firstofone} \def\@makeschapterhead{\@makechapterhead@base\phantom}
我从您的代码中删除了几个包导入和定义以使其最小化,因此您应该将上述补丁单独应用到您的代码中。
\documentclass[11pt,french,oneside]{report}
\usepackage[latin1]{inputenc}
\usepackage[T1]{fontenc}
\usepackage{indentfirst}
\usepackage{lastpage}
\usepackage{fancyhdr}
\usepackage{vmargin}
\usepackage{lipsum}
\usepackage[hyperfootnotes=false,colorlinks,allcolors=blue,breaklinks]{hyperref}
\usepackage{setspace}
\usepackage{caption}
\usepackage[table,svgnames,dvipsnames]{xcolor}
\usepackage{calc}
\usepackage{geometry}
\setcounter{tocdepth}{3}
\setcounter{secnumdepth}{3}
\usepackage[skip=0.5\baselineskip]{caption}
\makeatletter
\newlength{\chapter@number@width}
\newlength{\chapter@bottom@space}
\setlength{\chapter@bottom@space}{50pt}
\def\@makechapterhead{\@makechapterhead@base\@firstofone}
\def\@makeschapterhead{\@makechapterhead@base\phantom}
\def\@makechapterhead@base#1#2{%
{\normalfont
\setlength{\parindent}{0pt}%
\vspace*{10pt}%
\settowidth{\chapter@number@width}{%
\hbox{\color{white}\LARGE\bfseries
\hspace{\dimexpr 1mm+3pt}%
\thechapter
\hspace{\dimexpr 1mm+3pt}%
}}
\hbox{%
\vtop{%
\hsize=\dimexpr\chapter@number@width+\tabcolsep+2\fboxrule+\tabcolsep
\begin{tabular}[t]{@{}c}
\scshape\strut\makebox[0pt]{\hspace{0pt plus 1 fill minus 1 fill}#1{\@chapapp}\hspace{0pt plus 1 fill minus 1 fill}} \\
\fboxsep=0pt
\colorbox{black}{\vbox{%
\hbox{\vbox to \dimexpr 1mm+3pt{}}
\hbox{\color{white}\LARGE\bfseries
\hspace{\dimexpr 1mm+3pt}%
#1{\thechapter}%
\hspace{\dimexpr 1mm+3pt}%
}
\hrule height 0.4pt depth 0pt width 0pt
\hbox{\vbox to 6pt{}}
\hbox{\parbox{0pt}{\Huge\bfseries\vphantom{E}}}
}}%
\end{tabular}%
}%
\vtop{%
\advance\hsize by -\dimexpr\chapter@number@width+2\fboxrule+\tabcolsep
\hspace*{-0.5cm}\begin{tabular}[t]{c}
\scshape\strut\vphantom{\@chapapp} \\
\fboxsep=0pt
\colorbox{white}{\vbox{%
\hbox{\vbox to \dimexpr 1mm+3pt{}}
\hbox{\LARGE\bfseries
\hspace{\dimexpr 1mm+3pt}%
\phantom{\thechapter}
\hspace{\dimexpr 1mm+3pt}%
}
\hrule height 0.4pt depth 0pt width \hsize
\hbox{\vbox to 6pt{}}
\hbox{\hspace*{20pt}\parbox{\dimexpr\textwidth-2mm-6pt-\chapter@number@width-\tabcolsep-2\fboxrule-20pt}{\Huge\bfseries\strut #2}}
}}%
\end{tabular}%
}%
}%
\vspace{\chapter@bottom@space}%
}
}
\makeatother
\setlength\parindent{0pt}
\setmarginsrb{2.3cm}{0.0cm}{2.1cm}{1cm}{1.3cm}{0.5cm}{0.4cm}{1cm}
\pagestyle{fancy}
\renewcommand{\footrulewidth}{0.4pt}
\renewcommand{\headrulewidth}{0.4pt}
\chead{\hspace{-0.3cm}\textit{Rapport de stage M2 Astrophysique, Sciences de l\rq Espace, Plan\'etologie \hspace{-0.3cm}}}
\lhead{XXX}
\rhead{YYY}
\lfoot{\textit{lisssold riufi}}
\cfoot{\hspace{1.6cm} \textit{ - Performances}}
\rfoot{\thepage/\pageref{LastPage}}
\begin{document}
\renewcommand*\listfigurename{Liste des Figures}
\renewcommand*\listtablename{Liste des Tables}
\tableofcontents
%%%%%% CRITICAL PART TO GET list of figures and list of tables %%%%
%%%%%% ON THE SAME PAGE %%%%%
%%%%%% This is HERE where I would like to reduce space between title
%%%%%% list while keeping the special style of titles (like chapters)
\thispagestyle{plain}
\begingroup
\makeatletter
\setlength{\chapter@bottom@space}{15pt}
\makeatother
\listoffigures
\let\clearpage\relax
\listoftables
\endgroup
\thispagestyle{plain}
\chapter*{Introduction}
\addcontentsline{toc}{chapter}{Introduction}
\lipsum[1]
\def\fig{
\begin{figure}
Figure
\caption{This is HERE where I would like to reduce space between title
list while keeping the special style of titles (like chapters)}
\end{figure}
}
\fig\fig\fig\fig\fig\fig\fig\fig\fig
\def\tab{
\begin{table}
Figure
\caption{This is HERE where I would like to reduce space between title
list while keeping the special style of titles (like chapters)}
\end{table}
}
\tab\tab\tab\tab\tab\tab\tab\tab\tab
\end{document}