From mboxrd@z Thu Jan 1 00:00:00 1970 From: Peter Davis Subject: Re: Remaining document problems Date: Thu, 13 Oct 2016 08:46:01 -0400 Message-ID: <1476362761.2721522.754730017.6974F230@webmail.messagingengine.com> References: <1476284126.2405843.753686713.71418D96@webmail.messagingengine.com> <87vawxy3ta.fsf@gmail.com> <463a5687c70841b8a6603102739fbf02@HE1PR01MB1898.eurprd01.prod.exchangelabs.com> <87fuo0llhw.fsf@pinto.chemeng.ucl.ac.uk> Mime-Version: 1.0 Content-Type: text/plain Content-Transfer-Encoding: 7bit Return-path: Received: from eggs.gnu.org ([2001:4830:134:3::10]:35092) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1bufOk-00079u-PH for emacs-orgmode@gnu.org; Thu, 13 Oct 2016 08:46:11 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1bufOg-0001KZ-0l for emacs-orgmode@gnu.org; Thu, 13 Oct 2016 08:46:10 -0400 Received: from out5-smtp.messagingengine.com ([66.111.4.29]:40203) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1bufOe-0001GQ-P0 for emacs-orgmode@gnu.org; Thu, 13 Oct 2016 08:46:05 -0400 In-Reply-To: <87fuo0llhw.fsf@pinto.chemeng.ucl.ac.uk> List-Id: "General discussions about Org-mode." List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: emacs-orgmode-bounces+geo-emacs-orgmode=m.gmane.org@gnu.org Sender: "Emacs-orgmode" To: Eric S Fraga Cc: emacs-orgmode@gnu.org 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