Information and discussion about LaTeX's general text formatting features (e.g. bold, italic, enumerations, ...)
csmgroup
Posts: 25 Joined: Sat Jul 17, 2010 6:58 pm
Post
by csmgroup » Sun Jul 18, 2010 3:57 pm
Form LaTeX workshop (
http://www.deesaster.org/latex-magazinerstellung.php ), I found a way to make this listing style as attached image by defining a new environment.
Code: Select all
\documentclass{article}
\usepackage{color}
\usepackage{listings}
\definecolor{mittelgrau}{gray}{0.85}%
\lstdefinestyle{StyleCommand}{%
style=StyleListingBasic, backgroundcolor=\color{mittelgrau}, prebreak=\mbox{\textbackslash{}}%
}
\lstnewenvironment{Befehl}[1][1] {\lstset{style=StyleCommand,linewidth=#1\linewidth}} {}%
\begin{document}
\begin{Befehl}
$ ./robots-gui-helper
\end{Befehl}%
\end{document}
Running the code, I get this error message.
Code: Select all
ERROR: Package Listings Error: Couldn't load requested style.
What might be wrong?
Attachments
Screen shot 2010-07-17 at 11.29.39 PM.png (12.09 KiB) Viewed 3663 times
Last edited by
csmgroup on Tue Jul 20, 2010 1:38 am, edited 2 times in total.
NEW: TikZ book now 40% off at Amazon.com for a short time.
gmedina
Posts: 2313 Joined: Wed Jul 11, 2007 11:45 pm
Post
by gmedina » Sun Jul 18, 2010 5:57 pm
Hi,
please post complete, minimal and compilable code.
1,1,2,3,5,8,13,21,34,55,89,144,233,...
csmgroup
Posts: 25 Joined: Sat Jul 17, 2010 6:58 pm
Post
by csmgroup » Sun Jul 18, 2010 9:00 pm
I added preambles to generate the error message that I have. Thanks for your help.
localghost
Site Moderator
Posts: 9202 Joined: Fri Feb 02, 2007 12:06 pm
Post
by localghost » Sun Jul 18, 2010 9:39 pm
Your problem description remains unclear because your example is still not a MWE. You try to use some definitions for the listings style which are missing in your code (as the error message clearly states). Take a close look at the content of the archive behind the link »Beispielartikel (Quellcode)« on the page you mentioned. The missing style definitions can be found in the file »layout.tex«. Either try to run the compiler on the file called »main.tex« and see what happens or copy the relevant parts to your MWE and then try this one.
Best regards and welcome to the board
Thorsten
csmgroup
Posts: 25 Joined: Sat Jul 17, 2010 6:58 pm
Post
by csmgroup » Mon Jul 19, 2010 3:23 am
Code: Select all
\documentclass{article}
\usepackage{color} % Farben
\usepackage{listings} % für Listings
% Listingdefinitionen
\lstdefinestyle{StyleListingBasic}{%
basicstyle=\ttfamily, % Schriftstil
frame=single, % einfacher Rahmen
framesep=1pt, % Abstand des Rahmens
framerule=0.8pt, % Linienstaerke des Rahmens
rulecolor=\color{mittelgrau}, % Farbe der Rahmenlinie
breaklines=true, % automatischen Umbruch aktivieren
breakindent=0pt % Einrueckung nach Umbruch
}
\definecolor{mittelgrau}{gray}{0.85}%
\lstdefinestyle{StyleCommand}{%
style=StyleListingBasic, backgroundcolor=\color{mittelgrau}, prebreak=\mbox{\textbackslash{}}%
}
\lstnewenvironment{Befehl}[1][1] {\lstset{style=StyleCommand,linewidth=#1\linewidth}} {}%
\begin{document}
\begin{Befehl}
./robots-gui-helper
\end{Befehl}%
\end{document}
I missed some part of the code, and now it works.
Thanks for the advice.
Last edited by
csmgroup on Tue Jul 20, 2010 1:41 am, edited 1 time in total.
csmgroup
Posts: 25 Joined: Sat Jul 17, 2010 6:58 pm
Post
by csmgroup » Tue Jul 20, 2010 1:40 am
Thanks for the help again.
I checked the green mark as it's solved. Did I do everything that is required?