Graphics, Figures & Tablesusepackage graphicx error

Information and discussion about graphics, figures & tables in LaTeX documents.
Post Reply
guven
Posts: 1
Joined: Mon Feb 13, 2017 8:13 am

usepackage graphicx error

Post by guven »

Dear Community members,

I get this error

[5] <img/MLC.png, id=55, 449.42906pt x 395.97937pt> <use img/MLC.png>
! Too many }'s.
\color@endbox ->\color@endgroup \egroup

l.81 \end{figure}

I googled and most say I need to add \usepackage{graphicx} which I already have. Here is my code

Code: Select all

\documentclass[11pt]{report} %font must be 10pt or larger
\special{papersize=8.5in,11in}
\usepackage[showframe=false,left=1.5in,right=1in,top=1in,bottom=1in]{geometry}
\setlength{\footskip}{0.5in}   % distance between the text block and your page number
\input{preambles/packages}
\input{preambles/commands}

%--------------------------------------------------------------

\newenvironment{remark}[1][Remark]{\begin{trivlist}
\item[\hskip \labelsep {\bfseries #1}]}{\end{trivlist}}

%--------------------------------------------------------------
\setlength{\abovecaptionskip}{0.3cm}
\setcounter{secnumdepth}{3}

\begin{document}

\input{frontmatter/frontmatter}
\doublespacing

\pagenumbering{roman}
\setcounter{page}{9} %check to make sure the page number is set properly

\pagenumbering{arabic}
\setcounter{page}{1}

%chap1: introduction
\input{chap1.tex}

\end{document}
\input{preambles/packages} is:

Code: Select all

% -------- Fonts ---------------------------------------------------

\usepackage{lmodern}
\usepackage[T1]{fontenc}
\usepackage{setspace}
\usepackage{indentfirst}
% -------- Math and Graphics stuff ----------------------------
\usepackage{amsmath}
\usepackage{latexsym}
\usepackage{amssymb}
\usepackage{amsfonts}
\usepackage{amsthm}
\usepackage{graphicx}
\usepackage{afterpage}

\usepackage{rotating}
\usepackage[labelfont=bf, font=small]{caption}
\usepackage{mdwlist,paralist}
\usepackage{algorithmic}
%\usepackage{algpascal}
%\usepackage{algpseudocode}
\usepackage{algorithm}
\usepackage{subfigure}
\usepackage{mathrsfs}
\usepackage{dsfont}
\usepackage{color}
\usepackage{setspace}
\usepackage{appendix}
\usepackage[compact]{titlesec}
\usepackage{epsfig} % for postscript graphics files
\usepackage{epstopdf}
\usepackage{enumitem}

% -------- table packages ----------------------------
\usepackage{booktabs}
\usepackage{multirow}
\usepackage{colortbl}
\usepackage{array, supertabular}
\usepackage{tocbibind}
\usepackage[subfigure]{tocloft}
\renewcommand{\cftfigfont}{Figure }
\renewcommand{\cfttabfont}{Table }
\renewcommand{\cftchappresnum}{Chapter }
\renewcommand{\cftchapnumwidth}{6em}
%------------ Chapter ------------------------------------
\usepackage{titlesec}

\titleformat{\chapter}[display]{\normalfont\large\bfseries}{\chaptertitlename ~\thechapter}{-1pt}{\large}
%\titleformat{\section}{\bfseries\sffamily\large}{\thesection.}{\hspace{1cm}}{}%
\titlespacing*{\chapter}{0pt}{-8mm}{0pt}

% ---- section  --------------------------------------------
\usepackage{sectsty}



\sectionfont{\large\bfseries}
\subsectionfont{\large\bfseries}
\subsubsectionfont{\normalsize\itshape}
\chapterfont{\LARGE}
\chaptertitlefont{\LARGE}
%\uppercase
% ---------------------------------------------------------------

%\usepackage{hyperref} %hyper links references in text

\input{chap1.tex} is:

Code: Select all

\titleformat{\chapter}[display]{\normalfont\large\bfseries}{\chaptertitlename~\thechapter}{-1pt}{\large}
%\titleformat{\section}{\bfseries\sffamily\large}{\thesection.}{\hspace{1cm}}{}%
\titlespacing*{\chapter}{0pt}{-8mm}{0pt}
\chapter{Introduction}
\label{chap:Intro}
%\vspace{-15mm}
\section{Background}
\vspace{-4mm}

\vspace{-4mm}
\section{Healthcare Delivery}
\vspace{-4mm}



\begin{figure}[!h]
\begin{center}
\includegraphics[scale=0.3]{img/MLC.png}
\end{center}
\caption{A multi-leaf collimator \cite{bortfeld2006imrt}}
\label{MLC}
\end{figure}
ALL HELP IS GREATLY APPRECIATED

Recommended reading 2024:

LaTeXguide.org • LaTeX-Cookbook.net • TikZ.org
TikZ book
User avatar
Johannes_B
Site Moderator
Posts: 4182
Joined: Thu Nov 01, 2012 4:08 pm

usepackage graphicx error

Post by Johannes_B »

We would appreaciate a minimal working example.

From a first glance, you are doing many strange things in your code.
The smart way: Calm down and take a deep breath, read posts and provided links attentively, try to understand and ask if necessary.
User avatar
Stefan Kottwitz
Site Admin
Posts: 10314
Joined: Mon Mar 10, 2008 9:44 pm

usepackage graphicx error

Post by Stefan Kottwitz »

Hi Guven,

welcome to the forum!

Generally, please try to provide a small single document code (based on your code) that brings the error. Her it would be like making a copy, putting document and preamble.tex and chap1.tex into a single file for testing, removing not relevant code, then posting here. Link for getting perfect help: Infominimal working example.

In all the code above there is no real issue, at least no cause for that error. So I think, the cause is in the file preambles/commands.tex. It could be a float redefinition.

Please post commands.tex here.

Stefan
LaTeX.org admin
Post Reply