
Tengo la siguiente figura con el título correspondiente:
Como puede ver, el título rompe la línea de manera inapropiada, lo cual quiero evitar. De manera óptima, sin simplemente reducir el tamaño de fuente del texto del título.
Codifique de la siguiente manera:
\documentclass[12pt, a4paper] {article}
\usepackage[skip=10pt, labelfont=bf, labelsep=space]{caption}
\usepackage{tikz}
\usepackage[numbers,sort,authoryear]{natbib}
\hypersetup{hidelinks=true}
\begin{document}
\newcommand{\mytab}[1]{%
\begin{tabular}{@{}c@{}}
#1
\end{tabular}
}
\begin{figure} [h!]
\label{fig: timeline}
\begin{center}
\begin{tikzpicture}
\draw (0,0) -- (11,0);
\foreach \x in {0.8,4,5.5,7,10.2}
\draw(\x cm,3pt) -- (\x cm, -3pt);
\draw (0.8,0) node[below=3pt] {$T_0$};
\draw (4,0) node[below=3pt] {$T_1$};
\draw (5.5,0) node[below=3pt] {$0$};
\draw (7,0) node[below=3pt] {$T_2$};
\draw (10.2,0) node[below=3pt] {$T_3$};
\draw (2.35,0) node[above=12pt, align=center] {
$\left(\mytab{estimation \\ window}\right]$};
\draw (5.5,0) node[above=12pt, align=center]{
$\left(\mytab{event \\ window}\right]$};
\draw(8.65,0) node[above=12pt, align=center]{
$\left(\mytab{post-event \\ window}\right]$};
\end{tikzpicture}
\end{center}
\caption{Time Line for an Event Study (\cite{campbell1996}, p. 157})
\end{figure}
\bibliographystyle{agsm}
\bibliography{./references}
\end{document}
¡Gracias por tu ayuda!
Respuesta1
Varios comentarios:
Dado que está (i) utilizando el
agsm
estilo de bibliografía, que se distribuye con elharvard
paquete de gestión de citas y (ii) cargando elnatbib
paquete en lugar del paquete, tambiénharvard
debe cargar el paquete.har2nat
Como su nombre indica, "traduce" varias macros definidas por elharvard
paquete (y que se utilizan en ) en macrosagsm.bst
equivalentes .natbib
Actualmente estás cargando el
natbib
paquete con las opcionesnumbers
,sort
yauthoryear
. Deberías descartar las dos primeras opciones: elagsm
estilo está pensado para llamadas de citas al estilo del año del autor; no tiene sentido intentar usarlo con llamadas de citas de estilo numérico; lasort
opción sólo tiene sentido sinumbers
es el estilo de llamada.Ahora al punto principal de su consulta: debe escribir el
\caption
comando como\caption{Time Line for an Event Study \citep[p.~157]{campbell1996}}
Tenga en cuenta el uso del
~
carácter ("empate"), que actúa como un carácter de espacio irrompible.Dos puntos menores: (i) La
\label
instrucción debe venirdespuéslas\caption
instrucciones, especialmente si desea poder hacer una referencia cruzada de la figura en otra parte del documento. (ii) El uso de\begin{center}...\end{center}
agrega muchos espacios en blanco (verticales); utilice la\centering
directiva en su lugar.
\documentclass[12pt, a4paper]{article}
\usepackage{filecontents}
\begin{filecontents}{references.bib}
@book{campbell1996,
author = "John Y. Campbell and Andrew W. Lo and A. Craig McKinlay",
title = "The Econometrics of Financial Markets",
year = 1996,
publisher = "Princeton University Press",
address = "Princeton NJ",
}
\end{filecontents}
\usepackage[skip=10pt, labelfont=bf, labelsep=space]{caption}
\usepackage{tikz}
\usepackage[authoryear]{natbib}
\usepackage{har2nat}
\usepackage{hyperref}
\hypersetup{hidelinks=true}
\newcommand{\mytab}[1]{%
\begin{tabular}{@{}c@{}}
#1
\end{tabular}
}
\begin{document}
\begin{figure} [h!]
\centering
\begin{tikzpicture}
\draw (0,0) -- (11,0);
\foreach \x in {0.8,4,5.5,7,10.2}
\draw(\x cm,3pt) -- (\x cm, -3pt);
\draw (0.8,0) node[below=3pt] {$T_0$};
\draw (4,0) node[below=3pt] {$T_1$};
\draw (5.5,0) node[below=3pt] {$0$};
\draw (7,0) node[below=3pt] {$T_2$};
\draw (10.2,0) node[below=3pt] {$T_3$};
\draw (2.35,0) node[above=12pt, align=center] {
$\left(\mytab{estimation \\ window}\right]$};
\draw (5.5,0) node[above=12pt, align=center]{
$\left(\mytab{event \\ window}\right]$};
\draw(8.65,0) node[above=12pt, align=center]{
$\left(\mytab{post-event \\ window}\right]$};
\end{tikzpicture}
\caption{Time Line for an Event Study \protect\citep[p.~157]{campbell1996}}
\label{fig:timeline}
\end{figure}
A cross-reference to \autoref{fig:timeline}.
\bibliographystyle{agsm}
\bibliography{./references}
\end{document}