LaTeX forum ⇒ BibTeX, biblatex and biberItalics in book titles

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

Italics in book titles

Postby Loupiote3 » Tue Jan 29, 2019 2:46 pm

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!

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

Postby Johannes_B » Tue Jan 29, 2019 3:19 pm

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: 4044
Joined: Thu Nov 01, 2012 4:08 pm

Postby Johannes_B » Wed Jan 30, 2019 9:05 am

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.

  1. \begin{filecontents}{\jobname.bib}
  2. @book{lion2010,
  3. author = {Laura Lion and Gabrielle Giraffe and Carl Capybara},
  4. title = {The history of \species{Homo sapiens} and other stuff},
  5. publisher = {publishing house},
  6. date = {2010},
  7. keywords = {trusted},
  8. }
  9. \end{filecontents}
  10. \documentclass{article}
  11. \usepackage[backend=biber]{biblatex}
  12. \addbibresource{\jobname.bib}
  13. \makeatletter
  14. \DeclareRobustCommand\spec{\@nomath\spec \ifdim \fontdimen\@ne\font >\z@
  15. \specinnershape \else \itshape \fi}
  16. \newcommand\specinnershape{\upshape}%
  17. \makeatother
  18. \DeclareTextFontCommand{\species}{\spec}
  19. \usepackage{xcolor}
  20. \begin{document}
  21. Quote: \textit{test of \species{Lalala}}
  22. \cite{lion2010}
  23. \printbibliography
  24.  
  25. {\renewcommand\specinnershape{\color{black!50!red}\selectfont}\itshape test \species{wombat}}
  26. \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

Postby Loupiote3 » Mon Feb 25, 2019 11:22 pm

Hi Johannes,

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


Return to “BibTeX, biblatex and biber”

Who is online

Users browsing this forum: No registered users and 1 guest