1

I am documenting a script which has almost 43+ keywords. The output I want is something on the below lines... enter image description here

and the latex code I have is

\documentclass[a4paper, onesided]{article}
\usepackage{listings}

\lstdefinestyle{customc}
{%
basicstyle=\small\ttfamily,
keywordstyle=\color{blue},
commentstyle=\color{green!40!black},
stringstyle=\color{red!40!black},
columns=fullflexible
}%

\lstdefinelanguage{InnoScript}{%
keywords={AllowCancelDuringInstall, WindowVisible, RestartIfNeededByRun, Name, MessagesFile, Source, DestDir, Flags, Languages, Parameters, Filename, WorkingDir},
sensitive=true,
comment=[l]{;},
string=[b]'
}%
\begin{document}
\lstset{style=customc}
\lstinputlisting[language=InnoScript, firstline=39, lastline=51]{<WindowsLocation>Script.iss}
\end{document}

The errors I receive is:

enter image description here

Where am I wrong?

EDIT

@Daniel, came to rescue. Now, the question arises. How do I fix the overfull box warning? :-D

  • Load one of the available color packages (e.g., \usepackage{xcolor}), which define the \color command. – Daniel Jan 14 '16 at 10:59
  • And, by the way: Welcome to tex.se :-) – Daniel Jan 14 '16 at 11:00
  • What the...? Someone willing to blind me in one eye? I have been kicking myself inside out!!!Thank you so much @Daniel. – abyshukla Jan 14 '16 at 11:02
  • About the overfull box, breaklines=true added to the 'lstdefinestyle`? – Torbjørn T. Jan 14 '16 at 11:39
  • Geez. Another foot-in-mouth moment... @TorbjørnT. thank you so much – abyshukla Jan 14 '16 at 12:40
1

Just add the \usepackage{color} line to your preamble, like this:

\documentclass[a4paper]{article}
\usepackage{listings}
\usepackage{color}

this works for me on Mac using latest TeXShop and TeXLive.

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.