Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

better code listings #6

Open
SimonMcCallum opened this issue Apr 25, 2017 · 2 comments
Open

better code listings #6

SimonMcCallum opened this issue Apr 25, 2017 · 2 comments

Comments

@SimonMcCallum
Copy link
Contributor

No description provided.

@TJuberg
Copy link
Contributor

TJuberg commented May 18, 2017

For code listing with syntax highlighting one could possibly also mention the minted package.

Eksempel på bruk av minted sammen med tcolorbox

% Minted og tcolorbox for syntax highlighting og fargerike bokser
\usepackage[many,minted]{tcolorbox}
\usepackage{minted}
% Default settings for Minted
\setminted{breaklines=true,autogobble=true}

% Macro for å opprette nytt minted miljø og tcolobox samtidig
\newcommand{\mynewminted}[3]{%
  \newminted[#1]{#2}{#3}%
  \tcbset{myminted/#1/.style={minted language=#2,minted options={#3}}}}

% Definere de forskjellige minted miljøene vi vil benytte
\mynewminted{myconsole}{console}{}
\mynewminted{myconsolelong}{console}{breakanywhere=true}
\mynewminted{mybash}{bash}{}
\mynewminted{mymanpage}{man}{}

% Kodeblokker
\newtcblisting[auto counter,number within=section,
  list inside=mypyg]{kode}[3][]{%
  listing only,title={#3},
  list entry={\protect\numberline{\thetcbcounter}#3},
  breakable,
  enhanced,colframe=blue!50!black,drop fuzzy shadow,myminted/#2,#1}

% oppgavesitater
\newtcolorbox{oppgave}[1][]{%
    title=Oppgavesitat,
    breakable,
    enhanced,colframe=brown!50!black,drop fuzzy shadow,
    #1
}

% Endring
\newtcolorbox{altered}[1][]{%
    title=Endring,
    breakable,
    enhanced,colframe=red!50!black,drop fuzzy shadow,
    #1
}

@ifarup
Copy link
Contributor

ifarup commented Jun 24, 2019

After reading this discussion

https://tex.stackexchange.com/questions/389191/minted-vs-listings-pros-and-cons

I prefer to stay with listings. However, the listings package is highly configurable, so we could make much better use of it than we currently do.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants