0

So I've been writing my exam in Overleaf Latex (new to Latex) and I'm experienced three kinds of problems. I'll just simply state the problems then show a picture with more details:

First problem: I would like to change my font for all my references to "Times New Roman". (Purple ring)

Second problem: I would like to move the second row and rest of the rows to the red line so it aligns with the first line. (Red arrow)

Third problem: I would like to get rid of the black boxes I guess randomly in my references. (Blue arrow)

As general setup I currently work with:

    \documentclass[draft]{article} 
%but will change this to \documentclass[a4paper,oneside,swedish]{article} once everything is done correctly.

I use:

\usepackage[
backend = biber,
style = authoryear-comp,
citestyle = apa, 
sorting=nyc, 
isbn=true, 
doi=true, 
dashed=false, 
maxbibnames=99,
uniquenames=init,
giveninits 
]{biblatex}

For the first problem I have imported some .tff files for Times New Roman and applied them for a custom font like this (Files are included in the folder "Typsnitt") and they are working in normal text.

\newfontfamily\timesRoman[
    Path                = Typsnitt/,
    Extension           = .ttf,
    BoldItalicFont          = timesbi,
    BoldFont                = timesbd,
    ItalicFont              = timesi,
]{times}

I've also changed title and institution in references with the following:

\DeclareFieldFormat*{title}{\timesRoman\textit{#1}}

\DeclareFieldFormat{institution}{\timesRoman\textit{#1}}

And changing the size of my references with the following:

\renewcommand*{\bibfont}{\parskip=12pt\small}

For the second problem I've tried solutions like:

\setlength{\bibleftmargin}{0mm}
\setlength{\bibindent}{0mm}

But also with a list which I'm a little bit worried that this only work with natbib:

\defbibenvironment{bibliography} 
  {\list{}{%
    \setlength\bibleftmargin=0mm
    \setlength\bibindent=0mm
  }}
  {\endlist}
  {\item}

As for the third problem my worries is that something is wrong with hyperlinks but I'm not sure. Here is my setup for that:

\hypersetup{
    colorlinks = true,
    linkcolor={black!50!black},
    citecolor={black!50!black},
    urlcolor={black!80!black}
}

I have and I've been looking a bit at this but I guess this solution is for natbib only since they use \begin{thebibliography}{0} and \end{thebibliography} and not \printbibliography which I use.

Would be glad if someone have a good input for all this problems Kind regards

EDIT: So sorry if I used multiple questions but I thought I could wrap all my questions in with one picture (which I also forgot to include).

Picture of problem

EDIT2: Big thanks to moewe and Skillmon for fixing my problem! First problem was solved with this:

\newcommand*{\bibfont}{\parskip=12pt\normalfont\small}

Second problem solved with this:

\setlength{\bibhang}{0pt}

Third problem solved with this:

\documentclass[a4paper,oneside,swedish]{article}
8
  • 1
    The black boxes are put there to mark overfull lines, if you remove the draft option from your \documentclass the black boxes will disappear.
    – Skillmon
    Jun 30, 2019 at 15:26
  • 1
    Welcome to TeX.SX! Please note that ideally questions here should be about one specific issue. If you have several problems it is a much better idea to ask separate questions for each of them. That avoids scaring away people who can only say something about one of your subquestions and makes the question more relevant for other people as well, see tex.meta.stackexchange.com/q/7425/35864. With more complex questions like this it is a good idea to include a fully compilable example document in your question (tex.meta.stackexchange.com/q/228/35864) instead of code snippets.
    – moewe
    Jun 30, 2019 at 15:26
  • 1
    Ad problem 1: Usually the bibliography should uses the font settings \newcommand*{\bibfont}{\normalfont\normalsize}. This should reset the font to the global defaults. If the bibliography uses a different font than the rest of the document, this suggests your complete document is not written in the default font. I suggest you change the defaults, so that this is the case (how you do sthat I can't say without an MWE, I'm afraid).
    – moewe
    Jun 30, 2019 at 15:31
  • Ad 3: The black boxes are quite probably caused by overfull boxes in combination with the draft option: tex.stackexchange.com/q/61286/35864. Fix the overfull/underfull boxes and remove the draft option from \documentclass[draft]{article}.
    – moewe
    Jun 30, 2019 at 15:34
  • Ad 2: Something like \setlength{\bibhang}{0pt} should do that. Unless you have a large \bibitemsep I would avoid this, since it makes it quite hard to tell where a new entry starts.
    – moewe
    Jun 30, 2019 at 15:45

1 Answer 1

0

Just collecting Skillmon's and my comments into an answer, since you mention that the issue is solved.

  1. The font settings for the bibliography generated by biblatex are given by

    \newcommand*{\bibfont}{\normalfont\normalsize}
    

    This means that the bibliography will use the default font in the default size.

    If the rest of your document uses a different font this implies that your document does not use the default font settings defined in the preamble.

    Change your font settings so that the document can use the default settings.

  2. The hanging indentation of subsequent lines in bibliography items is controlled by \bibhang, if set to 0 there is no hanging indent

    \setlength{\bibhang}{0pt}
    

    Note that in that case you should set \bibitemsep to a larger value so that your readers can tell where an entry ends and the next one starts.

  3. As Skillom commented this comes from the draft option passed to the document class. With draft active overfull boxes will be marked with a small black rectangle (a slug) in the margin. See Latex generates pdf with black end of line.

    Fix the overfull and underfull boxes and remove the draft option.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.