Evitar saltos de línea en el título de la figura

Evitar saltos de línea en el título de la figura

Tengo la siguiente figura con el título correspondiente:ingrese la descripción de la imagen aquí

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 agsmestilo de bibliografía, que se distribuye con el harvardpaquete de gestión de citas y (ii) cargando el natbibpaquete en lugar del paquete, también harvarddebe cargar el paquete. har2natComo su nombre indica, "traduce" varias macros definidas por el harvardpaquete (y que se utilizan en ) en macros agsm.bstequivalentes .natbib

  • Actualmente estás cargando el natbibpaquete con las opciones numbers, sorty authoryear. Deberías descartar las dos primeras opciones: el agsmestilo 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; la sortopción sólo tiene sentido si numberses el estilo de llamada.

  • Ahora al punto principal de su consulta: debe escribir el \captioncomando 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 \labelinstrucción debe venirdespuéslas \captioninstrucciones, 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 \centeringdirectiva en su lugar.

ingrese la descripción de la imagen aquí

\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}

información relacionada