0

I would like the figure envirement to be put on the top of this page, but whatever I do it remains at the middle of the page...

here is the preamble:

\documentclass[a4paper,12pt,two side]{book}

\usepackage[a4paper,width=160mm,top=5mm,bottom=50mm,bindingoffset=6mm]{geometry}

\usepackage{url}
\usepackage[utf8]{inputenc}
\usepackage[greek]{babel}
\usepackage{amsthm}
\usepackage{amssymb}
\usepackage{amsmath}
\usepackage{graphicx}
\usepackage{thmtools, thm-restate}
\usepackage{fancyhdr}
\usepackage{lipsum}
\usepackage[LGR, T1]{fontenc}
\usepackage{alphabeta}
\usepackage{enumitem}
\usepackage{csquotes}
\usepackage{tipa}


\usepackage{biblatex}

\usepackage{float}
\usepackage{authblk}
\usepackage{dirtytalk}
\usepackage{epigraph}
\usepackage{wrapfig}
\usepackage{caption}
\usepackage{subcaption}

\usepackage{fourier-orns}


\addbibresource{reffence.bib}


\renewcommand\headrule{%
\vspace{-6pt}
\hrulefill
\raisebox{-2.1pt}
{\quad\decofourleft\decotwo\decofourright\quad}%
\hrulefill}









\usepackage{graphicx,tipa}% http://ctan.org/pkg/{graphicx,tipa}
\newcommand{\arc}[1]{{%
  \setbox9=\hbox{#1}%
  \ooalign{\resizebox{\wd9}{\height}{\texttoptiebar{\phantom{A}}}\cr#1}}}

\newtheorem{remark}{Παρατήρηση}[section]
\newtheorem{theorem}{Θεώρημα}[section]
\newtheorem{lemma}{Λήμμα}[section]
\newtheorem{corollary}{Πόρισμα}[section]


\newcounter{example}[section]
\newenvironment{example}[1][]{\refstepcounter{example}\par\medskip
   \noindent \textbf{Παράδειγμα~\theexample. #1} \rmfamily}{\medskip}




\fancyhf{}

\setlength{\headheight}{95pt}
\fancyfoot[CE, CO]{\textbf{\thepage}}

\pagestyle{fancy}



\lhead{\includegraphics[width=0.9\textwidth]{logometitlo2.png}}


\graphicspath{{images/}}

And here the figure I cannot fix.....

\begin{figure}[pt]
     \centering
     \begin{subfigure}[b]{0.45\textwidth}
         \centering
         \includegraphics[width=\textwidth]{notglobalrigidspiti.png}
         \caption{}
         \label{notglobalrigidspiti}
     \end{subfigure}
     \hfill
     \begin{subfigure}[b]{0.5\textwidth}
         \centering
         \includegraphics[width=0.7\textwidth]{alexandrovrigidity.png}
         \caption{}
         \label{alexandrovrigiditysxima}
     \end{subfigure}
     \caption{}

 \end{figure}

problematic figure...

How can I put the figure on the top of the page?

2
  • 2
    unrelated but the option is twoside the version two side that you have only works by an accident of the implementation (and may not work in classes using newer option handlers) Feb 19, 2022 at 17:53
  • 3
    a figure can only use t if it is placed on a page with text you have provided no example but is there text that could be placed under the figure? (it is best to always provide a complete test document, you can use example-image as the image) figures placed on float pages are vertically centred by default, although you could change that to top alignment (ser \@fptop to 0pt) Feb 19, 2022 at 17:55

1 Answer 1

2

Try \begin{figure}[ht!]

a

This is a simplified code.

% !TeX TS-program = pdflatex

\documentclass[a4paper,12pt,twoside]{book}

\usepackage[a4paper,width=160mm,top=5mm,bottom=50mm,bindingoffset=6mm]{geometry}    

\usepackage[greek]{babel}
\usepackage{graphicx}
\usepackage{fancyhdr}
\usepackage{lipsum}
\usepackage[LGR, T1]{fontenc}

\usepackage{float}
\usepackage{authblk}
\usepackage{subcaption}
\usepackage{fourier-orns}   

\renewcommand\headrule{%
    \vspace{-6pt}
    \hrulefill
    \raisebox{-2.1pt}
    {\quad\decofourleft\decotwo\decofourright\quad}%
    \hrulefill}

\newcommand{\arc}[1]{{%
        \setbox9=\hbox{#1}%
        \ooalign{\resizebox{\wd9}{\height}{\texttoptiebar{\phantom{A}}}\cr#1}}}

\newtheorem{remark}{Παρατήρηση}[section]
\newtheorem{theorem}{Θεώρημα}[section]
\newtheorem{lemma}{Λήμμα}[section]
\newtheorem{corollary}{Πόρισμα}[section]


\newcounter{example}[section]
\newenvironment{example}[1][]{\refstepcounter{example}\par\medskip
    \noindent \textbf{Παράδειγμα~\theexample. #1} \rmfamily}{\medskip}

\fancyhf{}

\setlength{\headheight}{95pt}
\fancyfoot[CE, CO]{\textbf{\thepage}}

\pagestyle{fancy}

\lhead{\includegraphics[width=0.15\textwidth]{example-image}}
\graphicspath{{images/}}

\begin{document}
    
    \begin{figure}[ht!]% changed <<<<<<<<<<<<<
        \centering
        \begin{subfigure}[b]{0.45\textwidth}
            \centering
            \includegraphics[width=\textwidth]{example-image-a}
            \caption{}
            \label{notglobalrigidspiti}
        \end{subfigure}
        \hfill
        \begin{subfigure}[b]{0.5\textwidth}
            \centering
            \includegraphics[width=0.7\textwidth]{example-image-b}
            \caption{}
            \label{alexandrovrigiditysxima}
        \end{subfigure}
        \caption{}
        
    \end{figure}

\lipsum[1]

\end{document}

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .