我有以下内容:
请注意图像位于文本上方。
如果我增加尺寸,它会继续向页面右侧和文本边缘增长,而不是在页面两侧按比例增长。
我的代码如下:
\documentclass[10pt]{article}
\usepackage{amsmath,amsfonts,amssymb}
\usepackage{graphicx}
\graphicspath{ {./images/} }
\usepackage{hyperref}
\hypersetup{
colorlinks=true,
linkcolor=blue,
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}
如果有人能解释一下我该如何做,当我调整图片大小时,图片会按比例向页面的两侧扩展,而不是只向右侧扩展,我将不胜感激。这样一来,图片看起来会更整齐、更专业,而不会从页面的一侧突出。
答案1
\makebox[0pt][c]
在 周围放置\includegraphics
。这告诉排版算法图像的宽度为 0pt,并让其在两边重叠。
\documentclass[10pt]{article}
\usepackage{amsmath,amsfonts,amssymb}
\usepackage{graphicx}
\usepackage{hyperref}
\hypersetup{
colorlinks=true,
linkcolor=blue,
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}