I have to produce two different versions of a document: one with author-year citations, and one with numbered citations. Thus, I'm using natbib
and for each document I modify the natbib
options.
Although I can provide a width for the table's citation column, I would like it to automatically decide the width as with numbered citations its width is much smaller than needed with a author-year citation. How can I go about solving this issue (preferably automatically)?
The following is the MWE that generates this:
\begin{filecontents*}{database.bib}
@article{Somecite,
author = {First Last and Fname Lname and F.N. Somename},
title = {Title of this wonderful article},
journal = {Unknown journal},
volume = {2},
number = {5},
pages = {100--101},
year = {1901}
}
@misc{Anothercite,
author = {{Company Has A Terrible Long Abbreviation (CHATLA)}},
title = {CHATLNAA does everything for you},
howpublished = {\url{http://www.chatlnaa.com}},
year = {2017},
note = {Accessed today}
}
\end{filecontents*}
\documentclass[a4paper]{report}
\usepackage[authoryear,round,semicolon,sort]{natbib}
%\usepackage[numbers,square,comma,sort]{natbib}
\usepackage{longtable}
\usepackage{rotating}
\newcommand{\bs}{\begin{sideways}}
\newcommand{\es}{\end{sideways}}
\begin{document}
Here is some text, and we refer to \citep{Somecite}. \Citet{Anothercite} is there too. See table.
\scriptsize
\begin{longtable}{|p{2.2cm}cp{2cm}c|p{0.15cm}p{0.15cm}p{0.15cm}p{0.15cm}p{0.15cm}p{0.15cm}p{0.15cm}|}
\caption{Overview of a table with a lot of numbers.}\label{tbl:numbers} \\
\hline
Name & &Location &Number 1 & \multicolumn{7}{c|}{Items} \\
& & & &\bs Item 1 \es &\bs Item 2 \es &\bs Item 3 \es &\bs Item 4 \es &\bs Item 5 \es &\bs Item 6 \es &\bs Item 7 \es \\
\hline \endhead
\hline \endfoot
\hline \endlastfoot
A name that is short &\citep{Somecite} &Locaville &100 & &x & & & & &\\
Some name that is relatively long, but alright &\citep{Anothercite} &Abroad & 900 m & &x & & &x & &\\
\end{longtable}
\bibliographystyle{plainnat}
\bibliography{database}
\end{document}