0

I'm writing a thesis using latex. I had the following a error when I add the figure caption:

l. 91 \caption{Chevauchement et ligature}
I suspect you've forgotten a `}', causing me to apply this control sequence to too much text.

when I write the same code in a new file it's work, but not in my thesis. Any help please?

thesis files in the link

  • Welcome to TeX.SX! The question is unclear; can you show the code that causes the failure? – egreg Mar 24 '16 at 11:18
  • 1
    Try isolating the problem by removing parts of the document until you get no error and then narrowing the part the error may be caused by as mich as you can. And check your braces: the error suggests you mau be missing one. – MickG Mar 24 '16 at 11:43
  • 2
    Your MWE is not helpfull at all. (i) it can't be compiled since you use packages which we haven't (ii) it call your files with content, which we haven't, (iii) you not provide part of text, where you observe your error. How one can help you? By the way, hyperref package is normally last in the preamble. – Zarko Mar 24 '16 at 12:25
  • 1
    After removing the bits that I don't have (specifically your document class and srcltx.sty) and using a book class instead, the code provided generates no errors. As MickG suggested, you need to make a copy of your failing document, and start commenting out parts until you can isolate a few lines causing the error. Additionally, the preamble is very outdated or redundant in several locations: graphicx supersedes graphics and epsfig, for example. subfigure is twice-deprecated, first by subfig, and later by subcaption. – Mike Renfro Mar 24 '16 at 12:30
  • 1
    Is your LaTeX distributoin up to date? – MickG Mar 24 '16 at 15:05
1

Since the pfe and ./styles/srcltx are not present in my system, I changed the first to book and removed the second one. I made a folder chapters and a subfolder chap1. As shown in the screen shot below, the result compiles in my system and the figure appears (I've used a dummy figure). Other than what seems to be encoding problems, there are no errors in your MWE. imgur.com/GRtTOy7

AjN's comment.

Indeed, the offending bit is in the class file

%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% % caption %%% ATTENTION CE N'est PAS forcement supporté par toutes les % distrib LateX %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%

\RequirePackage{caption2}

\captionstyle{centerlast}
\renewcommand\captionfont{\footnotesize}
\renewcommand\captionlabelfont{\bfseries\itshape}
%\setcaptionmargin{\leftmargini}
%\setlength\captionindent{\parindent}
\renewcommand\captionlabeldelim{~---}
\onelinecaptionstrue
\setcaptionwidth{12.9999cm}

The comment reads:

caption ATTENTION THIS is NOT necessarily supported by all LateX distribs.

I tried having a look at the package documentation for caption2, which seemed to be the source of the problem, and in the compatibility section I found:

Das Paket caption und seine experimentelle, nun veraltete Variante caption2 sind vom internen Konzept her zu unterschiedlich, um hier eine vollständige Kompatibilität gewährleisten zu können. Daher liegt diesem Paket weiterhin die Datei caption2.sty bei, so daß ältere Dokumente, die das caption2-Paket verwenden, weiterhin übersetzt werden können.

which Google translates to:

The package caption and its experimental and now obsolete variant caption2 have Conceptually too different to here to be able to ensure full compatibility. Therefore, this package is still in the caption2.sty file so that old documents using the caption2 package will still compile.

So the question is: why does your class use an obsolete version of a package? Please update that class so that it doesn't, and I bet the problem will go away.

Update

I modified the offending bit in the class following the instructions in the documentation, and now it looks like this:

\RequirePackage[font=footnotesize,labelfont={bf,it}]{caption}

\captionsetup{justification=centerlast,singlelinecheck=on}
%\renewcommand\captionfont{\footnotesize}
%\renewcommand\captionlabelfont{\bfseries\itshape}
%\setcaptionmargin{\leftmargini}
%\setlength\captionindent{\parindent}
\newcommand\captionlabeldelim{~---}
%\onelinecaptionstrue
\setcaptionwidth{12.9999cm}

and everything compiles, and the format seems more or less the same as the original.

Btw, the error I got was completely different:

Runaway argument?
{\parbox [b]\captionlinewidth {\strut \@nameuse {caption@@@centerlast\ETC.
./chapters/chap1.tex:15: Paragraph ended before \@gobble was complete.
<to be read again> 
                   \par 
l.15 ...ns possibles du hamza en association avec}

There still seem to be encoding problems in your document. TeXShop warned me that it had to open one of your documents in IsoLatin8 encoding. Please make sure everything is in the same encoding, best if UTF-8. At the moment, the output pdf looks like this:

enter image description here

Update 2

Exactly why would your class load inputenc with encoding latin1, when utf8 is decidedly always better, and latin1 causes the encoding problems? And did you know that it did? Seeing as you called it from your document, I guess you didn't. Please take your class and change the encoding option for inputenc from latin1 to utf8, and the encoding problems (or most of them) will vanish. With this result:

enter image description here

And since I'm editing, here is my now-deleted comment:

Also, LaTeX doesn't particularly like having to fetch packages from specified folders, since it seems the folder name is part of the package name and when it finds the file it says "NO, this does not provide ./styles/pfe but just pfe" ;). The ?? for the figure reference obviously clears up on second compilation.

And it cleared up in the encoding-fixed version.

  • Thanks for your detailed response I tried to do the required step, but I still have the following problem:! Package inputenc Error: Unicode char \u8:�cr not set up for use with LaTeX. – user2873476 Mar 25 '16 at 9:59
  • That is an entirely different question. What line is the error reported on? – MickG Mar 25 '16 at 10:15
  • Try pinpointing the exact line of the error. The error message should give you a number, and if you look at the lines before the message it should tell you what file you are in. Or else it should show a portion of that line. Find it, and paste it here. I'll see what the offending Unicode char is. – MickG Mar 25 '16 at 10:19
  • i have modified the class file the encoding to utf8 by modifying the class file \RequirePackage[utf8]{inputenc} i get this error – user2873476 Mar 25 '16 at 10:21
  • When you put code in a comment, question or answer, please surround it with backticks. \RequirePackage[utf8]{inputenc} is much better than \RequirePackage[utf8]{inputenc}, don't you think? It greatly improves readability. Backticks are ` ` `. – MickG Mar 25 '16 at 10:26

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.