我有以下代码:
\documentclass{article}
\usepackage{float}
\usepackage{siunitx}
\usepackage{graphicx}
\begin{document}
By plotting the attenuation in $ \si{\decibel s} $ we get the following graphs:
\begin{itemize}
\item \underline{For Butterworth:}
\vspace{-0.1cm}
\begin{figure}[H]
\centering
\includegraphics[width=0.9\textwidth]{sample_photo.png}
\caption{Tabulated LPP normalized attenuation curve for Butterworth.}
\end{figure}
There are $ n $ number of zeros, in our case $ n=3 $ zeros of each kind. As we can see, the transmission zeros are in the infinity...
\end{itemize}
\end{document}
如您所见,与整体文本相比,标题和图像似乎是左对齐的。 有没有办法将图形和标题都移到右侧? 添加\hspace
图像有效,但添加标题无效。
谢谢。
答案1
由于您的图像不必浮动,因此您可以measuredfigure
通过threeparttable
嵌套在简单 center
环境中的环境获得正确的居中:
\documentclass{article}
\usepackage[utf8]{inputenc}
\usepackage[showframe]{geometry}
\usepackage{caption}%loat,
\usepackage{threeparttable, floatrow}
\usepackage[demo]{graphicx}
\usepackage{siunitx}
\begin{document}
By plotting the attenuation in $ \si{\decibel s} $ we get the following graphs:
\begin{itemize}
\item \underline{For Butterworth:}
\vspace{-0.1cm}
\begin{center}
\begin{measuredfigure}%
\includegraphics[width=0.9\linewidth]{sample_photo.png}
\captionof{figure}{Tabulated LPP normalized attenuation curve for Butterworth.}
\end{measuredfigure}
\end{center}
There are $ n $ number of zeros, in our case $ n=3 $ zeros of each kind. As we can see, the transmission zeros are in the infinity...
\end{itemize}
\end{document}
答案2
你只需要图片无浮动,使图像的宽度相对于包的\linewidth
使用。\captionof
capt-of
显示边距边缘并且没有段落缩进可能示例更清晰(注意:图像是故意压平的,只需按比例移除高度即可):
\documentclass{article}
\usepackage[showframe]{geometry}
\usepackage{capt-of,lipsum,parskip}
\usepackage{graphicx}
\begin{document}
\lipsum[2]
\begin{itemize}
\item \lipsum[3]
\item For Butterworth:\par
\includegraphics[width=\linewidth,height=1cm]{example-image-a}
\captionof{figure}{Tabulated LPP normalized attenuation curve for Butterworth.}
\lipsum[4]
\item \lipsum[5]
\end{itemize}
\lipsum[6]
\end{document}
如果想要将较小的图像居中,则在\hfil
图像上方放置一个,或者用 {\centering ... \par}
或括起来就足够了\begin{center}...\end{center}
。