0

I am using wrapfigure to position a figure on the right side of my document. However when I do it the text to the left increases in both vertical and horizontal spacing. It is not a huge amount but it is bugging me. I have tried using the package setspace to remedy the situation but it doesn't seem to be working. Can anyone help? See code below:

EDIT: The problem with spacing to left of figure has now resolved itself (thankyou!) after removing the \\ used. However the spacing above has now gone funny, any help would be greatly appreciated! (I have edited code accordingly) Picture 2, spacing above has now increased...

\documentclass{article}

\DeclareUnicodeCharacter{2212}{-}

\usepackage[a4paper]{geometry}
\usepackage{gensymb}
\usepackage{graphicx}
\usepackage{cite}
\usepackage{hyperref}
\usepackage{amsmath}
\numberwithin{equation}{section}
\usepackage{subfig}
\usepackage{wrapfig}
\usepackage{minted}
\usepackage{setspace}
\renewcommand{\MintedPygmentize}{/Library/Frameworks/Python.framework/Versions/Current/bin/pygmentize}
\DeclareMathOperator{\Tr}{Tr}

\begin{document}

A natural progression now would be to ask how fast these waves travel. This is because all waves will travel the same speed, $c$, in the system, so once we create spirals later we can determine the wavelength using $\lambda=Pc$. Then we can investigate if the period changes under different $\epsilon$ and $\beta$ values. To do this we will continue looking at the waves generated with parameters as before, namely $\epsilon = 0.3$ and $\beta = 0.7$.
\begin{wrapfigure}[17]{r}{0.5\textwidth}
\captionsetup{justification=centering}
\centering
    \includegraphics[width=0.48\textwidth]{example-image}
\caption[caption for ToF]{An example of how we can produce an individual travelling wave.}
\end{wrapfigure}
\vspace{-5mm} \paragraph{} \hspace{-5mm} When calculating speed, we must first set a base point to follow on the wave as it progresses. If the model is set up in such a way that the waves are created from the left side of the excitable area, then after a small number of iterations one of them will fall outside of the boundary whilst the other remains inside travelling right. An example of this can be seen on the right. This means that there will be only one maximum value (the peak $\hat{x}_{max}$) and so we choose this as our initial base point.
\paragraph{} \hspace{-5mm} We are now presented with the problem that the true maximum value of the wave, denoted as $x_{max}$, may lie between two grid points. Therefore, we seek a technique to approximate $x_{max}$ to set as our new base point to improve the accuracy of our wave speed calculation. To do this we construct the following algorithm;

\end{document}

As you can see the spacing has increased to the left of the figure.

  • 1
    it is hard to debug if you provide no usable test document but you should start by removing all the \\ which should almost never be used in text and certainly not after a figure. – David Carlisle Apr 4 at 14:59
  • please make a small but complete document that shows the problem (you can use example-image as the image which is available for this kind of test.) – David Carlisle Apr 4 at 15:01
  • Please use a complete MWE that contains the \documentclass, all the \usepackages (and libraries if you use tikz or something like that), as well as the \begin{document} and \end{document}. Please refer to this and to this – Vinccool96 Apr 4 at 15:03
  • I have revised code, hope that helps? – Jake Apr 4 at 15:13
  • As David pointed out in his first comment you should get rid of all those \\. – campa Apr 4 at 15:28
1

Is this what you want?

demo

Note that wrapfig ignores \parskip, or any form of spacing that doesn't produce a line of text (\null will do).

\documentclass{article}

\DeclareUnicodeCharacter{2212}{-}

\usepackage[a4paper]{geometry}
\usepackage{gensymb}
\usepackage{graphicx}
\usepackage{cite}
\usepackage{hyperref}
\usepackage{amsmath}
\numberwithin{equation}{section}
\usepackage{subfig}
\usepackage{wrapfig}
%\usepackage{minted}% sorry, no shell-escape here
\usepackage{setspace}
%\renewcommand{\MintedPygmentize}{/Library/Frameworks/Python.framework/Versions/Current/bin/pygmentize}
\DeclareMathOperator{\Tr}{Tr}

\parskip=\baselineskip
\parindent=0pt

\begin{document}

A natural progression now would be to ask how fast these waves travel. This is because all waves will travel the same speed, $c$, in the system, so once we create spirals later we can determine the wavelength using $\lambda=Pc$. Then we can investigate if the period changes under different $\epsilon$ and $\beta$ values. To do this we will continue looking at the waves generated with parameters as before, namely $\epsilon = 0.3$ and $\beta = 0.7$.

\begin{wrapfigure}{r}{0.5\textwidth}
  \captionsetup{justification=centering}%
  \centering
  \vskip-\intextsep
    \includegraphics[width=0.48\textwidth]{example-image}
  \caption[caption for ToF]{An example of how we can produce an individual travelling wave.}
  \vskip-\intextsep
\end{wrapfigure}
When calculating speed, we must first set a base point to follow on the wave as it progresses. If the model is set up in such a way that the waves are created from the left side of the excitable area, then after a small number of iterations one of them will fall outside of the boundary whilst the other remains inside travelling right. An example of this can be seen on the right. This means that there will be only one maximum value (the peak $\hat{x}_{max}$) and so we choose this as our initial base point.
\newline\null\newline% wrapfig ignores \parskip
We are now presented with the problem that the true maximum value of the wave, denoted as $x_{max}$, may lie between two grid points. Therefore, we seek a technique to approximate $x_{max}$ to set as our new base point to improve the accuracy of our wave speed calculation. To do this we construct the following algorithm;

\end{document}
  • Thankyou so much! So much easier to read now too haha – Jake Apr 4 at 16:32

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.