我想在图像旁边放置一个项目符号列表。因此我做了以下操作:
\documentclass[11pt, a4paper, twoside, openright]{report}
\usepackage[english]{babel} % languages rules
\usepackage[utf8]{inputenc} % text encoding
\usepackage[top=2.5cm,
bottom=2.5cm,
inner=2.5cm,
outer=3cm,
twoside]{geometry}
\usepackage{graphicx} % optional arguments to the \includegraphics command
\usepackage{float} % Improves the interface for defining floating objects such as figures and tables.
\usepackage[lofdepth, % Faire des sous-figures
lotdepth]{subfig}
\usepackage{enumitem} % Personalized list
%\insertImage[position]{image_path}{scale}{Figure_title}{label}
\newcommand{\insertImage}[5][center]{
\begin{#1}
\includegraphics[width=#3\textwidth]{#2}
\captionof{figure}{#4}
\label{#5}
\end{#1}
}
\begin{document}
\begin{minipage}[t]{.2\textwidth}
\noindent
\begin{itemize}
\item Node
\item Endpoint
\item Service
\item Pod
\item Ingress
\end{itemize}
\end{minipage}
\begin{minipage}[t]{.8\textwidth}
\insertImage{monitoring}{1}{CEE monitoring}{fig-monitoring}
\end{minipage}
\end{document}
但是当我编译时,我收到以下警告:段落中的 \hbox 过满(2.43332pt 太宽)
我不明白这个警告,因为两个小页面应该是 1\textwidth。基于此:minipage 的水平盒子已经满了 使用 \noindent 应该可以解决问题,但是它不起作用。
并且两个小页面没有对齐:
你们知道我怎样才能让项目符号列表和这张图片处于同一高度吗?提前谢谢!
答案1
您需要注意在小页面之前和之间添加空白。
\documentclass[11pt, a4paper, twoside, openright]{report}
\usepackage[english]{babel} % languages rules
\usepackage[utf8]{inputenc} % text encoding
\usepackage[top=2.5cm,
bottom=2.5cm,
inner=2.5cm,
outer=3cm,
twoside]{geometry}
\usepackage{graphicx} % optional arguments to the \includegraphics command
\usepackage{float} % Improves the interface for defining floating objects such as figures and tables.
\usepackage[lofdepth, % Faire des sous-figures
lotdepth]{subfig}
\usepackage{enumitem} % Personalized list
%\insertImage[position]{image_path}{scale}{Figure_title}{label}
\newcommand{\insertImage}[5][center]{
\begin{#1}
\includegraphics[width=#3\textwidth]{#2}
\captionof{figure}{#4}
\label{#5}
\end{#1}
}
\begin{document}
%no indent here
\noindent
\begin{minipage}[t]{.2\textwidth}
% not this \noindent
\vspace{0pt}% something to top align on
\begin{itemize}
\item Node
\item Endpoint
\item Service
\item Pod
\item Ingress
\end{itemize}
\end{minipage}%no space here
\begin{minipage}[t]{.8\textwidth}
\vspace{0pt}% something to top align on
\insertImage{example-image}{1}{CEE monitoring}{fig-monitoring}
\end{minipage}
\end{document}