Re: [O] Remaining document problems

2016-10-13 Thread Eric S Fraga
On Thursday, 13 Oct 2016 at 12:46, Peter Davis wrote:
>> 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:

Thanks.  Useful to have the definition for javascript on the list.

-- 
: Eric S Fraga (0xFFFCF67D), Emacs 25.1.1, Org release_8.3.6-1207-g91e263



Re: [O] Remaining document problems

2016-10-13 Thread Eric S Fraga
On Thursday, 13 Oct 2016 at 12:46, Peter Davis wrote:
> 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.

Oh, and thanks for this!  This is very useful.

-- 
: Eric S Fraga (0xFFFCF67D), Emacs 25.1.1, Org release_8.3.6-1207-g91e263



Re: [O] Remaining document problems

2016-10-13 Thread Peter Davis


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



Re: [O] Remaining document problems

2016-10-13 Thread Eric S Fraga
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...

Thanks,
eric

-- 
: Eric S Fraga (0xFFFCF67D), Emacs 25.1.1, Org release_8.3.6-1207-g91e263



Re: [O] Remaining document problems

2016-10-12 Thread Peter Davis

On Wed, Oct 12, 2016, at 11:39 AM, Nick Dokos wrote:
> Peter Davis  writes:
> 
> > A. Source code listings
> >
> > 1) Source code blocks: Using
> >
> > #+BEGIN_SRC js
> >
> > works for HTML output, but not for LaTeX/PDF. It seems js is not
> > understood by the listings package, and I have to use java.
> >
> > 2) Even with java, the output is pretty ugly. Any way to get some color
> > in there?
> >
> >
> 
> It shouldn't take much to define a language environment for listings:
> 
> http://tex.stackexchange.com/questions/89574/language-option-supported-in-listings
> 
> Maybe that helps?
> 

Excellent!  Thanks to this, I now have great looking JavaScript
listings, and I can easily change the styling.

Thank you, Nick!

-pd


-- 
  Peter Davis
  www.techcurmudgeon.com



Re: [O] Remaining document problems

2016-10-12 Thread Nick Dokos
Peter Davis  writes:

> A. Source code listings
>
> 1) Source code blocks: Using
>
> #+BEGIN_SRC js
>
> works for HTML output, but not for LaTeX/PDF. It seems js is not
> understood by the listings package, and I have to use java.
>
> 2) Even with java, the output is pretty ugly. Any way to get some color
> in there?
>
>

It shouldn't take much to define a language environment for listings:

http://tex.stackexchange.com/questions/89574/language-option-supported-in-listings

Maybe that helps?

Alternatively, can you use minted instead of listings? It requires
some external packages and some changes in how the latex is processed
(basically adding --shell-escape to the pdflatex (or similar)
invocation(s)). C-h v org-latex-listings RET has the details.
But it does contain support for javascript, IIRC.

-- 
Nick