0

currently I have a problem with the lstlisting environment. Every time I try to include this to my LaTeX document, the compiler stuck at the point "C:/Users/xxxx/AppData/Local/Programs/MiKTeX 2.9/tex/latex/listings/lstlang1.sty". An empty lstlisting environment will compile. e.g.

\begin{lstlisting}
\end{lstlisting}

At the moment where I try to put some text inside the environment like

\begin{lstlisting}
int i = 10;
\end{lstlisting}

or only a line break like

\begin{lstlisting}

\end{lstlisting}

the compiler stuck at the lstlang1.sty. I used the pdflatex compiler but also tested LuLaTeX and XeLaTeX (MikTeX 2.9). My LaTeX file based on the following template: https://github.com/jreichwald/DHBW_LaTeX_Template

The template also contains a lstlisting example and the compiling process of this example don't stuck. If I try to replace the template config.tex with my config.tex the compiling process also stuck. I think the issue is inside my config.tex but when I remove the lstlisting environments from my LaTeX documents, everything is fine.

Have anyone an idea?
Thank you!

config.tex

% !TEX root =  master.tex

%       LANGUAGE SETTINGS AND FONT ENCODING 
%
\usepackage[ngerman]{babel}     % German language
\usepackage[utf8]{inputenc}
\usepackage[german=quotes]{csquotes}    % correct quotes using \enquote{}
\usepackage[T1]{fontenc}
% ------ Custom Packages
\usepackage{microtype}% verbesserter Randausgleich
\usepackage[section]{placeins}
\usepackage{longtable}
\usepackage{amsmath} 
\usepackage{pdfpages}
\usepackage{manyfoot}

%       HYPERREF
%
\usepackage[
    hidelinks=true % keine roten Markierungen bei Links
]{hyperref}

% Zwei eigene Befehle zum Setzen von Autor und Titel. Ausserdem werden die PDF-Informationen richtig gesetzt.
\newcommand{\TitelDerArbeit}[1]{\def\DerTitelDerArbeit{#1}\hypersetup{pdftitle={#1}}}
\newcommand{\AutorDerArbeit}[1]{\def\DerAutorDerArbeit{#1}\hypersetup{pdfauthor={#1}}}
\newcommand{\Firma}[1]{\def\DerNameDerFirma{#1}}
\newcommand{\Kurs}[1]{\def\DieKursbezeichnung{#1}}
%\usepackage[table,xcdraw]{xcolor}

% ---- Eigene Counter -----
\newcounter{AB}
\newcounter{A}
\newcounter{AN}
\newcounter{AP}
\newcounter{AU}
\newcounter{HW}
\newcounter{I}
\newcounter{M}
\newcounter{MB}
\newcounter{NW}
\newcounter{O}
\newcounter{P}
\newcounter{PO}
\newcounter{SW}
\newcounter{T}
\newcounter{V}
\newcounter{VE}
\newcounter{W}
\newcounter{footnoteA}
%------------------------------------------
%--------------- Eigene Längen ------------
\newlength{\asdf} %definiere neue länge
\setlength{\asdf}{\textwidth} %setze neue länge auf textbreite
\addtolength{\asdf}{-6\tabcolsep} %subtrahiere -8\cdot textbreite von asdf
%----------Eigene Kommandos ---------------
\newcommand{\kategorieINIT}{
  * & Inhalt der Codierten Stelle. & Generallisierung des Inhalts. \\ \hline
}

\newcommand{\kategorie}[3]
{
  \stepcounter{#1}
  #1.\arabic{#1} & #2 & #3 \\ \hline
}
\newcommand{\teamdesc}[1]{
  \multicolumn{3}{|c|}{#1} \\ \hline
}

\newcommand*{\captionsource}[2]{%
    \caption[{#1}]{%
      #1 \hfill \hspace{\linewidth}%
      %\\\hspace{\linewidth}%
      \textbf{Quelle:} #2%
    }%
}
\newfootnote{A}

\newcommand{\footnoteA}{%
\stepcounter{footnoteA}%
\Footnotemark\thefootnoteA \FootnotetextA{}}
\renewcommand{\thefootnoteA}{\alph{footnoteA}}
%--------------------------------------------
%------- Eigene Umgebungen ------------------
\usepackage{xargs}
\newenvironment{MultiTable}[2][1=no caption,2=noLabel]{ 
\iffalse  
\setcounter{AB}{0}
  \setcounter{A}{0}
  \setcounter{AN}{0}
  \setcounter{AP}{0}
  \setcounter{AU}{0}
  \setcounter{HW}{0}
  \setcounter{I}{0}
  \setcounter{M}{0}
  \setcounter{MB}{0}
  \setcounter{NW}{0}
  \setcounter{O}{0}
  \setcounter{P}{0}
  \setcounter{PO}{0}
  \setcounter{SW}{0}
  \setcounter{T}{0}
  \setcounter{V}{0}
  \setcounter{VE}{0}
  \setcounter{W}{0}
\fi
  \begin{longtable}{|p{.07\asdf}|p{.52\asdf}|p{.41\asdf}|}
  \caption{#1} \label{#2} \\
    \hline
  Code & Wert & Generalisierung \\ \hline
}{
  \end{longtable}
}

\newenvironment{descriptionrueck}{
  \addmargin{1em}\description
}{
  \enddescription
  \endaddmargin
}

%------------------------------------------------------------

%-----------------------------------------------------------

\usepackage{filecontents,pdfpages}

\usepackage{formular}

\usepackage[page,titletoc,title,toc]{appendix}


\addto\captionsngerman{%
  \renewcommand{\appendixpagename}{\sffamily Anhänge}
  \renewcommand{\appendixtocname}{Anhänge}
}


% Correct superscripts 
\usepackage{fnpct}
\usepackage{enumerate}

%       CALCULATIONS
%
\usepackage{calc} % Used for extra space below footsepline
\usepackage{setspace}
\usepackage{tikz}


%       BIBLIOGRAPHY SETTINGS
%

% Uncomment the next three lines for author-year-style with footnotes (Chicago)
\usepackage{enumitem}
\usepackage[numbib]{tocbibind}
\usepackage[autopunct=false, backend=biber, sorting=nty, autocite=footnote, bibstyle=numeric, citestyle=authoryear-ibid,  eprint=false,doi=false,isbn=false]{biblatex}  %Use Author-Year-Cites with footnotes
\AdaptNoteOpt\footcite\multfootcite   %will add  separators if footcite is called multiple consecutive times 
\AdaptNoteOpt\autocite\multautocite % will add  separators if autocite is called multiple consecutive times
\DeclareFieldFormat{url}{\newline\url{#1}}
\DeclareFieldFormat{urldate}{\addcomma\space\bibstring{urlseen}\space#1}

\DefineBibliographyStrings{german}{%
  urlseen = {Abruf am},
}
% Uncomment the next line for IEEE-style 
% \usepackage[backend=biber, autocite=inline, style=ieee]{biblatex}     % Use IEEE-Style (e.g. [1])

% Uncomment the next line for alphabetic style 
% \usepackage[backend=biber, autocite=inline, style=alphabetic]{biblatex}   % Use alphabetic style (e.g. [TGK12])

% Uncomment the next two lines vor Harvard-Style 
%\usepackage[backend=biber, style=apa]{biblatex}    
%\DeclareLanguageMapping{german}{german-apa}


\DefineBibliographyStrings{ngerman}{  %Change u.a. to et al. (german only!)
    andothers = {{et\,al\adddot}},
}

%%% Uncomment the following lines to support hard URL breaks in bibliography 
%\apptocmd{\UrlBreaks}{\do\f\do\m}{}{}
%\setcounter{biburllcpenalty}{9000}% Kleinbuchstaben
%\setcounter{biburlucpenalty}{9000}% Großbuchstaben


\setlength{\bibparsep}{\parskip}        %add some space between biblatex entries in the bibliography
\addbibresource{bibliography.bib}   %Add file bibliography.bib as biblatex resource


%       FOOTNOTES 
%
% Count footnotes over chapters
\usepackage{chngcntr}
\counterwithout{footnote}{chapter}

%   ACRONYMS
%%%
%%% WICHTIG: Installieren Sie das neueste Acronyms-Paket!!!
%%%
\makeatletter
\usepackage[printonlyused]{acronym}
\@ifpackagelater{acronym}{2015/03/20}
  {%
    \renewcommand*{\aclabelfont}[1]{\textbf{\textsf{\acsfont{#1}}}}
  }%
  {%
  }%
\makeatother

%       LISTINGS
\usepackage{listings}   %Format Listings properly
\renewcommand{\lstlistingname}{Quelltext} 
\renewcommand{\lstlistlistingname}{Quelltextverzeichnis}
\lstset{numbers=left,
    numberstyle=\tiny,
    captionpos=b,
    basicstyle=\ttfamily\small}

%       EXTRA PACKAGES
\usepackage{lipsum}    %Blindtext
\usepackage{graphicx} % use various graphics formats
\usepackage[german]{varioref}   % nicer references \vref
\usepackage{caption}    %better Captions
\usepackage{booktabs} %nicer Tabs
\usepackage[german]{cleveref} %referenz
\usepackage{array}
%\newcolumntype{P}[1]{>{\raggedright\arraybackslash}p{#1}}


%       ALGORITHMS
\usepackage{algorithm}
\usepackage{algpseudocode}
\renewcommand{\listalgorithmname}{Algorithmenverzeichnis }
\floatname{algorithm}{Algorithmus}


%       FONT SELECTION: Entweder Latin Modern oder Times / Helvetica
\usepackage{lmodern} %Latin modern font
%\usepackage{mathptmx}  %Helvetica / Times New Roman fonts (2 lines)
%\usepackage[scaled=.92]{helvet} %Helvetica / Times New Roman fonts (2 lines)


%       PAGE HEADER / FOOTER
%       Warning: There are some redefinitions throughout the master.tex-file!  DON'T CHANGE THESE REDEFINITIONS!
\RequirePackage[automark,headsepline,footsepline]{scrpage2}
\pagestyle{scrheadings}
\renewcommand*{\pnumfont}{\upshape\sffamily}
\renewcommand*{\headfont}{\upshape\sffamily}
\renewcommand*{\footfont}{\upshape\sffamily}
\renewcommand{\chaptermarkformat}{}
\RedeclareSectionCommand[beforeskip=0pt]{chapter}
\crefname{chapter}{Kapitel}{Kapitel}
\crefname{section}{Unterkapitel}{Unterkapitel}
\crefname{subsection}{Unterkapitel}{Unterkapitel}
\clearscrheadfoot

\ifoot[\rule{0pt}{\ht\strutbox+\dp\strutbox}DHBW Mannheim]{\rule{0pt}{\ht\strutbox+\dp\strutbox}DHBW Mannheim}
\ofoot[\rule{0pt}{\ht\strutbox+\dp\strutbox}\pagemark]{\rule{0pt}{\ht\strutbox+\dp\strutbox}\pagemark}

\ohead{\headmark}

1
  • A minimal example: latex \documentclass[ 12pt, BCOR=5mm, DIV=12, headinclude=on, footinclude=off, parskip=half, bibliography=totoc, listof=entryprefix, toc=listof, pointlessnumbers, plainfootsepline]{scrreprt} \input{config} %\usepackage[]{listings} \begin{document} \chapter{Test} \begin{lstlisting} int i = 5; \end{lstlisting} \end{document} – Dennis Apr 29 '19 at 12:08
1

The issue was related to a wrong order of loaded packages.

\usepackage{hyperref} 
\usepackage{varioref} 
\usepackage{cleveref} 

In this case the order should be like this one:

\usepackage{varioref} 
\usepackage{hyperref} 
\usepackage{cleveref}

A big thanks goes to "Gast" from goLaTeX Forum

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.