* Xemacs: org-preview-latex-fragment, png not readable.
@ 2012-01-28 20:20 Uwe Brauer
2012-01-28 20:59 ` Solved (was: Xemacs: org-preview-latex-fragment, png not readable.) Uwe Brauer
0 siblings, 1 reply; 8+ messages in thread
From: Uwe Brauer @ 2012-01-28 20:20 UTC (permalink / raw
To: emacs-orgmode
[-- Attachment #1: Type: text/plain, Size: 1254 bytes --]
Hello
I made some progress in getting the function to work in
Xemacs.
The main problem seemed to be the function
org-dvipng-color which is called in
org-create-formula-image.
The original formulation was
(defun org-dvipng-color (attr)
"Return an rgb color specification for dvipng."
(apply 'format "rgb %s %s %s"
(mapcar 'org-normalize-color
(color-values (face-attribute 'default attr
nil)))))
Which does not work for Xemacs. Thanks to Julian Bradfield,
the solution seems to be:
(defun org-dvipng-color (attr)
"Return an rgb color specification for dvipng."
(apply 'format "rgb %s %s %s"
(mapcar 'org-normalize-color
(color-rgb-components
(face-property 'default (intern (substring (symbol-name attr) 1)))))))
However the png which were generated where to small to be
readable. I attach one at the end of the message.
So I tried out in GNU Emacs 21.3 to comment out
org-dvipng-color in org-create-formula-image.
org-preview-latex-fragment then still works, so is not
necessary for generating the pngs.
So I tried to do the same in Xemacs but the formulas in the
png files keep being too small.
What could be the reason for this behavior?
Uwe Brauer
The following attachment should be an integral.
Xemacs:
[-- Attachment #2: test3_7801a85c58c7aabc4553724e826b458ba08dda90.png --]
[-- Type: image/png, Size: 96 bytes --]
[-- Attachment #3: Type: text/plain, Size: 12 bytes --]
Gnu Emacs
[-- Attachment #4: test_7ceb32811fbcd1322f595ca60dcc47456c20b5fe.png --]
[-- Type: image/png, Size: 268 bytes --]
^ permalink raw reply [flat|nested] 8+ messages in thread
* Solved (was: Xemacs: org-preview-latex-fragment, png not readable.)
2012-01-28 20:20 Xemacs: org-preview-latex-fragment, png not readable Uwe Brauer
@ 2012-01-28 20:59 ` Uwe Brauer
2012-01-28 22:33 ` Solved Bastien
0 siblings, 1 reply; 8+ messages in thread
From: Uwe Brauer @ 2012-01-28 20:59 UTC (permalink / raw
To: emacs-orgmode; +Cc: XEmacs Beta Discussion
>> On Sat, 28 Jan 2012 21:20:48 +0100, Uwe Brauer <oub@mat.ucm.es> wrote:
> Which does not work for Xemacs. Thanks to Julian Bradfield,
> the solution seems to be:
> (defun org-dvipng-color (attr)
> "Return an rgb color specification for dvipng."
> (apply 'format "rgb %s %s %s"
> (mapcar 'org-normalize-color
> (color-rgb-components
> (face-property 'default (intern (substring (symbol-name attr) 1)))))))
> However the png which were generated where to small to be
> readable. I attach one at the end of the message.
The issue are the options
in
call-process "dvipng" nil nil nil
After trying out different configurations, I found out that
the option
"-D" dpi
Does not work well with Xemacs.
So
(call-process "dvipng" nil nil nil
"-fg" fg "-bg" bg
;; "-D" dpi
;; "-x" scale "-y" scale
"-T" "tight"
"-o" pngfile
dvifile)
is ok, however the back and foreground setting as generated
by org-dvipng-color, even with Julian Bradfield's patch do
not produce very nice results. In my Xemacs setting it is better to
comment them out.
So there are two small changes necessary to make
org-preview-latex-fragment work in Xemacs. One is the above
change, the other
(font-height (face-font 'default))
instead of
(font-height (get-face-font 'default))
I can send a patch against 7.8.03
Uwe Brauer
^ permalink raw reply [flat|nested] 8+ messages in thread
* Re: Solved
2012-01-28 20:59 ` Solved (was: Xemacs: org-preview-latex-fragment, png not readable.) Uwe Brauer
@ 2012-01-28 22:33 ` Bastien
2012-01-29 0:13 ` Solved Nick Dokos
2012-01-31 18:09 ` patch " Uwe Brauer
0 siblings, 2 replies; 8+ messages in thread
From: Bastien @ 2012-01-28 22:33 UTC (permalink / raw
To: Uwe Brauer; +Cc: emacs-orgmode, XEmacs Beta Discussion
Hi Uwe,
Uwe Brauer <oub@mat.ucm.es> writes:
> So there are two small changes necessary to make
> org-preview-latex-fragment work in Xemacs. One is the above
> change, the other
>
>
> (font-height (face-font 'default))
> instead of
> (font-height (get-face-font 'default))
>
> I can send a patch against 7.8.03
Please do so -- but please make sure the patch adapts current code
to XEmacs without suppressing any feature for GNU Emacs.
Thanks in advance!
--
Bastien
^ permalink raw reply [flat|nested] 8+ messages in thread
* Re: Solved
2012-01-28 22:33 ` Solved Bastien
@ 2012-01-29 0:13 ` Nick Dokos
2012-01-29 14:57 ` change call-process also for GNU emacs? (was: Solved) Uwe Brauer
2012-01-31 18:09 ` patch " Uwe Brauer
1 sibling, 1 reply; 8+ messages in thread
From: Nick Dokos @ 2012-01-29 0:13 UTC (permalink / raw
To: Bastien; +Cc: Uwe Brauer, nicholas.dokos, emacs-orgmode, XEmacs Beta Discussion
Bastien <bzg@altern.org> wrote:
> Hi Uwe,
>
> Uwe Brauer <oub@mat.ucm.es> writes:
>
> > So there are two small changes necessary to make
> > org-preview-latex-fragment work in Xemacs. One is the above
> > change, the other
> >
> >
> > (font-height (face-font 'default))
> > instead of
> > (font-height (get-face-font 'default))
> >
> > I can send a patch against 7.8.03
>
> Please do so -- but please make sure the patch adapts current code
> to XEmacs without suppressing any feature for GNU Emacs.
>
> Thanks in advance!
>
... and bonus points if you also fix the problems described in
http://thread.gmane.org/gmane.emacs.orgmode/50584
:-)
Nick
^ permalink raw reply [flat|nested] 8+ messages in thread
* change call-process also for GNU emacs? (was: Solved)
2012-01-29 0:13 ` Solved Nick Dokos
@ 2012-01-29 14:57 ` Uwe Brauer
2012-01-29 17:42 ` Nick Dokos
0 siblings, 1 reply; 8+ messages in thread
From: Uwe Brauer @ 2012-01-29 14:57 UTC (permalink / raw
To: emacs-orgmode; +Cc: xemacs-beta
>> On Sat, 28 Jan 2012 19:13:57 -0500, Nick Dokos
>> <nicholas.dokos@hp.com> wrote:
>>
> ... and bonus points if you also fix the problems described in
Now I am confused, from the link, you provided, I conclude
you are talking about GNU Emacs, however I only wanted my changes to
work with Xemacs and therefore wrap a
(if (featurep 'xemacs)
Around my changes. If you want to have the changes I have in
mind for call-process also for GNU Emacs, I think the
maintainers should have a say.
Uwe Brauer
^ permalink raw reply [flat|nested] 8+ messages in thread
* Re: change call-process also for GNU emacs? (was: Solved)
2012-01-29 14:57 ` change call-process also for GNU emacs? (was: Solved) Uwe Brauer
@ 2012-01-29 17:42 ` Nick Dokos
0 siblings, 0 replies; 8+ messages in thread
From: Nick Dokos @ 2012-01-29 17:42 UTC (permalink / raw
To: Uwe Brauer; +Cc: nicholas.dokos, emacs-orgmode, xemacs-beta
Uwe Brauer <oub@mat.ucm.es> wrote:
> >> On Sat, 28 Jan 2012 19:13:57 -0500, Nick Dokos
> >> <nicholas.dokos@hp.com> wrote:
>
> >>
>
> > ... and bonus points if you also fix the problems described in
>
> Now I am confused, from the link, you provided, I conclude
> you are talking about GNU Emacs, however I only wanted my changes to
> work with Xemacs and therefore wrap a
>
> (if (featurep 'xemacs)
>
> Around my changes. If you want to have the changes I have in
> mind for call-process also for GNU Emacs, I think the
> maintainers should have a say.
>
Actually, it might very well be that they are Xemacs problems as well,
but you are right: I meant that since you'd be visiting the area, I
might convince you to do some additional work and fix those bugs as
well.
Nick
^ permalink raw reply [flat|nested] 8+ messages in thread
* patch (was: Solved)
2012-01-28 22:33 ` Solved Bastien
2012-01-29 0:13 ` Solved Nick Dokos
@ 2012-01-31 18:09 ` Uwe Brauer
2012-03-16 17:57 ` patch Bastien
1 sibling, 1 reply; 8+ messages in thread
From: Uwe Brauer @ 2012-01-31 18:09 UTC (permalink / raw
To: Bastien; +Cc: emacs-orgmode
[-- Attachment #1: Type: text/plain, Size: 211 bytes --]
>> On Sat, 28 Jan 2012 23:33:24 +0100, Bastien <bzg@altern.org> wrote:
Hi Bastien,
Here comes the patch (I tested it with Xemacs 21.5 and GNU
emacs 23.1); I used the
diff -u option and hope this is ok.
Uwe
[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #2: org.patch --]
[-- Type: text/x-diff, Size: 3037 bytes --]
--- org-old.el 2012-01-31 18:37:53.000000000 +0100
+++ org.el 2012-01-31 19:01:19.667099891 +0100
@@ -1,4 +1,4 @@
-;;; org-old.el --- Outline-based notes management and organizer
+;;; org.el --- Outline-based notes management and organizer
;; Carstens outline-mode for keeping track of everything.
;; Copyright (C) 2004-2011 Free Software Foundation, Inc.
;;
@@ -16966,7 +16966,7 @@
(dvifile (concat texfilebase ".dvi"))
(pngfile (concat texfilebase ".png"))
(fnh (if (featurep 'xemacs)
- (font-height (get-face-font 'default))
+ (font-height (face-font 'default))
(face-attribute 'default :height nil)))
(scale (or (plist-get options (if buffer :scale :html-scale)) 1.0))
(dpi (number-to-string (* scale (floor (* 0.9 (if buffer fnh 140.))))))
@@ -16995,24 +16995,32 @@
(if (not (file-exists-p dvifile))
(progn (message "Failed to create dvi file from %s" texfile) nil)
(condition-case nil
- (call-process "dvipng" nil nil nil
- "-fg" fg "-bg" bg
- "-D" dpi
- ;;"-x" scale "-y" scale
- "-T" "tight"
- "-o" pngfile
- dvifile)
- (error nil))
- (if (not (file-exists-p pngfile))
- (if org-format-latex-signal-error
- (error "Failed to create png file from %s" texfile)
- (message "Failed to create png file from %s" texfile)
- nil)
- ;; Use the requested file name and clean up
- (copy-file pngfile tofile 'replace)
- (loop for e in '(".dvi" ".tex" ".aux" ".log" ".png") do
- (delete-file (concat texfilebase e)))
- pngfile))))
+ (if (featurep 'xemacs)
+ (call-process "dvipng" nil nil nil
+ "-fg" fg "-bg" bg
+;; "-D" dpi
+;; "-x" scale "-y" scale
+ "-T" "tight"
+ "-o" pngfile
+ dvifile)
+ (call-process "dvipng" nil nil nil
+ "-fg" fg "-bg" bg
+ "-D" dpi
+ ;;"-x" scale "-y" scale
+ "-T" "tight"
+ "-o" pngfile
+ dvifile))
+ (error nil))
+ (if (not (file-exists-p pngfile))
+ (if org-format-latex-signal-error
+ (error "Failed to create png file from %s" texfile)
+ (message "Failed to create png file from %s" texfile)
+ nil)
+ ;; Use the requested file name and clean up
+ (copy-file pngfile tofile 'replace)
+ (loop for e in '(".dvi" ".tex" ".aux" ".log" ".png") do
+ (delete-file (concat texfilebase e)))
+ pngfile))))
(defun org-splice-latex-header (tpl def-pkg pkg snippets-p &optional extra)
"Fill a LaTeX header template TPL.
@@ -17077,7 +17085,12 @@
"Return an rgb color specification for dvipng."
(apply 'format "rgb %s %s %s"
(mapcar 'org-normalize-color
- (color-values (face-attribute 'default attr nil)))))
+ (if (featurep 'xemacs)
+ (color-rgb-components
+ (face-property 'default (cond
+ ((eq attr :foreground) 'foreground)
+ ((eq attr :background) 'background))))
+ (color-values (face-attribute 'default attr nil))))))
(defun org-normalize-color (value)
"Return string to be used as color value for an RGB component."
^ permalink raw reply [flat|nested] 8+ messages in thread
* Re: patch
2012-01-31 18:09 ` patch " Uwe Brauer
@ 2012-03-16 17:57 ` Bastien
0 siblings, 0 replies; 8+ messages in thread
From: Bastien @ 2012-03-16 17:57 UTC (permalink / raw
To: Uwe Brauer; +Cc: emacs-orgmode
Hi Uwe,
Uwe Brauer <oub@mat.ucm.es> writes:
> Here comes the patch (I tested it with Xemacs 21.5 and GNU
> emacs 23.1); I used the
> diff -u option and hope this is ok.
Applied, thanks for the patch.
--
Bastien
^ permalink raw reply [flat|nested] 8+ messages in thread
end of thread, other threads:[~2012-03-16 18:41 UTC | newest]
Thread overview: 8+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2012-01-28 20:20 Xemacs: org-preview-latex-fragment, png not readable Uwe Brauer
2012-01-28 20:59 ` Solved (was: Xemacs: org-preview-latex-fragment, png not readable.) Uwe Brauer
2012-01-28 22:33 ` Solved Bastien
2012-01-29 0:13 ` Solved Nick Dokos
2012-01-29 14:57 ` change call-process also for GNU emacs? (was: Solved) Uwe Brauer
2012-01-29 17:42 ` Nick Dokos
2012-01-31 18:09 ` patch " Uwe Brauer
2012-03-16 17:57 ` patch Bastien
Code repositories for project(s) associated with this external index
https://git.savannah.gnu.org/cgit/emacs.git
https://git.savannah.gnu.org/cgit/emacs/org-mode.git
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.