emacs-orgmode@gnu.org archives
 help / color / mirror / code / Atom feed
From: Peter Davis <pfd@pfdstudio.com>
To: Eric S Fraga <e.fraga@ucl.ac.uk>
Cc: emacs-orgmode@gnu.org
Subject: Re: Remaining document problems
Date: Thu, 13 Oct 2016 08:46:01 -0400	[thread overview]
Message-ID: <1476362761.2721522.754730017.6974F230@webmail.messagingengine.com> (raw)
In-Reply-To: <87fuo0llhw.fsf@pinto.chemeng.ucl.ac.uk>



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	other threads:[~2016-10-13 12:46 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2016-10-12 14:55 Remaining document problems Peter Davis
2016-10-12 15:39 ` Nick Dokos
2016-10-12 16:35   ` Peter Davis
     [not found]   ` <463a5687c70841b8a6603102739fbf02@HE1PR01MB1898.eurprd01.prod.exchangelabs.com>
2016-10-13  8:08     ` Eric S Fraga
2016-10-13 12:46       ` Peter Davis [this message]
     [not found]       ` <1da24f56addb4163963006cdae9703cb@HE1PR01MB1898.eurprd01.prod.exchangelabs.com>
2016-10-13 13:01         ` Eric S Fraga
2016-10-13 13:03         ` Eric S Fraga

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

  List information: https://www.orgmode.org/

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=1476362761.2721522.754730017.6974F230@webmail.messagingengine.com \
    --to=pfd@pfdstudio.com \
    --cc=e.fraga@ucl.ac.uk \
    --cc=emacs-orgmode@gnu.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
Code repositories for project(s) associated with this public inbox

	https://git.savannah.gnu.org/cgit/emacs/org-mode.git

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).