3

I am having problems to align or better put, make my figures being of equal size/margins like my text

What I do is this

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

I what ever I am trying, my pics are always bigger than the text... thanks

Alex

enter image description here

3
  • 1
    working example ?
    – Alex
    Mar 30, 2013 at 20:28
  • this {\centering\par \makebox[0pt]{\includegraphics{...}} aligns pic, but this cannot be surrounded by the \begin{figure} etc... \par}
    – Alex
    Mar 30, 2013 at 20:38
  • Instead of using the scale key, use width, as in \includegraphics[width=\textwidth]{./chapter3/figures_susy/q_qq.png}. Mar 30, 2013 at 20:40

1 Answer 1

3

To guarantee that your images will have a width equat to the text width, instead of using the scale key use widthwith a value equal to \textwidth, as in

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

A complete example; the showframe package was only used to draw a frame showing the margins:

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

enter image description here

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.