ミニページ環境での垂直および水平配置

ミニページ環境での垂直および水平配置

この例では、図とページの両方の余白の間に同じスペースを確保するにはどうすればよいでしょうか。 ここに画像の説明を入力してください

また、左の図の下側を右の tikzpicture の軸に合わせて調整したいのですがx、どうすればよいですか?

助けてくれてありがとう、

よろしくお願いします、

コード:

\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}

編集:baseline数字を垂直に揃えるように実装しようとしましたが、正しく動作しないため、間違いを犯しました。

コード:

\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}

寄付:

ここに画像の説明を入力してください

答え1

右側の描画は割り当てられたスペースよりも幅が広くなっています。

境界ボックスを表示するために、

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

文書の序文に2つのminipagesを囲むと\fbox{...}

ここに画像の説明を入力してください

図面が外れminipage、次のような警告も表示されます。

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

(行番号は異なる場合があります)。

もちろん、これはドキュメント内のテキストの幅によって異なります。標準のテキスト幅で、0.45 : 0.5 の比率が必要な場合は、一方または両方の部分を縮小する必要があります。

コードにある 0.45 ではなく、図面を 0.35 に縮小すると、かなり満足のいく結果が得られます。

ここに画像の説明を入力してください

\begin{minipage}[b]両方に ではなくを使用したので、2 つの凡例が適切に配置されます。ちなみに[t]は必要ありません。\caption*

\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}

ここに画像の説明を入力してください

この場合、画像を上げるのは適切ではないようですが、実際の画像の比率によって異なります。

目で測ってください。

  \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

画像の場合、出力は

ここに画像の説明を入力してください

関連情報