Text FormattingDistinguish reference text

Information and discussion about LaTeX's general text formatting features (e.g. bold, italic, enumerations, ...)
Post Reply
vinp
Posts: 12
Joined: Thu Dec 30, 2010 10:25 am

Distinguish reference text

Post by vinp »

Hi,

I am using a reference style mandated by the university for my thesis report. According to this style, the names of authors appear at the place of a citation, along with the year. This causes a problem, as often the reference text interrupts the intended flow of the paragraph, or even interferes with the sentence construct. I would like to distinguish the reference text by means of font or a mechanism such as highlighting, so that the reader could easily make out reference text from the main text. Can anyone suggest a way for doing this?

TIA
Vin

Recommended reading 2024:

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

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

5gon12eder
Posts: 126
Joined: Sun Feb 13, 2011 8:36 pm

Distinguish reference text

Post by 5gon12eder »

How are the citations managed? Using bibtex and natbib?
I'm using pdfTeX, Version 3.1415926-1.40.10 (TeX Live 2009/Debian).
vinp
Posts: 12
Joined: Thu Dec 30, 2010 10:25 am

Re: Distinguish reference text

Post by vinp »

bibtex
5gon12eder
Posts: 126
Joined: Sun Feb 13, 2011 8:36 pm

Distinguish reference text

Post by 5gon12eder »

The easiest way I can think of is to use the hyperref package with the colorlinks option.

More complex, the natbib package allows you to do quite a lot. It has a formatting macro \citenumfont handy but I don't know about an equivalent for author-year style citations. However, you may do this yourself. You can use the etoolbox package to perpend arbitrary code to a macro. Unfortunately, after spending more time on this issue than I should have, I could not manage to successfully hook to the end of a \cite command to restore the style. The foolhardy solution is to put curly braces around all your \cites.

Here is a complete example:

Code: Select all

\begin{filecontents}{references.bib}
  @book{Goossens93,
    author    = "Goossens, Michel and Mittlebach, Frank and Samarin, Alexander",
    year      = "1993",
    title     = "The \LaTeX{} Companion",
    publisher = "Addison-Wesley",
    address   = "Reading, Massachusetts"
  }
\end{filecontents}

\documentclass{article}
\usepackage[T1]{fontenc}
\usepackage{natbib}
\usepackage{color}
\usepackage{etoolbox}
%\usepackage[colorlinks]{hyperref}% as an alternative to the demonstrated approach

\newcommand\citationformat{\color{blue}}% or whatever...
\preto\citep{\citationformat}

\begin{document}
  Lorem ipsum dolor sit amet, consectetur adipiscing elit. Morbi
  convallis, tortor non imperdiet tincidunt, ligula mauris eleifend
  mauris, in malesuada massa elit eget nunc {\citep{Goossens93}}. Nunc
  vel dui vitae elit interdum laoreet.
  
  \bibliographystyle{plainnat}
  \bibliography{references}
\end{document}
Best
I'm using pdfTeX, Version 3.1415926-1.40.10 (TeX Live 2009/Debian).
Post Reply