emacs-orgmode
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [O] Remaining document problems


From: Peter Davis
Subject: Re: [O] Remaining document problems
Date: Thu, 13 Oct 2016 08:46:01 -0400


On Thu, Oct 13, 2016, at 04:08 AM, Eric S Fraga wrote:
> On Wednesday, 12 Oct 2016 at 16:35, Peter Davis wrote:
> 
> [...]
> 
> > Excellent!  Thanks to this, I now have great looking JavaScript
> > listings, and I can easily change the styling.
> 
> For completeness, would you please tell us your solution?  I'm sure this
> question will come up again at some point...
> 

Sure thing, Eric. Basically, I just added the following to my org file:


#+LaTeX_HEADER: \lstset{
#+LaTeX_HEADER:    columns=fullflexible,
#+LaTeX_HEADER:    keepspaces=true
#+LaTeX_HEADER:    language=js,
#+LaTeX_HEADER:    backgroundcolor=\color{lightgray},
#+LaTeX_HEADER:    extendedchars=true, 
#+LaTeX_HEADER:    basicstyle=\footnotesize\ttfamily,
#+LaTeX_HEADER:    showstringspaces=false,
#+LaTeX_HEADER:    showspaces=false,
#+LaTeX_HEADER:    showtabs=false,
#+LaTeX_HEADER:    numbers=left,
#+LaTeX_HEADER:    numberstyle=\footnotesize,
#+LaTeX_HEADER:    numbersep=9pt,
#+LaTeX_HEADER:    tabsize=2,
#+LaTeX_HEADER:    breaklines=true,
#+LaTeX_HEADER:   
prebreak=\mbox{\ensuremath{\color{red}\hookleftarrow}},
#+LaTeX_HEADER:   
postbreak=\raisebox{0ex}[0ex][0ex]{\ensuremath{\color{red}\hookrightarrow\space}},
#+LaTeX_HEADER:    captionpos=b
#+LaTeX_HEADER: }
#+LaTeX_HEADER: \definecolor{lightgray}{rgb}{.9,.9,.9}
#+LaTeX_HEADER: \definecolor{darkgray}{rgb}{.4,.4,.4}
#+LaTeX_HEADER: \definecolor{purple}{rgb}{0.65, 0.12, 0.82}
#+LaTeX_HEADER: \definecolor{darkgreen}{rgb}{0.12, 0.65, 0.30}
#+LaTeX_HEADER: \lstdefinelanguage{js}{
#+LaTeX_HEADER:   keywords={typeof, new, true, false, catch, function,
return, null, catch, switch, var, if, in, while, do, else, case, break},
#+LaTeX_HEADER:   keywordstyle=\color{blue}\bfseries\footnotesize,
#+LaTeX_HEADER:   ndkeywords={class, export, boolean, throw, implements,
import, this},
#+LaTeX_HEADER:   ndkeywordstyle=\color{darkgray}\bfseries,
#+LaTeX_HEADER:   identifierstyle=\color{black},
#+LaTeX_HEADER:   sensitive=false,
#+LaTeX_HEADER:   comment=[l]{//},
#+LaTeX_HEADER:   morecomment=[s]{/*}{*/},
#+LaTeX_HEADER:   commentstyle=\color{darkgreen}\itshape,
#+LaTeX_HEADER:   stringstyle=\color{purple}\ttfamily,
#+LaTeX_HEADER:   morestring=[b]',
#+LaTeX_HEADER:   morestring=[b]"
#+LaTeX_HEADER: }


This way, I get syntax highlighting in org, in HTML output, and in
LaTeX/PDF output.

NOTE: The prebreak and postbreak definitions just add little red hooks
to the source block to show me where a line break was added. It's a
trick I picked up on this list a while ago.

Thanks!
-pd

-- 
  Peter Davis
  www.techcurmudgeon.com



reply via email to

[Prev in Thread] Current Thread [Next in Thread]