3

I have the following code:

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

which produces this output: enter image description here

As you can see, it seems that the caption and the image are left-aligned in comparison with the overall text. Could be a way to move both figure and caption to the right? Adding \hspace for the image worked but not for the caption.

Thank you.

2
  • The image is centered within the textwidth, while the itemize enironment starts with an indentation from the left margin. Therefor the image seems to be shifted to the left. Assuming, that you want to horizontally center the image with repsect to the width that is occupied by the itemize environment, you might be interested in the following answer: tex.stackexchange.com/a/401823/134144
    – leandriis
    Apr 30, 2018 at 20:38
  • You could use 1.ref. image: adjust package and \textwodth, left see https://tex.stackexchange.com/a/91580/124842and 2. ref caption:\usepackage{caption}\captionsetup{justification = raggedleft,singlelinecheck = false} (see:Align Caption to the left)
    – Bobyandbob
    Apr 30, 2018 at 20:41

2 Answers 2

2

Since your image doesn't have to float, you can obtain a correct centring with a measuredfigure environment, from threeparttable, nested in a simple center environment:

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

enter image description here

2

You simply need the image without a float, make the width of the image relative to the \linewidth and use \captionof of the capt-of package.

Showing margin edges and without paragraph indentation maybe the example is more clear (note: the image is intentionally flattened,just remove the height have it proportionally):

mwe

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

If you want a smaller image centered, it is enough put a \hfil bebore of the image, or enclose with {\centering ... \par} or with \begin{center}...\end{center}.

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .