3 tikzpictures en 1 preservando coordenadas

3 tikzpictures en 1 preservando coordenadas
\documentclass[12pt,a4paper,twoside]{report} \usepackage[english,greek]{babel} \usepackage[iso-8859-7]{inputenc} \usepackage{amsfonts} 
\usepackage{amssymb}
\usepackage{amsmath}
\usepackage{amsxtra}
\usepackage{mathtools}
\usepackage{textgreek}
\usepackage{tikz}
\usetikzlibrary{tikzmark}
\usepackage{xcolor}
\usepackage{calc}
\usepackage{tikz-feynman}
\usepackage{pgfplots}
\usetikzlibrary{arrows,shapes,positioning,snakes}
\tikzstyle arrowstyle=[scale=1]
\usetikzlibrary{arrows,decorations.pathmorphing,backgrounds,positioning,fit,matrix}
\usetikzlibrary{decorations.pathmorphing,patterns}
\usetikzlibrary{calc,patterns,decorations.markings}
\usetikzlibrary{positioning}
\usepackage{tikz,tikz-3dplot}
\usetikzlibrary{shapes.geometric} 



\begin{figure}[!h]
\centering
\begin{tikzpicture}\node [] at(0,5){    
\begin{tikzpicture}
\tikzstyle{spring}=[double,decorate,decoration={pre=lineto,pre length=0.3cm, ,post=curveto,post length=0.3cm,aspect=0, segment length=1mm, amplitude=2.2mm,coil}]
\tikzstyle{platform1}=[fill,pattern=north east lines,draw=none,minimum width=2cm,minimum height=0.3cm]
\coordinate (topspring) at (0,0);
\coordinate (bottomspring) at (0,-2cm);
\draw [spring] (bottomspring) -- (topspring) node[draw=none,pos=.5,left=.25cm] (spring){$k$};

\draw[thick,-](-1,0)--(1,0);

\node [platform1,anchor=south] at (0,0)  {};

\end{tikzpicture}};\end{tikzpicture}
\begin{tikzpicture}
\tikzstyle{spring}=[double,decorate,decoration={pre=lineto,pre length=0.3cm, ,post=curveto,post length=0.3cm,aspect=0, segment length=2mm, amplitude=2.2mm,coil}]
\tikzstyle{platform1}=[fill,pattern=north east lines,draw=none,minimum width=2cm,minimum height=0.3cm]
\coordinate (topspring) at (0,0);
\coordinate (bottomspring) at (0,-4cm);
\draw [spring] (bottomspring) -- (topspring) node[draw=none,pos=.5,left=.25cm] (spring){$k$};

\draw[thick,-](-1,0)--(1,0);
\draw[thick,fill=gray!40,rounded corners] (-0.4,-4) rectangle (0.4,-4.7)node at (0,-4.35)[font=\small]{$m_1$};
\node [platform1,anchor=south] at (0,0)  {};
\shade[ball color=white] (0,-5.5) circle (0.25)node at (0,-5.5)[font=\small]{$m$};
\draw[thick,-stealth'](0.4,-5.8)--(0.4,-5.2)node[right,pos=0.5][font=\small]{$\vec v_2$};
\draw[thick,-stealth',violet](1,-1)--(1,-2)node[right,pos=0.5][font=\small]{$(+)$};
\end{tikzpicture}
\begin{tikzpicture}
\tikzstyle{spring}=[double,decorate,decoration={pre=lineto,pre length=0.3cm, ,post=curveto,post length=0.3cm,aspect=0, segment length=2mm, amplitude=2.2mm,coil}]
\tikzstyle{platform1}=[fill,pattern=north east lines,draw=none,minimum width=2cm,minimum height=0.3cm]
\coordinate (topspring) at (0,0);
\coordinate (bottomspring) at (0,-4cm);
\draw [spring] (bottomspring) -- (topspring) node[draw=none,pos=.5,left=.25cm] (spring){$k$};

\draw[thick,-](-1,0)--(1,0);
\draw[thick,fill=gray!40,rounded corners] (-0.4,-4) rectangle (0.4,-4.7);
\node [platform1,anchor=south] at (0,0)  {};
\shade[ball color=white] (0,-4.35) circle (0.25);
\draw[thick,-stealth'](0.55,-4.5)--(0.55,-3.8)node[right,pos=0.5][font=\small]{$\vec v_{\kappa}$};

\end{tikzpicture}

\end{figure}


\end{document}

imagen

Respuesta1

La parte principal de la solución es utilizar baseline={(topspring)}como opción los tres tikzpictures para alinearlos con la misma coordenada.

Pero también deberías hacer algunas otras cosas:

  • No anidar tikzpictures. En este caso no es compatible ni necesario.
  • Úselo \tikzseten lugar de \tikzstyle, este último está en desuso. Además, dado que reutiliza algunos estilos, puede definirlos \tikzsetfuera del alcance y simplemente cambiar los estilos relevantes según sea necesario.
  • Elimine todas las bibliotecas y paquetes innecesarios, intente no cargar cosas varias veces y piense qué paquetes ya cargan cosas (por ejemplo, pgfplotscargas tikzy tikzcargas xcolor).

Un ejemplo práctico mínimo de lo anterior sería:

\documentclass[12pt, a4paper, twoside]{report} 
\usepackage{tikz}
\usetikzlibrary{patterns, decorations.pathmorphing, arrows}

\tikzset{
    spring/.style={
        double,
        decorate,
        decoration={
            pre=lineto,
            pre length=0.3cm,
            post=curveto,
            post length=0.3cm,
            aspect=0, 
            segment length=1mm, 
            amplitude=2.2mm,
            coil
        }
    },
    platform1/.style={
        fill,
        pattern=north east lines,
        draw=none,
        minimum width=2cm,
        minimum height=0.3cm
    }
}

\begin{document}
\begin{figure}[!h]
\centering

\begin{tikzpicture}[baseline={(topspring)}]

    \coordinate (topspring) at (0,0);
    \coordinate (bottomspring) at (0,-2cm);
    \draw [spring] (bottomspring) -- (topspring) 
        node[draw=none, pos=.5, left=.25cm] (spring) {$k$};
    \draw[thick] (-1,0) -- (1,0);
    \node[platform1, anchor=south] at (0,0)  {};

\end{tikzpicture}
\begin{tikzpicture}[baseline={(topspring)}, spring/.append style={segment length=2mm}]

    \coordinate (topspring) at (0,0);
    \coordinate (bottomspring) at (0,-4cm);
    \draw [spring] (bottomspring) -- (topspring) 
        node[draw=none, pos=.5, left=.25cm] (spring) {$k$};
    \draw[thick] (-1,0) -- (1,0);
    \draw[thick, fill=gray!40, rounded corners] (-0.4,-4) rectangle (0.4,-4.7)
        node at (0,-4.35) [font=\small] {$m_1$};
    \node[platform1, anchor=south] at (0,0) {};
    \shade[ball color=white] (0,-5.5) circle (0.25)
        node at (0,-5.5) [font=\small] {$m$};
    \draw[thick, -stealth'] (0.4,-5.8) -- (0.4,-5.2)
        node[right, pos=0.5, font=\small] {$\vec v_2$};
    \draw[thick, -stealth', violet] (1,-1) -- (1,-2)
        node[right, pos=0.5, font=\small] {$(+)$};
    
\end{tikzpicture}
\begin{tikzpicture}[baseline={(topspring)}, spring/.append style={segment length=2mm}]

    \coordinate (topspring) at (0,0);
    \coordinate (bottomspring) at (0,-4cm);
    \draw [spring] (bottomspring) -- (topspring) 
        node[draw=none, pos=.5, left=.25cm] (spring) {$k$};
    \draw[thick] (-1,0) -- (1,0);
    \draw[thick, fill=gray!40, rounded corners] (-0.4,-4) rectangle (0.4,-4.7);
    \node[platform1, anchor=south] at (0,0) {};
    \shade[ball color=white] (0,-4.35) circle (0.25);
    \draw[thick, -stealth'] (0.55,-4.5) -- (0.55,-3.8)
        node[right, pos=0.5, font=\small] {$\vec v_{\kappa}$};

\end{tikzpicture}

\end{figure}
\end{document}

ingrese la descripción de la imagen aquí

información relacionada