Graphics, Figures & TablesAppendix title below figure

Information and discussion about graphics, figures & tables in LaTeX documents.
Post Reply
kodaly
Posts: 2
Joined: Tue Apr 13, 2021 1:56 pm

Appendix title below figure

Post by kodaly »

Hello,
I'm new to latex and I'm using a template I found on overleaf. I'm struggling with my appendix; for some reason, when I add an image, the appendix title will appear below the image instead of at the top. It is probably a very simple mistake, but I'm learning it by myself and still need to grasp a lot of things.

Code: Select all

\documentclass[12pt,a4paper]{article}
\usepackage[german]{babel}
\usepackage{xcolor}

\usepackage[utf8]{inputenc}
\usepackage{amsmath, amsthm, amssymb}
\usepackage{enumerate}
\usepackage{graphicx}
\usepackage{lscape}
\usepackage{setspace}
\onehalfspacing
\usepackage{wrapfig}
\usepackage{multirow}
\usepackage[round]{natbib}
\usepackage{hyperref}
\bibliographystyle{apalike}

\newtheorem{definition}{Definition}[section]
\newtheorem{interview}{Interview}[section]
\newtheorem{satz}{Satz}[section]
\newtheorem{beispiel}{Beispiel}[section]
\newtheorem{bemerkung}{Bemerkung}[section]
\newtheorem{literaturverzeichnis}{Literaturverzeichnis}[section]

\usepackage[top=25mm, bottom=20mm, vmargin=25mm, includehead]{geometry}
\setlength{\topmargin}{0cm}
\setlength{\parindent}{5mm}
\setlength{\parskip}{2mm}
\setlength{\evensidemargin}{0mm}
\setlength{\oddsidemargin}{0cm}



\newpage
\appendix
\section{Abbildungen}
In diesem Anhang finden Sie alle Abbildungen.

\begin{figure}
\includegraphics[width=\textwidth]{FS-Vorlage/Abbildungen/G.Egle Metakognition Grafik deklarativ exekutiv.jpeg}
\caption{Schema zur Metakognition} \centering\cite{Egle}
\end{figure}

\end{document]
I am also very sorry if I did not post the example correctly, this is my first contribution.

thanks in advance,
Di.
Last edited by Stefan Kottwitz on Tue Apr 13, 2021 7:58 pm, edited 1 time in total.
Reason: code marked

Recommended reading 2024:

LaTeXguide.org • LaTeX-Cookbook.net • TikZ.org

NEW: TikZ book now 40% off at Amazon.com for a short time.

And: Currently, Packt sells ebooks for $4.99 each if you buy 5 of their over 1000 ebooks. If you choose only a single one, $9.99. How about combining 3 LaTeX books with Python, gnuplot, mathplotlib, Matlab, ChatGPT or other AI books? Epub and PDF. Bundle (3 books, add more for higher discount): https://packt.link/MDH5p

Ijon Tichy
Posts: 640
Joined: Mon Dec 24, 2018 10:12 am

Appendix title below figure

Post by Ijon Tichy »

figure is a float environment. Floats can, ;) float. The default float options for figures in latex are tbp. I think, you want hbp or bp for this float. See an introduction to LaTeX for more information about floats.

And please use the code tag to mark code. Otherwise the new online compiling feature (see the Run LaTeX here button below my examples) would not work. And for the same reason, please try to show a compilable Infominimal working example, like:

Code: Select all

\documentclass[12pt,a4paper]{article}
\usepackage[ngerman]{babel}% NOTE: german would be outdates/old spelling
\usepackage{xcolor}

%\usepackage[utf8]{inputenc}% NOTE: Not needed from LaTeX 2018-04-01
\usepackage{amsmath, amsthm, amssymb}
\usepackage{enumerate}
\usepackage{graphicx}
\usepackage{pdflscape}% Better alternative to lscape with respect to PDF viewers.
\usepackage[onehalfspacing]{setspace}% NOTE: The package knows options!
\usepackage{wrapfig}
\usepackage{multirow}
\usepackage[round]{natbib}% NOTE: I would recommend to use biblatex + biber!
\usepackage{hyperref}
\bibliographystyle{apalike}% NOTE: This is not suitable for German.

\newtheorem{definition}{Definition}[section]
\newtheorem{interview}{Interview}[section]
\newtheorem{satz}{Satz}[section]
\newtheorem{beispiel}{Beispiel}[section]
\newtheorem{bemerkung}{Bemerkung}[section]
\newtheorem{literaturverzeichnis}{Literaturverzeichnis}[section]

\usepackage[top=25mm, bottom=20mm, vmargin=25mm, includehead]{geometry}
\setlength{\topmargin}{0cm}% NOTE: You should not manipulate the length on your own. Use geomtry options!
\setlength{\parindent}{5mm}% NOTE: Combination of paragraph intend with
\setlength{\parskip}{2mm}%      paragraph skip is nonsense
\setlength{\evensidemargin}{0mm}% NOTE: You should not manipulate the length on your own. Use geomtry options!
\setlength{\oddsidemargin}{0cm}% NOTE: You should not manipulate the length on your own. Use geomtry options!

\begin{document}
\appendix
\section{Abbildungen}
In diesem Anhang finden Sie alle Abbildungen.

\begin{figure}[hbp]
\includegraphics[width=\textwidth]{example-image}
\caption{Schema zur Metakognition} \centering\cite{Egle}
\end{figure}

\end{document}
But maybe in your case it would be better not to use floats, because in a figure appendix they don't make sense. So maybe:

Code: Select all

\documentclass[12pt,a4paper]{article}
\usepackage[ngerman]{babel}% NOTE: german would be outdates/old spelling
\usepackage{xcolor}

%\usepackage[utf8]{inputenc}% NOTE: Not needed from LaTeX 2018-04-01
\usepackage{caption}
\usepackage{amsmath, amsthm, amssymb}
\usepackage{enumerate}
\usepackage{graphicx}
\usepackage{pdflscape}% Better alternative to lscape with respect to PDF viewers.
\usepackage[onehalfspacing]{setspace}% NOTE: The package knows options!
\usepackage{wrapfig}
\usepackage{multirow}
\usepackage[round]{natbib}% NOTE: I would recommend to use biblatex + biber!
\usepackage{hyperref}
\bibliographystyle{apalike}% NOTE: This is not suitable for German.

\newtheorem{definition}{Definition}[section]
\newtheorem{interview}{Interview}[section]
\newtheorem{satz}{Satz}[section]
\newtheorem{beispiel}{Beispiel}[section]
\newtheorem{bemerkung}{Bemerkung}[section]
\newtheorem{literaturverzeichnis}{Literaturverzeichnis}[section]

\usepackage[top=25mm, bottom=20mm, vmargin=25mm, includehead]{geometry}
\setlength{\topmargin}{0cm}% NOTE: You should not manipulate the length on your own. Use geomtry options!
\setlength{\parindent}{5mm}% NOTE: Combination of paragraph intend with
\setlength{\parskip}{2mm}%      paragraph skip is nonsense
\setlength{\evensidemargin}{0mm}% NOTE: You should not manipulate the length on your own. Use geomtry options!
\setlength{\oddsidemargin}{0cm}% NOTE: You should not manipulate the length on your own. Use geomtry options!

\begin{document}
\appendix
\section{Abbildungen}
In diesem Anhang finden Sie alle Abbildungen.

\noindent\begin{minipage}{\linewidth}
\centering
\includegraphics[width=\textwidth]{example-image}
\captionof{figure}[Schema zur Metakognition]{Schema zur Metakognition \cite{Egle}}
\end{minipage}

\end{document}
would be better.
Sorry, but I can no longer participate here as the administrator is trampling on my wishes on one of his other platforms. :cry:
kodaly
Posts: 2
Joined: Tue Apr 13, 2021 1:56 pm

Appendix title below figure

Post by kodaly »

ok, so first of all, thank you for the help!
most importantly: if I choose the last option you mentioned, it tells me that for \captionof "Package caption Warning: The option `hypcap=true' will be ignored for this particular \caption on input line 329. See the caption package documentation for explanation.sequence." It appears below the appendix title tho, so thats already a win.

Code: Select all

\documentclass[12pt,a4paper]{article}
\usepackage[ngerman]{babel}
\usepackage{xcolor}
\usepackage[utf8]{inputenc}
\usepackage{amsmath, amsthm, amssymb}
\usepackage{enumerate}
\usepackage{graphicx}
\usepackage{pdflscape}
\usepackage[onehalfspacing]{setspace}
\onehalfspacing
\usepackage{wrapfig}
\usepackage{multirow}
\usepackage[round]{natbib}
\usepackage{hyperref}% für die Einbettung von Hyperlinks
\usepackage{caption}
\bibliographystyle{apalike}

\newpage
\appendix
\section{Abbildungen}
In diesem Anhang finden Sie alle Abbildungen.
\noindent
\begin{minipage}{\linewidth}
\centering
\includegraphics[width=\textwidth]{FS-Vorlage/Abbildungen/G.Egle Metakognition Grafik deklarativ exekutiv.jpeg}
\captionof{figure}[Schema zur Metakognition]{Schema zur Metakognition \cite{Egle}} 
\end{minipage}
\end{document}
Regarding your package edits; as I said I used an overleaf template from a German paper to mess as less as possible with packages, design etc. So everything until line 32 was not my own work. Thank you for the edits tho!
User avatar
Ijon Tichy
Posts: 640
Joined: Mon Dec 24, 2018 10:12 am

Appendix title below figure

Post by Ijon Tichy »

kodaly wrote:Regarding your package edits; as I said I used an overleaf template from a German paper to mess as less as possible with packages, design etc. So everything until line 32 was not my own work.
Bad code is bad code regardless of where it comes from. I consider it my responsibility to at least point out bad code, if not correct it immediately. Not only so that someone doesn't claim at some point that I recommended it, but also so that others are warned and don't adopt it carelessly.
Sorry, but I can no longer participate here as the administrator is trampling on my wishes on one of his other platforms. :cry:
Post Reply