Alinhamento vertical e horizontal em ambiente de minipágina

Alinhamento vertical e horizontal em ambiente de minipágina

Como seria possível ter o mesmo espaço entre a figura e ambas as margens da página neste exemplo: insira a descrição da imagem aqui

Além disso, gostaria de ajustar o lado inferior da figura esquerda com o eixo xda imagem tikz direita: como fazer isso?

Obrigado pela ajuda,

Atenciosamente,

Código:

\documentclass{article}
\usepackage{graphicx}
\usepackage{caption}
\usepackage{pgfplots}
\usepackage{pgf, tikz, adjustbox}
\usepgfplotslibrary{fillbetween}
\usetikzlibrary{angles,calc}
\usetikzlibrary{spy}
\usetikzlibrary{patterns, matrix, positioning}
\usetikzlibrary{decorations.markings, decorations.pathreplacing, arrows.meta,
                patterns.meta,
                quotes}
\usetikzlibrary{shapes.geometric}
 %%HYPERBOLE   
    \newcommand\tikzhyperbola[6][thick]{%
    \draw [#1, rotate around={#2: (0, 0)}, shift=#3]
        plot [variable = \t, samples=1000, domain=-#6:#6] ({#4 / cos( \t )}, {#5 * tan( \t )});
        }

\begin{document}

\begin{figure}[h]
  \centering
  \begin{minipage}[t]{0.45\textwidth} % Définition de la taille de la première colonne
    \centering
    \includegraphics[width=\linewidth]{example-image}
    \caption*{Image 1}
    \vspace{1em} % Ajoutez de l'espace vertical si nécessaire
  \end{minipage} % Fin de la première colonne
  \hfill % Espace horizontal entre les deux colonnes
  \begin{minipage}[t]{0.5\textwidth} % Définition de la taille de la deuxième colonne
    \centering
    \begin{tikzpicture}[scale=0.45,
    the_angle/.style args = {#1/#2}{draw,latex-latex,
                                   angle radius=#1,
                                   angle eccentricity=#2,
                                   }, % angle label position
                                   ]
    
    \tikzset{
        elli/.style args={#1:#2and#3}{
            draw,
            shape=ellipse,
            rotate=#1,
            minimum width=2*#2,
            minimum height=2*#3,
            outer sep=0pt,
        }
    }
    \def\angle{90}
    \def\bigaxis{1.5cm}
    \def\smallaxis{1.5cm}
    \def\bigaxisbis{2.9cm}
    \def\smallaxisbis{3.6cm}
    
    \pgfmathsetmacro\axisratio{\smallaxis / \bigaxis}
    
    \coordinate (center) at (0, 0);
    
    \node [scale=0.55, elli=\angle:\bigaxis and \smallaxis, line width = 1.2pt, color=black, dotted] at (center) (e) {};
    
    \draw [-{stealth}, line width = 0.8pt, color = black] ([shift={(\angle:0)}] e.center) -- ([shift={(\angle:8)}] e.center) node [above right] {$z$};
    \draw [-{stealth}, line width = 1pt, color = black] ([shift={(0:-8)}] e.center) -- ([shift={(0:8)}] e.center) node [above left]  {$x$}  ;
    
    \draw[blue!80!black, very thick, Stealth-Stealth] (\bigaxis,0) --node[fill=white,scale = .65,right,xshift = 0.1 cm]{$h_{0}(t)$} (\bigaxis,\smallaxis);
    \draw[blue!80!black, dashed, thin] (0,\smallaxis) -- (\bigaxis,\smallaxis);
    \draw[red!80!black, very thick, Stealth-Stealth] (\bigaxisbis,0) --node[fill=white,scale = .65,right,xshift = 0.1 cm]{$h_{0}(t+\delta t)$} (\bigaxisbis,2.95cm);
    \draw[red!80!black, dashed, thin] (0,2.875cm) -- (3cm,2.95cm);
     % Dessin des 2 hyperboles
    \tikzhyperbola[line width = 1.2pt, color=blue!80!black]{\angle}{(center)}{\bigaxis}{\smallaxis}{77}
    \tikzhyperbola[line width = 1.2pt, color=red!80!black]{\angle}{(center)}{\bigaxisbis}{\smallaxisbis}{62}
    % asymptotes
    \def\lengthofasymptote{15}
            \coordinate (O) at (0,0); % intersection with coordinate axis
            \coordinate (C) at (-2,0);        
    % Dessin de l'arc de cercle entre CO et l'asymptote
    \draw[stealth-stealth, color=black, line width = 0.4pt]
        let \p1=($(O)-(C)$),\n1={veclen(\x1,\y1)} in
        (O) ++(135: \n1) arc (135:180: \n1) node[pos=0.5, above left] {$\alpha$};
    % asymptotes
    \draw [color=black!40, line width = 0.4pt, rotate around={45: (center)}]
        ($ (0, 0) + (center) $) --++(0.75*\lengthofasymptote, 0) ;
    \draw [color=black!40, line width = 0.4pt, rotate around={ 135: (center)}]
        ($ (0, 0) + (center) $) -- ++(0.75*\lengthofasymptote, 0) ;
    \end{tikzpicture}
    \caption*{Image 2}
    \vspace{1em} % Ajoutez de l'espace vertical si nécessaire
  \end{minipage} % Fin de la deuxième colonne
  \caption{Légende générale pour les deux figures}
  \label{fig:exemple_figures_alignees}
\end{figure}

\end{document}

EDIT: Tentei implementar baselinepara alinhar as figuras verticalmente, mas cometi um erro porque não está funcionando corretamente.

Código:

\begin{figure}[h]
  \centering
  \begin{minipage}[t]{0.4\textwidth} % Définition de la taille de la première colonne
    \centering
    \includegraphics[width=\linewidth]{example-image}
    \caption*{Image 1}
    \vspace{1em} % Ajoutez de l'espace vertical si nécessaire
  \end{minipage} % Fin de la première colonne
  \hfill % Espace horizontal entre les deux colonnes
  \begin{minipage}[t][\dimexpr\height+\depth\relax]{0.5\textwidth} % Définition de la taille de la deuxième colonne avec la même hauteur que l'image
    \centering
    \begin{tikzpicture}[baseline=(current bounding box.south),scale=0.45,
    the_angle/.style args = {#1/#2}{draw,latex-latex,
                                   angle radius=#1,
                                   angle eccentricity=#2,
                                   }, % angle label position
                                   ]  % BASELINE HERE
    \tikzset{
        elli/.style args={#1:#2and#3}{
            draw,
            shape=ellipse,
            rotate=#1,
            minimum width=2*#2,
            minimum height=2*#3,
            outer sep=0pt,
        }
    }
    \def\angle{90}
    \def\bigaxis{1.5cm}
    \def\smallaxis{1.5cm}
    \def\bigaxisbis{2.9cm}
    \def\smallaxisbis{3.6cm}
    
    \pgfmathsetmacro\axisratio{\smallaxis / \bigaxis}
    
    \coordinate (center) at (0, 0);
    
    \node [scale=0.55, elli=\angle:\bigaxis and \smallaxis, line width = 1.2pt, color=black, dotted] at (center) (e) {};
    
    \draw [-{stealth}, line width = 0.8pt, color = black] ([shift={(\angle:0)}] e.center) -- ([shift={(\angle:8)}] e.center) node [above right] {$z$};
    \draw [-{stealth}, line width = 1pt, color = black] ([shift={(0:-8)}] e.center) -- ([shift={(0:8)}] e.center) node [above left]  {$x$}  ;
    
    \draw[blue!80!black, very thick, Stealth-Stealth] (\bigaxis,0) --node[fill=white,scale = .65,right,xshift = 0.1 cm]{$h_{0}(t)$} (\bigaxis,\smallaxis);
    \draw[blue!80!black, dashed, thin] (0,\smallaxis) -- (\bigaxis,\smallaxis);
    \draw[red!80!black, very thick, Stealth-Stealth] (\bigaxisbis,0) --node[fill=white,scale = .65,right,xshift = 0.1 cm]{$h_{0}(t+\delta t)$} (\bigaxisbis,2.95cm);
    \draw[red!80!black, dashed, thin] (0,2.875cm) -- (3cm,2.95cm);
     % Dessin des 2 hyperboles
    \tikzhyperbola[line width = 1.2pt, color=blue!80!black]{\angle}{(center)}{\bigaxis}{\smallaxis}{77}
    \tikzhyperbola[line width = 1.2pt, color=red!80!black]{\angle}{(center)}{\bigaxisbis}{\smallaxisbis}{62}
    % asymptotes
    \def\lengthofasymptote{15}
            \coordinate (O) at (0,0); % intersection with coordinate axis
            \coordinate (C) at (-2,0);        
    % Dessin de l'arc de cercle entre CO et l'asymptote
    \draw[stealth-stealth, color=black, line width = 0.4pt]
        let \p1=($(O)-(C)$),\n1={veclen(\x1,\y1)} in
        (O) ++(135: \n1) arc (135:180: \n1) node[pos=0.5, above left] {$\alpha$};
    % asymptotes
    \draw [color=black!40, line width = 0.4pt, rotate around={45: (center)}]
        ($ (0, 0) + (center) $) --++(0.75*\lengthofasymptote, 0) ;
    \draw [color=black!40, line width = 0.4pt, rotate around={ 135: (center)}]
        ($ (0, 0) + (center) $) -- ++(0.75*\lengthofasymptote, 0) ;
    \end{tikzpicture}
    \caption*{Image 2}
    \vspace{1em} % Ajoutez de l'espace vertical si nécessaire
  \end{minipage} % Fin de la deuxième colonne
  \caption{Légende générale pour les deux figures}
  \label{fig:exemple_figures_alignees}
\end{figure}

Dando :

insira a descrição da imagem aqui

Responder1

Seu desenho à direita é mais largo que o espaço alocado.

Se eu adicionar, com o propósito de mostrar as caixas delimitadoras,

\usepackage[pass,showframe]{geometry}
\setlength{\fboxsep}{-\fboxrule}

ao preâmbulo do documento e colocar os dois minipagedentro \fbox{...}, recebo

insira a descrição da imagem aqui

Você vê que o desenho dispara minipagee você até é avisado sobre isso:

Overfull \hbox (33.35834pt too wide) in paragraph at lines 91--91

(os números das linhas podem ser diferentes).

Claro, isso depende da largura do texto que você tem no seu documento. Com a largura de texto padrão, se você precisar da proporção 0,45: 0,5, será necessário reduzir uma ou ambas as partes.

Reduzir o desenho para 0,35, em vez de 0,45 como você tem no código, parece bastante satisfatório:

insira a descrição da imagem aqui

Usei \begin{minipage}[b]para ambos, em vez de [t], então as duas legendas estão bem alinhadas. \caption*A propósito, não há necessidade .

\documentclass{article}
\usepackage{graphicx}
\usepackage{caption}
\usepackage{pgfplots}
\usepackage{pgf, tikz, adjustbox}
\usepgfplotslibrary{fillbetween}
\usetikzlibrary{angles,calc}
\usetikzlibrary{spy}
\usetikzlibrary{patterns, matrix, positioning}
\usetikzlibrary{decorations.markings, decorations.pathreplacing, arrows.meta,
                patterns.meta,
                quotes}
\usetikzlibrary{shapes.geometric}

 %%HYPERBOLE   
\newcommand\tikzhyperbola[6][thick]{%
  \draw [#1, rotate around={#2: (0, 0)}, shift=#3]
    plot [variable = \t, samples=1000, domain=-#6:#6] ({#4 / cos( \t )}, {#5 * tan( \t )});
}

\begin{document}

\begin{figure}[htp]
  \centering
  \begin{minipage}[b]{0.45\textwidth} % Définition de la taille de la première colonne
    \centering
    \includegraphics[width=\linewidth]{example-image}
    \caption*{Image 1}
  \end{minipage}% Fin de la première colonne
  \hfill % Espace horizontal entre les deux colonnes
  \begin{minipage}[b]{0.5\textwidth} % Définition de la taille de la deuxième colonne
    \centering
    \begin{tikzpicture}[
      scale=0.35,% <--- CHANGED HERE
      the_angle/.style args = {#1/#2}{
        draw,
        latex-latex,
        angle radius=#1,
        angle eccentricity=#2,
      }, % angle label position
      elli/.style args={#1:#2and#3}{
        draw,
        shape=ellipse,
        rotate=#1,
        minimum width=2*#2,
        minimum height=2*#3,
        outer sep=0pt,
      },
    ]
    \def\angle{90}
    \def\bigaxis{1.5cm}
    \def\smallaxis{1.5cm}
    \def\bigaxisbis{2.9cm}
    \def\smallaxisbis{3.6cm}
    
    \pgfmathsetmacro\axisratio{\smallaxis / \bigaxis}
    
    \coordinate (center) at (0, 0);
    
    \node [scale=0.55, elli=\angle:\bigaxis and \smallaxis, line width = 1.2pt, color=black, dotted] at (center) (e) {};
    
    \draw [-{stealth}, line width = 0.8pt, color = black] ([shift={(\angle:0)}] e.center) -- ([shift={(\angle:8)}] e.center) node [above right] {$z$};
    \draw [-{stealth}, line width = 1pt, color = black] ([shift={(0:-8)}] e.center) -- ([shift={(0:8)}] e.center) node [above left]  {$x$}  ;
    
    \draw[blue!80!black, very thick, Stealth-Stealth] (\bigaxis,0) --node[fill=white,scale = .65,right,xshift = 0.1 cm]{$h_{0}(t)$} (\bigaxis,\smallaxis);
    \draw[blue!80!black, dashed, thin] (0,\smallaxis) -- (\bigaxis,\smallaxis);
    \draw[red!80!black, very thick, Stealth-Stealth] (\bigaxisbis,0) --node[fill=white,scale = .65,right,xshift = 0.1 cm]{$h_{0}(t+\delta t)$} (\bigaxisbis,2.95cm);
    \draw[red!80!black, dashed, thin] (0,2.875cm) -- (3cm,2.95cm);
     % Dessin des 2 hyperboles
    \tikzhyperbola[line width = 1.2pt, color=blue!80!black]{\angle}{(center)}{\bigaxis}{\smallaxis}{77}
    \tikzhyperbola[line width = 1.2pt, color=red!80!black]{\angle}{(center)}{\bigaxisbis}{\smallaxisbis}{62}
    % asymptotes
    \def\lengthofasymptote{15}
            \coordinate (O) at (0,0); % intersection with coordinate axis
            \coordinate (C) at (-2,0);        
    % Dessin de l'arc de cercle entre CO et l'asymptote
    \draw[stealth-stealth, color=black, line width = 0.4pt]
        let \p1=($(O)-(C)$),\n1={veclen(\x1,\y1)} in
        (O) ++(135: \n1) arc (135:180: \n1) node[pos=0.5, above left] {$\alpha$};
    % asymptotes
    \draw [color=black!40, line width = 0.4pt, rotate around={45: (center)}]
        ($ (0, 0) + (center) $) --++(0.75*\lengthofasymptote, 0) ;
    \draw [color=black!40, line width = 0.4pt, rotate around={ 135: (center)}]
        ($ (0, 0) + (center) $) -- ++(0.75*\lengthofasymptote, 0) ;
    \end{tikzpicture}
    \caption*{Image 2}
  \end{minipage} % Fin de la deuxième colonne

\caption{Légende générale pour les deux figures}
\label{fig:exemple_figures_alignees}

\end{figure}

\end{document}

insira a descrição da imagem aqui

Aumentar a imagem não parece certo, neste caso, mas depende das proporções da sua imagem real.

Avalie a olho nu. Com

  \begin{minipage}[b]{0.45\textwidth} % Définition de la taille de la première colonne
    \centering
    \includegraphics[width=\linewidth]{example-image}

    \vspace{5ex}

    \caption*{Image 1}
  \end{minipage}% Fin de la première colonne

para a imagem, a saída é

insira a descrição da imagem aqui

informação relacionada