2

How can I adjust the margins from the following picture in that way that W, X, Y and Z have the same distance? Additionally if I would delete the label with respect to X or W I want that this affects the margin as well. That means the distance should be smaller for the highness of the word "Label". And I'm not sure if the margins A and B are equal.

enter image description here

I found different properties to setup the margins like \intextsep and \columnsep but I don't know a proper value which I have to pass those variables. Please see the working example below.

\documentclass[a4paper]{article}
\usepackage[ngerman]{babel}
\usepackage[T1]{fontenc} 
\usepackage{lmodern}
\usepackage[utf8]{inputenc}
\usepackage{blindtext}
\usepackage{pgfplots}
\usepackage{wrapfig}
\usepackage{enumitem}

\begin{document}
%
%
\blindtext[1]%
\setlength{\intextsep}{-3pt}%
\setlength{\columnsep}{-10pt}%
\begin{wrapfigure}{l}{9cm}
%\vspace{-15pt}
\begin{tikzpicture}
\begin{axis}[scale=0.8,xmin=0,ymin=1.5, y dir=reverse,
    title={Label}, 
   xlabel={Label}, 
   ylabel={Label}]
\addplot[ mark=*, only marks
    ] table [% Provide data as a table
     ] {
x   y   
4   2.3
};
\end{axis}
\end{tikzpicture}
%\vspace{-2pt}
\end{wrapfigure}
\noindent \blindtext[4]

\end{document}
0

1 Answer 1

2

Increasing Y also increases X, so had to use \intextsep=0pt. Z cannot be controlled precisely since it depends on where the next line of text shows up, but this forces at least a 10pt gap.

The \fbox is just to show the border. It isn't needed (unlike the \nopar).

\documentclass[a4paper]{article}
\usepackage[ngerman]{babel}
\usepackage[T1]{fontenc} 
\usepackage{lmodern}
\usepackage[utf8]{inputenc}
\usepackage{blindtext}
\usepackage{pgfplots}
\usepackage{wrapfig}
\usepackage{enumitem}

\newcommand{\nopar}{\bgroup\parfillskip=0pt\hrule height0pt\egroup}

\begin{document}
%
%
\blindtext[1]\nopar
\setlength{\intextsep}{0pt}%
\setlength{\columnsep}{10pt}%
\begin{wrapfigure}{l}{0pt}
\fboxsep=0pt
\fbox{%
\begin{tikzpicture}
\begin{axis}[scale=0.8,xmin=0,ymin=1.5, y dir=reverse,
    every axis y label/.style={at={(ticklabel cs: 0.5)},rotate=90,above,inner sep=0pt},
    every axis x label/.style={at={(ticklabel cs: 0.5)},below,inner sep=0pt},
    every axis title/.style={at={(rel axis cs: 0.5,1)},above=6pt,inner sep=0pt},
    title={Label},
   xlabel={Label}, 
   ylabel={Label}]
\addplot[ mark=*, only marks
    ] table [% Provide data as a table
     ] {
x   y   
4   2.3
};
\end{axis}
\path (current bounding box.south) ++(0pt,-10pt);% add 10pt to bottom
\end{tikzpicture}}
\end{wrapfigure}
\vspace{10pt}\noindent \blindtext[4]

\end{document}

demo

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.