将图片与文本对齐

将图片与文本对齐

我在对齐方面遇到了问题,或者说,使我的图形与我的文本具有相同的大小/边距

我做的是

\documentclass[a4paper,12pt]{book}

%%%%%%%%%%%%%%%%%%%%%%%%%
%%% Document preamble %%%
%%%%%%%%%%%%%%%%%%%%%%%%%
\usepackage{appendix}

\usepackage[sort&compress,square,comma,numbers]{natbib}
\usepackage{hypernat}
% for figures
\usepackage{pstricks}
\usepackage{graphicx} 
\usepackage[center,tight]{subfigure}
\usepackage{eso-pic}
\usepackage{epigraph}
\usepackage{verbatim}
\usepackage{geometry}                % See geometry.pdf to learn the layout options. \usepackage{graphicx}
\usepackage{epstopdf}
\usepackage{tikz}
\usepackage{mathptmx}
\usepackage{accents}
\usepackage{amsmath}
\usepackage{amssymb}
\usepackage{amsfonts}
\usepackage[todo,colour,check,front]{optional}
\usepackage{slashed}
\usepackage{multirow}
\usepackage{url}

\DeclareGraphicsRule{.tif}{png}{.png}{`convert #1 `dirname #1`/`basename #1 .tif`.png}

\usepackage[utf8]{inputenc}
\usepackage{slantsc}
\usepackage{array}
\usepackage{wasysym}
\usepackage{scalerel}
\usepackage[export]{adjustbox}
\usepackage{graphicx}
\linespread{1.30}

\pagestyle{empty}
\usepackage[T1]{fontenc}

%special font

\usepackage{mathpazo}
\usepackage{slashed}            % for slashed characters in math mode
\usepackage{bbm}                % for \mathbbm{1} (unit matrix)
\usepackage{xspace}             % For spacing after commands


\renewcommand{\textfraction}{1}
\renewcommand{\topfraction}{1.5}
\setcounter{totalnumber}{10}
\setcounter{secnumdepth}{5}
\setcounter{tocdepth}{5}
\usepackage{blindtext}
% adjust page width (needs to be done before fancy headers)
% fancy page headers

%\setcounter{MaxMatrixCols}{30}

\numberwithin{equation}{section} 

\setlength{\textwidth}{18cm}

\setlength{\oddsidemargin}{.5cm}
\setlength{\evensidemargin}{.5cm} 
\setlength{\headsep}{1cm} 
\setlength{\topmargin}{0.25cm}
\setlength{\footskip}{30pt}



 \usepackage[usenames,dvipsnames]{pstricks}
 \usepackage{epsfig}
 \usepackage{pst-grad} % For gradients
 \usepackage{pst-plot} % For axes

\usepackage{fancyhdr}
\usepackage{paralist}
\pagestyle{fancy}
\renewcommand{\chaptermark}[1]{\markboth{\MakeUppercase{\chaptername}\ \thechapter:\ #1}{}}
\renewcommand{\sectionmark}[1]{}
\fancyhf{}
%\fancyhead[LE,RO]{\begin{footnotesize}\thepage\end{footnotesize}}
\fancyhead[RE,LO]{\begin{small}\textsc{\leftmark}\end{small}}
\renewcommand{\headrulewidth}{0.5pt}


% adjust rest of page layout (needs to be done after fancy headers)
\addtolength{\headheight}{2pt} % bring header closer
\addtolength{\headsep}{10pt}
\addtolength{\topmargin}{-20mm} % enlarge vertical space
\addtolength{\textheight}{25mm}
\addtolength{\textwidth}{5mm}
\addtolength{\oddsidemargin}{-25mm} % adjust odd&even margins for texwidth
\addtolength{\evensidemargin}{-25mm}

% just to generate text for the example


% Add rotating possibility in columns and such
\usepackage{rotating}

\interfootnotelinepenalty=1000


%%%%%%%%%%%%%%%%%%%%%%%%%%%
%%% The document itself %%%
%%%%%%%%%%%%%%%%%%%%%%%%%%%

\begin{document}


    \begin{figure}[!ht]
    \begin{center}
    \minipage{0.8\textwidth}
    %\centerline{  \includegraphics[scale=0.65]{./chapter3/figures_susy/q_qq.png}}
    \includegraphics[scale=0.65 ]{./chapter3/figures_susy/q_qq.png}


    \caption{The Feynman diagrams bla bla bla }
    \endminipage\hill
    \label{fig:q_qq}
    \end{center}
    \end{figure}
\end{document}

无论我如何尝试,图片总是比文字大...谢谢

亚历克斯

在此处输入图片描述

答案1

为了保证图像的宽度等于文本宽度,请将键值scale改为width等于\textwidth,而不是使用 ,如下所示

\includegraphics[width=\textwidth]{./chapter3/figures_susy/q_qq.png}

一个完整的例子;该showframe包仅用于绘制一个显示边距的框架:

\documentclass{article}
\usepackage{showframe}
\usepackage{graphicx}

\begin{document}

\noindent\includegraphics[scale=0.9]{example-image-a}

\noindent\includegraphics[width=\textwidth]{example-image-a}

\end{document}

在此处输入图片描述

相关内容