emacs-orgmode@gnu.org archives
 help / color / mirror / code / Atom feed
* Resolution of LaTeX fragments
@ 2006-09-01 21:50 Daniel J. Sinder
  2006-09-02  5:26 ` Carsten Dominik
  0 siblings, 1 reply; 2+ messages in thread
From: Daniel J. Sinder @ 2006-09-01 21:50 UTC (permalink / raw)
  To: emacs-orgmode

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

I've encountered a problem with LaTeX fragments: the default
resolution that dvipng produces results in text (in the images)
which is too small. Of course, browsers (eg, firefox) can manipulate
font size from the client side, but that doesn't affect images (and
changing the relative size of the two). Monitor resolution is also a
factor. Uugh. I guess mixing text with images containing text is not
really ideal, but I'll put that aside for now.

I don't have a great solution for this, but I needed something to
make it usable. I've added a little hack that creates a variable,
org-export-LaTeX-fragments-resolution, that is used in the call to
dvipng. I've found that a setting of 150 is much easier on my eyes
than the default (which I've estimated to be ~86). I added something
to org-export-plist-vars for publishing too, but that doesn't seem
to work -- not sure why (I'm new to Elisp).

The patch is attached in case anyone else was looking for a fix for
this.

Dan



[-- Attachment #2: org-dvipng-resolution.patch --]
[-- Type: text/plain, Size: 1315 bytes --]

--- org-orig.el	2006-09-01 14:36:16.000000000 -0700
+++ org.el	2006-09-01 13:38:30.000000000 -0700
@@ -1985,6 +1985,12 @@
   :group 'org-latex
   :type 'boolean)
 
+(defcustom org-export-LaTeX-fragments-resolution 86
+  "Output resolution of images created by conversion of LaTeX fragments when exporting to HTML."
+  :group 'org-export-translation
+  :group 'org-latex
+  :type 'integer)
+
 (defcustom org-export-with-fixed-width t
   "Non-nil means, lines starting with \":\" will be in fixed width font.
 This can be used to have pre-formatted text, fragments of code etc.  For
@@ -13110,6 +13116,7 @@
     (:sub-superscript      . org-export-with-sub-superscripts)
     (:TeX-macros           . org-export-with-TeX-macros)
     (:LaTeX-fragments      . org-export-with-LaTeX-fragments)
+    (:LaTeX-resolution     . org-export-LaTeX-fragments-resolution)
     (:fixed-width          . org-export-with-fixed-width)
     (:timestamps           . org-export-with-timestamps)
     (:tables               . org-export-with-tables)
@@ -15532,6 +15539,7 @@
       (call-process "dvipng" nil nil nil
 		    "-E" "-fg" fg "-bg" bg
 		    "-x" scale "-y" scale "-T" "tight"
+		    "-D" (number-to-string org-export-LaTeX-fragments-resolution)
 		    "-o" pngfile
 		    dvifile)
       (if (not (file-exists-p pngfile))


[-- Attachment #3: Type: text/plain, Size: 149 bytes --]

_______________________________________________
Emacs-orgmode mailing list
Emacs-orgmode@gnu.org
http://lists.gnu.org/mailman/listinfo/emacs-orgmode

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

* Re: Resolution of LaTeX fragments
  2006-09-01 21:50 Resolution of LaTeX fragments Daniel J. Sinder
@ 2006-09-02  5:26 ` Carsten Dominik
  0 siblings, 0 replies; 2+ messages in thread
From: Carsten Dominik @ 2006-09-02  5:26 UTC (permalink / raw)
  To: Daniel J. Sinder; +Cc: emacs-orgmode

Hi Daniel,

thanks for your patch, and for looking into this.

There is already a parameter in org-mode to change the size of the 
images: the variable org-format-latex-options contains several 
parameters for creating the LaTeX images, and one of them is `:scale' - 
the default is 1.0, but you can set it to 1.5 or 2.0 to increase the 
the size.

Having said that, maybe it is a good idea to allow changing the 
resolution - but the main purpose of this parameter would be to improve 
the *quality* when printing.

- Carsten

On Sep 1, 2006, at 23:50, Daniel J. Sinder wrote:

> I've encountered a problem with LaTeX fragments: the default
> resolution that dvipng produces results in text (in the images)
> which is too small. Of course, browsers (eg, firefox) can manipulate
> font size from the client side, but that doesn't affect images (and
> changing the relative size of the two). Monitor resolution is also a
> factor. Uugh. I guess mixing text with images containing text is not
> really ideal, but I'll put that aside for now.
>
> I don't have a great solution for this, but I needed something to
> make it usable. I've added a little hack that creates a variable,
> org-export-LaTeX-fragments-resolution, that is used in the call to
> dvipng. I've found that a setting of 150 is much easier on my eyes
> than the default (which I've estimated to be ~86). I added something
> to org-export-plist-vars for publishing too, but that doesn't seem
> to work -- not sure why (I'm new to Elisp).
>
> The patch is attached in case anyone else was looking for a fix for
> this.
>
> Dan
>
>
> --- org-orig.el	2006-09-01 14:36:16.000000000 -0700
> +++ org.el	2006-09-01 13:38:30.000000000 -0700
> @@ -1985,6 +1985,12 @@
>    :group 'org-latex
>    :type 'boolean)
>
> +(defcustom org-export-LaTeX-fragments-resolution 86
> +  "Output resolution of images created by conversion of LaTeX 
> fragments when exporting to HTML."
> +  :group 'org-export-translation
> +  :group 'org-latex
> +  :type 'integer)
> +
>  (defcustom org-export-with-fixed-width t
>    "Non-nil means, lines starting with \":\" will be in fixed width 
> font.
>  This can be used to have pre-formatted text, fragments of code etc.  
> For
> @@ -13110,6 +13116,7 @@
>      (:sub-superscript      . org-export-with-sub-superscripts)
>      (:TeX-macros           . org-export-with-TeX-macros)
>      (:LaTeX-fragments      . org-export-with-LaTeX-fragments)
> +    (:LaTeX-resolution     . org-export-LaTeX-fragments-resolution)
>      (:fixed-width          . org-export-with-fixed-width)
>      (:timestamps           . org-export-with-timestamps)
>      (:tables               . org-export-with-tables)
> @@ -15532,6 +15539,7 @@
>        (call-process "dvipng" nil nil nil
>  		    "-E" "-fg" fg "-bg" bg
>  		    "-x" scale "-y" scale "-T" "tight"
> +		    "-D" (number-to-string org-export-LaTeX-fragments-resolution)
>  		    "-o" pngfile
>  		    dvifile)
>        (if (not (file-exists-p pngfile))
>
> _______________________________________________
> Emacs-orgmode mailing list
> Emacs-orgmode@gnu.org
> http://lists.gnu.org/mailman/listinfo/emacs-orgmode
>

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

end of thread, other threads:[~2006-09-02  5:26 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2006-09-01 21:50 Resolution of LaTeX fragments Daniel J. Sinder
2006-09-02  5:26 ` 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).