emacs-orgmode@gnu.org archives
 help / color / mirror / code / Atom feed
* Problems with source code listings in PDF
@ 2011-02-08 14:59 Avdi Grimm
  2011-02-08 15:17 ` Eric S Fraga
                   ` (2 more replies)
  0 siblings, 3 replies; 5+ messages in thread
From: Avdi Grimm @ 2011-02-08 14:59 UTC (permalink / raw)
  To: emacs-orgmode

[-- Attachment #1: Type: text/plain, Size: 973 bytes --]

I'm working on creating a PDF eBook with Org-Mode, and I'm running
into some difficulty getting them to come out looking decent.

I've followed the directions I found in the list archives for
outputting colorized source code listings. I set
org-export-latex-listings to t, and customized
org-export-latex-packages-alist according to the directions in the
org-export-latex-listings docs.

I'm seeing a few problems with the output:

1. There is no color; only bolded keywords.
2. Listings are formatted in a not-very-well-rendered font with serifs
that just doesn't look good at all.
3. In begin_example sections, spaces are replaced with odd little
curved underscores.

I've attached some examples to show what I mean.

I'm running Org-Mode 7.4 on Ubuntu 10.10 with Emacs 23.1.50.1.

Has anyone had any luck formatting source code and example listings in
PDF output? What I'd really like to get is output identical to the
listings exported to HTML.

Thanks!

--
Avdi Grimm

[-- Attachment #2: example.png --]
[-- Type: image/png, Size: 11291 bytes --]

[-- Attachment #3: listing.png --]
[-- Type: image/png, Size: 18852 bytes --]

[-- Attachment #4: Type: text/plain, Size: 201 bytes --]

_______________________________________________
Emacs-orgmode mailing list
Please use `Reply All' to send replies to the list.
Emacs-orgmode@gnu.org
http://lists.gnu.org/mailman/listinfo/emacs-orgmode

^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: Problems with source code listings in PDF
  2011-02-08 14:59 Problems with source code listings in PDF Avdi Grimm
@ 2011-02-08 15:17 ` Eric S Fraga
  2011-02-08 15:25 ` Rainer M Krug
  2011-02-08 15:47 ` Thomas S. Dye
  2 siblings, 0 replies; 5+ messages in thread
From: Eric S Fraga @ 2011-02-08 15:17 UTC (permalink / raw)
  To: Avdi Grimm; +Cc: emacs-orgmode

Avdi Grimm <groups@inbox.avdi.org> writes:

> I'm working on creating a PDF eBook with Org-Mode, and I'm running
> into some difficulty getting them to come out looking decent.
>
> I've followed the directions I found in the list archives for
> outputting colorized source code listings. I set
> org-export-latex-listings to t, and customized
> org-export-latex-packages-alist according to the directions in the
> org-export-latex-listings docs.
>
> I'm seeing a few problems with the output:

> 1. There is no color; only bolded keywords.

I must admit that colour has never been something I've considered...
it is, however, an option for the listings package.

> 2. Listings are formatted in a not-very-well-rendered font with serifs
> that just doesn't look good at all.

I've had no problems with typeface etc for listings in the past.

> 3. In begin_example sections, spaces are replaced with odd little
> curved underscores.

The use of curved underscores for spaces is deliberate and whether this
is done will depend on your source language.  You can customise this in
any case (see below).

In summary, you may need to add a line customising the listings
package.  Check out the user manual at

: ftp://ftp.tex.ac.uk/tex-archive/macros/latex/contrib/listings/listings.pdf

and then have something like this in your org file near the top:

#+latex_header: \lstset{showspaces=false, ...}

(replacing ... with the other options you may wish).

HTH.

-- 
: Eric S Fraga (GnuPG: 0xC89193D8FFFCF67D) in Emacs 24.0.50.1
: using Org-mode version 7.4 (release_7.4.319.g88b7.dirty)

^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: Problems with source code listings in PDF
  2011-02-08 14:59 Problems with source code listings in PDF Avdi Grimm
  2011-02-08 15:17 ` Eric S Fraga
@ 2011-02-08 15:25 ` Rainer M Krug
  2011-02-08 15:47 ` Thomas S. Dye
  2 siblings, 0 replies; 5+ messages in thread
From: Rainer M Krug @ 2011-02-08 15:25 UTC (permalink / raw)
  To: Avdi Grimm; +Cc: emacs-orgmode

-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

On 02/08/2011 03:59 PM, Avdi Grimm wrote:
> I'm working on creating a PDF eBook with Org-Mode, and I'm running
> into some difficulty getting them to come out looking decent.
> 
> I've followed the directions I found in the list archives for
> outputting colorized source code listings. I set
> org-export-latex-listings to t, and customized
> org-export-latex-packages-alist according to the directions in the
> org-export-latex-listings docs.
> 
> I'm seeing a few problems with the output:
> 
> 1. There is no color; only bolded keywords.

add these definitions to the headers of the org file - they should
provide colour and a list of other things you can customize - these are
not from me, I think they are from this list or from worg.

Cheers,

Rainer

#+LATEX_HEADER: \definecolor{light-gray}{gray}{0.9}
#+LATEX_HEADER: \lstset{%
#+LATEX_HEADER:     basicstyle=\ttfamily\tiny,       % the font that is
used for the code
#+LATEX_HEADER:     tabsize=4,                       % sets default
tabsize to 4 spaces
#+LATEX_HEADER:     numbers=left,                    % where to put the
line numbers
#+LATEX_HEADER:     numberstyle=\tiny,               % line number font size
#+LATEX_HEADER:     stepnumber=0,                    % step between two
line numbers
#+LATEX_HEADER:     breaklines=true,                 %!! don't break
long lines of code
#+LATEX_HEADER:     showtabs=false,                  % show tabs within
strings adding particular underscores
#+LATEX_HEADER:     showspaces=false,                % show spaces
adding particular underscores
#+LATEX_HEADER:     showstringspaces=false,          % underline spaces
within strings
#+LATEX_HEADER:     keywordstyle=\color{blue},
#+LATEX_HEADER:     identifierstyle=\color{black},
#+LATEX_HEADER:     stringstyle=\color{green},
#+LATEX_HEADER:     commentstyle=\color{red},
#+LATEX_HEADER:     backgroundcolor=\color{light-gray},   % sets the
background color
#+LATEX_HEADER:     columns=fullflexible,
#+LATEX_HEADER:     basewidth={0.5em,0.4em},
#+LATEX_HEADER:     captionpos=b,                    % sets the caption
position to `bottom'
#+LATEX_HEADER:     extendedchars=false              %!?? workaround for
when the listed file is in UTF-8
#+LATEX_HEADER: }

> 2. Listings are formatted in a not-very-well-rendered font with serifs
> that just doesn't look good at all.
> 3. In begin_example sections, spaces are replaced with odd little
> curved underscores.
> 
> I've attached some examples to show what I mean.
> 
> I'm running Org-Mode 7.4 on Ubuntu 10.10 with Emacs 23.1.50.1.
> 
> Has anyone had any luck formatting source code and example listings in
> PDF output? What I'd really like to get is output identical to the
> listings exported to HTML.
> 
> Thanks!
> 
> --
> Avdi Grimm
> 
> 
> 
> _______________________________________________
> Emacs-orgmode mailing list
> Please use `Reply All' to send replies to the list.
> Emacs-orgmode@gnu.org
> http://lists.gnu.org/mailman/listinfo/emacs-orgmode


- -- 
Rainer M. Krug, PhD (Conservation Ecology, SUN), MSc (Conservation
Biology, UCT), Dipl. Phys. (Germany)

Centre of Excellence for Invasion Biology
Natural Sciences Building
Office Suite 2039
Stellenbosch University
Main Campus, Merriman Avenue
Stellenbosch
South Africa

Tel:        +33 - (0)9 53 10 27 44
Cell:       +27 - (0)8 39 47 90 42
Fax (SA):   +27 - (0)8 65 16 27 82
Fax (D) :   +49 - (0)3 21 21 25 22 44
Fax (FR):   +33 - (0)9 58 10 27 44
email:      Rainer@krugs.de

Skype:      RMkrug
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.10 (GNU/Linux)
Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org/

iEYEARECAAYFAk1RYE4ACgkQoYgNqgF2egqzHQCfVFZ9nQP5l1cEsCaFpzRyR2vv
o9MAnArHaXN8pPEDoZE4ATdt/6OgN2Wq
=xwFH
-----END PGP SIGNATURE-----

^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: Problems with source code listings in PDF
  2011-02-08 14:59 Problems with source code listings in PDF Avdi Grimm
  2011-02-08 15:17 ` Eric S Fraga
  2011-02-08 15:25 ` Rainer M Krug
@ 2011-02-08 15:47 ` Thomas S. Dye
  2011-02-09 13:25   ` Robert Klein
  2 siblings, 1 reply; 5+ messages in thread
From: Thomas S. Dye @ 2011-02-08 15:47 UTC (permalink / raw)
  To: Avdi Grimm; +Cc: emacs-orgmode


[-- Attachment #1.1: Type: text/plain, Size: 1684 bytes --]


On Feb 8, 2011, at 4:59 AM, Avdi Grimm wrote:

> I'm working on creating a PDF eBook with Org-Mode, and I'm running
> into some difficulty getting them to come out looking decent.
>
> I've followed the directions I found in the list archives for
> outputting colorized source code listings. I set
> org-export-latex-listings to t, and customized
> org-export-latex-packages-alist according to the directions in the
> org-export-latex-listings docs.
>
> I'm seeing a few problems with the output:
>
> 1. There is no color; only bolded keywords
> 2. Listings are formatted in a not-very-well-rendered font with serifs
> that just doesn't look good at all.

Instructions for setting up different fonts can be found here:

http://orgmode.org/worg/org-tutorials/org-latex-export.html#sec-14

Note that some of the fonts clash with the amssymb LaTeX package,  
which Org-mode loads by default.  You'll want to choose a font that  
doesn't clash, or configure Org-mode so the amssymb package isn't  
loaded.

All the best,
Tom


> 3. In begin_example sections, spaces are replaced with odd little
> curved underscores.
>
> I've attached some examples to show what I mean.
>
> I'm running Org-Mode 7.4 on Ubuntu 10.10 with Emacs 23.1.50.1.
>
> Has anyone had any luck formatting source code and example listings in
> PDF output? What I'd really like to get is output identical to the
> listings exported to HTML.
>
> Thanks!
>
> --
> Avdi Grimm
> < 
> example 
> .png><listing.png>_______________________________________________
> Emacs-orgmode mailing list
> Please use `Reply All' to send replies to the list.
> Emacs-orgmode@gnu.org
> http://lists.gnu.org/mailman/listinfo/emacs-orgmode


[-- Attachment #1.2: Type: text/html, Size: 2329 bytes --]

[-- Attachment #2: Type: text/plain, Size: 201 bytes --]

_______________________________________________
Emacs-orgmode mailing list
Please use `Reply All' to send replies to the list.
Emacs-orgmode@gnu.org
http://lists.gnu.org/mailman/listinfo/emacs-orgmode

^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: Problems with source code listings in PDF
  2011-02-08 15:47 ` Thomas S. Dye
@ 2011-02-09 13:25   ` Robert Klein
  0 siblings, 0 replies; 5+ messages in thread
From: Robert Klein @ 2011-02-09 13:25 UTC (permalink / raw)
  To: emacs-orgmode

Am 08.02.2011, 16:47 Uhr, schrieb Thomas S. Dye <tsd@tsdye.com>:

>
> On Feb 8, 2011, at 4:59 AM, Avdi Grimm wrote:
>
>> I'm working on creating a PDF eBook with Org-Mode, and I'm running
>> into some difficulty getting them to come out looking decent.
>>
[s.d.]
>>
>> I'm seeing a few problems with the output:
>>
>> 1. There is no color; only bolded keywords
>> 2. Listings are formatted in a not-very-well-rendered font with serifs
>> that just doesn't look good at all.
>
> Instructions for setting up different fonts can be found here:
>
> http://orgmode.org/worg/org-tutorials/org-latex-export.html#sec-14
>

I think a better answer for point 2. might be a header line of


#+LaTeX_HEADER: \lstset{ basicstyle=\small\ttfamily }

Best regards
Robert


>
> All the best,
> Tom
>
>
>> 3. In begin_example sections, spaces are replaced with odd little
>> curved underscores.
>>
>> I've attached some examples to show what I mean.
>>
>> I'm running Org-Mode 7.4 on Ubuntu 10.10 with Emacs 23.1.50.1.
>>
>> Has anyone had any luck formatting source code and example listings in
>> PDF output? What I'd really like to get is output identical to the
>> listings exported to HTML.
>>
>> Thanks!
>>
>> --
>> Avdi Grimm
>> <
>> example
>> .png><listing.png>_______________________________________________
>> Emacs-orgmode mailing list
>> Please use `Reply All' to send replies to the list.
>> Emacs-orgmode@gnu.org
>> http://lists.gnu.org/mailman/listinfo/emacs-orgmode

^ permalink raw reply	[flat|nested] 5+ messages in thread

end of thread, other threads:[~2011-02-09 13:25 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2011-02-08 14:59 Problems with source code listings in PDF Avdi Grimm
2011-02-08 15:17 ` Eric S Fraga
2011-02-08 15:25 ` Rainer M Krug
2011-02-08 15:47 ` Thomas S. Dye
2011-02-09 13:25   ` Robert Klein

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).