3

This is my first question to any StackExchange ever so please bear with me! I am writing my thesis using two fonts, a serif font for the main text and a sans-serif font for the captions for tables and figures. Some of these captions contain in-line citations that have an `et al.' in them - however, instead of following the sans-serif font of the caption, they retain the serif font. A minimum example is shown below (and the code to generate it).

enter image description here

\documentclass{article}

%Temporary Bibliography
\usepackage{filecontents}
\begin{filecontents}{\jobname.bib}
@book{alberts_2008,
  place={New York}, 
  title={Molecular Biology of the Cell}, 
  publisher={Garland Science}, 
  author={Alberts, Bruce and others}, 
  year={2008}
}
\end{filecontents}
\immediate\write18{bibtex \jobname}

%Load packages
\usepackage{booktabs}
\usepackage{fontspec}
\usepackage[colon, authoryear]{natbib}

%Set fonts
\setromanfont{Times New Roman}
\setsansfont{Helvetica}

%Define Caption Options
\usepackage[labelfont={bf,sf,singlespacing},
                textfont={sf,singlespacing},
                justification={justified,RaggedRight},
                singlelinecheck=false,
                margin=0pt]{caption}

\begin{document}
The quick brown fox jumps over the lazy dog \citep{alberts_2008}.

\begin{table}
\caption{Sample data}
\centering
\begin{tabular}{ccc}
Sample & A    & B   \\
One    & 7.5  & 5.5 \\
Two    & 3.45 & 3.4
\end{tabular}
\caption*{

From \citep{alberts_2008}}
\end{table}

%Print Bibliography
\bibliographystyle{cell}
\bibliography{\jobname}
\end{document}

I am open to any type of solution! Also, thanks to the advice of some posters, I have cleaned up this example quite a bit.

5
  • Welcome! Please post your example in your question here so that your question does not depend on external links (which are likely to change or disappear in the future and which people are less likely to bother looking at). – cfr Jun 12 '17 at 1:46
  • Thanks! I updated the post with some code, but it might be easier to check the overleaf link. – crastogi Jun 12 '17 at 2:07
  • I wouldn't use that class if I were you (and I've only read 4 random lines). – cfr Jun 12 '17 at 4:03
  • I support @cfr's assessment of the (lack of) quality of the document class. The first few lines alone are highly problematic. You're going experience lots and lots of pointless frustration. – Mico Jun 12 '17 at 5:18
  • I have updated the example with a properly working example that has the same issue. Hopefully, this helps in diagnosing the issue. Thanks! – crastogi Jun 14 '17 at 5:25
2

In case you are not bound to use bibtex, you could circumvent the problem by using biblatex:

\documentclass{article}

%Temporary Bibliography
\usepackage{filecontents}
\begin{filecontents}{\jobname.bib}
@book{alberts_2008,
  place={New York}, 
  title={Molecular Biology of the Cell}, 
  publisher={Garland Science}, 
  author={Alberts, Bruce and others}, 
  year={2008}
}
\end{filecontents}

\usepackage[natbib=true, style=authoryear, giveninits=true]{biblatex}
\DeclareFieldFormat{title}{#1}
\addbibresource{\jobname.bib}

%Define Caption Options
\usepackage[labelfont={bf,sf,singlespacing},
                textfont={sf,singlespacing},
                justification={justified,RaggedRight},
                singlelinecheck=false,
                margin=0pt]{caption}

\begin{document}
The quick brown fox jumps over the lazy dog \citep{alberts_2008}.

\begin{table}
\caption{Sample data}
\centering
\begin{tabular}{ccc}
Sample & A    & B   \\
One    & 7.5  & 5.5 \\
Two    & 3.45 & 3.4
\end{tabular}
\caption*{From \citep{alberts_2008}}
\end{table}

%%Print Bibliography
\printbibliography
\end{document}

enter image description here

0

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.