1

I want to add this plot plot(code here) below the title on the cover page.

cover

How can i do it?

This is the source of the document.

\documentclass[10pt, twoside]{book} 
\usepackage{authblk}
    % Title, author and date
    \title{\Huge \textbf{Title}}
    \author{\textsc{John Doe}}
    \affil{Department of Mathematics}
    \date{2020}


    \begin{document}
    \frontmatter % Turns on roman numbering
    \maketitle
 \end{document}%
icebit
  • 195
  • As long as you do not show us the code that produces the current title page, it is rather hard to answer the question. Also the code you link to does not necessarily reproduce the plot you show in detail. –  Apr 29 '20 at 18:29
  • I added the code but i don't know how this could help considering that is just a basic template. – icebit Apr 29 '20 at 18:51
  • Well, it is important to know what you are using. The package authblk is not necessarily made for adding graphics at the title page. –  Apr 29 '20 at 19:00

1 Answers1

2

The authblk style does not seem to be made for this. It redefines the \maketitle command by locally redefining the tabular environment to become a center environment. One can exploit this to place the graphics. However, due to the authblk hacks, \endcenter gets executed twice so we need to take care of this, too.

\documentclass[10pt, twoside]{book} 
\usepackage{authblk}
\usepackage{pgfplots}
\pgfplotsset{compat=1.17}%<- use a smaller version if you have an older installation
% Title, author and date
\title{\Huge \textbf{Title}}
\author{\textsc{John Doe}}
\affil{Department of Mathematics}
\date{2020}

\newsavebox\myplot
\sbox\myplot{\begin{tikzpicture}
\begin{axis}[trig format plots=rad,axis lines=left,
    xtick=\empty,ytick=\empty,domain=0:4,xmin=-0.5,
    xlabel=$n$,ylabel=$X_n$,
    xlabel style={at={(ticklabel cs:1,0)}},
    ylabel style={at={(ticklabel cs:1,0)},rotate=-90,anchor=west}]
\addplot[smooth,red,dashed,very thick] {1+exp(-x)};
\addplot[smooth,red,dashed,very thick] {1-exp(-x)};
\addplot[only marks,mark=*,color=blue!70!black,samples=151] {1+exp(-x)*sin(10*x)};
\end{axis}
\path (current bounding box.north) + (0,1); % add some vertical space
\end{tikzpicture}}

\begin{document}
\begingroup
\let\oldendcenter\endcenter
\edef\mypftflag{0}%
\def\endcenter{%
\xdef\mypftflag{\the\numexpr\mypftflag+1}%
\ifnum\mypftflag>1\relax
\usebox\myplot
\fi
\oldendcenter}
\frontmatter % Turns on roman numbering

\maketitle
\endgroup

\section{pft}
\end{document}%

enter image description here