3

I am trying to prepare my bibliography, but when I try to add some references it comes without authors of references.

Here is my main.text:

\documentclass[a4paper,12pt]{article}
\usepackage[utf8]{inputenc}
\usepackage{geometry}

\geometry{top=30mm,right=30mm,left=30mm,bottom=30mm}

\usepackage{setspace} \usepackage{anyfontsize} \usepackage{multicol} \usepackage{ragged2e} \usepackage{amsmath} \usepackage{mathptmx} \usepackage[english,turkish]{babel} \usepackage[T1]{fontenc} \usepackage{graphicx} \usepackage[style=authoryear]{biblatex} \addbibresource{biblio.bib}

\begin{document} \shorthandoff{=!} %\input{Chapters/Titlepage} %\input{Chapters/Titlepage2} %\input{Chapters/Abstract} \input{Chapters/Micromechanics of Lamina} \input{Chapters/MacroMechanics of Lamina} \input{Chapters/Macromechanical Analysis of Laminates}

\printbibliography

\end{document}

This is my bibliography, it is just for a demo right now.

@article{knuth:1984,
title={Literate Programming},
author={Donald, Knuth},
journal={The Computer Journal},
volume={27},
number={2},
pages={97--111},
year={1984},
publisher={Oxford University Press}
}

And this is the result I get:

enter image description here

moewe
  • 175,683
harschyy
  • 35
  • 3
  • Hi, with the code you've provided, the document doesn't compile. Please convert this to a minimal working example. This would involve removing any line that references an unnecessary external file (like the \input{} commands), and also any packages that are unnecessary for reproducing the problem with the bibliography. If I comment out the \input{} commands, I still can't get this to compile—the cause seems to be to do with the babel and shorthand lines. – baileythegreen Mar 31 '22 at 21:04
  • For what it's worth, when I comment out the babel line entirely, the document compiles, and the author name is there. So, at least it's not missing information, just a weird interaction between commands. – baileythegreen Mar 31 '22 at 21:07
  • Hi, thanks for the reply. When I write the paragraph without Turkish Babel, it doesn't fit within the page boundaries and no justifies. How can I find a solution to this? – harschyy Mar 31 '22 at 21:36
  • 1
    I'm sorry, I don't know. I don't have experience with babel, or LaTeX in Turkish. I just thought I would include those details here in case they help someone else hone in on the problem. I would suggest maybe putting babel or Turkish into the question title, since that is part of the problem. That might help attract people who have a better idea. – baileythegreen Mar 31 '22 at 21:40

1 Answers1

6

The problem here are babel-turkish's shorthand settings. babel-turkish makes = active, which brakes many key-value packages. Since biblatex uses key-value syntax for names, those error and will not show.

In the example the problematic shorthands for != are disabled after \begin{document}, but that is slightly too late for biblatex, as it reads the .bbl file (which contains all the bibliographic data, amongst them names) at \begin{document}.

With the new hook management system we can fine-tune the placement of \shorthandoff within \begin{document}.

\documentclass[a4paper,12pt]{article}
\usepackage[utf8]{inputenc}
\usepackage[english,turkish]{babel}
\usepackage[T1]{fontenc}
\usepackage[style=authoryear]{biblatex}
\addbibresource{biblatex-examples.bib}

\AtBeginDocument[biblatex/shorthands]{% \shorthandoff{=!}% }

\DeclareHookRule{begindocument}{biblatex/shorthands}{before}{biblatex}

\begin{document} Lorem \autocite{sigfridsson}

\printbibliography \end{document}

Lorem (Sigfridsson ve Ryde 1998)

Another way to resolve this problem would be to use the shorthands option to explicitly enable those shorthands that we want. Turkish sets :, = and !. If we disable != we're left with :, so we say shorthands=:. If you don't even want an active colon, go with shorthands=off.

\documentclass[a4paper,12pt]{article}
\usepackage[utf8]{inputenc}
\usepackage[english, turkish, shorthands=:]{babel}
\usepackage[T1]{fontenc}
\usepackage[style=authoryear]{biblatex}
\addbibresource{biblatex-examples.bib}

\begin{document} Lorem \autocite{sigfridsson}

\printbibliography \end{document}

moewe
  • 175,683
  • See also https://tex.stackexchange.com/q/160385/35864, https://tex.stackexchange.com/a/627908/35864, https://tex.stackexchange.com/q/637450/35864. – moewe Apr 01 '22 at 05:44
  • Hi, thanks for the reply. I found your second solution in babel documentation. It works very well. Thanks :). – harschyy Apr 01 '22 at 07:51