Document Classes[Solved]Listings and eis_msc_thesis.cls

Information and discussion about specific document classes and how to create your own document classes.
Post Reply
Kai
Posts: 8
Joined: Sun Sep 21, 2008 1:01 am

[Solved]Listings and eis_msc_thesis.cls

Post by Kai »

Hi,

I am using the eis_msc_thesis.cls template to write my thesis.

The problem is, that I cannot use lstlistings in my code;

\begin{lstlisting}
for(;;)
{
printf("hi there.");
}
\end{lstlisting}

Error output is:
1:
! Missing number. treated as zero.
<to be read again> \relax
1.9 \begin{lstlisting}

2:
! Illegal unit of measure (pt inserted).
<to be read again> \relax
1.9 \begin{lstlisting}


any ideas?
Last edited by Kai on Thu Nov 20, 2008 6:19 pm, edited 1 time in total.

Recommended reading 2024:

LaTeXguide.org • LaTeX-Cookbook.net • TikZ.org

NEW: TikZ book now 40% off at Amazon.com for a short time.

User avatar
localghost
Site Moderator
Posts: 9202
Joined: Fri Feb 02, 2007 12:06 pm

[Solved]Listings and eis_msc_thesis.cls

Post by localghost »

Please provide a complete minimal working example (MWE) and attach the class file (*.cls) to your next post or give at least a link where to find it. Specify the programming language you want typeset. First approaches are listed in the documentation of the listings package.


Best regards
Thorsten¹
Kai
Posts: 8
Joined: Sun Sep 21, 2008 1:01 am

[Solved]Listings and eis_msc_thesis.cls

Post by Kai »

The .cls file can be found here:
http://rafb.net/p/ev58qt34.html

A minimal Latex file is:

Code: Select all

\documentclass{eis_msc_thesis}     % English

\usepackage{listings}
\lstset{
language=C                % choose the language of the code}
}
\begin{document}
\begin{lstlisting}
for(;;)
{
printf("hi there.");
}
\end{lstlisting}
\end{document}
The highlight language is C.
User avatar
localghost
Site Moderator
Posts: 9202
Joined: Fri Feb 02, 2007 12:06 pm

[Solved]Listings and eis_msc_thesis.cls

Post by localghost »

After some research I also found the class file on the homepage of the author [1]. It seems that the version provided there is the more relevant one. Furthermore I found the same request in the forum of LEd without any solution [2]. I suggest to contact the author because the error may be caused by some internals of the class file. Any issues can best be clarified by him.

[1] Johan Carlson
[2] LaTeX Editor Forum :: View topic - use of package listings doesnt work
User avatar
Juanjo
Posts: 657
Joined: Sat Jan 27, 2007 12:46 am

[Solved]Listings and eis_msc_thesis.cls

Post by Juanjo »

The file eis_msc_thesis.cls contains the line

Code: Select all

\renewcommand{\belowcaptionskip}{12pt}
which is the cause of the issue. There are two solutions:
  • Edit eis_msc_thesis.cls and replace that line by

    Code: Select all

    \setlength{\belowcaptionskip}{12pt}
  • Add to the preamble of your document the lines

    Code: Select all

    \let\belowcaptionskip\undefined
    \newlength{\belowcaptionskip}
    \setlength{\belowcaptionskip}{12pt}
    
Choose the solution you prefer. Of course, it is worthwhile to contact the author of this class to notify him this issue. In fact, he should update or correct some additional things, as for example:
  • the loading of amsfonts is superfluous, since amssymb is also loaded,
  • \sc should be replaced by \scshape
  • Since inputenc is loaded with latin1 option, Mac and Linux users are forced to use that enconding if they want to avoid a package option clash.
The CTAN lion is an artwork by Duane Bibby. Courtesy of www.ctan.org.
ceke
Posts: 13
Joined: Thu Nov 20, 2008 9:45 am

Re: Listings

Post by ceke »

Hej guys,

OK, So I'm the author of the thesis template. It's been used by our students for some time since I made it available for download at my web page.

Generally, I do not have the time to provide support to anyone other than our own students. Nevertheless, I'm thankful for any bug reports.

It seems to me like the issue in this thread was resolved, and I'll try to incorporate the fix into the next release.

Glad you liked it!
/Johan Carlson
ceke
Posts: 13
Joined: Thu Nov 20, 2008 9:45 am

Re: Listings

Post by ceke »

For your info... The template has now been updated.

Go here: http://www.ltu.se/csee/misc/staff/johanc?l=en

Click on the link named "Course material, LaTeX templates, etc."

Cheers,
/JC
Kai
Posts: 8
Joined: Sun Sep 21, 2008 1:01 am

Re: Listings

Post by Kai »

Thank you guys!
User avatar
Juanjo
Posts: 657
Joined: Sat Jan 27, 2007 12:46 am

[Solved]Listings and eis_msc_thesis.cls

Post by Juanjo »

ceke wrote:For your info... The template has now been updated.
If I'm right, the new version only fixes the issue with \belowcaptionskip. It's a pity not to have taken the opportunity of updating the template a bit more, since it was so simple to make, in addition, the first two changes I suggested. Concerning the inputenc package, I don't find a good idea to load it with a fixed option (latin1 in this case), at least if the class is adressed to a more or less wide audience. Those wanting UTF or applemac encondings must modify the class file.
The CTAN lion is an artwork by Duane Bibby. Courtesy of www.ctan.org.
ceke
Posts: 13
Joined: Thu Nov 20, 2008 9:45 am

Re: [Solved]Listings and eis_msc_thesis.cls

Post by ceke »

Well,
The template was written for Swedish students writing reports in either Swedish or English, hence the choice of hard-coding the latin1 of inputenc, since the users then don't need to worry about how this works.

That said, if anyone has other ideas on improvements of the class, please list here and I'll do periodic checks when I find the time to update.

/JC
Post Reply