# [scribus] designing instructional posters on code/programming -- lots of syntax highlighting

Lars Behrens lars.behrens at kit.edu
Fri Jan 6 19:51:27 UTC 2017

Am 06.01.2017 um 15:56 schrieb Gregory Pittman:

> Maybe you might explain the process so that we might have something on

Yes, sure.  Glad if I can help.

Short instruction:

As I am no LaTeX hero myself, I just did an internet search "latex

https://www.overleaf.com/latex/examples/syntax-highlighting-in-latex-with-the-listings-package/jxnppmxxvsvk

from there I copied the basics into a render frame and that just worked
(the given color names didn't work for me, so I changed them).

Step by step instruction:

---------------------------------------------------------------------
*** Display highlighted code with a render frame in Scribus

- Prerequisites: Of course you need LaTeX installed, plus the
"listings"-package which may or may not be in your default LaTeX
installation, depending on your environment. A pdf file with detailed
documentation "listings.pdf" should be available in your LaTeX
documentation directory when you have the package on board (e.g.
/usr/share/doc/texlive-doc/latex/listings/ in Ubuntu).

- In Scribus insert a render frame (shortcut "D")

- Right-click on the frame and choose "Edit Source"

Headers" text field on the right:

\usepackage{listings}
\usepackage{color}
\lstset{ %
backgroundcolor=\color{white},  % choose the background color
basicstyle=\footnotesize,       % size of fonts used for the code
breaklines=true,               % automatic line breaking only whitespace
captionpos=b,                   % sets the caption-position to bottom
keywordstyle=\color{blue},      % keyword style
stringstyle=\color{red},        % string literal style
}

The variables in the lstset section define how your source code examples
will be displayed, find details in the mentioned doc file "listings.pdf".

- Remove the example text in the code field on the left

- Now you can insert your code examples in the text field on the left.
Make sure that you choose the right language in the "[language=XXX]"
tag. A short example in Java:

\section{Java}
\begin{lstlisting}[language=java]
class HelloWorldApp {
public static void main(String[] args) {
System.out.println("Hello World!"); // Display the string.
for (int i = 0; i < 100; ++i) {
System.out.println(i);
}
}
}
\end{lstlisting}

As you can see, basically you just have to surround your code example with
\begin{lstlisting}[language=YourLanguage]

\end{lstlisting}

- by clicking the "Update" button at the bottom of the render frame
dialog you can check if your code is rendered correctly

- make sure to click "Ok" when your done inserting your example code,
otherwise your input might get lost

- you can edit your code at any time by right clicking the render frame
again and clicking "Edit Source"

- if you need more render frames just copy an existing one and edit it,
so that you won't have to go through the process of inserting the header
lines again.

https://www.overleaf.com/latex/examples/syntax-highlighting-in-latex-with-the-listings-package/jxnppmxxvsvk
---------------------------------------------------------------------

Hope that is helpfull and understandable, as English is not my mother
tongue.

Cheerz,
Lars

-------------- next part --------------
A non-text attachment was scrubbed...
Name: smime.p7s
Type: application/pkcs7-signature
Size: 5373 bytes
Desc: S/MIME Cryptographic Signature
URL: <http://lists.scribus.net/pipermail/scribus/attachments/20170106/94a6cf69/attachment.bin>