我目前正在学习 LaTeX。关于参考书目,我希望它尽可能简单。我尝试过biblatex
并且成功了,但我必须进行大量修改,因为所有样式都不符合参考书目的所需布局。
所以我决定不使用额外的软件包,而是使用thebibliography
LaTeX 自带的软件包。到目前为止,它运行良好。对于 documentclass,使用的是 KOMA-Script。
编辑(完整示例):
\documentclass[
12pt,
a4paper,
oneside,
listof=totoc,
pagesize,
parskip,
captions=tableheading,
listof=nochaptergap,
%%fleqn,
numbers=noendperiod,
]{scrreprt}
\usepackage
[
a4paper,
centering,
left=3cm,
right=3cm,
top=2.5cm,
bottom=2.5cm,
headsep=1cm,
%footskip=2.5cm,
]{geometry}
%%Standard
\usepackage{blindtext}
%%Zeilenabstand 1.5 wie bei Word
\usepackage{setspace}
\makeatletter
\newcommand{\MSonehalfspacing}{%
\setstretch{1.44}% default
\ifcase \@ptsize \relax % 10pt
\setstretch {1.448}%
\or % 11pt
\setstretch {1.399}%
\or % 12pt
\setstretch {1.433}%
\fi
}
\makeatother
\MSonehalfspacing
\usepackage[utf8]{inputenc}
\usepackage[T1]{fontenc}
\usepackage[ngerman]{babel}
\usepackage{lmodern}
\setkomafont{sectioning}{\bfseries}
\usepackage[withpage]{acronym}
\newcommand{\bflabel}[1]{\normalfont{\normalsize{#1}}\hfill}
\renewcommand{\bflabel}[1]{\normalfont{\normalsize{#1}}\hfill}
%Tabellen
\usepackage{booktabs}
\usepackage{tabularx}
%Mathe
\usepackage{amsmath}
%Sonderzeichen
\usepackage{amssymb}
\usepackage[euler]{textgreek}
%Elektrische Zeichnungen
\usepackage{circuitikz}
\usepackage{pgf}
\usepackage{tikz}
%Grafik
\usepackage{graphicx}
\usepackage{float}
\usepackage{subfigure}
%Bildunterschrift
\usepackage[margin=2 cm,font=small,labelfont=bf,]
{caption}
% Listings
\usepackage{listings}
%Zähleranpassung
\usepackage{chngcntr}
\counterwithout{figure}{chapter}
\counterwithout{table}{chapter}
\counterwithout{equation}{chapter}
\counterwithout{figure}{part}
\counterwithout{table}{part}
\counterwithout{equation}{part}
%Kopf-/Fußzeile
\usepackage{fancyhdr}
\fancypagestyle{plain}{
\fancyhf{}
\fancyhead[C]{}
\fancyhead[R]{\small \leftmark}
\fancyhead[L]{}
\fancyfoot[L]{\authorOne}
\fancyfoot[R]{\thepage}
\fancyfoot[C]{}
%% Linien in Kopf- und Fußzeile
\renewcommand{\headrulewidth}{0.4pt}
\renewcommand{\footrulewidth}{0.4pt}
}
\fancypagestyle{framepart}{
\fancyhf{}
\fancyhead[C]{}
\fancyhead[L]{}
\fancyhead[R]{\leftmark}
\fancyfoot[L]{\authorOne}
\fancyfoot[C]{}
\renewcommand{\headrulewidth}{0.4pt}
\renewcommand{\footrulewidth}{0.4pt}
\pagenumbering{gobble}
}
\pagestyle{plain}
\renewcommand{\chaptermark}[1]{\markboth{\thechapter. #1}{}}
%Punkte im Inhaltsverzeichnis als Füllobjekte
\usepackage[]{tocstyle}
\usetocstyle{allwithdot}
%Formelverzeichnis:
\usepackage[version-1-compatibility]{siunitx}
\newcommand{\acrou}[1]{\acroextra{\makebox[18mm][l]{\si[per-mode=fraction,fraction=nice]{#1}}}}
%Überschriftformatierung
\usepackage{titlesec}
\titleformat{\chapter}[hang]{\LARGE\bfseries\color{black}}{\thechapter\quad}{0pt}{}
\titleformat{\section}[hang]{\Large\bfseries\color{black}}{\thesection\quad}{0pt}{}
\titleformat{\subsection}[hang]{\large\bfseries\color{black}}{\thesubsection\quad}{0pt}{}
\titleformat{\subsubsection}[hang]{\bfseries\color{black}}{\thesubsubsection\quad}{0pt}{}
%Abstände nach den Überschriften
\titlespacing{\chapter} { 0em} { -8ex} { 0ex}
\titlespacing{\section} { 0em} { 0ex} { -2ex}
\titlespacing{\subsection} { 0em} { 0ex} { -2ex}
\titlespacing{\subsubsection} { 0em} { 0ex} { -2ex}
%%Weiteres
\setcounter{tocdepth}{4}
\setcounter{secnumdepth}{4}
\usepackage{url}
\usepackage{longtable}
%PDF Einstellungen
\usepackage[%
pdftitle={Info},
pdfauthor={Info},
pdfsubject={Info},
pdfcreator={pdflatex, LaTeX with KOMA-Script},
pdfpagemode=UseOutlines,
pdfdisplaydoctitle=true,
pdflang=de,
]{hyperref}
\begin{document}
This is a test \cite{papula,horowitz}.
\begin{thebibliography}{1}
\bibitem{papula} Papula, Lothar: {\em Mathematik für Ingenieure und Naturwissenschaftler.} Band 3. 3.Aufl., München: Vieweg+Teubner Verlag, 2016
\bibitem{horowitz} Horowitz, Paul \& Hill, Winfield: {\em The Art of Electronics.} 3.Aufl., Cambridge: Cambridge University Press, 2015
\end{thebibliography}
\end{document}
不幸的是,我不知道如何增加数字和后面的信息之间的水平间距。例如,我希望 (1)----Papula 而不是 (1)-Papula。任何帮助或建议都将不胜感激。
答案1
thebibliography
是一个类似于 的列表enumerate
,上面有一些语法糖。因此,(引文)标签和参考书目项之间的空间由 (默认值为 )控制。\labelsep
您可以简单地用 来放大这个值,但如果您在序言中这样做,这将适用于文档中的所有列表。\labelsep
0.5em
\setlength{\labelsep}{1em}
我认为重新定义它会很有用,thebibliography
这样它就会得到\labelsep
自己的:\biblabelsep
。
本质上,定义新的长度并在 中正确\biblabelsep
添加就足够了。使用补丁实现相同的功能是可能的(而且更短),但了解如何定义 可能会很有启发。\setlength{\labelsep}{\biblabelsep}%
thebibliography
thebibliography
\documentclass[12pt,oneside,pagesize,parskip,]{scrreprt}
\usepackage[T1]{fontenc}
\usepackage[ngerman]{babel}
\usepackage{lmodern}
\usepackage{hyperref}
\newlength{\biblabelsep}
\setlength{\biblabelsep}{2\labelsep}
\makeatletter
% copied from scrreprt.cls
% we just added the line
% \setlength{\labelsep}{\biblabelsep}%
\renewenvironment{thebibliography}[1]{%
\if@bib@break@
\bib@beginhook
\else
\ifx\bibpreamble\relax\else\ifx\bibpreamble\@empty\else
\setchapterpreamble{\bibpreamble}%
\fi\fi
\bib@heading
\bib@beginhook
\bib@before@hook
\fi
\renewcommand{\BreakBibliography}[1]{%
\@bib@break
\end{thebibliography}%
\begingroup ##1\endgroup
\begin{thebibliography}{#1}
}%
\list{%
\@biblabel{\@arabic\c@enumiv}%
}{%
\setlength{\labelsep}{\biblabelsep}%
\settowidth\labelwidth{\@biblabel{#1}}%
\leftmargin\labelwidth
\advance\leftmargin\labelsep
\@openbib@code
\if@bib@break@
\edef\@tempa{%
\noexpand\usecounter{enumiv}%
\noexpand\setcounter{enumiv}{\the\c@enumiv}%
}\@tempa
\no@bib@break
\else
\usecounter{enumiv}%
\fi
\let\p@enumiv\@empty
\renewcommand*\theenumiv{\@arabic\c@enumiv}%
}%
\sloppy\clubpenalty4000 \widowpenalty4000
\sfcode`\.=\@m
}{%
\if@bib@break@
\def\@noitemerr{%
\@latex@warning{%
\string\BreakBibliography\space at begin of `thebibliography'
environment\MessageBreak
or following \string\BreakBibliography}%
}%
\else
\def\@noitemerr{%
\@latex@warning{%
Empty `thebibliography' environment or
\string\BreakBibliography\MessageBreak
before end of `thebibliography' environment}%
}%
\fi
\endlist
\if@bib@break@
\else
\bib@after@hook
\let\bib@before@hook\@empty
\let\bib@after@hook\@empty
\fi
\bib@endhook
}
\makeatother
\begin{document}
This is a test \cite{papula,horowitz}.
\begin{thebibliography}{1}
\bibitem{papula} Papula, Lothar:
{\em Mathematik für Ingenieure und Naturwissenschaftler.} Band 3.
3.~Aufl., München: Vieweg+Teubner Verlag, 2016
\bibitem{horowitz} Horowitz, Paul \& Hill, Winfield: {\em The Art of Electronics.}
3.~Aufl., Cambridge: Cambridge University Press, 2015
\end{thebibliography}
\end{document}
您可以使用以下方式修改水平空间
\setlength{\biblabelsep}{2\labelsep}