이 예에서 그림과 페이지의 양쪽 여백 사이에 동일한 공간을 갖는 것이 어떻게 가능합니까?
또한 오른쪽 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}
문서 서문에 추가하고 두 개의 minipage
s를 안에 넣 \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]
대신 두 가지 모두를 사용했기 [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
그림의 출력은 다음과 같습니다.