emacs-orgmode@gnu.org archives
 help / color / mirror / code / Atom feed
* :scale option in org-format-latex-options
@ 2010-03-14  1:16 Dan Davison
  2010-03-14  7:54 ` David Maus
  0 siblings, 1 reply; 5+ messages in thread
From: Dan Davison @ 2010-03-14  1:16 UTC (permalink / raw)
  To: emacs org-mode mailing list

When creating png images of latex fragments in org-create-formula-image,
the :scale option in org-format-latex-options is not currently honoured
(it's commented out). My dvipng documentation says

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

I don't know what a magstep is, let alone a PK file, but it seems to
suggest something like the patch below. Is there any reason not to make
a change like this?

--8<---------------cut here---------------start------------->8---
diff --git a/lisp/org.el b/lisp/org.el
index aa22309..e5d046e 100644
--- a/lisp/org.el
+++ b/lisp/org.el
@@ -15043,6 +15043,7 @@ Some of the options can be changed using the variable
                   (font-height (get-face-font 'default))
                 (face-attribute 'default :height nil)))
         (scale (or (plist-get options (if buffer :scale :html-scale)) 1.0))
+        (dvipng-scale (number-to-string (* 1000 scale)))
         (dpi (number-to-string (* scale (floor (* 0.9 (if buffer fnh 140.))))))
         (fg (or (plist-get options (if buffer :foreground :html-foreground))
                 "Black"))
@@ -15078,7 +15079,7 @@ Some of the options can be changed using the variable
          (call-process "dvipng" nil nil nil
                        "-fg" fg "-bg" bg
                        "-D" dpi
-                       ;;"-x" scale "-y" scale
+                       "-x" dvipng-scale "-y" dvipng-scale
                        "-T" "tight"
                        "-o" pngfile
                        dvifile)
--8<---------------cut here---------------end--------------->8---


Also, this looks to me like a typo in the docstring of
org-format-latex-options, is that right?


--8<---------------cut here---------------start------------->8---
diff --git a/lisp/org.el b/lisp/org.el
index aa22309..e5d046e 100644
--- a/lisp/org.el
+++ b/lisp/org.el
@@ -2860,7 +2860,7 @@ This is a property list with the following properties:
              \"$\"      find math expressions surrounded by $...$
              \"$$\"     find math expressions surrounded by $$....$$
              \"\\(\"     find math expressions surrounded by \\(...\\)
-             \"\\ [\"    find math expressions surrounded by \\ [...\\]"
+             \"\\[\"    find math expressions surrounded by \\[...\\]"
   :group 'org-latex
   :type 'plist)
--8<---------------cut here---------------end--------------->8---
 

Dan

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

* Re: :scale option in org-format-latex-options
  2010-03-14  1:16 :scale option in org-format-latex-options Dan Davison
@ 2010-03-14  7:54 ` David Maus
  2010-03-14 13:02   ` Carsten Dominik
  0 siblings, 1 reply; 5+ messages in thread
From: David Maus @ 2010-03-14  7:54 UTC (permalink / raw)
  To: Dan Davison; +Cc: emacs org-mode mailing list


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

Hi Dan,

Dan Davison wrote:
>When creating png images of latex fragments in org-create-formula-image,
>the :scale option in org-format-latex-options is not currently honoured
>(it's commented out). My dvipng documentation says

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

>I don't know what a magstep is, let alone a PK file, but it seems to
>suggest something like the patch below. Is there any reason not to make
>a change like this?

I see two problems: First we should find out what "x magnification"
and "magstep" actually is and why the manual suggests using these
"strange" standard numbers.  And second: At least dvipng shipped with
debian testing

,----
| This is dvipng 1.12 Copyright 2002-2008 Jan-Ake Larsson
| dvipng 1.12
| kpathsea version 5.0.0
| Compiled with Freetype 2.3.11
| Using libft 2.3.11
| Using t1lib 5.1.2
`----

does not have a -y option.

Regards
 -- David
--
OpenPGP... 0x99ADB83B5A4478E6
Jabber.... dmjena@jabber.org
Email..... dmaus@ictsoc.de

[-- Attachment #1.2: Type: application/pgp-signature, Size: 230 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: :scale option in org-format-latex-options
  2010-03-14  7:54 ` David Maus
@ 2010-03-14 13:02   ` Carsten Dominik
  2010-03-14 16:16     ` Dan Davison
  0 siblings, 1 reply; 5+ messages in thread
From: Carsten Dominik @ 2010-03-14 13:02 UTC (permalink / raw)
  To: David Maus; +Cc: Dan Davison, emacs org-mode mailing list


On Mar 14, 2010, at 8:54 AM, David Maus wrote:

> Hi Dan,
>
> Dan Davison wrote:
>> When creating png images of latex fragments in org-create-formula- 
>> image,
>> the :scale option in org-format-latex-options is not currently  
>> honoured
>> (it's commented out). My dvipng documentation says
>
>>      -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 magstep
>>          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.
>
>> I don't know what a magstep is, let alone a PK file, but it seems to
>> suggest something like the patch below. Is there any reason not to  
>> make
>> a change like this?
>
> I see two problems: First we should find out what "x magnification"
> and "magstep" actually is and why the manual suggests using these
> "strange" standard numbers.  And second: At least dvipng shipped with
> debian testing
>
> ,----
> | This is dvipng 1.12 Copyright 2002-2008 Jan-Ake Larsson
> | dvipng 1.12
> | kpathsea version 5.0.0
> | Compiled with Freetype 2.3.11
> | Using libft 2.3.11
> | Using t1lib 5.1.2
> `----
>
> does not have a -y option.

I remember removing the option precise because some (newer?)
versions of dvipng do not have these options.  I believe you can use a  
larger DPI to make the image larger.

- Carsten

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

* Re: :scale option in org-format-latex-options
  2010-03-14 13:02   ` Carsten Dominik
@ 2010-03-14 16:16     ` Dan Davison
  2010-03-15 15:35       ` Carsten Dominik
  0 siblings, 1 reply; 5+ messages in thread
From: Dan Davison @ 2010-03-14 16:16 UTC (permalink / raw)
  To: Carsten Dominik; +Cc: emacs org-mode mailing list

Carsten Dominik <carsten.dominik@gmail.com> writes:

> On Mar 14, 2010, at 8:54 AM, David Maus wrote:
>
>> Hi Dan,
>>
>> Dan Davison wrote:
[...]
>>> Is there any reason not to
>>> make
>>> a change like this?
>>
>> I see two problems: First we should find out what "x magnification"
>> and "magstep" actually is and why the manual suggests using these
>> "strange" standard numbers.  And second: At least dvipng shipped with
>> debian testing
[...]
>> does not have a -y option.
>
> I remember removing the option precise because some (newer?)
> versions of dvipng do not have these options.  I believe you can use a
> larger DPI to make the image larger.

Ah, right, thanks David and Carsten, I see. What I thought was the
effects of -x and -y was in fact the effect of the DPI option, which is
already set by :scale. So it was already working fine for my purposes :)

I think the following is a docstring typo (org-format-latex-options),
right?

--8<---------------cut here---------------start------------->8---
diff --git a/lisp/org.el b/lisp/org.el
index aa22309..e5d046e 100644
--- a/lisp/org.el
+++ b/lisp/org.el
@@ -2860,7 +2860,7 @@ This is a property list with the following properties:
              \"$\"      find math expressions surrounded by $...$
              \"$$\"     find math expressions surrounded by $$....$$
              \"\\(\"     find math expressions surrounded by \\(...\\)
-             \"\\ [\"    find math expressions surrounded by \\ [...\\]"
+             \"\\[\"    find math expressions surrounded by \\[...\\]"
   :group 'org-latex
   :type 'plist)
--8<---------------cut here---------------end--------------->8---


Dan

>
> - Carsten
>
>
>
> _______________________________________________
> 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 related	[flat|nested] 5+ messages in thread

* Re: :scale option in org-format-latex-options
  2010-03-14 16:16     ` Dan Davison
@ 2010-03-15 15:35       ` Carsten Dominik
  0 siblings, 0 replies; 5+ messages in thread
From: Carsten Dominik @ 2010-03-15 15:35 UTC (permalink / raw)
  To: Dan Davison; +Cc: emacs org-mode mailing list


On Mar 14, 2010, at 5:16 PM, Dan Davison wrote:

> Carsten Dominik <carsten.dominik@gmail.com> writes:
>
>> On Mar 14, 2010, at 8:54 AM, David Maus wrote:
>>
>>> Hi Dan,
>>>
>>> Dan Davison wrote:
> [...]
>>>> Is there any reason not to
>>>> make
>>>> a change like this?
>>>
>>> I see two problems: First we should find out what "x magnification"
>>> and "magstep" actually is and why the manual suggests using these
>>> "strange" standard numbers.  And second: At least dvipng shipped  
>>> with
>>> debian testing
> [...]
>>> does not have a -y option.
>>
>> I remember removing the option precise because some (newer?)
>> versions of dvipng do not have these options.  I believe you can  
>> use a
>> larger DPI to make the image larger.
>
> Ah, right, thanks David and Carsten, I see. What I thought was the
> effects of -x and -y was in fact the effect of the DPI option, which  
> is
> already set by :scale. So it was already working fine for my  
> purposes :)
>
> I think the following is a docstring typo (org-format-latex-options),
> right?
>
> --8<---------------cut here---------------start------------->8---
> diff --git a/lisp/org.el b/lisp/org.el
> index aa22309..e5d046e 100644
> --- a/lisp/org.el
> +++ b/lisp/org.el
> @@ -2860,7 +2860,7 @@ This is a property list with the following  
> properties:
>              \"$\"      find math expressions surrounded by $...$
>              \"$$\"     find math expressions surrounded by $$....$$
>              \"\\(\"     find math expressions surrounded by \\(...\\)
> -             \"\\ [\"    find math expressions surrounded by \\ [... 
> \\]"
> +             \"\\[\"    find math expressions surrounded by \\[...\ 
> \]"
>   :group 'org-latex
>   :type 'plist)
> --8<---------------cut here---------------end--------------->8---


:-)  That definitely looks like a typo, but is is not.  Try to apply  
you patch and then look at the docstring using C-h v    :-)

\\[ .... ]  is treated special in docstrings.

If you find a way to do this without breaking the docstring, I'd love  
to hear about it.

- Carsten

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

end of thread, other threads:[~2010-03-15 17:51 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2010-03-14  1:16 :scale option in org-format-latex-options Dan Davison
2010-03-14  7:54 ` David Maus
2010-03-14 13:02   ` Carsten Dominik
2010-03-14 16:16     ` Dan Davison
2010-03-15 15:35       ` Carsten Dominik

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