# Tag Info

1

Within your aghdpl.cls class file, you'll see that chapters are set using a font size \LARGE (line 191-192): \titleformat{\chapter}[block] {\bfseries\LARGE}{\filright \LARGE\thechapter. }{0ex}{} However, ToC-related entries are set using only \Large (line 209): \renewcommand{\cfttoctitlefont}{\bfseries\Large} Since \lstlistoflistings is set just like ...

0

If you want only some lines to be discused in your paper you can easy split the listing in for example three parts, using option linerange={1-3} for the first 3 lines. If you want the real line numbers in your listing use for example option firstnumber=10 to start with line number 10. Here comes the MWE: \RequirePackage{filecontents} ...

5

For the usage of listings you have to use the fragile option for the frame: \documentclass{beamer} \usepackage{listings} \begin{document} \begin{frame}[fragile] \begin{lstlisting} Hello world \end{lstlisting} \end{frame} \end{document} Further information can be at found ...

4

The easiest thing to do here is to declare all digits as "letters" and define all your keywords with the keywords key alone, eschewing the otherkeywords key completely: \documentclass[12pt]{article} \usepackage{xcolor} \usepackage{listings} \renewcommand{\ttdefault}{pcr} \definecolor{Black}{gray}{0.0} \definecolor{Blue}{rgb}{0.12,0.29,0.53} \lstset{ ...

3

Better late than never :) As stated by Qrrbrbirlbel in his comment, the problem is that, because % is a (one-line) comment delimiter in the Octave language, listings treats your closing overlay delimiter @ as part of the comment. One workaround is to undefine % as a comment delimiter, but use literate to apply the comment style when that character is ...

2

Although not explicitly stated in the documentation I have found that the escaping only works in listings using the lstlisting environment, not within lstinline. See this: \documentclass{scrreprt} % Quellcode \usepackage{listings} % für Formatierung in Quelltexten \lstset{ escapeinside={(*@}{@*)}, % if you want to add LaTeX within your code } ...

2

I propose to put the the structure saving commands into the lower part only. Such, the numbering of the tcolorbox is not affected. To avoid the tocs and bookmarks problems, I suggest to deactivate \addtocontents and \addcontentsline as was done for \documentclass. My answer creates a new option protect structure which contains all this stuff. ...

2

The number within option in the definition of texexptitled has to be set to backupsection or \backupchapter (perhaps better) \documentclass[oneside]{book} \usepackage{listings} \usepackage{tcolorbox} \tcbuselibrary{listings}% \usepackage{xcolor} \usepackage[bookmarks=true, bookmarksopenlevel=2]{hyperref} %Definition of New Environments \tcbset{ ...

1

I'm not sure, if I understood your intention completely. But, I corrected the errors Christian Hupfer already mentioned, and I made a new macro \texexptitledinputlisting which hopefully helps for your own extensions. I kept the rest unchanged with small exceptions / corrections. \documentclass{article} \usepackage{xcolor} \usepackage{listings} ...

3

I would put the beamer example into a separate file which can be compiled for its own. Then, the source code and the beamer slides can be included into the target document. Here, I used example01.tex for the beamer file: % example01.tex \documentclass{beamer} \usepackage{blindtext} \begin{document} \begin{frame} \frametitle{First Frame} ...

3

This stores the current section counter and restores it after the listing environment. Internally, the section counter is reset for the listings output purposes. \documentclass{article} \usepackage{listings} \usepackage{tcolorbox} \tcbuselibrary{listings}% \usepackage{xcolor} \lstset{ % General setup for the package language={[LaTeX]TeX}, ...

5

As Jubobs commented while I was working on this answer, the problem is that ' is treated as a string delimiter in C, so everything until the next ' is considered part of a string. You can see this by setting stringstyle=\itshape or similar; everything following the ' is shown as a string. Discussion in the comments notwithstanding (I would recommend ...

7

The best way to show the output along with the LaTeX code is to use the showexpl package: Notes: To adjust the position of the output you can use the pos= option: top, bottom, right, left, outer, and inner. Code: %\RequirePackage{filecontents}% Comment out so that "example.tex" is not overwritten \begin{filecontents*}{example.tex} Here is some ...

7

The tcolorbox provides means for nice typesetting and direct output of listings LaTeX code. There are many conceptual and visual configuration possibilities, see the documentation of tcolorbox, e.g. in chapter 9 of the current version 3.12. However, a \begin{document}....\end{document} cannot be catched easily. Just relaxing \begin{document} etc. is no ...

1

You could add a rotated box with a (short) listing after the section title. My answer uses the tcolorbox package for the job. The given width of the box is the height of the rotated box. Obviously, the width/height has to be small enough to fit inside the page. This solution is not adequate, if you want to the listing to continue to the next page. Any ...

3

My answer uses the tcolorbox package for assistence with the boxing problem. Note that you should use the current version 3.12 (2014/07/29) of the package, i.e. you may have to update first. Version 1: The basic idea of the solution is to box the listing with a tcolorbox which is enlarged into the margins of the page. Here, I used a brutal enlargement ...

2

This should allow typing the characters you requested - basically adding more to the list of literates will allow other characters as well: \documentclass[a4paper,oneside]{article} \usepackage[utf8]{inputenc} \usepackage[T1]{fontenc} \usepackage{listings} \lstset{literate=% {Ç}{{\c{C}}}1 {ç}{{\c{c}}}1 {ı}{{\i}}1 {ö}{{\"{o}}}1 ...

0

Here is another solution: \documentclass[a4paper]{book} \usepackage[T1]{fontenc} \usepackage{caption} \usepackage{fancyvrb} \usepackage{listings} \begin{document} \begin{figure} \centering \lstset{xleftmargin=0.18\textwidth,xrightmargin=0.18\textwidth} \begin{lstlisting} trait Sys[S <: Sys[S]] { type Tx <: stm.Txn[S] type Var[A] <: ...

0

I use a similar solution to the one proposed by werner. However I prefer to define the minipage with text instead of line width: \begin{minipage}[c]{0.95\textwidth} \begin{lstlisting} \end{lstlisting} \end{minipage} "c" for centering and "0.95\textwidth" to make the listing a little bit smaller than the rest of the text.

1

There is a solution which works with the example files you provided at http://tex.stackexchange.com/a/65839/60451 The code \makeatletter \def\lst@lettertrue{\let\lst@ifletter\iffalse} \makeatother will make listings break lines at letter characters.

3


3

\documentclass[12pt]{book} \usepackage{listings} \usepackage{accsupp} \newcommand*{\noaccsupp}[1]{\BeginAccSupp{ActualText={}}#1\EndAccSupp{}} \lstdefinestyle{Common} { basicstyle=\scriptsize\ttfamily\null, numbers=left, numbersep=1em, frame=single, framesep=\fboxsep, framerule=\fboxrule, ...

Top 50 recent answers are included