# Centering Image When image Grows Rightward

I have the following:

Notice that the image is above the text.

If I increase the size, it keeps growing towards the right of the page and over the margin of the text, rather than growing proportionally on both sides of the page.

My code is as follows:

\documentclass[10pt]{article}
\usepackage{amsmath,amsfonts,amssymb}
\usepackage{graphicx}
\graphicspath{ {./images/} }
\usepackage{hyperref}
\hypersetup{
filecolor=magenta,
urlcolor=cyan,
}
\usepackage{csquotes}
\setlength{\parskip}{\baselineskip}%
\setlength{\parindent}{0pt}%
\begin{document}
\raggedright

\begin{center}
\includegraphics[scale=0.7]{a}
\end{center}

We have $odds(D|C)$ in the numerator and $odds(D|C^c)$ in the denominator. As such, the two odds are not simply \textit{any} two odds from \textit{any} two probabilities $p_1$ and $p_2$; rather, they are

\end{document}


I would appreciate it if people could please explain how I can make it so that, when I resize the image, it grows proportionally towards both sides of the page, rather than just towards the right. That way, it looks more aligned and professional, rather than protruding through one side of the page.

Put a \makebox[0pt][c] around the \includegraphics. This tells the typesetting algorithm that the image has a width of 0pt and lets it overlap on both sides.

\documentclass[10pt]{article}
\usepackage{amsmath,amsfonts,amssymb}
\usepackage{graphicx}
\usepackage{hyperref}
\hypersetup{
filecolor=magenta,
urlcolor=cyan,
}
\usepackage{csquotes}
\setlength{\parskip}{\baselineskip}
\setlength{\parindent}{0pt}
\DeclareMathOperator{\odds}{odds}
\begin{document}
\raggedright

\begin{center}
\makebox[0pt][c]{\includegraphics[scale=2.7]{example-image-duck}}
\end{center}

We have $\odds(D\mid C)$ in the numerator and $\odds(D\mid C^c)$ in the denominator. As
such, the two odds are not simply \textit{any} two odds from \textit{any} two
probabilities $p_1$ and $p_2$; rather, they are

\end{document}