You can move the \bibliographystyle
to the preamble or whatever, so it is easier to switch out.
That much is unobjectionable. However, everything suggested below this point is subject to a large caveat:
If you are submitting source - as opposed to PDF - you should
not do this as it will only annoy. In particular, it will piss off copy editors no end. They do not want a highly
customised preamble and a body which uses a bunch of user-defined
macros.
Caveat emptor
You could handle the tabular in this way by providing a command which will not overwrite an existing definition, but only supply a default if none is defined.
\documentclass{IEEEtran}
\providecommand\tbl[2]{%
\caption{#1}%
#2}
\bibliographystyle{IEEEtran}
\begin{document}
\begin{table}[htbp]
\centering
\tbl{My Table Title \label{tab:label1}}{
\begin{tabular}{|l|l|}\hline
Key & Value \cite{Lastname2010title} \\\hline
\end{tabular}
}
\end{table}
% Currently I have to use this
Lastname et al. \cite{Lastname2010title} present a technique.
\bibliography{\jobname}
\end{document}
produces
Switching classes means we need to alter the preamble to use the relevant bibliography style, but the \providecommand
can stay. We don't need it, but it does no harm. (It will result in an infinitesimal increase in compilation time as TeX will read the code, but it will not make any difference to the compiled result.)
We also still need to change \cite
to \citeN
etc. as applicable.
\documentclass{acmsmall}
\providecommand\tbl[2]{%
\caption{#1}%
#2}
\bibliographystyle{ACM-Reference-Format-Journals}
\begin{document}
\begin{table}[htbp]
\centering
\tbl{My Table Title \label{tab:label1}}{
\begin{tabular}{|l|l|}\hline
Key & Value \cite{Lastname2010title} \\\hline
\end{tabular}
}
\end{table}
\citeN{Lastname2010title} present a technique.
\bibliography{\jobname}
\end{document}
produces
Note that you could obviously \providecommand
for \citeN
, too. But you would still need to change the structure of the text in that case.
You could work around this by defining a custom citation command, \myciteN{}{}
which does something different, depending on which class is loaded. For example, using etoolbox
for testing whether \citeN
is defined,
\documentclass{acmsmall}
\usepackage{etoolbox}
\providecommand\tbl[2]{%
\caption{#1}%
#2}
\providecommand\myciteN[2]{%
\ifundef\citeN{%
#1 \cite{#2}%
}{%
\citeN{#2}%
}%
}
\bibliographystyle{ACM-Reference-Format-Journals}
\begin{document}
\begin{table}[htbp]
\centering
\tbl{My Table Title \label{tab:label1}}{
\begin{tabular}{|l|l|}\hline
Key & Value \cite{Lastname2010title} \\\hline
\end{tabular}
}
\end{table}
\myciteN{Lastname et al.}{Lastname2010title} present a technique.
\bibliography{\jobname}
\end{document}
produces
while merely changing the class and the bibliography style in the preamble as follows
\documentclass{IEEEtran}
\usepackage{etoolbox}
\providecommand\tbl[2]{%
\caption{#1}%
#2}
\providecommand\myciteN[2]{%
\ifundef\citeN{%
#1 \cite{#2}%
}{%
\citeN{#2}%
}%
}
\bibliographystyle{IEEEtran}
\begin{document}
\begin{table}[htbp]
\centering
\tbl{My Table Title \label{tab:label1}}{
\begin{tabular}{|l|l|}\hline
Key & Value \cite{Lastname2010title} \\\hline
\end{tabular}
}
\end{table}
\myciteN{Lastname et al.}{Lastname2010title} present a technique.
\bibliography{\jobname}
\end{document}
now produces
This means that you can write, for example,
\documentclass{IEEEtran}
% \documentclass{acmsmall}
\usepackage{etoolbox}
\providecommand\tbl[2]{%
\caption{#1}%
#2}
\providecommand\myciteN[2]{%
\ifundef\citeN{%
#1 \cite{#2}%
}{%
\citeN{#2}%
}%
}
\bibliographystyle{IEEEtran}
% \bibliographystyle{ACM-Reference-Format-Journals}
\begin{document}
\begin{table}[htbp]
\centering
\tbl{My Table Title \label{tab:label1}}{
\begin{tabular}{|l|l|}\hline
Key & Value \cite{Lastname2010title} \\\hline
\end{tabular}
}
\end{table}
\myciteN{Lastname et al.}{Lastname2010title} present a technique.
\bibliography{\jobname}
\end{document}
and merely comment/uncomment the class line and one preamble line to switch between formats.
Best Answer
Almost all the bibliographic BibTeX styles show the article title. You must have many of them already installed in you TeX distribution. Try simply to change
spphys
withplain
oralpha
,vancouver
,chicago
etc. For a complete list of available styles in you hard disk, you only need search files with.bst
extension.Help for Choosing a BibTeX Style by examples can be obtained of the Web here and there.Or you can search those that meet your requirements playing with a minimal working example (MWE):