2

Does anyone know how to make the most "beautiful" method of aligning two graphs placed on a page side-by-side? The alignment is assumed to be on the lower axis.

A concrete example of execution: enter image description here

Corresponding code

\documentclass[12pt]{article}

\usepackage[T1]{fontenc}
\usepackage[utf8]{inputenc}
\usepackage[english, russian]{babel}

\usepackage[a4paper, total={170mm, 257mm},
            left=2cm, right=1cm,
            top=1cm, bottom=1.5cm, bindingoffset=0cm]{geometry}

\usepackage{makecell, tikz}
\usetikzlibrary{calc, intersections, math}


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

\def \aLen {3}
\def \xM {2.1}
\def \yM {1.8}
\def \onePhi {20}
\def \secPhi {65}

\def \Scal {1.5}

%%%%%%%%%%
\begin{tabular}{cc}
    \begin{minipage}{0.4\textwidth}
        \begin{tikzpicture}[thick, scale=\Scal]

        \tikzmath{\eCos1 = cos(\onePhi)*\aLen;
            \eSin1 = sin(\onePhi)*\aLen;
            \eCos2 = cos(\secPhi)*\aLen;
            \eSin2 = sin(\secPhi)*\aLen;
            %%%
            \1k = (\xM / cos(\onePhi)) - (\yM - \xM*tan(\onePhi)) / (sin(\secPhi) - cos(\secPhi)*tan(\onePhi)) * (cos(\secPhi)/cos(\onePhi));
            \2k = (\yM - \xM*tan(\onePhi)) / (sin(\secPhi) - cos(\secPhi)*tan(\onePhi));
            \mx1 = \1k * cos(\onePhi);
            \my1 = \1k * sin(\onePhi);
            \mx2 = \2k * cos(\secPhi);
            \my2 = \2k * sin(\secPhi);
            %%%
            \PrOM1 = \xM*cos(\onePhi) + \yM*sin(\onePhi);
            \Mx1 = \PrOM1*cos(\onePhi);
            \My1 = \PrOM1*sin(\onePhi);
            \PrOM2 = \xM*cos(\secPhi) + \yM*sin(\secPhi);
            \Mx2 = \PrOM2*cos(\secPhi);
            \My2 = \PrOM2*sin(\secPhi);
        }


        \begin{scope}[-stealth]

        \draw [black] (0,0) -- (\aLen, 0)           node [right] {$\vec{e}_{x}$};
        \draw [black] (0,0) -- (0, \aLen)           node [right] {$\vec{e}_{y}$};
        \draw [blue]  (0,0) -- (\eCos1, \eSin1) node [right] {$\vec{e}_{1}$};
        \draw [blue]  (0,0) -- (\eCos2, \eSin2) node [right] {$\vec{e}_{2}$};
        \end{scope}

        %%%
        \coordinate  (M) at (\xM, \yM);
        \fill[black] (M) circle (2pt) node[above right] {$M$};

        \draw [dashed, black] (M) -- (\xM, 0);
        \fill[black] (\xM, 0) circle (1.5pt) node[below] {$m_{x}$};
        \draw [dashed, black] (M) -- (0, \yM);
        \fill[black] (0, \yM) circle (1.5pt) node[left] {$m_{y}$};
        \end{tikzpicture}
    \end{minipage} &

    \begin{minipage}{0.4\textwidth}
        \centering
        \begin{tikzpicture}[thick, scale=\Scal]

        \tikzmath{\eCos1 = cos(\onePhi)*\aLen;
            \eSin1 = sin(\onePhi)*\aLen;
            \eCos2 = cos(\secPhi)*\aLen;
            \eSin2 = sin(\secPhi)*\aLen;
            %%%
            \1k = (\xM / cos(\onePhi)) - (\yM - \xM*tan(\onePhi)) / (sin(\secPhi) - cos(\secPhi)*tan(\onePhi)) * (cos(\secPhi)/cos(\onePhi));
            \2k = (\yM - \xM*tan(\onePhi)) / (sin(\secPhi) - cos(\secPhi)*tan(\onePhi));
            \mx1 = \1k * cos(\onePhi);
            \my1 = \1k * sin(\onePhi);
            \mx2 = \2k * cos(\secPhi);
            \my2 = \2k * sin(\secPhi);
            %%%
            \PrOM1 = \xM*cos(\onePhi) + \yM*sin(\onePhi);
            \Mx1 = \PrOM1*cos(\onePhi);
            \My1 = \PrOM1*sin(\onePhi);
            \PrOM2 = \xM*cos(\secPhi) + \yM*sin(\secPhi);
            \Mx2 = \PrOM2*cos(\secPhi);
            \My2 = \PrOM2*sin(\secPhi);
        }


        \begin{scope}[-stealth]

        \draw [black] (0,0) -- (\aLen, 0)           node [right] {$\vec{e}_{x}$};
        \draw [black] (0,0) -- (0, \aLen)           node [right] {$\vec{e}_{y}$};
        \draw [blue]  (0,0) -- (\eCos1, \eSin1) node [right] {$\vec{e}_{1}$};
        \draw [blue]  (0,0) -- (\eCos2, \eSin2) node [right] {$\vec{e}_{2}$};
        \end{scope}

        %%%
        \coordinate  (M) at (\xM, \yM);
        \coordinate (m1) at (\mx1, \my1);
        \fill[blue] (m1) circle (1.5pt) node[below] {$m^{1}$};
        \coordinate (m2) at (\mx2, \my2);
        \fill[blue] (m2) circle (1.5pt) node[left] {$m^{2}$};

        \draw [dashed, blue] (M) -- (m1);
        \draw [dashed, blue] (M) -- (m2);

        \coordinate (M1) at (\Mx1, \My1);
        \fill[blue] (M1) circle (1.5pt) node[below] {$m_{1}$};
        \coordinate (M2) at (\Mx2, \My2);
        \fill[blue] (M2) circle (1.5pt) node[left] {$m_{2}$};

        \draw [dashed, blue] (M) -- (M1);
        \draw [dashed, blue] (M) -- (M2);

        \fill[black] (M) circle (2pt) node[above right] {$M$};

        \end{tikzpicture}
        \vfill
    \end{minipage}
\end{tabular}
\end{figure}
\end{document}

Obviously, the shift of chart axes appears due to the presence of an additional signature on the left chart.

A crony variant could be to install an empty box of the corresponding size in the place of the signature ($m_{x}$). However, how to do this also raises questions.

Maybe the table version isn't the best either?

  • Welcome to TeX.SE! What is the problem? So far both diagrams are well aligned. Do you like to add some TikZ picture (now not part of your MWE /Minimal Working Example/), for example an rectangle which center anchor is aligned to x-axis of diagrams? – Zarko Oct 17 at 4:47
2

Welcome! You could just put them in a picture into two scopes which are shifted relative to each other.

\documentclass[12pt]{article}

\usepackage[T1]{fontenc}
\usepackage[utf8]{inputenc}
\usepackage[english, russian]{babel}

\usepackage[a4paper, total={170mm, 257mm},
            left=2cm, right=1cm,
            top=1cm, bottom=1.5cm, bindingoffset=0cm]{geometry}

\usepackage{makecell, tikz}
\usetikzlibrary{calc, intersections, math}


\begin{document}
\begin{figure}[h]
\centering
\def\aLen{3}
\def\xM{2.1}
\def\yM{1.8}
\def\onePhi{20}
\def\secPhi{65}
\def\Scal{1.5}
%%%%%%%%%%
\begin{tikzpicture}[thick, scale=\Scal]
        \begin{scope}[local bounding box=left]
        \tikzmath{\eCos1 = cos(\onePhi)*\aLen;
            \eSin1 = sin(\onePhi)*\aLen;
            \eCos2 = cos(\secPhi)*\aLen;
            \eSin2 = sin(\secPhi)*\aLen;
            %%%
            \1k = (\xM / cos(\onePhi)) - (\yM - \xM*tan(\onePhi)) / (sin(\secPhi) - cos(\secPhi)*tan(\onePhi)) * (cos(\secPhi)/cos(\onePhi));
            \2k = (\yM - \xM*tan(\onePhi)) / (sin(\secPhi) - cos(\secPhi)*tan(\onePhi));
            \mx1 = \1k * cos(\onePhi);
            \my1 = \1k * sin(\onePhi);
            \mx2 = \2k * cos(\secPhi);
            \my2 = \2k * sin(\secPhi);
            %%%
            \PrOM1 = \xM*cos(\onePhi) + \yM*sin(\onePhi);
            \Mx1 = \PrOM1*cos(\onePhi);
            \My1 = \PrOM1*sin(\onePhi);
            \PrOM2 = \xM*cos(\secPhi) + \yM*sin(\secPhi);
            \Mx2 = \PrOM2*cos(\secPhi);
            \My2 = \PrOM2*sin(\secPhi);
        }


        \begin{scope}[-stealth]

        \draw [black] (0,0) -- (\aLen, 0)           node [right] {$\vec{e}_{x}$};
        \draw [black] (0,0) -- (0, \aLen)           node [right] {$\vec{e}_{y}$};
        \draw [blue]  (0,0) -- (\eCos1, \eSin1) node [right] {$\vec{e}_{1}$};
        \draw [blue]  (0,0) -- (\eCos2, \eSin2) node [right] {$\vec{e}_{2}$};
        \end{scope}

        %%%
        \coordinate  (M) at (\xM, \yM);
        \fill[black] (M) circle (2pt) node[above right] {$M$};

        \draw [dashed, black] (M) -- (\xM, 0);
        \fill[black] (\xM, 0) circle (1.5pt) node[below] {$m_{x}$};
        \draw [dashed, black] (M) -- (0, \yM);
        \fill[black] (0, \yM) circle (1.5pt) node[left] {$m_{y}$};
        \end{scope}
        \begin{scope}[local bounding box=right,xshift=\textwidth/4]

        \tikzmath{\eCos1 = cos(\onePhi)*\aLen;
            \eSin1 = sin(\onePhi)*\aLen;
            \eCos2 = cos(\secPhi)*\aLen;
            \eSin2 = sin(\secPhi)*\aLen;
            %%%
            \1k = (\xM / cos(\onePhi)) - (\yM - \xM*tan(\onePhi)) / (sin(\secPhi) - cos(\secPhi)*tan(\onePhi)) * (cos(\secPhi)/cos(\onePhi));
            \2k = (\yM - \xM*tan(\onePhi)) / (sin(\secPhi) - cos(\secPhi)*tan(\onePhi));
            \mx1 = \1k * cos(\onePhi);
            \my1 = \1k * sin(\onePhi);
            \mx2 = \2k * cos(\secPhi);
            \my2 = \2k * sin(\secPhi);
            %%%
            \PrOM1 = \xM*cos(\onePhi) + \yM*sin(\onePhi);
            \Mx1 = \PrOM1*cos(\onePhi);
            \My1 = \PrOM1*sin(\onePhi);
            \PrOM2 = \xM*cos(\secPhi) + \yM*sin(\secPhi);
            \Mx2 = \PrOM2*cos(\secPhi);
            \My2 = \PrOM2*sin(\secPhi);
        }


        \begin{scope}[-stealth]

        \draw [black] (0,0) -- (\aLen, 0)           node [right] {$\vec{e}_{x}$};
        \draw [black] (0,0) -- (0, \aLen)           node [right] {$\vec{e}_{y}$};
        \draw [blue]  (0,0) -- (\eCos1, \eSin1) node [right] {$\vec{e}_{1}$};
        \draw [blue]  (0,0) -- (\eCos2, \eSin2) node [right] {$\vec{e}_{2}$};
        \end{scope}

        %%%
        \coordinate  (M) at (\xM, \yM);
        \coordinate (m1) at (\mx1, \my1);
        \fill[blue] (m1) circle (1.5pt) node[below] {$m^{1}$};
        \coordinate (m2) at (\mx2, \my2);
        \fill[blue] (m2) circle (1.5pt) node[left] {$m^{2}$};

        \draw [dashed, blue] (M) -- (m1);
        \draw [dashed, blue] (M) -- (m2);

        \coordinate (M1) at (\Mx1, \My1);
        \fill[blue] (M1) circle (1.5pt) node[below] {$m_{1}$};
        \coordinate (M2) at (\Mx2, \My2);
        \fill[blue] (M2) circle (1.5pt) node[left] {$m_{2}$};

        \draw [dashed, blue] (M) -- (M1);
        \draw [dashed, blue] (M) -- (M2);

        \fill[black] (M) circle (2pt) node[above right] {$M$};

        \end{scope}
\end{tikzpicture}
\end{figure}
\end{document}

enter image description here

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.