From mboxrd@z Thu Jan 1 00:00:00 1970 From: Nick Dokos Subject: Re: configure latex fragments preview Date: Mon, 14 Sep 2009 15:39:11 -0400 Message-ID: <9856.1252957151@alphaville.usa.hp.com> References: <87d45tbeng.fsf@gmail.com> Reply-To: nicholas.dokos@hp.com Mime-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: quoted-printable Return-path: Received: from mailman by lists.gnu.org with tmda-scanned (Exim 4.43) id 1MnHPb-00089p-6q for emacs-orgmode@gnu.org; Mon, 14 Sep 2009 15:40:31 -0400 Received: from exim by lists.gnu.org with spam-scanned (Exim 4.43) id 1MnHPW-00082i-DO for emacs-orgmode@gnu.org; Mon, 14 Sep 2009 15:40:30 -0400 Received: from [199.232.76.173] (port=36699 helo=monty-python.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1MnHPW-00082Y-7B for emacs-orgmode@gnu.org; Mon, 14 Sep 2009 15:40:26 -0400 Received: from g4t0015.houston.hp.com ([15.201.24.18]:47628) by monty-python.gnu.org with esmtps (TLS-1.0:DHE_RSA_AES_256_CBC_SHA1:32) (Exim 4.60) (envelope-from ) id 1MnHPV-0007lN-La for emacs-orgmode@gnu.org; Mon, 14 Sep 2009 15:40:26 -0400 Received: from smtp1.fc.hp.com (smtp.fc.hp.com [15.15.136.127]) by g4t0015.houston.hp.com (Postfix) with ESMTP id 799578CBA for ; Mon, 14 Sep 2009 19:38:54 +0000 (UTC) In-Reply-To: Message from Nicolas Goaziou of "Mon\, 14 Sep 2009 19\:49\:07 +0200." <87d45tbeng.fsf@gmail.com> List-Id: "General discussions about Org-mode." List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: emacs-orgmode-bounces+geo-emacs-orgmode=m.gmane.org@gnu.org Errors-To: emacs-orgmode-bounces+geo-emacs-orgmode=m.gmane.org@gnu.org To: Org-mode list Nicolas Goaziou wrote: > This is some minor annoyance, but I would like to find a solution for it > anyway. >=20 > 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. >=20 > In order to solve that situation, I modified org-format-latex-header so > that the template for the preview starts with > \documentclass[17pt]{extarticle}. >=20 > 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 ? >=20 > And if it doesn't exist, could a variable be introduced to fine-tune it ? >=20 > 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. >=20 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 magni= fication specified in the | DVI file. Must be between 10 and 100000. It is recommended t= hat you use standard mag=E2=80=90 | 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=20 | (:foreground default :background default :scale 1.0 :html-foreground "Bla= ck" :html-background "Transparent" :html-scale 1.0 :matchers | ("begin" "$1" "$" "$$" "\\(" "\\[")) |=20 |=20 | 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. "Bla= ck". | `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 \ [...\] |=20 | You can customize this variable. `---- HTH, Nick