BibTeX, biblatex and biberItalics in book titles

Information and discussion about BiBTeX - the bibliography tool for LaTeX documents.
Post Reply
Loupiote3
Posts: 4
Joined: Tue Jul 31, 2018 2:47 pm

Italics in book titles

Post by Loupiote3 »

Dear all,

Please excuse me for asking this question as there is probably an easy fix but haven't been able to find it online and have been out of using Latex for a couple of months so I am a bit rusty…

I have a number of book titles with species names in them. BibTex is automatically putting my book titles in italics, which is fine. But seeing that species names are normally italicised, when they are in a title which is already in italics one is supposed to de-italicise the species name (if that makes sense). And I have no idea how to do this!

For instance, I have:

Cranial shape variation in \textit{Homo erectus}
or
Cranial shape variation in Homo erectus

which compiles as:

Cranial shape variation in Homo erectus


But I want:

Cranial shape variation in Homo erectus

Does anyone know what to do to rectify this?

Many thanks!

Recommended reading 2024:

LaTeXguide.org • LaTeX-Cookbook.net • TikZ.org

NEW: TikZ book now 40% off at Amazon.com for a short time.

User avatar
Johannes_B
Site Moderator
Posts: 4182
Joined: Thu Nov 01, 2012 4:08 pm

Italics in book titles

Post by Johannes_B »

Use emph instead of textit.
The smart way: Calm down and take a deep breath, read posts and provided links attentively, try to understand and ask if necessary.
User avatar
Johannes_B
Site Moderator
Posts: 4182
Joined: Thu Nov 01, 2012 4:08 pm

Italics in book titles

Post by Johannes_B »

Back on my computer I thought i would provide a more robust solution.

Naturally, defining a new semantic command comes to mind for this kind of stuff. So i looked up the original definition for \emph and modified it to create a new command \species.

Code: Select all

\begin{filecontents}{\jobname.bib}
@book{lion2010,
	author       = {Laura Lion and  Gabrielle Giraffe and Carl Capybara},
	title        = {The history of \species{Homo sapiens} and other stuff},
	publisher    = {publishing house},
	date         = {2010},
	keywords     = {trusted},
}
\end{filecontents}
\documentclass{article}
\usepackage[backend=biber]{biblatex}
\addbibresource{\jobname.bib}
\makeatletter
\DeclareRobustCommand\spec{\@nomath\spec \ifdim \fontdimen\@ne\font >\z@
\specinnershape \else \itshape \fi}
\newcommand\specinnershape{\upshape}%
\makeatother
\DeclareTextFontCommand{\species}{\spec}
\usepackage{xcolor}
\begin{document}
Quote: \textit{test of \species{Lalala}}
\cite{lion2010}
\printbibliography

{\renewcommand\specinnershape{\color{black!50!red}\selectfont}\itshape test \species{wombat}}
\end{document}
The smart way: Calm down and take a deep breath, read posts and provided links attentively, try to understand and ask if necessary.
Loupiote3
Posts: 4
Joined: Tue Jul 31, 2018 2:47 pm

Italics in book titles

Post by Loupiote3 »

Hi Johannes,

Sorry for this ridiculously late reply, thank you so very much for your help, that's fantastic !
Post Reply