我有以下文档序言,但我不明白为什么notoccite
不起作用(即 LaTeX 仍然将图表列表中的参考文献视为文档中出现的第一个参考文献)。这可能与有关吗hyperref
?我搞不懂!提前谢谢您
% **************************************************
% Document Class Definition
% **************************************************
\documentclass[%
%paper=A4, % paper size --> A4 is default in Germany
paperheight=24cm, % Size of a book
paperwidth=17cm,
twoside=true, % true onesite or twoside printing
openright, % doublepage cleaning ends up right side
%parskip=small, % spacing value / method for paragraphs
chapterprefix=true, % prefix for chapter marks
12pt, % font size
headings=normal, % size of headings
bibliography=totoc, % include bib in toc totoc
listof=nottoc, % include listof entries in toc
titlepage=on, % own page for each title page
captions=tableabove, % display table captions above the float env
draft=false, % value for draft version
]{scrreprt}%
%% MISCELANEOUS
\usepackage{notoccite}
\usepackage{lmodern,textcomp}
% babel system, adjust the language of the content
\usepackage[english]{babel}
\usepackage{enumerate}
\usepackage{siunitx}
\usepackage{mathptmx} %ecuaciones con misma letra que texto
%% Use the following command to allow font sizes larger than `Huge'. Useful for doing the title larger
\newcommand\SuperHuge{\fontsize{40}{40}\selectfont} % For cover page
\newcommand\SuperHuuge{\fontsize{31}{31}\selectfont}% For page after cover
%% Use the parskip package to control the space between paragraphs. The following command will leave one empty line of space and will remove the identation. The space can be controlled by changing the value in the second {}.
\setlength{\parskip}{0.5\baselineskip}
\usepackage[ % clean thesis style package and options. You can find all options in `doc' folder. These options can also be defined at the document options
figuresep=colon, % This determines what appears after the number of the figure caption. Options are: 'colon' (inserts :), 'none' (inserts nothing), 'period' (inserts .), 'space' (inserts a single space), `quad` (inserts a larger space), 'endash' (inserts a -).
%sansserif=false, % Option to use sanserif font. Options are: 'true' or 'false'. This is no longer used since times font is enforced.
hangfigurecaption=false, %Sets whether to use a hanging figure label or not (placed in page margin). Options: 'true' or 'false'.
hangsection=true, %Sets whether to use a hanging section label (placed in page margin). Options are 'true' or 'false'
hangsubsection=true, %Sets whether to use a hanging subsection label (placed in page margin). Options are 'true' or 'false'
colorize=full, %This determines how many things are colored 8such as the titles, etc.). Options are: 'full' (footers, headers, sections are painted everywhere), 'reduced' (less things are painted), and 'bw' (all is black-grey color except figures).
colortheme=blueblack, %This changes the colors of sections, titles, headers, etc. Combinations are: 'bluemagenta', 'bluegreen', 'blueblack' (added by Jose).
bibfile=library, %Put the name of the bibliography file
%bibsys=bibtex,%
%bibstyle=numeric-comp %authoryear,%alphabetic,%numeric, numeric-comp
]{cleanthesis}
\usepackage{enumitem}
\usepackage{placeins}
%% Use the package `pdfpages' to include given pdf documents into your generated document
\usepackage{pdfpages}
%% Use package `threeparttable' to provides a scheme for tables that have a structured note section, after the caption.
\usepackage{threeparttable}
%% Use package `pifont' for providing commands for pi fonts. See http://ctan.org/pkg/pifont
\usepackage{pifont}
%% Use package `lscape' for placing selected parts of a document in landscape
\usepackage{lscape}
\newcommand{\cmark}{\ding{51}}%
\newcommand{\xmark}{\ding{55}}%
%% Use package `changes' to show produced changes into your document
\usepackage[final]{changes}
%% The package hyperref is used to generate hyperreferences along the document. Setup it according to clean-thesis style:
\hypersetup{
pdftitle={\thesisTitle}, % - title (PDF meta)
pdfsubject={\thesisSubject},% - subject (PDF meta)
pdfauthor={\thesisName}, % - author (PDF meta)
plainpages=false, % -
colorlinks=false, % - colorize links?
pdfborder={0 0 0}, % - {0 0 0}
breaklinks=true, % - allow line break inside links
bookmarksnumbered=true, %
bookmarksopen=true %
}
\usepackage{graphics}
%% or use the graphicx package for more complicated commands:
\usepackage{graphicx}
%% MATHEMATICAL PACKAGES
\usepackage{amssymb} %provides various useful mathematical symbols
\usepackage{amsthm} %provides extended theorem environments
\usepackage{amsfonts} %provides extended fonts
\usepackage{amsmath} %provides mathematical facilities
\usepackage{mathtools} %provides useful tools for mathematical typesetting
\DeclarePairedDelimiter\floor{\lfloor}{\rfloor}
\usepackage{bm} %Allows bold math font
\usepackage{gensymb} %Adds generics symbols
\usepackage[nodots]{numcompress}
\usepackage{adjustbox}
%% The cleveref package allows to compres multiple refenced equations:
\usepackage{cleveref}
\newcommand{\crefrangeconjunction}{--} %Changes "to" by "-" when referencing multiple equations, i.e. (1) to (5) becomes (1)-(5).
\crefname{equation}{}{} %This option allows that only the equation numbers appear when using the package.
%% Clean style thesis does not number `subsubsection' by default. Add the following code so that they are numbered, and follow the same style as section and subsection:
\usepackage{titlesec}
\makeatletter
\setcounter{secnumdepth}{3}
\titlespacing{\subsubsection}{0em}{0.5em}{-0.25\baselineskip}%[0pt]
\ifct@cthesis@hangsubsection
\titleformat{\subsubsection}[hang]%
{\usekomafont{subsubsection}}%
{\color{ctcolorblack}\thesubsubsection\hspace*{10pt}}%
{0pt}%
{\raggedright}%
[\phantomsection]
\else
\titleformat{\subsubsection}[block]%
{\usekomafont{subsubsection}}%
{\color{ctcolorblack}\thesubsubsection\hspace*{10pt}}%
{0pt}%
{\raggedright}%
[\phantomsection]
\fi
\makeatother
%Change also the spacing of the section, subsection, etc, by deleting the empty line left below with:
\titlespacing{\section}{0pt}{0pt}{-0.25\baselineskip}
\titlespacing{\subsection}{0pt}{0pt}{-0.25\baselineskip}
%% By default, latex leaves a large space between the text and equations. Use the following to reduce it:
\makeatletter
\g@addto@macro\normalsize{%
\setlength\abovedisplayskip{5pt}
\setlength\belowdisplayskip{5pt}
\setlength\abovedisplayshortskip{5pt}
\setlength\belowdisplayshortskip{5pt}
}
\makeatother
%% Use the package caption or subcaption to customize the caption in figures and tables:
\usepackage{caption}
\usepackage{subcaption}
\usepackage[numbers, square, comma, sort&compress]{natbib}
%% Use the following commando to change how latex decides if a word is pushed to the next line earlier or not. It helps to avoid having words exceeding the page width
\setlength{\emergencystretch}{2pt}
%% Use the following commands to change the space between the text and figures
\setlength{\intextsep}{0.5\baselineskip plus 0.0\baselineskip minus 0.0\baselineskip} %This changes the space betwen figure and text for a figure placed at top or bottom of a page
%\setlength{\textfloatsep}{10 pt plus 0pt minus 0pt}
\setlength{\textfloatsep}{0.5\baselineskip plus 0.0\baselineskip minus 0.0\baselineskip} %This changes the space between figure and text for a figure placed in any other place of the document.
%
% **************************************************
% ToC, LoF, LoT
% **************************************************
%
% -- modifications regarding the table of contents,
% the list of figures and the list of tables
% The tocloft package enables us to control the typographic design of the
% table of contents, list of figures and list of tables
\usepackage{tocloft}
%
% > adjusts the indention for figure and table entries (lof and lot)
% -- \cftsetindents{entry}{indent}{numwidth} sets the entry's indent to
% the length indent and its numwidth to the length numwidth
\cftsetindents{figure}{0em}{3em}
\cftsetindents{table}{0em}{3em}
\renewcommand{\cfttoctitlefont}{\normalfont\huge\bfseries} %To customizethe Contents title. In this case, to use the normal font and bold.
\renewcommand{\cftpartfont}{\normalfont\sffamily\bfseries}% \part font in ToC
\renewcommand{\cftchapfont}{\normalfont\large\bfseries} % \chapter fontin ToC
%\renewcommand{\cftsecfont}{\normalfont\slshape} % \section fontin ToC
%\renewcommand{\cftsubsecfont}{\normalfont\itshape} % \subsectionfont in ToC
%\renewcommand{\cftsubsubsecfont}{\normalfont\small} %\subsubsection font in ToC
\renewcommand{\cftloftitlefont}{\normalfont\huge\bfseries} %To customizethe List of Figures title. In this case, to use the normal font and bold.
\renewcommand{\cftlottitlefont}{\normalfont\huge\bfseries} %To customizethe List of Figures title. In this case, to use the normal font and bold.
\begin{filecontents}{\jobname.bib}
@misc{foo,
author = {Foo},
title = {Title of Foo},
}
@misc{bar,
author = {Bar},
title = {Title of Bar},
}
@misc{ba,
author = {Ba},
title = {Title of Ba},
}
\end{filecontents}
% **************************************************
% Document CONTENT
% **************************************************
\begin{document}
\listoffigures
this is the text \cite{foo} and it should be cited first \cite{bar}
\begin{figure} [h]
\centering
\includegraphics[width=4cm]{example-image}
\caption{the caption in the text \cite{ba}}
\label{X}
\end{figure}
\bibliographystyle{elsarticle-num}
\bibliography{library}
% **************************************************
\end{document}
答案1
嗯,你的显示代码中有很多问题,我猜其中一些问题是由于误解造成的。请参阅以下列表:
classicthesis
它有自己的参考书目biblatex
,所以你使用的命令\bibliographystyle
和\bibliography
完全是错误的。改用\printbibliography
。- 使用给定的代码,您需要
bibfile=\jobname,
作为包选项classicthesis
。 colortheme=blueblack
在我的系统上似乎未定义,我注释了classicthesis
\usepackage[nodots]{numcompress}
导致错误,已评论。\usepackage[numbers, square, comma, sort&compress]{natbib}
和 一起是错误的biblatex
,评论道。请阅读 classicthesis 的文档,了解如何使用natbib
。- 中有几个命令
thesis...
未定义\hypersetup
,已注释掉。 cleverref
应该在之后调用hyperref
,hyperref
在调用classicthesis
- 你收到了几个关于使用最好不要在 KOMA-Script 中使用的包的警告,例如
fancyhdr
(改用\scrlayer-scrpage
),以及其他由于使用classicthesis
- 软件包
notoccite
比较旧(2000 年)。您真的需要它吗?
但是,以下代码在我当前的 MiKTeX 2.9 上编译时没有错误:
\documentclass[%
%paper=A4, % paper size --> A4 is default in Germany
paperheight=24cm, % Size of a book
paperwidth=17cm,
twoside=true, % true onesite or twoside printing
openright, % doublepage cleaning ends up right side
%parskip=small, % spacing value / method for paragraphs
chapterprefix=true, % prefix for chapter marks
12pt, % font size
headings=normal, % size of headings
bibliography=totoc, % include bib in toc totoc
listof=nottoc, % include listof entries in toc
titlepage=on, % own page for each title page
captions=tableabove, % display table captions above the float env
draft=false, % value for draft version
]{scrreprt}%
%% MISCELANEOUS
\usepackage{notoccite}
\usepackage{lmodern,textcomp}
% babel system, adjust the language of the content
\usepackage[english]{babel}
\usepackage{enumerate}
\usepackage{siunitx}
\usepackage{mathptmx} %ecuaciones con misma letra que texto
%% Use the following command to allow font sizes larger than `Huge'. Useful for doing the title larger
\newcommand\SuperHuge{\fontsize{40}{40}\selectfont} % For cover page
\newcommand\SuperHuuge{\fontsize{31}{31}\selectfont}% For page after cover
%% Use the parskip package to control the space between paragraphs. The following command will leave one empty line of space and will remove the identation. The space can be controlled by changing the value in the second {}.
\setlength{\parskip}{0.5\baselineskip}
\usepackage[ % clean thesis style package and options. You can find all options in `doc' folder. These options can also be defined at the document options
figuresep=colon, % This determines what appears after the number of the figure caption. Options are: 'colon' (inserts :), 'none' (inserts nothing), 'period' (inserts .), 'space' (inserts a single space), `quad` (inserts a larger space), 'endash' (inserts a -).
%sansserif=false, % Option to use sanserif font. Options are: 'true' or 'false'. This is no longer used since times font is enforced.
hangfigurecaption=false, %Sets whether to use a hanging figure label or not (placed in page margin). Options: 'true' or 'false'.
hangsection=true, %Sets whether to use a hanging section label (placed in page margin). Options are 'true' or 'false'
hangsubsection=true, %Sets whether to use a hanging subsection label (placed in page margin). Options are 'true' or 'false'
colorize=full, %This determines how many things are colored 8such as the titles, etc.). Options are: 'full' (footers, headers, sections are painted everywhere), 'reduced' (less things are painted), and 'bw' (all is black-grey color except figures).
% colortheme=blueblack, %This changes the colors of sections, titles, headers, etc. Combinations are: 'bluemagenta', 'bluegreen', 'blueblack' (added by Jose). <===================================
bibfile=\jobname,%, %Put the name of the bibliography file % <================================
%bibsys=bibtex,%
%bibstyle=numeric-comp %authoryear,%alphabetic,%numeric, numeric-comp
]{cleanthesis}
\usepackage{enumitem}
\usepackage{placeins}
%% Use the package `pdfpages' to include given pdf documents into your generated document
\usepackage{pdfpages}
%% Use package `threeparttable' to provides a scheme for tables that have a structured note section, after the caption.
\usepackage{threeparttable}
%% Use package `pifont' for providing commands for pi fonts. See http://ctan.org/pkg/pifont
\usepackage{pifont}
%% Use package `lscape' for placing selected parts of a document in landscape
\usepackage{lscape}
\newcommand{\cmark}{\ding{51}}%
\newcommand{\xmark}{\ding{55}}%
%% Use package `changes' to show produced changes into your document
\usepackage[final]{changes}
%\usepackage{graphics}
%% or use the graphicx package for more complicated commands:
\usepackage{graphicx}
%% MATHEMATICAL PACKAGES
\usepackage{amssymb} %provides various useful mathematical symbols
\usepackage{amsthm} %provides extended theorem environments
\usepackage{amsfonts} %provides extended fonts
\usepackage{amsmath} %provides mathematical facilities
\usepackage{mathtools} %provides useful tools for mathematical typesetting
\DeclarePairedDelimiter\floor{\lfloor}{\rfloor}
\usepackage{bm} %Allows bold math font
\usepackage{gensymb} %Adds generics symbols
%\usepackage[nodots]{numcompress} % <=====================================
\usepackage{adjustbox}
%% Clean style thesis does not number `subsubsection' by default. Add the following code so that they are numbered, and follow the same style as section and subsection:
\usepackage{titlesec}
\makeatletter
\setcounter{secnumdepth}{3}
\titlespacing{\subsubsection}{0em}{0.5em}{-0.25\baselineskip}%[0pt]
\ifct@cthesis@hangsubsection
\titleformat{\subsubsection}[hang]%
{\usekomafont{subsubsection}}%
{\color{ctcolorblack}\thesubsubsection\hspace*{10pt}}%
{0pt}%
{\raggedright}%
[\phantomsection]
\else
\titleformat{\subsubsection}[block]%
{\usekomafont{subsubsection}}%
{\color{ctcolorblack}\thesubsubsection\hspace*{10pt}}%
{0pt}%
{\raggedright}%
[\phantomsection]
\fi
\makeatother
%Change also the spacing of the section, subsection, etc, by deleting the empty line left below with:
\titlespacing{\section}{0pt}{0pt}{-0.25\baselineskip}
\titlespacing{\subsection}{0pt}{0pt}{-0.25\baselineskip}
%% By default, latex leaves a large space between the text and equations. Use the following to reduce it:
\makeatletter
\g@addto@macro\normalsize{%
\setlength\abovedisplayskip{5pt}
\setlength\belowdisplayskip{5pt}
\setlength\abovedisplayshortskip{5pt}
\setlength\belowdisplayshortskip{5pt}
}
\makeatother
%% Use the package caption or subcaption to customize the caption in figures and tables:
\usepackage{caption}
\usepackage{subcaption}
%\usepackage[numbers, square, comma, sort&compress]{natbib} % <====== classicthesis
%% Use the following commando to change how latex decides if a word is pushed to the next line earlier or not. It helps to avoid having words exceeding the page width
\setlength{\emergencystretch}{2pt}
%% Use the following commands to change the space between the text and figures
\setlength{\intextsep}{0.5\baselineskip plus 0.0\baselineskip minus 0.0\baselineskip} %This changes the space betwen figure and text for a figure placed at top or bottom of a page
%\setlength{\textfloatsep}{10 pt plus 0pt minus 0pt}
\setlength{\textfloatsep}{0.5\baselineskip plus 0.0\baselineskip minus 0.0\baselineskip} %This changes the space between figure and text for a figure placed in any other place of the document.
%
% **************************************************
% ToC, LoF, LoT
% **************************************************
%
% -- modifications regarding the table of contents,
% the list of figures and the list of tables
% The tocloft package enables us to control the typographic design of the
% table of contents, list of figures and list of tables
\usepackage{tocloft}
%
% > adjusts the indention for figure and table entries (lof and lot)
% -- \cftsetindents{entry}{indent}{numwidth} sets the entry's indent to
% the length indent and its numwidth to the length numwidth
\cftsetindents{figure}{0em}{3em}
\cftsetindents{table}{0em}{3em}
\renewcommand{\cfttoctitlefont}{\normalfont\huge\bfseries} %To customizethe Contents title. In this case, to use the normal font and bold.
\renewcommand{\cftpartfont}{\normalfont\sffamily\bfseries}% \part font in ToC
\renewcommand{\cftchapfont}{\normalfont\large\bfseries} % \chapter fontin ToC
%\renewcommand{\cftsecfont}{\normalfont\slshape} % \section fontin ToC
%\renewcommand{\cftsubsecfont}{\normalfont\itshape} % \subsectionfont in ToC
%\renewcommand{\cftsubsubsecfont}{\normalfont\small} %\subsubsection font in ToC
\renewcommand{\cftloftitlefont}{\normalfont\huge\bfseries} %To customizethe List of Figures title. In this case, to use the normal font and bold.
\renewcommand{\cftlottitlefont}{\normalfont\huge\bfseries} %To customizethe List of Figures title. In this case, to use the normal font and bold.
%% The cleveref package allows to compres multiple refenced equations:
\usepackage{cleveref}
\newcommand{\crefrangeconjunction}{--} %Changes "to" by "-" when referencing multiple equations, i.e. (1) to (5) becomes (1)-(5).
\crefname{equation}{}{} %This option allows that only the equation numbers appear when using the package.
%% The package hyperref is used to generate hyperreferences along the document. Setup it according to clean-thesis style:
\hypersetup{
% pdftitle={\ThesisTitle}, % - title (PDF meta) <================================
% pdfsubject={\thesisSubject},% - subject (PDF meta)
% pdfauthor={\thesisName}, % - author (PDF meta)
plainpages=false, % -
colorlinks=false, % - colorize links?
pdfborder={0 0 0}, % - {0 0 0}
breaklinks=true, % - allow line break inside links
bookmarksnumbered=true, %
bookmarksopen=true %
}
\begin{filecontents}{\jobname.bib}
@misc{foo,
author = {Foo},
title = {Title of Foo},
}
@misc{bar,
author = {Bar},
title = {Title of Bar},
}
@misc{ba,
author = {Ba},
title = {Title of Ba},
}
\end{filecontents}
% **************************************************
% Document CONTENT
% **************************************************
\begin{document}
\listoffigures
this is the text \cite{foo} and it should be cited first \cite{bar}
\begin{figure} [h]
\centering
\includegraphics[width=4cm]{example-image}
\caption{the caption in the text \cite{bar}}
\label{X}
\end{figure}
%\bibliographystyle{elsarticle-num} % <=================================
\printbibliography%{\jobname} % <=======================================
% **************************************************
\end{document}
结果如下:
和
答案2
我也遇到了软件包问题notoccite
。出于某种原因,我不得不清理辅助文件以更新引用顺序。在 TeXstudio 中,转到工具 > 清理辅助文件... > 确定然后构建并查看。我依稀记得在 Overleaf 中我必须关闭选项卡并重新打开文档。我希望这可以帮助别人。