我一直在开发一个包,用于放置我论文的所有布局代码。在这里我还定义了 Biblatex 代码。然而,我在让 biblatex 正常运行方面遇到了一些问题。
我在 TexStudio 中编辑,这个编辑软件通常会在我开始输入代码时提示代码。具体来说,对于引用,当我输入时,我会得到一个包含所有可能与我的条目匹配的引用的框。我相信你们中的许多人都熟悉这一点。当我将“article”类与 biblatex 一起使用时,TexStudio 会这样做,但不会与 memoir 和我自己的“包”一起使用。
我希望有经验的人能快速查看一下,看看是否能找到可能导致问题的原因。我使用 biber 作为后端,并且已为此选项设置了 TexStudio,并在加载 biblatex 时指定。包文件不是很大(大约 100 行)。
我已经制作了一个 MWE,并且我还在这里发布了我的包的全部内容。这样,您只需复制这些行,将它们粘贴到新文档中并保存为 .sty 文件,就可以了 - 我无法在此处上传文件。我还发布了我的 .bib 文件的内容,供您复制粘贴。
我非常感谢对这个问题提供的任何帮助!
.tex 文件:
\documentclass{memoir}
%\usepackage[backend=biber]{biblatex}
\usepackage{assignments}
\addbibresource{refs.bib}
\begin{document}
\chapter{Hello World}
Here I make a preposterous claim, which is supported by \textcite{kelleher2000idpt}.
\printbibliography
\end{document}
.bib 文件
@article{kelleher2000idpt,
Author = {P. Kelleher AND K. Pacheco AND L. S. Newman},
Date = {2000},
Date-Added = {2014-04-27 13:12:26 +0000},
Date-Modified = {2014-07-23 17:03:42 +0000},
Journaltitle = {Environmental Health Perspectives},
Number = {4},
Pages = {685 -- 696},
Read = {0},
Title = {Inorganic dust pneumonias: the metal-related parenchymal disorders},
Volume = {108},
}
.sty 文件
% Declare that this style file requires at least LaTeX version 2e.
\NeedsTeXFormat{LaTeX2e}
% Provide the name of your page, the date it was last updated, and a comment about what it's used for
\ProvidesPackage{assignments}[]
%=============================================================================
% PACKAGES AND SETTINGS
\RequirePackage[backend=biber, style=authoryear-comp, maxbibnames=99, firstinits=true, hyperref=true]{biblatex}
% remove the "In:" preceeding the journal name
\renewbibmacro{in:}{%
\ifentrytype{article}{}{\printtext{\bibstring{in}\intitlepunct}}}
% add space between bibliography entries by 50 %
\setlength\bibitemsep{1.5\itemsep}
\addbibresource{refs.bib}
%\RequirePackage{}
%\RequirePackage{}
%\RequirePackage{}
%\RequirePackage{}
\RequirePackage{caption}
\captionsetup[figure]{labelfont={color=PineGreen,bf},textfont=up,labelsep=period,format=hang,font=small}
\captionsetup[table]{labelfont={color=PineGreen,bf},textfont=up, labelsep=period,format=hang,font=small}
\RequirePackage{minitoc}
\RequirePackage[american]{babel}
\RequirePackage[fulloldstylenums]{kpfonts}
\RequirePackage[utf8]{inputenc}
\RequirePackage{amsfonts,amsmath,cancel,dsfont,textgreek}
\RequirePackage{csquotes}
\RequirePackage{lettrine}
\RequirePackage[usenames,dvipsnames]{color}
\RequirePackage{lipsum}
\RequirePackage{subfig}
\RequirePackage{pdfpages}
\RequirePackage{float}
\RequirePackage{rotating}
\RequirePackage{pbox}
\RequirePackage{chemformula}
\RequirePackage{threeparttable}
\RequirePackage{hyperref}
\hypersetup{
pdfborder = {0 0 0},
colorlinks,
linktocpage = true,
citecolor=PineGreen,
filecolor=PineGreen,
linkcolor=PineGreen,
}
\RequirePackage{calc}
%=======================
% defining the chapter style
\renewcommand\colorchapnum{\color{PineGreen}}
\renewcommand\colorchaptitle{\color{PineGreen}}
\chapterstyle{pedersen}
% defining the headers, footers, and pagestyle
\pagestyle{headings}
\makepagestyle{headings}
\makeevenfoot{headings}{{\Large\color{PineGreen}\thepage}}{}{}
\makeoddfoot{headings}{}{}{{{\Large\color{PineGreen}\thepage}}}
\makeevenhead{headings}{\footnotesize {\color{PineGreen}\rightmark}}{}{}
\makeoddhead{headings}{}{}{\footnotesize {\color{PineGreen}\leftmark}}
\makeheadrule{headings}{\textwidth}{\normalrulethickness}
\makefootrule{headings}{\textwidth}{\normalrulethickness}{\footruleskip}
\makepagestyle{plain}
\makeevenfoot{plain}{\thepage}{}{}
\makeoddfoot{plain}{}{}{\thepage}
\aliaspagestyle{chapter}{empty} % pagestyle "plain" on first page of chapters
\aliaspagestyle{cleared}{empty} % pagestyle "empty" on cleared pages (blank pages)
\OnehalfSpacing % one-half spacing between adjacent lines of text, but not within captions and the like
\flushbottom % stretch out pages to obtain equal height (default with twoside)
%\raggedbottom % not stretch out pages
% ToC/ToF/ToT: page number next to entries
\renewcommand{\cftsubsectionleader}{}
\renewcommand{\cftsubsectionafterpnum}{\cftparfillskip}
\renewcommand{\cftsectionleader}{}
\renewcommand{\cftsectionafterpnum}{\cftparfillskip}
\renewcommand{\cftchapterleader}{}
\renewcommand{\cftchapterafterpnum}{\cftparfillskip}
\AtBeginDocument{\addtocontents{toc}{\protect\thispagestyle{empty}}} % empty pagestyle on toc page
\setsecnumdepth{subsection} % lowest structural level in toc
% setting color in toc
\setsecnumformat{\color{PineGreen}\csname the#1\endcsname\quad}
\setsecnumdepth{subsubsection}
\setsecheadstyle{\color{PineGreen}\Large\bfseries\memRTLraggedright}
\setsubsecheadstyle{\color{PineGreen}\Large\bfseries\memRTLraggedright}
\endinput
答案1
我想这次我回答了自己的问题。我尝试在包文档中不“需要 biblatex 包”,而是在实际论文文档中使用“usepcakge”。这似乎解决了问题。现在一切都运行良好。