0

I am doing this paper with the tikz picture tools to draw some diagrams and the wrapfigure enviroment to situate them in the text.

The problem is that when I run the code, the picture is placed below what I would like, leaving a space between the first line of text and the picture. It seems to me that this space has the same width as a text line.

My code and my document is here:

\documentclass[final, 12pt,oneside]{book}
\usepackage[utf8]{inputenc}
\usepackage[T1]{fontenc}
\usepackage[spanish]{babel}
\usepackage{amsmath} % American Mathematics Society standards
\usepackage{graphicx} % Extended graphics package.

\usepackage{amsxtra}
\usepackage{amssymb}
\usepackage{amsthm}
\usepackage{ dsfont }
\usepackage{latexsym}
\usepackage{spverbatim}
\usepackage{enumitem}
\usepackage{hyperref}
\usepackage{biblatex}
\usepackage{csquotes}

%BIBLIOGRAFÍA

\addbibresource{bibliografia.bib}
\topmargin      = -0.56in
\textheight     =  8.60in
\textwidth      =  6.46in
\oddsidemargin  =  0.02in

%TEOREMAS
\newtheorem{theorem}{Theorem}[section]
\newtheorem{prop}{Proposición}
\newtheorem{corollary}{Corollary}[theorem]
\newtheorem{lemma}[theorem]{Lemma}
\newtheorem*{remark}{Observación}
\newtheorem{exmp}{Ejemplo}[section]
\def\proof{\paragraph{Demostraci\'on:\\}}
\def\endproof{\hfill$\square$}

\theoremstyle{definition}
\newtheorem{definition}{Definición}[chapter]


%WRAPFIGURE
\usepackage{wrapfig}
\usepackage{adjustbox}

%TIKZ
\usepackage{tikz}
\usepackage{tkz-euclide}
\usetikzlibrary{shapes.geometric, arrows, angles, intersections, calc, math, quotes}
\usetikzlibrary{babel}

%COLORES
\usepackage{xcolor}
\definecolor{gualda}{RGB}{250,194,43}
\definecolor{rred}{RGB}{212,42,32}
\definecolor{bblue}{RGB}{14,99,142}

%ESPACIOS
\setlength{\parskip}{0.5 em}
\setlength{\baselineskip}{1.5 em}


\begin{document}

\noindent \textsc{Axiomas de Ordenación:}\par
\noindent \textbf{B1.} Si $B$ está entre $A$ y $C$, (escrito como $A*B*C$), entonces $A$, $B$, $C$ son tres puntos distintos que pertenecen a la misma recta, y también $C*B*A$.\par

\noindent \textbf{B2.} Para cualquiera dos puntos distintos $A$, $B$, existe un punto $C$ tal que $A*B*C$.\par

\noindent \textbf{B3.} Dados $A$, $B$, $C$, tres puntos distintos en una recta, uno y sólo uno de ellos está entre los otros dos. Es decir: $A*B*C$, o bien $A*C*B$, o bien $B*A*C$.\par

\begin{wrapfigure}[5]{r}{0pt}
    \begin{tikzpicture}[>=stealth]
        \coordinate (A) at (-1.2,0);
        \coordinate (B) at (0,2.4);
        \coordinate (C) at (3.6,0);
    
        \draw[rred, line width=2.5pt, name path=AC] (A) -- (C);
        \draw[bblue, line width=2.5pt, name path=AB] (A) -- (B);
        \draw[black, line width=2.5pt, name path=CB] (C) -- (B);
    
        \filldraw[black] (A) circle (2pt) node[anchor=north east]{$A$};
        \filldraw[black] (B) circle (2pt) node[anchor=south west]{$B$};
        \filldraw[black] (C) circle (2pt) node[anchor= west]{$C$};
   
        \draw[->, gualda, line width=2.5pt, name path=l] (-1.25,2.25) -- node [black, above, near start]{$l$} (0.75,0.25);
    
        \path[name intersections={of=AB and l, by=D}];
        \filldraw[black] (D) circle (2pt) node[below=3pt,left=3pt]{$D$};
    \end{tikzpicture}
\end{wrapfigure}

\noindent \textbf{B4.} (Axioma de Pasch). Dados $A$,$B$, $C$ tres puntos no alineados, y una recta $l$ que no contiene a ninguno de ellos. Si $l$ contiene a un punto $D$ tal que $A*D*B$, entonces debe contener también un punto entre $A$ y $C$, o bien, un punto entre $B$ y $C$, pero no ambos.
\newpage


\end{document}

enter image description here

However, I have faced this problem before, although not with a tikz picture. Previously I had managed to fix it with a \raisebox before inserting the figure like one user said at this post:

Moving a wrapfig vertically to encroach partially on a subsection title

But the problem is that, apart from all the errors overleaf detects, the arrow of my diagram disappear. I have tried the other solutions in the answer of that post, but it doesn't work it out (\vspace, etc).

Someone knows how to adjust vertically a tikz picture in a wrapfigure enviroment without eliminating the arrows of the diagram? Thanks

6
  • Unfortunately your code won't compile. Please add for us what's missing. Thanks
    – MS-SPO
    Apr 27, 2022 at 17:24
  • I forgot all the previous code, sorry
    – GoRza
    Apr 27, 2022 at 17:40
  • off topic: there is no chapter counter in article class.
    – Sigur
    Apr 27, 2022 at 17:45
  • I know, I am using a class_diss.cls but the problem is not there
    – GoRza
    Apr 27, 2022 at 17:49
  • I know that it is not there. This is why I wrote off topic. Fixing it will help people compiling your code.
    – Sigur
    Apr 27, 2022 at 17:52

1 Answer 1

1

Use \setlength\intextsep{0pt} to eliminate extra top and below space of the wrapped figure.

\intextsep is the vertical space placed above and below all floats not just a wrap figure. To affect only them add this code to the preamble.

\usepackage{etoolbox}
\BeforeBeginEnvironment{wrapfigure}{\setlength{\intextsep}{0pt}}

a

See eliminate the extra top and below space of the wrapped figure

This is a minimum compilable code. (allocating 9 lines to the figure)

\documentclass{article}

\usepackage[T1]{fontenc}
\usepackage[spanish]{babel}
    
\topmargin      = -0.56in
\textheight     =  8.60in
\textwidth      =  6.46in
\oddsidemargin  =  0.02in


%WRAPFIGURE
\usepackage{wrapfig}

%TIKZ
\usepackage{tikz}
\usepackage{tkz-euclide}

%COLORES
\usepackage{xcolor}
\definecolor{gualda}{RGB}{250,194,43}
\definecolor{rred}{RGB}{212,42,32}
\definecolor{bblue}{RGB}{14,99,142}


% ******************************************** added <<<<<<<<<<
\usepackage{etoolbox}
\BeforeBeginEnvironment{wrapfigure}{\setlength{\intextsep}{0pt}}
%****************************************************

\usepackage{kantlipsum}% ONLY for the dummy thext <<<

\begin{document}
    
    \noindent \textsc{Axiomas de Ordenación:}\par
    \noindent \textbf{B1.} Si $B$ está entre $A$ y $C$, (escrito como $A*B*C$), entonces $A$, $B$, $C$ son tres puntos distintos que pertenecen a la misma recta, y también $C*B*A$.\par
    
    \noindent \textbf{B2.} Para cualquiera dos puntos distintos $A$, $B$, existe un punto $C$ tal que $A*B*C$.\par
    
    \noindent \textbf{B3.} Dados $A$, $B$, $C$, tres puntos distintos en una recta, uno y sólo uno de ellos está entre los otros dos. Es decir: $A*B*C$, o bien $A*C*B$, o bien $B*A*C$.\par
    
    \begin{wrapfigure}[9]{r}{0pt}% changed <<<<<<<<<<
        \begin{tikzpicture}[>=stealth]
            \coordinate (A) at (-1.2,0);
            \coordinate (B) at (0,2.4);
            \coordinate (C) at (3.6,0);
            
            \draw[rred, line width=2.5pt, name path=AC] (A) -- (C);
            \draw[bblue, line width=2.5pt, name path=AB] (A) -- (B);
            \draw[black, line width=2.5pt, name path=CB] (C) -- (B);
            
            \filldraw[black] (A) circle (2pt) node[anchor=north east]{$A$};
            \filldraw[black] (B) circle (2pt) node[anchor=south west]{$B$};
            \filldraw[black] (C) circle (2pt) node[anchor= west]{$C$};
            
            \draw[->, gualda, line width=2.5pt, name path=l] (-1.25,2.25) -- node [black, above, near start]{$l$} (0.75,0.25);
            
            \path[name intersections={of=AB and l, by=D}];
            \filldraw[black] (D) circle (2pt) node[below=3pt,left=3pt]{$D$};
        \end{tikzpicture}
    \end{wrapfigure}
    
    \noindent \textbf{B4.} (Axioma de Pasch). Dados $A$,$B$, $C$ tres puntos no alineados, y una recta $l$ que no contiene a ninguno de ellos. Si $l$ contiene a un punto $D$ tal que $A*D*B$, entonces debe contener también un punto entre $A$ y $C$, o bien, un punto entre $B$ y $C$, pero no ambos.
    
    \noindent \textbf{B5.} (Dummy text). \kant[1]
    
\end{document}

c

You must log in to answer this question.

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