emacs-orgmode
[Top][All Lists]

## Re: [Orgmode] configure latex fragments preview

 From: Carsten Dominik Subject: Re: [Orgmode] configure latex fragments preview Date: Tue, 15 Sep 2009 09:26:30 +0100

```Hi Nick,

```
:scale is use to change the -D dpi setting, which also changes the image size.
```
- Carsten

On Sep 14, 2009, at 8:39 PM, Nick Dokos wrote:

```
```Nicolas Goaziou <address@hidden> wrote:

```
This is some minor annoyance, but I would like to find a solution for it
```anyway.

The preview image of a latex fragment produced by C-c C-x C-l is so
small that I sometimes find it hard to read.

```
In order to solve that situation, I modified org-format-latex- header so
```that the template for the preview starts with
\documentclass[17pt]{extarticle}.

Though, I find it not quite satisfying as there is little control on
```
that size (I would like it to be a bit less than 17pt). Thus my question (eventually) : is it possible to play with dvipng options like scale or
```dpi directly, without modifying org.el ?

```
And if it doesn't exist, could a variable be introduced to fine- tune it ?
```
```
As a last note, I think there is a Latex only way to solve all of this,
```but I wouldn't like to depends on too much latex packages or tricks.

```
```
The call to dvipng in org.el looks like this:

,----
|         ...
|         (call-process "dvipng" nil nil nil
|                       "-fg" fg "-bg" bg
|                       "-D" dpi
|                       ;;"-x" scale "-y" scale
|                       "-T" "tight"
|                       "-o" pngfile
|                       dvifile)
|         ...
`----

Try modifying it to this:

,----
|           ...
|         (call-process "dvipng" nil nil nil
|                       "-fg" fg "-bg" bg
|                       "-D" dpi
|                       ;;"-x" scale "-y" scale
|                         "-x" "2074"
|                       "-T" "tight"
|                       "-o" pngfile
|                       dvifile)
`----

The dvipng man page suggests values for the -x option:

,----
|        -x num
```
| Set the x magnification ratio to num/1000. Overrides the magnification specified in the | DVI file. Must be between 10 and 100000. It is recommended that you use standard mag‐ | step values (1095, 1200, 1440, 1728, 2074, 2488, 2986, and so on) to help reduce the | total number of PK files generated. num may be a real number, not an integer, for
```|            increased precision.
`----

Note the commented out -x/-y options in org.el: afaict, there is no -y
```
option, but perhaps Carsten can reintroduce the -x option, and then use
```scale to set it properly (although the value of scale will need to be,
ahem, scaled).  If so, then you 'd be able to get what you want by
customizing org-format-latex-options:

,----
| org-format-latex-options is a variable defined in `org.el'.
| Its value is
```
| (:foreground default :background default :scale 1.0 :html- foreground "Black" :html-background "Transparent" :html-scale 1.0 :matchers
```|              ("begin" "\$1" "\$" "\$\$" "\\(" "\\["))
|
|
| Documentation:
| Options for creating images from LaTeX fragments.
| This is a property list with the following properties:
```
| :foreground the foreground color for images embedded in Emacs, e.g. "Black".
```|              `default' means use the foreground of the default face.
| :background  the background color, or "Transparent".
|              `default' means use the background of the default face.
| :scale       a scaling factor for the size of the images.
| :html-foreground, :html-background, :html-scale
|              the same numbers for HTML export.
| :matchers    a list indicating which matchers should be used to
|              find LaTeX fragments.  Valid members of this list are:
|              "begin"  find environments
|              "\$1"     find single characters surrounded by \$.\$
|              "\$"      find math expressions surrounded by \$...\$
|              "\$\$"     find math expressions surrounded by \$\$....\$\$
|              "\("     find math expressions surrounded by \(...\)
|              "\ ["    find math expressions surrounded by \ [...\]
|
| You can customize this variable.
`----

HTH,
Nick

_______________________________________________
Emacs-orgmode mailing list
Remember: use `Reply All' to send replies to the list.
```