Centering caption in wrapfigure environment
You can replace [scale=…]
with [width=…]
, and choose 0pt
as width argument. Here is an example of boths with one of my graphics files:
\documentclass[11pt,a4paper]{article}
\usepackage{amssymb,amsmath,amsthm}
\usepackage[dutch]{babel}
\setlength{\parindent}{1cm}
\setlength{\parskip}{0cm}
\usepackage{relsize}
\usepackage{graphicx}
\usepackage{hyperref}
\usepackage{wrapfig}
\usepackage[justification=centering]{caption}
%\graphicspath{ {c:/Bureaublad} }
\usepackage{lipsum}
\begin{document}
% \lipsum[2]
\begin{wrapfigure}{r}{0pt}
\includegraphics[width = 0.75\linewidth]{loupnorstein2}
\caption{Hysteresis-lus}
\end{wrapfigure}
\lipsum[3]
\begin{wrapfigure}{r}{0pt}
\includegraphics[scale=0.5]{loupnorstein2}
\caption{Hysteresis-lus}
\end{wrapfigure}
\lipsum[4]
\end{document}
Related videos on Youtube
Kamil
I'm a PhD student in theoretical high energy physics who likes to do pure mathematics from time to time.
Updated on August 01, 2022Comments
-
Kamil over 1 year
\documentclass[11pt,a4paper]{article} \usepackage{amssymb,amsmath,amsthm} \usepackage[dutch]{babel} \setlength{\parindent}{1cm} \setlength{\parskip}{0cm} \usepackage{relsize} \usepackage{graphicx} \usepackage{movie15} \usepackage{hyperref} \usepackage{wrapfig} \usepackage[justification=centering]{caption} \graphicspath{ {c:/Bureaublad} } \newcommand\md{\ } \begin{document}
I have a trouble with centering the captions on my figures (PNG-files) which I want to include in LaTeX. For example, this is what I get for one of them (I took a screenshot):
To the left of the graph is my text. The trouble I'm having is this: the 'figuur 2' and the description that follows is not really centered under the graph. It's too much to the left.
Also I'm having a problem with the 'wrapfigure' environment. For example, when I use the command:
\begin{wrapfigure}{r}{0.80\textwidth} \centering \includegraphics[scale=0.7]{hysteresis.png} \caption{Hysteresis-lus} \end{wrapfigure}
The figure (another graph) somehow shows up at the bibliography section (end of document), while I want it to the left, surrounded by my text.
Any help with these issues please?
-
Kamil over 8 yearsAny help with the last issue please? I use wrapfigure command, but still my graph always shows up at the bottom of my text...
-
Bernard over 8 yearsProbably the value of
0.80\textwidth
is not the real width of your figure. Try with0pt
, LaTeX will measure the real width. -
Kamil over 8 yearsJust tried that, and it doesn't fix the problem.
-
Kamil over 8 yearsFinally found it! The command 'FloatBarrier' which I inserted after the graph, prevented it from going down. I'm still not sure why, but it worked. But still I want the captions to be centered, any ideas?
-