General ⇒ apalike bibliography style comes out w/ no parenthesis
apalike bibliography style comes out w/ no parenthesis
pdfTeXk, Version 3.141592-1.40.3 (Web2C 7.5.6). Newly installed on Ubuntu linux system.
In the past, and as I've seen documented, apalike bibliography style worked as documented. Now it's now producing output of the citation in text with no parenthasis, like this: Smith et al. 2008, rather than (Smith et al., 2008). Below I've pasted the apalike.sty file I'm using. Could there be a problem with this file? How best to resolve? Simple modification to that file or could there more a more insidious problem here.
Next, when using \ref to reference Table numbers in same article document, the Table numbers I'm getting with \ref{tab:string} linked to the \label{string} in table environment are always exactly equal to the number of \section that I have in the document.
Thanks in advance.
Mike
% apalike.sty style, used in conjunction with apalike.bst,
% will produce an apa-like bibliography style:
%
% 1) Bibliography entries formatted alphabetically, last name
% first, each entry having a hanging indentation and no label.
% 2) References in the following formats:
% (Author, 1986)
% (Author and Author, 1986)
% (Author et al., 1986).
% 3) Multiple references in the form (Author1, 1986; Author2, 1987)
%
% To be used as an optional argument to the \documentstyle command; for example
% \documentstyle[11pt,apalike]{book}
%
% 16-Sep-86, original version by Susan King and Oren Patashnik.
% 13-Oct-87 changes:
% Fixed bug in last line by adding the {} that disappeard when
% the \hbox{} was removed from the pre-APALIKE definition;
% added club and widow penalties;
% patched the \newblock LaTeX bug from `-.07em' to simply `.07em';
% and made this work for document styles that don't define `chapter'.
%
%
% Use parens instead of brackets for \cite, and no label in the bibliography
%
\def\@cite#1#2{#1\if@tempswa , #2\fi}
\def\@biblabel#1{}
% Set length of hanging indentation for bibliography entries
%
\newlength{\bibhang}
\setlength{\bibhang}{2em}
% \thebibliography environment depends on whether or not `chapter's can exist
%
\@ifundefined{chapter}{\def\thebibliography#1{\section*{References\@mkboth
{REFERENCES}{REFERENCES}}\list
{\relax}{\setlength{\labelsep}{0em}
\setlength{\itemindent}{-\bibhang}
\setlength{\leftmargin}{\bibhang}}
\def\newblock{\hskip .11em plus .33em minus .07em}
\sloppy\clubpenalty4000\widowpenalty4000
\sfcode`\.=1000\relax}}%
{\def\thebibliography#1{\chapter*{Bibliography\@mkboth
{BIBLIOGRAPHY}{BIBLIOGRAPHY}}\list
{\relax}{\setlength{\labelsep}{0em}
\setlength{\itemindent}{-\bibhang}
\setlength{\leftmargin}{\bibhang}}
\def\newblock{\hskip .11em plus .33em minus .07em}
\sloppy\clubpenalty4000\widowpenalty4000
\sfcode`\.=1000\relax}}
% `; ' goes between cites, and there's no \hbox around individual cites
%
\def\@citex[#1]#2{\if@filesw\immediate\write\@auxout{\string\citation{#2}}\fi
\def\@citea{}\@cite{\@for\@citeb:=#2\do
{\@citea\def\@citea{; }\@ifundefined
{b@\@citeb}{{\bf ?}\@warning
{Citation `\@citeb' on page \thepage \space undefined}}%
{\csname b@\@citeb\endcsname}}}{#1}}
Learn LaTeX easily with newest books:
The LaTeX Beginner's Guide: 2nd edition and perfect for students writing a thesis
The LaTeX Cookbook: 2nd edition full of practical examples for mathematics, physics, chemistry, and more
LaTeX Graphics with TikZ: the first book about TikZ for perfect drawings in your LaTeX thesis
apalike bibliography style comes out w/ no parenthesis
It seems to me that apalike.sty is an obsolete package. You should load natbib. This package provides commands to obtain different styles of citation. You may need the \citep command. Read the documentation.rawlins02 wrote: In the past, and as I've seen documented, apalike bibliography style worked as documented. Now it's now producing output of the citation in text with no parenthasis, like this: Smith et al. 2008, rather than (Smith et al., 2008). Below I've pasted the apalike.sty file I'm using. Could there be a problem with this file? How best to resolve? Simple modification to that file or could there more a more insidious problem here.
Surely you have written the \label command before \caption. Just write \label after \caption:rawlins02 wrote: Next, when using \ref to reference Table numbers in same article document, the Table numbers I'm getting with \ref{tab:string} linked to the \label{string} in table environment are always exactly equal to the number of \section that I have in the document.
Code: Select all
\begin{table}[table_placement]
\centering
\begin{tabular}{column_descriptors}
tabular stuff
\end{tabular}
\caption{Text} \label{tab:mylabel}
\end{table}
apalike bibliography style comes out w/ no parenthesis
As for Tables problem no, I correctly have \label after \caption:
Code: Select all
\documentclass [12pt] {article}
\usepackage{graphicx}
\usepackage{array,alltt,amsmath,rotating}
\usepackage{setspace} % make document double space
%\usepackage{cite} % allow latex to break citations to avoid overfull
\sloppy % allow wide inter-word spacing
\usepackage{indentfirst}
\usepackage{tabularx}
\usepackage{natbib}
\doublespacing
\begin{document}
\section{Introduction}
Figure~\ref{fig:Q36_99}
Figure~\ref{fig:Q36_65}a, Table~\ref{tab:seasonalQ}
Figure~\ref{fig:Q36_65}b, Table~\ref{tab:seasonalQ}
Figure~\ref{fig:Q2periods}
Figure~\ref{fig:prcp_annQ_trends}
% **** UNCOMMENTING SOME OF THESE SECTION CALLS WILL SHOW HOW
% **** THE TABLE NUMBER PRODUCED WITH \ref{tab:string} IS SHOWN
% **** AS THE SAME NUMBER OF SECTION CALLS. THE ABOVE CALL
% **** \ref{tab:seasonalQ} IS PRODUCING A '3' RIGHT NOW.
%\section{Annual and Seasonal River Discharge} \label{sec:discharge}
%\section{Precipitation and Discharge Trends Across Subbasins of the OYL}
%\section{X}
%\section{Y}
%\section{Z}
\section{Conclusions} \label{sec:conclusions}
\section{Acknowledgments}
\bibliographystyle{plainnat}
%\bibliographystyle{amsplain}
\bibliography{../biblio}
\clearpage
\begin{figure}
\begin{center}
\includegraphics*[keepaspectratio=true,width=0.65\hsize,angle=270,draft=false] {example.eps}
\end{center}
\caption{}
\label{fig:Q36_99}
\end{figure}
\begin{figure}
\begin{center}
\includegraphics*[keepaspectratio=true,width=0.6\hsize,angle=270,draft=false] {example.eps}
\end{center}
\caption{}
\label{fig:Q36_65}
\end{figure}
\begin{figure}
\begin{center}
\includegraphics*[keepaspectratio=true,width=0.7\hsize,angle=270,draft=false] {example.eps}
\end{center}
\caption{}
\label{fig:Q2periods}
\end{figure}
\begin{table} [p]
\begin{center}
\begin{tabular}{|l|r@{.}l|r@{.}l|r@{.}l|r@{.}l|r@{.}l|r@{.}l|}
\hline
\multicolumn{1}{|l|} { } &
\multicolumn{6}{c|} {1936--1965} &
\multicolumn{6}{c|} {1966--1995} \\ % \hline
\multicolumn{1}{|l|} {River Basin} &
\multicolumn{2}{c|} {Winter} &
\multicolumn{2}{c|} {Spring} &
\multicolumn{2}{c|} {Summ./Fall} &
\multicolumn{2}{c|} {Winter} &
\multicolumn{2}{c|} {Spring} &
\multicolumn{2}{c|} {Summ./Fall} \\ \hline \hline
%%& (mm yr$^{-1}$) & (mm yr$^{-1}$) & (mm yr$^{-1}$) & (year) & (mm yr$^{-1}$) \\ \hline
Ob & 0&10 & 0&06 & $-$0&25 & 0&14 & \textbf{0}&\textbf{16} & \textbf{$-$0}&\textbf{66} \\ \hline
Yenisey & $-$0&05 & $-$0&23 & $-$0&26 & \textbf{0}&\textbf{63} & 0&36 & $-$0&09 \\ \hline
Lena & \textbf{0}&\textbf{13} & 0&14 & 0&27 & \textbf{0}&\textbf{24} & $-$0&06 & $-$0&20 \\ \hline
Combined & \textbf{$-$0}&\textbf{06} & $-$0&01 & $-$0&10 & \textbf{0}&\textbf{33} & 0&16 & \textbf{$-$0}&\textbf{34} \\ \hline
\end{tabular}
%\end{center}
\caption{}
\end{center}
\label{tab:seasonalQ}
%\end{sidewaystable}
\end{table}
\begin{figure}
\begin{center}
\includegraphics*[keepaspectratio=true,width=0.8\hsize,angle=270,draft=false] {example.eps}
\end{center}
\caption{}
\label{fig:prcp_annQ_trends}
\end{figure}
\end{document}
apalike bibliography style comes out w/ no parenthesis
Sorry, but you haven't correctly \label after \caption, since the former is inside a center environment and the latter is outside it. Follow the scheme I gave above. Put \label right after \caption. It is also better to use \centering instead of the center environment (this saves vertical space).rawlins02 wrote: As for Tables problem no, I correctly have \label after \caption:Code: Select all
................. \begin{table} [p] \begin{center} \begin{tabular}{|l|r@{.}l|r@{.}l|r@{.}l|r@{.}l|r@{.}l|r@{.}l|} (tabular stuff removed) \end{tabular} %\end{center} \caption{} \end{center} \label{tab:seasonalQ} %\end{sidewaystable} \end{table}
apalike bibliography style comes out w/ no parenthesis
Can you please suggest how to improve this table. There are 7 columns. I see, as I intended, left justified for columns 1 and 2 and center (decimal aligned) for columns 3 and 4. Column 5 also OK. How do I make numerical values line up under the column headings for columns 6 and 7, which are also to be decimal aligned. I also can't seem to get the missing vertical lines on right side of table headings. Any other general suggestions to improve appearance greatly appreciated. Apologies if not starting a separate thread is incorrect here...
Code: Select all
\begin{table} [p]
\centering
\begin{tabular}{|llr@{.}lr@{.}lrr@{.}lr@{.}l|}
\hline
{Station Name} & Basin & \multicolumn{2}{c}{Lat} & \multicolumn{2}{c}{Lon} & Area & \multicolumn{2}{c}{TrendP} & \multicolumn{2}{c}{TrendQ} \\
& & \multicolumn{2}{c}{$^{\circ}N$} & \multicolumn{2}{c}{$^{\circ}E$} & km$^{2}$ & \multicolumn{2}{c}{mm season$^{-2}$} & \multicolumn{2}{c}{mm season$^{-2}$} \\ \hline \hline
Tom' At Tomsk & Ob & 56&50 & 84&92 & 57000 & 1&35 & -2&83 \\
Katun' At Srostky & Ob & 152&42 & 185&72 & 58400 & -2&01 & -1&11\\
\end{tabular}
\caption{Caption text...} \label{tab:riversubbasins}
\end{table}
apalike bibliography style comes out w/ no parenthesis
Whether or not you use vertical lines, you may try to get a not so tight table, increasing the vertical space between rows. Just before \begin{tabular} add \renewcommand{\arraystretch}{1.4}. By default this parameter is 1. The greater its value is, the more space between rows you get. See also the \extrarowheight length defined in the array package.
- localghost
- Site Moderator
- Posts: 9202
- Joined: Fri Feb 02, 2007 12:06 pm
apalike bibliography style comes out w/ no parenthesis
Code: Select all
\documentclass[11pt,a4paper]{article}
\usepackage[T1]{fontenc}
\usepackage[latin1]{inputenc}
\usepackage[font=small,labelfont=bf]{caption}
\usepackage[centering,includeheadfoot,margin=2cm]{geometry}
\usepackage{array,booktabs,dcolumn,textcomp}
\parindent0em
\newcolumntype{d}{D{.}{.}{-2}}
\begin{document}
\begin{table}[!p]
\centering
\caption{Caption text...} \label{tab:riversubbasins}
\begin{tabular}{llddcdd} \toprule
Station Name & Basin & \multicolumn{1}{c}{Lat} & \multicolumn{1}{c}{Lon} & Area & \multicolumn{1}{c}{TrendP} & \multicolumn{1}{c}{TrendQ} \\
& & \multicolumn{1}{c}{\textdegree N} & \multicolumn{1}{c}{\textdegree E} & \multicolumn{1}{c}{km\textsuperscript{2}} & \multicolumn{1}{c}{mm season\textsuperscript{-2}} & \multicolumn{1}{c}{mm season\textsuperscript{-2}} \\ \midrule[1pt]
Tom' At Tomsk & Ob & 56.50 & 84.92 & 57000 & 1.35 & -2.83 \\ \midrule
Katun' At Srostky & Ob & 152.42 & 185.72 & 58400 & -2.01 & -1.11 \\ \bottomrule
\end{tabular}
\end{table}
\end{document}
Best regards and welcome to the board
Thorsten¹
Board Rules
Avoidable Mistakes
¹ System: TeX Live 2025 (vanilla), TeXworks 0.6.10
Re: apalike bibliography style comes out w/ no parenthesis
Mike