1

This figure has represented a speedbag for training and some more nodes. However, when compiling the resulting PDF has a blank area at the bottom:

\documentclass[border=2mm]{standalone}
\usepackage    {tikz}
\usepackage    {siunitx} % SI units, \SI and \ang commands
\usetikzlibrary{3d}      
\usetikzlibrary{babel}   % There are issues with some babel packages
\usetikzlibrary{calc}    % Computing some coordinates 
\usepackage{xcolor}
\usetikzlibrary{patterns}
\usetikzlibrary{patterns.meta}
\usetikzlibrary{arrows.meta}
\usetikzlibrary{decorations.pathreplacing}
\begin{document}
    
    \begin{tikzpicture}[
  pics/hook/.style={code={
    \pgfgettransformentries{\tmpa}{\tmpb}{\tmpc}{\tmpd}{\tmp}{\tmp}%
    \pgfmathsetmacro{\myJacobian}{sqrt(abs(\tmpa*\tmpd-\tmpb*\tmpc))}   
    \draw[line width=\myJacobian*12pt,line cap=round]
         (0,-1) -- (0,-0.6) to[out=90,in=0] (-0.1,-0.5)
         arc[start angle=250,end angle=0,radius=0.5cm];
         }},  
  pics/bar/.style={code={\pgfgettransformentries{\tmpa}{\tmpb}{\tmpc}{\tmpd}{\tmp}{\tmp}%
    \pgfmathsetmacro{\myJacobian}{sqrt(abs(\tmpa*\tmpd-\tmpb*\tmpc))}   
   \draw[top color=black!65,
    bottom color=black!70, 
    middle color=cyan!30,
    vertical custom shading=35, rounded corners=1pt, line width=\myJacobian*2pt]
    (-0.25,-1.5) rectangle (0.25,1.5);
   \draw [fill=black] (0,0) circle[radius=1mm];}},line cap=round,>=stealth,
    declare function={alpha=15;}
    ]
        
        \def\xR{20pt}; %x radius of ellipse
        \def\yR{5pt};  %y radius of ellipse
        \def\d0{4cm};  % initial distance
        \newcommand*{\ArcAngle}{-160}%
        \newcommand*{\ArcRadius}{0.7}%
        \coordinate (Origin) at (0,-0.1);

% ceiling
        \fill [
               pattern={Lines[
                          distance=1.5mm,
                          angle=45,
                          line width=0.3mm
                         ]},
                pattern color=gray
               ] (-2.5,0) rectangle (2.5,.3);

        \draw [very thick] (-2.5, 0) -- (2.5, 0);
        
        
        % speedbag
        \begin{scope}[shift={(0,-2.2)}]

            % speedbag
            \coordinate (a) at (0,2.); % Change 1.5 to change the shape of the droplet
                \node [circle,draw,fill=blue!30!white, blue!30!white, opacity=1] (c) at (0,0) [minimum size=40pt] {};
                \draw[blue!30!white,fill=blue!30!white, opacity=1] (a) -- (tangent cs:node=c,point={(a)},solution=1) --
                (c.center) -- (tangent cs:node=c,point={(a)},solution=2) -- cycle;
            \draw [dashed]  (-\xR,0) arc[start angle=180,end angle=0,x radius=\xR,y radius=\yR]; %top half
            \draw (-\xR,0) arc[start angle=180,end angle=360,x radius=\xR,y radius=\yR]; %bottom half
            \draw[black, very thin] (0,0) --++ (\xR,0) node[pos=0.5, above] {\footnotesize h};
            \draw[black, very thin] (0,0) --++ (0,2) node[pos=0.5, left] {\footnotesize l};

            % TAG
            \draw[line width=.7ex,red!70, {Butt Cap[red!70]}-{Butt Cap[red!70]}, xshift=(\xR+.15), align=left] (0,-0.15) -- (0,0.15) 
                    node[right, pos=0.5, black] (TLAB) {};
                    
            \begin{scope}[rotate around={50:(a)}]
                \coordinate (A) at (0,2.); % Change 1.5 to change the shape of the droplet
                    \node [circle,draw,fill=blue!10!white, blue!10!white, opacity=1] (C) at (0,0) [minimum size=40pt] {};
                    \draw[blue!10!white,fill=blue!10!white, opacity=1] (A) -- (tangent cs:node=C,point={(A)},solution=1) --
                    (C.center) -- (tangent cs:node=C,point={(A)},solution=2) -- cycle;
                    %ELIPSE
                    \draw [dashed,black!60!white]  (-\xR,0) arc[start angle=180,end angle=0,x radius=\xR,y radius=\yR]; %top half
                    \draw [black!60!white] (-\xR,0) arc[start angle=180,end angle=360,x radius=\xR,y radius=\yR];
                    %TAG
                \draw[line width=.7ex,red!50, {Butt Cap[red!50]}-{Butt Cap[red!50]}, xshift=(\xR+.15), align=left] (0,-0.15) -- (0,0.15);
                
            \end{scope}
            \begin{scope}[rotate around={-60:(a)}]
                \coordinate (AA) at (0,2.); % Change 1.5 to change the shape of the droplet
                    \node [circle,draw,fill=blue!10!white, blue!10!white, opacity=1] (CC) at (0,0) [minimum size=40pt] {};
                    \draw[blue!10!white,fill=blue!10!white, opacity=1] (AA) -- (tangent cs:node=CC,point={(AA)},solution=1) --
                    (CC.center) -- (tangent cs:node=CC,point={(AA)},solution=2) -- cycle;
                    %ELIPSE
                    \draw [dashed, black!60!white]  (-\xR,0) arc[start angle=180,end angle=0,x radius=\xR,y radius=\yR]; %top half
                    \draw [black!60!white] (-\xR,0) arc[start angle=180,end angle=360,x radius=\xR,y radius=\yR];
                    %TAG
                \draw[line width=.7ex,red!50, {Butt Cap[red!50]}-{Butt Cap[red!50]}, xshift=(\xR+.15), align=left] (0,-0.15) -- (0,0.15);
            \end{scope}
            % hook
            \path (0.7,0) ++ (alpha:0.7) -- ++ (alpha-90:2.5) coordinate (H1)
               (0,2) pic[scale=0.2,gray,rotate=180]{hook};
               
            
        \end{scope}
        
        % ARC MOV
        \draw [<->, dashed] ($(Origin)+(\ArcRadius,0)$)  arc (0:\ArcAngle:\ArcRadius);
        
        % INITIAL ANTENNa
        \begin{scope}[shift={(0,-2.2)}] % Reader
            \draw[line width=.85ex,red!70, {Butt Cap[red!70]}-{Butt Cap[red!70]}, xshift=(\d0), align=left] (0,-0.35) -- (0,0.35)
                 node[above, align=left, black] (READ) {} 
                 node[pos=.5] (READ) {};
            % WAVES
            \draw[decoration={expanding waves,angle=25},decorate] ($(READ) + (0.1,0)$) --++ (-1.8,0);
        \end{scope}
    
    \end{tikzpicture}
    
\end{document}

enter image description here

I would like to adjust the frame to objects represented in the scheme.

3
  • Can you explain in more detail what's wrong and what you would like to achieve? I don't see anything unusual in your image as well as in my freshly typeset PDF. In particular, I do not find any black area at the bottom.
    – gernot
    May 27 at 17:22
  • @gernot I made a typo. I meant the blank space at the bottom. May 27 at 17:27
  • @gernot I would like to adjust the height of the frame to the piecture. May 27 at 17:30

1 Answer 1

3

The bounding box of the image is determined by the positions of all coordinates used when drawing the picture. If the bounding box is too large (there is extra white space) then you either have to set the bounding box manually (\useasboundingbox), or you have to correct the drawing (if there are unnecessary commands that cause the problem).

Your tikzpicture contains the lines

            % hook
            \path (0.7,0) ++ (alpha:0.7)   -- ++ (alpha-90:2.5) coordinate (H1)
               (0,2) pic[scale=0.2,gray,rotate=180]{hook};

The first part of the \path defines the coordinate H1. It is used nowhere, but is located at the bottom of your picture, at the bottom of the blank area. This coordinate is the reason for the extra space.

Replace this code by

            % hook
            \path (0,2) pic[scale=0.2,gray,rotate=180]{hook};

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.