Skip to main content
deleted 30 characters in body
Source Link
AndréC
  • 27.1k
  • 4
  • 44
  • 107

The bboxbbox library makes it possibleallows you to disregard control points in the calculation ofcalculate the dimensions ofsmallest bounding box that contains the bounding boxwithfigure with the option bezier bounding box=true.

Instead of using the fit library to frame this figure, I used the current bounding box dimensions. And since this box is too narrow on the right side (it is tangent to the frame), I made it slightly larger.

screenshot

\documentclass{article}
\usepackage{tikz}
%\usetikzlibrary {fit}
\usetikzlibrary{bbox}
\begin{document}
\begin{figure}
\centering
    \begin{tikzpicture}[node distance = 2cm, auto,bezier bounding box=true]
        \begin{scope}%[local bounding box=a]
            \node (Kinf) {$K_\infty$};
            \node[above of=Kinf, right of=Kinf] (Linf) {$L_\infty$};
            \node[below of=Kinf, right of=Kinf, node distance=4cm] (K0) {$K_{0}$};
            \node[above of=K0, right of=K0] (L0)   {$L_{0}$};
            \draw[-] (Kinf) to node [] {$Z_\infty $} (Linf);
            \draw[-] (Kinf) to node [rotate=-45, midway, above] {$\ldots$} (K0);
            \draw[-] (Linf) to node [rotate=-45, midway, above] {$\ldots$} (L0);
            \draw[-] (K0) to node [] {$Z_0$} (L0);
            \draw (Kinf) to[out=-90, in=180, edge node={node [near start, left] {$\Gamma$}}] (K0);
            \draw[-] (Linf) to[out=0, in=0, looseness=2, edge node={node [near start] {$G$}}] (K0);
        \end {scope}
%        \node [fit=(a),inner sep=0pt,draw] {};
        \draw (current bounding box.south west) rectangle
([xshift=5pt]current bounding box.north east);
    \end{tikzpicture}
\end{figure}
\end{document}

The bbox library makes it possible to disregard control points in the calculation of the dimensions of the bounding boxwith the option bezier bounding box=true.

Instead of using the fit library to frame this figure, I used the current bounding box dimensions. And since this box is too narrow on the right side (it is tangent to the frame), I made it slightly larger.

screenshot

\documentclass{article}
\usepackage{tikz}
%\usetikzlibrary {fit}
\usetikzlibrary{bbox}
\begin{document}
\begin{figure}
\centering
    \begin{tikzpicture}[node distance = 2cm, auto,bezier bounding box=true]
        \begin{scope}%[local bounding box=a]
            \node (Kinf) {$K_\infty$};
            \node[above of=Kinf, right of=Kinf] (Linf) {$L_\infty$};
            \node[below of=Kinf, right of=Kinf, node distance=4cm] (K0) {$K_{0}$};
            \node[above of=K0, right of=K0] (L0)   {$L_{0}$};
            \draw[-] (Kinf) to node [] {$Z_\infty $} (Linf);
            \draw[-] (Kinf) to node [rotate=-45, midway, above] {$\ldots$} (K0);
            \draw[-] (Linf) to node [rotate=-45, midway, above] {$\ldots$} (L0);
            \draw[-] (K0) to node [] {$Z_0$} (L0);
            \draw (Kinf) to[out=-90, in=180, edge node={node [near start, left] {$\Gamma$}}] (K0);
            \draw[-] (Linf) to[out=0, in=0, looseness=2, edge node={node [near start] {$G$}}] (K0);
        \end {scope}
%        \node [fit=(a),inner sep=0pt,draw] {};
        \draw (current bounding box.south west) rectangle
([xshift=5pt]current bounding box.north east);
    \end{tikzpicture}
\end{figure}
\end{document}

The bbox library allows you to calculate the smallest bounding box that contains the figure with the option bezier bounding box=true.

Instead of using the fit library to frame this figure, I used the current bounding box dimensions. And since this box is too narrow on the right side (it is tangent to the frame), I made it slightly larger.

screenshot

\documentclass{article}
\usepackage{tikz}
%\usetikzlibrary {fit}
\usetikzlibrary{bbox}
\begin{document}
\begin{figure}
\centering
    \begin{tikzpicture}[node distance = 2cm, auto,bezier bounding box=true]
        \begin{scope}%[local bounding box=a]
            \node (Kinf) {$K_\infty$};
            \node[above of=Kinf, right of=Kinf] (Linf) {$L_\infty$};
            \node[below of=Kinf, right of=Kinf, node distance=4cm] (K0) {$K_{0}$};
            \node[above of=K0, right of=K0] (L0)   {$L_{0}$};
            \draw[-] (Kinf) to node [] {$Z_\infty $} (Linf);
            \draw[-] (Kinf) to node [rotate=-45, midway, above] {$\ldots$} (K0);
            \draw[-] (Linf) to node [rotate=-45, midway, above] {$\ldots$} (L0);
            \draw[-] (K0) to node [] {$Z_0$} (L0);
            \draw (Kinf) to[out=-90, in=180, edge node={node [near start, left] {$\Gamma$}}] (K0);
            \draw[-] (Linf) to[out=0, in=0, looseness=2, edge node={node [near start] {$G$}}] (K0);
        \end {scope}
%        \node [fit=(a),inner sep=0pt,draw] {};
        \draw (current bounding box.south west) rectangle
([xshift=5pt]current bounding box.north east);
    \end{tikzpicture}
\end{figure}
\end{document}
Source Link
AndréC
  • 27.1k
  • 4
  • 44
  • 107

The bbox library makes it possible to disregard control points in the calculation of the dimensions of the bounding boxwith the option bezier bounding box=true.

Instead of using the fit library to frame this figure, I used the current bounding box dimensions. And since this box is too narrow on the right side (it is tangent to the frame), I made it slightly larger.

screenshot

\documentclass{article}
\usepackage{tikz}
%\usetikzlibrary {fit}
\usetikzlibrary{bbox}
\begin{document}
\begin{figure}
\centering
    \begin{tikzpicture}[node distance = 2cm, auto,bezier bounding box=true]
        \begin{scope}%[local bounding box=a]
            \node (Kinf) {$K_\infty$};
            \node[above of=Kinf, right of=Kinf] (Linf) {$L_\infty$};
            \node[below of=Kinf, right of=Kinf, node distance=4cm] (K0) {$K_{0}$};
            \node[above of=K0, right of=K0] (L0)   {$L_{0}$};
            \draw[-] (Kinf) to node [] {$Z_\infty $} (Linf);
            \draw[-] (Kinf) to node [rotate=-45, midway, above] {$\ldots$} (K0);
            \draw[-] (Linf) to node [rotate=-45, midway, above] {$\ldots$} (L0);
            \draw[-] (K0) to node [] {$Z_0$} (L0);
            \draw (Kinf) to[out=-90, in=180, edge node={node [near start, left] {$\Gamma$}}] (K0);
            \draw[-] (Linf) to[out=0, in=0, looseness=2, edge node={node [near start] {$G$}}] (K0);
        \end {scope}
%        \node [fit=(a),inner sep=0pt,draw] {};
        \draw (current bounding box.south west) rectangle
([xshift=5pt]current bounding box.north east);
    \end{tikzpicture}
\end{figure}
\end{document}