[O] [PATCH] Let radio target works well with Chinese

2019-02-24 Thread Feng Shu
>From bbf085c61f8b7e9b80077b401cd275b420b4ddca Mon Sep 17 00:00:00 2001
From: Feng Shu 
Date: Sun, 24 Feb 2019 17:52:51 +0800
Subject: [PATCH] Let radio target works well with Chinese
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit

* lisp/org.el (org-update-radio-target-regexp): Let radio target works well with Chinese.

There is no need to force split words with the help
of space for Chinese, this change let the below
example works well.

<<<天空>>>

我爱天空和大地

---
 lisp/org.el | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/lisp/org.el b/lisp/org.el
index 9f33c9e60..ea68aacfc 100644
--- a/lisp/org.el
+++ b/lisp/org.el
@@ -6052,8 +6052,8 @@ by a #."
 Also refresh fontification if needed."
   (interactive)
   (let ((old-regexp org-target-link-regexp)
-	(before-re "\\(?:^\\|[^[:alnum:]]\\)\\(")
-	(after-re "\\)\\(?:$\\|[^[:alnum:]]\\)")
+	(before-re "\\(?:^\\|[^[:alnum:]]\\|\\cc\\)\\(")
+	(after-re "\\)\\(?:$\\|[^[:alnum:]]\\|\\cc\\)")
 	(targets
 	 (org-with-wide-buffer
 	  (goto-char (point-min))
-- 
2.20.1



-- 


Re: [O] FW: [RFC] Link-type for attachments, more attach options

2019-01-04 Thread Feng Shu
Gustav Wikström  writes:


I like this feature very much!




> Hi,
>
>  
>
> I’ve attached a patch with some suggested additions to org-attach. Patch 
> comments below. Please review.
>
>  
>
> Kind regards
>
> Gustav
>
> ___
>
> Patch comments:
>
> * Add new linktype "attached" for attachments
>
>  
>
> A new linktype "attached" is added in order to reduce link-duplication
>
> when wanting to link to files in attached folders of nodes. This works
>
> for both ID-based attachments and ATTACH_DIR.  Inline images will
>
> trigger also for attachments, as well as search-decorations in the
>
> links.  The goal is to make the functionality for attached-links
>
> mirror file-links.
>
>  
>
> * Add further options for ATTACH_DIR
>
>  
>
> When working with ATTACH_DIR there are now a couple of new options available:
>
> - org-attach-dir-inherit-by-default
>
> - org-attach-dir-create-if-not-exist
>
> - org-attach-dir-relative
>
>  
>
> Descriptions of them can be found in the commit for each new customization.
>
>  
>
> * Documentation in org-manual
>
>  
>
> Org-manual is updated with the new link-type as well as some minor
>
> cleanup in the documentation related to external links and attachments.
>

-- 




[O] [PATCH] Fix type error in `org-preview-latex-process-alist' doc

2016-05-24 Thread Feng Shu
>From 3e5f7bf6e80d8e662b428f622de498047aa02790 Mon Sep 17 00:00:00 2001
From: Feng Shu 
Date: Tue, 24 May 2016 21:26:31 +0800
Subject: [PATCH] Fix type error in `org-preview-latex-process-alist' doc

* org.el (org-preview-latex-process-alist): Fix type error in `org-preview-latex-process-alist' doc
---
 lisp/org.el | 8 
 1 file changed, 4 insertions(+), 4 deletions(-)

diff --git a/lisp/org.el b/lisp/org.el
index 83ac51c..691fa57 100644
--- a/lisp/org.el
+++ b/lisp/org.el
@@ -4008,7 +4008,7 @@ All available processes and theirs documents can be found in
   '((dvipng
  :programs ("latex" "dvipng" "gs")
  :description "dvi > png"
- :message "you need to install programs: latex, dvipng and ghostscript."
+ :message "you need to install the programs: latex, dvipng and ghostscript."
  :image-input-type "dvi"
  :image-output-type "png"
  :image-size-adjust (1.0 . 1.0)
@@ -4017,7 +4017,7 @@ All available processes and theirs documents can be found in
 (dvisvgm
  :programs ("latex" "dvisvgm" "gs")
  :description "dvi > svg"
- :message "you need to install programs: latex, dvisvgm and ghostscript."
+ :message "you need to install the programs: latex, dvisvgm and ghostscript."
  :use-xcolor t
  :image-input-type "dvi"
  :image-output-type "svg"
@@ -4028,7 +4028,7 @@ All available processes and theirs documents can be found in
  :programs ("latex" "convert" "gs")
  :description "pdf > png"
  :message
- "you need to install programs: latex, imagemagick and ghostscript."
+ "you need to install the programs: latex, imagemagick and ghostscript."
  :use-xcolor t
  :image-input-type "pdf"
  :image-output-type "png"
@@ -4078,7 +4078,7 @@ PROPERTIES accepts the following attributes:
 
 Place-holders used by `:image-converter' and `:latex-compiler':
 
-  %iinput file name.
+  %finput file name.
   %bbase name of input file.
   %obase directory of input file.
 
-- 
2.1.4



-- 


[O] [PATCH] Latex Previewing process: imagemagick use pdflatex by default

2016-05-23 Thread Feng Shu
>From 2cce55f48773f05f1aaeed31be8a53e3f59af312 Mon Sep 17 00:00:00 2001
From: Feng Shu 
Date: Tue, 24 May 2016 12:06:41 +0800
Subject: [PATCH] Latex Previewing process: imagemagick use pdflatex by default

* org.el (org-preview-latex-process-alist):
---
 lisp/org.el | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/lisp/org.el b/lisp/org.el
index 83ac51c..8056016 100644
--- a/lisp/org.el
+++ b/lisp/org.el
@@ -4033,9 +4033,9 @@ All available processes and theirs documents can be found in
  :image-input-type "pdf"
  :image-output-type "png"
  :image-size-adjust (1.0 . 1.0)
- :latex-compiler ("latex -interaction nonstopmode -output-directory %o %f")
+ :latex-compiler ("pdflatex -interaction nonstopmode -output-directory %o %f")
  :image-converter
- ("convert -density %S -trim -antialias %f -quality 100 %b.png")))
+ ("convert -density %D -trim -antialias %f -quality 100 %b.png")))
   "Definitions of external processes for LaTeX previewing.
 Org mode can use some external commands to generate TeX snippet's images for
 previewing or inserting into HTML files, e.g., \"dvipng\".  This variable tells
-- 
2.1.4


-- 


Re: [O] Some thought about `org-latex-pdf-process-alist', was Re: (V9) [PATCH] New feature: Use dvisvgm to preview latex formular

2016-05-22 Thread Feng Shu


> This is mixing together org-latex-packages-alist, org-latex-pdf-process
> and org-latex-document-class, org-latex-default-class,
> org-koma-letter-default-class etc, and latexmk/carara into one (modulus
> typos).  IMO, it introduces too much dependency and convolution.  Take
> :valid-class; When I add a new class CLASS, I need to add it to the
> correct entries in org-latex-pdf-process-alist.  You ask me to form a
> joint opinion about too many things at once.

Yes, I think: compile + class + packages = process, if I don't joint
them to a profile setting, it is impossible to swith process easily.


If you know the default class and packages setting is suitable for your
process, just ignore :default-class :valid-classes :packages-alist
:default-packages-alist and :packages-override, the four options are
used by user special processes.


> equivalent should be used.  I don’t care about the process.  I care about
> the final document and its correctness.

because latex system can deal with English very well by default, so you
can "don't care about the process", if I don't care about the process,
"the final document and its correctness" is just a dream. :-)


> This is the nature of LaTeX.  The packages that Org selects by default do
> not conflict with each other.

packages selected by org may conflict with user's latex package, so user
should edit `org-latex-default-packages-alist' by hand.

>
>> 2. I don't want every users have to write latex-header in every org-file
>> and I like: install ox-latex-chinese and
>>
>>(setq org-latex-default-pdf-process "cn/xelatex-xelatex-xelatex")
>>
>> every org-file can export to pdf.
>
> I strongly disagree with this vision.
>
> This should be possible with org-latex-classes without limiting the
> flexibility of ox-latex.  Also, we already have a way of solving this
> use-case, namely org-export-define-derived-backend`.

`org-export-define-derived-backend' seem to be overkill for this situation.

> LaTeX success rests in its flexibility, so this critique is misfounded
> IMO.  The success of ox-latex is that it’s flexible enough to satisfy even
> power users’ use-cases, making it an uncompromizing alternative to plain
> LaTeX.

power users can do "anything" in org-mode, even rewrite ox-latex, my
question is that: is it flexible enough to let some power users to well
maintain some predefined configures which can make many beginning user's
install and config easily?

-- 




Re: [O] Some thought about `org-latex-pdf-process-alist', was Re: (V9) [PATCH] New feature: Use dvisvgm to preview latex formular

2016-05-21 Thread Feng Shu

> It is different, 3 runs of latex as example:
>
> if we don't deal with %latex place-hold in process commands,
> #+latex_compiler is useless, we need to define pdf process
> in org-latex-pdf-process-alist, 
>
>"pdflatex-pdflatex-pdflatex" "xelatex-xelatex-xelatex" 
> "lualatex-lualatex-lualatex"
>  
> otherwise, we can use #+latex_compile and define pdf process
>
>"latex-latex-latex"

By the way, I don't like the #+latex_compile approach, In my opinion, it seem 
to be a
hack. For user, ox-latex provide too much configure options.

Maybe someone says, it is stupid duplicate code:

#+BEGIN_COMMENT
pdflatex-pdflatex-pdflatex
pdflatex-pdflatex-pdflatex
pdflatex-bibtex-pdflatex-pdflatex
xelatex-xelatex-pdflatex
xelatex-xelatex-pdflatex
xelatex-bibtex-xelatex-xelatex
luatex-luatex-lualatex
luatex-luatex-lualatex
luatex-bibtex-luatex-lualatex
#+END_COMMENT

but I think, it is a right approach, we must know, we have org contrib
package, and we have other personnel org extension package, we don't
need put all the process setting to ox-latex.el, we just add the
following three as defaults and examples.

#+BEGIN_COMMENT
pdflatex-pdflatex-pdflatex
pdflatex-pdflatex-pdflatex
pdflatex-bibtex-pdflatex-pdflatex
#+END_SRC

ox-latex-process:xelatex package can be provided in elpa or melpa,
if some need xelatex process setting, just install it.

Users can develop and share their own special processes with the
help of emacs package.





[O] Some thought about `org-latex-pdf-process-alist', was Re: (V9) [PATCH] New feature: Use dvisvgm to preview latex formular

2016-05-21 Thread Feng Shu


> Hi Feng,
>
> Thanks for the patches. 
>
> "Feng Shu"  writes:
>
>> 1. org-latex-pdf-process -> org-latex-pdf-default-process
>> 2. Add new variable org-latex-pdf-process-alist
>
> What do you have in mind?  I assume it’s something more than just ripping
> out the :type part of org-latex-pdf-process.
>

Similar, but include more information, maybe it it like:

#+BEGIN_SRC emacs-lisp
(setq org-latex-pdf-process-alist
  '(("pdflatex-pdflatex-pdflatex"
 :commands ("pdflatex -interaction nonstopmode -output-directory %o %f"
"pdflatex -interaction nonstopmode -output-directory %o %f"
"pdflatex -interaction nonstopmode -output-directory %o %f")

 ;; A string in `:valid-classes',
 ;; when nil, fallback to `org-latex-default-class'
 :default-class "article"
 
 ;; class-settings which works well with the process,
 ;; they must be defined `org-latex-classes'.
 ;; when nil, all class-settings defined `org-latex-classes'
 ;; are valid.
 :valid-classes ("article" "beamer" "report" "book")

 ;; the process's default packages, when nil
 ;; fallback to `org-latex-default-packages-alist'
 :default-packages-alist nil

 ;; the process's packages, when nil
 ;; fallback to `org-latex-packages-alist'
 :packages-alist nil
 :packages-override nil)))
#+END_SRC

>> 3. Add #+LATEX_PDF_PROCESS setting
>
> Is this the same as #+latex_compiler, which is used for setting the
> process to pdflatex, xelatex or lualatex?

It is different, 3 runs of latex as example:

if we don't deal with %latex place-hold in process commands,
#+latex_compiler is useless, we need to define pdf process
in org-latex-pdf-process-alist, 

   "pdflatex-pdflatex-pdflatex" "xelatex-xelatex-xelatex" 
"lualatex-lualatex-lualatex"
 
otherwise, we can use #+latex_compile and define pdf process

   "latex-latex-latex"


>
>> I am a member of emacs community in chinese, many org-mode latex
>> beginners will ask me: "How to export org to pdf by latex?",
>> this problem is annoying, so i deside to write a package:
>> ox-latex-chinese and tell them: "Install org-latex-chinese package!"
>
> It sounds like #+language support should be extended.  A basic Chinese
> document with org doesn’t seem that hard.  With ttf-hannom, all I need is
> this:
>
> #+latex_compiler: xelatex
> #+latex_header: \usepackage{xeCJK}
> #+latex_header: \setCJKmainfont{HAN NOM A}
> 文章内容
>
Reason:
1. Not so simple, we often need to edit `org-latex-classes'
   `org-latex-default-packages-alist' and `org-latex-package-alist'
   for many reason, for example: macro conflict

2. I don't want every users have to write latex-header in every org-file
and I like: install ox-latex-chinese and

   (setq org-latex-default-pdf-process "cn/xelatex-xelatex-xelatex")

every org-file can export to pdf.

> Rasmus

-- 


-- 




Re: [O] (V9) [PATCH] New feature: Use dvisvgm to preview latex formular

2016-05-21 Thread Feng Shu
Nicolas Goaziou  writes:

> Hello,
>
> "Feng Shu"  writes:
>
>> From e18b7a4430ff90d6bcb828e3898ef25c61aba4bd Mon Sep 17 00:00:00 2001
>> From: Feng Shu 
>> Date: Tue, 17 May 2016 21:24:35 +0800
>> Subject: [PATCH] New feature: Use dvisvgm to preview latex formular
>
> It looks good. I applied it with minor tweak to docstrings. I also made
> use of `org-preview-latex-default-process', which was defined but not
> used in the patch.
>
> Thank you for all this work.

Thank you for you help too :-)

The next work i want to do is:

1. org-latex-pdf-process -> org-latex-pdf-default-process
2. Add new variable org-latex-pdf-process-alist
3. Add #+LATEX_PDF_PROCESS setting


I am a member of emacs community in chinese, many org-mode latex
beginners will ask me: "How to export org to pdf by latex?",
this problem is annoying, so i deside to write a package:
ox-latex-chinese and tell them: "Install org-latex-chinese package!"

But, it is a diffcult work to convert my own org latex configure
to a well organized emacs package, setq nightmare!.

The above suggestion is a try to solve this problem.

Any suggestion? if you agree, i will code the patch.

>
> BTW, could you provide an entry for ORG-NEWS about it? User visible
> changes are variables being renamed an, obviously, the new feature.

I can write an entry, but for my poor English, reviewing it may need
more time than writing a new, :-)

>
> Regards,

-- 




Re: [O] (V9) [PATCH] New feature: Use dvisvgm to preview latex formular

2016-05-19 Thread Feng Shu

Thank you for patiently help, this is v9 patch, inhert feature is
removed from this patch, I need to think it over, maybe submit
patch in the future.

please comment again, thanks again :-)


>From e18b7a4430ff90d6bcb828e3898ef25c61aba4bd Mon Sep 17 00:00:00 2001
From: Feng Shu 
Date: Tue, 17 May 2016 21:24:35 +0800
Subject: [PATCH] New feature: Use dvisvgm to preview latex formular

* ox-html.el (org-html-with-latex): Add dvisvgm support.
(org-html-with-latex): Add dvisvgm support.
(org-html-format-latex): "ltxpng" -> "ltximg".
(org-html-latex-environment): Add dvisvgm support.
(org-html-latex-fragment): Add dvisvgm support.

* org.el (org-preview-latex-default-process): New variable.
(org-latex-create-formula-image-program): Rename it to `org-preview-latex-default-process'.
(org-latex-preview-ltximg-directory): Rename it to `org-preview-latex-image-directory'.
(org-preview-latex-image-directory): New variable.
(org--format-latex-make-overlay): Add optional image-type, which used to deal with svg.
(org-toggle-latex-fragment): "org-ltxpng" -> "org-ltximg".
(org-format-latex): Add dvisvgm support.
(org-create-formula-image): Big refactor, merge dvipng and imagemagick backend's feature.
Add dvisvgm feature.
(org-preview-latex-process-alist): Add new variable, which used to set
   latex preview processes.
(org-create-formula-image-with-dvipng): Useless, removed.
(org-create-formula-image-with-imagemagick): Useless, removed.

* org.texi (@LaTeX{} fragments): Add dvisvgm information.
(Previewing @LaTeX{} fragments): Add dvisvgm information.
(Math formatting in HTML export): Add dvisvgm information.
(Working with @LaTeX{} math snippets): Add dvisvgm information.
---
 doc/org.texi|  43 ---
 lisp/org.el | 383 +++-
 lisp/ox-html.el |  43 +++
 3 files changed, 259 insertions(+), 210 deletions(-)

diff --git a/doc/org.texi b/doc/org.texi
index 025baaa..54f3c5a 100644
--- a/doc/org.texi
+++ b/doc/org.texi
@@ -10395,10 +10395,10 @@ snippets will be identified as @LaTeX{} source code:
 @item
 Environments of any kind@footnote{When MathJax is used, only the
 environments recognized by MathJax will be processed.  When
-@file{dvipng} program or @file{imagemagick} suite is used to create images,
-any @LaTeX{} environment will be handled.}.  The only requirement is that the
-@code{\begin} statement appears on a new line, at the beginning of the line
-or after whitespaces only.
+@file{dvipng} program, @file{dvisvgm} program or @file{imagemagick} suite is
+used to create images, any @LaTeX{} environment will be handled.}.  The only
+requirement is that the @code{\begin} statement appears on a new line, at the
+beginning of the line or after whitespaces only.
 @item
 Text within the usual @LaTeX{} math delimiters.  To avoid conflicts with
 currency specifications, single @samp{$} characters are only recognized as
@@ -10445,12 +10445,12 @@ lines:
 @subsection Previewing @LaTeX{} fragments
 @cindex @LaTeX{} fragments, preview
 
-@vindex org-latex-create-formula-image-program
-If you have a working @LaTeX{} installation and either @file{dvipng} or
-@file{convert} installed@footnote{These are respectively available at
-@url{http://sourceforge.net/projects/dvipng/} and from the @file{imagemagick}
-suite. Choose the converter by setting the variable
-@code{org-latex-create-formula-image-program} accordingly.}, @LaTeX{}
+@vindex org-preview-latex-default-process
+If you have a working @LaTeX{} installation and @file{dvipng}, @file{dvisvgm}
+or @file{convert} installed@footnote{These are respectively available at
+@url{http://sourceforge.net/projects/dvipng/}, @url{http://dvisvgm.bplaced.net/}
+and from the @file{imagemagick} suite.  Choose the converter by setting the
+variable @code{org-preview-latex-default-process} accordingly.}, @LaTeX{}
 fragments can be processed to produce images of the typeset expressions to be
 used for inclusion while exporting to HTML (see @pxref{@LaTeX{} fragments}),
 or for inline previewing within Org mode.
@@ -11715,6 +11715,7 @@ You could use @code{http} addresses just as well.
 @subsection Math formatting in HTML export
 @cindex MathJax
 @cindex dvipng
+@cindex dvisvgm
 @cindex imagemagick
 
 @LaTeX{} math snippets (@pxref{@LaTeX{} fragments}) can be displayed in two
@@ -11739,13 +11740,18 @@ template can be configure via @code{org-html-mathjax-template}.
 If you prefer, you can also request that @LaTeX{} fragments are processed
 into small images that will be inserted into the browser page.  Before the
 availability of MathJax, this was the default method for Org files.  This
-method requires that the @file{dvipng} program or @file{imagemagick} suite is
-available on your system.  You can still get this processing with
+method requires that the @file{dvipng} program, @file{dvisvgm} or
+@file{imagemag

Re: [O] (V8) [PATCH] New feature: Use dvisvgm to preview latex formular

2016-05-17 Thread Feng Shu

> As discussed in another message, I don't think we should mess with
> `org-latex-compile'. Instead, we could factor out the needed part in
> `org-latex-compile' and make it a generic function. Then we can
> introduce a new function to specifically handle previewing related
> compilation.
>
> Note that I'm not asking you to implement the factoring out part in your
> patch, but to tell me if the following would fulfill your needs for
> `org-create-formula-image'. I'm sending its docstring again.
>

I have rebase my patch to new function org-compile-file, the v8 patch is
very different with the earlier version, it is more simpler i think,
please comment again, thanks for your help!


>From 61885684f4826b06de4bb72b6ef1f369960f268a Mon Sep 17 00:00:00 2001
From: Feng Shu 
Date: Tue, 17 May 2016 21:24:35 +0800
Subject: [PATCH] New feature: Use dvisvgm to preview latex formular

* ox-html.el (org-html-with-latex): Add dvisvgm support.
(org-html-with-latex): Add dvisvgm support.
(org-html-format-latex): "ltxpng" -> "ltximg".
(org-html-latex-environment): Add dvisvgm support.
(org-html-latex-fragment): Add dvisvgm support.

* org.el (org-latex-create-formula-image-program): Add dvisvgm.
(org-latex-preview-ltximg-directory): Rename from `org-preview-latex-image-directory'.
(org--format-latex-make-overlay): Add optional image-type, which used to deal with svg.
(org-toggle-latex-fragment): "org-ltxpng" -> "org-ltximg".
(org-format-latex): Add dvisvgm support.
(org-create-formula-image): Big refactor, merge dvipng and imagemagick backend's feature.
Add dvisvgm feature.
(org-preview-latex-process-alist): Add new variable, which used to set
   latex preview processes.
(org-create-formula-image-with-dvipng): Useless, removed.
(org-create-formula-image-with-imagemagick): Useless, removed.

* org.texi (@LaTeX{} fragments): Add dvisvgm information.
(Previewing @LaTeX{} fragments): Add dvisvgm information.
(Math formatting in HTML export): Add dvisvgm information.
(Working with @LaTeX{} math snippets): Add dvisvgm information.
---
 doc/org.texi|  41 +++--
 lisp/org.el | 462 +---
 lisp/ox-html.el |  27 ++--
 3 files changed, 346 insertions(+), 184 deletions(-)

diff --git a/doc/org.texi b/doc/org.texi
index 17b01c2..ad75b5d 100644
--- a/doc/org.texi
+++ b/doc/org.texi
@@ -10393,10 +10393,10 @@ snippets will be identified as @LaTeX{} source code:
 @item
 Environments of any kind@footnote{When MathJax is used, only the
 environments recognized by MathJax will be processed.  When
-@file{dvipng} program or @file{imagemagick} suite is used to create images,
-any @LaTeX{} environment will be handled.}.  The only requirement is that the
-@code{\begin} statement appears on a new line, at the beginning of the line
-or after whitespaces only.
+@file{dvipng} program, @file{dvisvgm} program or @file{imagemagick} suite is
+used to create images, any @LaTeX{} environment will be handled.}.  The only
+requirement is that the @code{\begin} statement appears on a new line, at the
+beginning of the line or after whitespaces only.
 @item
 Text within the usual @LaTeX{} math delimiters.  To avoid conflicts with
 currency specifications, single @samp{$} characters are only recognized as
@@ -10444,11 +10444,11 @@ lines:
 @cindex @LaTeX{} fragments, preview
 
 @vindex org-latex-create-formula-image-program
-If you have a working @LaTeX{} installation and either @file{dvipng} or
-@file{convert} installed@footnote{These are respectively available at
-@url{http://sourceforge.net/projects/dvipng/} and from the @file{imagemagick}
-suite. Choose the converter by setting the variable
-@code{org-latex-create-formula-image-program} accordingly.}, @LaTeX{}
+If you have a working @LaTeX{} installation and @file{dvipng}, @file{dvisvgm}
+or @file{convert} installed@footnote{These are respectively available at
+@url{http://sourceforge.net/projects/dvipng/}, @url{http://dvisvgm.bplaced.net/}
+and from the @file{imagemagick} suite.  Choose the converter by setting the
+variable @code{org-latex-create-formula-image-program} accordingly.}, @LaTeX{}
 fragments can be processed to produce images of the typeset expressions to be
 used for inclusion while exporting to HTML (see @pxref{@LaTeX{} fragments}),
 or for inline previewing within Org mode.
@@ -11713,6 +11713,7 @@ You could use @code{http} addresses just as well.
 @subsection Math formatting in HTML export
 @cindex MathJax
 @cindex dvipng
+@cindex dvisvgm
 @cindex imagemagick
 
 @LaTeX{} math snippets (@pxref{@LaTeX{} fragments}) can be displayed in two
@@ -11737,13 +11738,18 @@ template can be configure via @code{org-html-mathjax-template}.
 If you prefer, you can also request that @LaTeX{} fragments are processed
 into small images that will be inserted into the browser

Re: [O] [PATCH] New feature: Use dvisvgm to preview latex formular

2016-05-16 Thread Feng Shu
"Feng Shu"  writes:

I will refactor the latex previewing code, this patch should be delay
reviewd.

> "Feng Shu"  writes:
>
> This is version 2, make diff more easy read.
>
> From 66804cf5642256a38beb0b84ad8194562f34bfce Mon Sep 17 00:00:00 2001
> From: Feng Shu 
> Date: Sat, 14 May 2016 22:42:53 +0800
> Subject: [PATCH] New feature: Use dvisvgm to preview latex formular
>
> Tester should set like below:
>
> (setq org-latex-create-formula-image-program 'dvisvgm)
> (setq org-latex-pdf-process
>   '(:fetcher my-org-latex-pdf-process-format))
> (defun my-org-latex-pdf-process-format (&optional texfile snippet 
> caller-info)
>   (cond
>(snippet '("latex -interaction nonstopmode -output-directory %o %f"))
>(t '("%latex -interaction nonstopmode -output-directory %o %f"
> "%latex -interaction nonstopmode -output-directory %o %f"
> "%latex -interaction nonstopmode -output-directory %o %f"
>
> * ox-latex.el (org-latex-pdf-process): Add a new config method, :fetcher.
> (org-latex-compile): Add a new optional argument: caller-info,
>  which used to record the caller's info
>
> * ox-html.el (org-html-with-latex): Add dvisvgm support.
> (org-html-with-latex): Add dvisvgm support.
> (org-html-format-latex): "ltxpng" -> "ltximg".
> (org-html-latex-environment): Add dvisvgm support.
> (org-html-latex-fragment): Add dvisvgm support.
>
> * org.el (org-latex-create-formula-image-program): Add dvisvgm.
> (org-latex-preview-ltximg-directory): Rename from 
> `org-latex-preview-ltximg-directory'.
> (org--format-latex-make-overlay): Add optional image-type, which used to deal 
> with svg.
> (org-toggle-latex-fragment): "org-ltxpng" -> "org-ltximg".
> (org-format-latex): Add dvisvgm support.
> (org-create-formula-image): Add dvisvgm case.
> (org-create-formula-image-with-dvisvgm): New function, deal with latex 
> formula with dvisvgm command.
>
> * org.texi (@LaTeX{} fragments): Add dvisvgm information.
> (Previewing @LaTeX{} fragments): Add dvisvgm information.
> (Math formatting in HTML export): Add dvisvgm information.
> (Working with @LaTeX{} math snippets): Add dvisvgm information.
> ---
>  doc/org.texi |  39 +-
>  lisp/org.el  | 101 --
>  lisp/ox-html.el  |  19 ---
>  lisp/ox-latex.el | 161 
> +++
>  4 files changed, 225 insertions(+), 95 deletions(-)
>
> diff --git a/doc/org.texi b/doc/org.texi
> index 17b01c2..286fabb 100644
> --- a/doc/org.texi
> +++ b/doc/org.texi
> @@ -10393,10 +10393,10 @@ snippets will be identified as @LaTeX{} source code:
>  @item
>  Environments of any kind@footnote{When MathJax is used, only the
>  environments recognized by MathJax will be processed.  When
> -@file{dvipng} program or @file{imagemagick} suite is used to create images,
> -any @LaTeX{} environment will be handled.}.  The only requirement is that the
> -@code{\begin} statement appears on a new line, at the beginning of the line
> -or after whitespaces only.
> +@file{dvipng} program, @file{dvisvgm} program or @file{imagemagick} suite is
> +used to create images, any @LaTeX{} environment will be handled.}.  The only
> +requirement is that the @code{\begin} statement appears on a new line, at the
> +beginning of the line or after whitespaces only.
>  @item
>  Text within the usual @LaTeX{} math delimiters.  To avoid conflicts with
>  currency specifications, single @samp{$} characters are only recognized as
> @@ -10444,10 +10444,10 @@ lines:
>  @cindex @LaTeX{} fragments, preview
>  
>  @vindex org-latex-create-formula-image-program
> -If you have a working @LaTeX{} installation and either @file{dvipng} or
> -@file{convert} installed@footnote{These are respectively available at
> -@url{http://sourceforge.net/projects/dvipng/} and from the @file{imagemagick}
> -suite. Choose the converter by setting the variable
> +If you have a working @LaTeX{} installation and @file{dvipng}, @file{dvisvgm}
> +or @file{convert} installed@footnote{These are respectively available at
> +@url{http://sourceforge.net/projects/dvipng/}, 
> @url{http://dvisvgm.bplaced.net/}
> +and from the @file{imagemagick} suite. Choose the converter by setting the 
> variable
>  @code{org-latex-create-formula-image-program} accordingly.}, @LaTeX{}
>  fragments can be processed to produce images of the typeset expressions to be
>  used for inclusion while exporting to HTML (see @pxref{@LaTeX{} fragments}),
> @@ -11713,6 +11713,7 @@ You could use @code{http} addresses jus

Re: [O] (v6) [PATCH] New feature: Use dvisvgm to preview latex formular

2016-05-16 Thread Feng Shu
Nicolas Goaziou  writes:

This is my modified patch (v6), fix the problems you stated. please review
again, thank!

>From 29760e5c5876fb6b772f7a6004b7160bc06efba8 Mon Sep 17 00:00:00 2001
From: Feng Shu 
Date: Sat, 14 May 2016 22:42:53 +0800
Subject: [PATCH] New feature: Use dvisvgm to preview latex formular

* ox-latex.el (org-latex-pdf-process): org-latex-pdf-process can be a
  configure generator (a plist with :generator keyword).
(org-latex-preview-process): new variable, which is used to process
 latex snippet.
(org-latex-compile): Add a new optional argument: extra-info.

* ox-html.el (org-html-with-latex): Add dvisvgm support.
(org-html-with-latex): Add dvisvgm support.
(org-html-format-latex): "ltxpng" -> "ltximg".
(org-html-latex-environment): Add dvisvgm support.
(org-html-latex-fragment): Add dvisvgm support.

* org.el (org-latex-create-formula-image-program): Add dvisvgm.
(org-latex-preview-ltximg-directory): Rename from `org-latex-preview-ltximg-directory'.
(org--format-latex-make-overlay): Add optional image-type, which used to deal with svg.
(org-toggle-latex-fragment): "org-ltxpng" -> "org-ltximg".
(org-format-latex): Add dvisvgm support.
(org-create-formula-image): Big refactor, merge dvipng and imagemagick backend's feature.
Add dvisvgm feature.
(org-latex-to-image-backends): Add new variable, which used to set latex2image program.
(org-create-formula-image-with-dvipng): Useless, removed.
(org-create-formula-image-with-imagemagick): Useless, removed.

* org.texi (@LaTeX{} fragments): Add dvisvgm information.
(Previewing @LaTeX{} fragments): Add dvisvgm information.
(Math formatting in HTML export): Add dvisvgm information.
(Working with @LaTeX{} math snippets): Add dvisvgm information.
---
 doc/org.texi |  39 --
 lisp/org.el  | 380 ---
 lisp/ox-html.el  |  28 ++--
 lisp/ox-latex.el | 171 -
 4 files changed, 374 insertions(+), 244 deletions(-)

diff --git a/doc/org.texi b/doc/org.texi
index 17b01c2..286fabb 100644
--- a/doc/org.texi
+++ b/doc/org.texi
@@ -10393,10 +10393,10 @@ snippets will be identified as @LaTeX{} source code:
 @item
 Environments of any kind@footnote{When MathJax is used, only the
 environments recognized by MathJax will be processed.  When
-@file{dvipng} program or @file{imagemagick} suite is used to create images,
-any @LaTeX{} environment will be handled.}.  The only requirement is that the
-@code{\begin} statement appears on a new line, at the beginning of the line
-or after whitespaces only.
+@file{dvipng} program, @file{dvisvgm} program or @file{imagemagick} suite is
+used to create images, any @LaTeX{} environment will be handled.}.  The only
+requirement is that the @code{\begin} statement appears on a new line, at the
+beginning of the line or after whitespaces only.
 @item
 Text within the usual @LaTeX{} math delimiters.  To avoid conflicts with
 currency specifications, single @samp{$} characters are only recognized as
@@ -10444,10 +10444,10 @@ lines:
 @cindex @LaTeX{} fragments, preview
 
 @vindex org-latex-create-formula-image-program
-If you have a working @LaTeX{} installation and either @file{dvipng} or
-@file{convert} installed@footnote{These are respectively available at
-@url{http://sourceforge.net/projects/dvipng/} and from the @file{imagemagick}
-suite. Choose the converter by setting the variable
+If you have a working @LaTeX{} installation and @file{dvipng}, @file{dvisvgm}
+or @file{convert} installed@footnote{These are respectively available at
+@url{http://sourceforge.net/projects/dvipng/}, @url{http://dvisvgm.bplaced.net/}
+and from the @file{imagemagick} suite. Choose the converter by setting the variable
 @code{org-latex-create-formula-image-program} accordingly.}, @LaTeX{}
 fragments can be processed to produce images of the typeset expressions to be
 used for inclusion while exporting to HTML (see @pxref{@LaTeX{} fragments}),
@@ -11713,6 +11713,7 @@ You could use @code{http} addresses just as well.
 @subsection Math formatting in HTML export
 @cindex MathJax
 @cindex dvipng
+@cindex dvisvgm
 @cindex imagemagick
 
 @LaTeX{} math snippets (@pxref{@LaTeX{} fragments}) can be displayed in two
@@ -11737,13 +11738,18 @@ template can be configure via @code{org-html-mathjax-template}.
 If you prefer, you can also request that @LaTeX{} fragments are processed
 into small images that will be inserted into the browser page.  Before the
 availability of MathJax, this was the default method for Org files.  This
-method requires that the @file{dvipng} program or @file{imagemagick} suite is
-available on your system.  You can still get this processing with
+method requires that the @file{dvipng} program, @file{dvisvgm} or
+@file{imagemagick} suite is available on your system.  You can still get
+this processing with
 
 @example
 #+OPTIONS: t

Re: [O] (version 3) [PATCH] New feature: Use dvisvgm to preview latex formular

2016-05-15 Thread Feng Shu
Nicolas Goaziou  writes:

>> +  :group 'org-latex
>> +  :version "24.1"
>
> :version "25.1"
>
>> +  :type 'alist)

I need to help to deal with it, what about just remove :type?

>




Re: [O] (version 3) [PATCH] New feature: Use dvisvgm to preview latex formular

2016-05-15 Thread Feng Shu
Nicolas Goaziou  writes:


> In any case, I suggest to create a new variable
> `org-latex-preview-process' for that.

`org-latex-preview-process' is a good idea, which make org-latex
beginner easily, i will add it.

>
>> (org-latex-compile): Add a new optional argument: caller-info,
>>  which used to record the caller's info
>
> In the same vein, I suggest to extract it out from ox-latex and use
> a dedicated command for that.
>
> WDYT?

I suggest to add (:generator my-generator-function) style configure
to `org-latex-pdf-process', it is simple and powerful feature, we
can use this feature to switch latex commands dynamicially, for example:

(defun my-latex-pdf-process-generator (texfile snippet extra-info)
  (cond
   (() ()
   (() ()

although we can set org-latex-pdf-process to a function to do the same work,
but this function is hard to write as org-latex-compile, it may only
useful for developer instead of user

caller-info argument is for the above feature.

>
>> (org-create-formula-image): Big refactor, merge dvipng and imagemagick 
>> backend's feature.
>> Add dvisvgm feature.
>
> Good news. This part was begging for a refactor. A couple (or more) of
> tests would be nice too.

yes


>> +
>> +(defalias 'org-latex-preview-ltxpng-directory 
>> 'org-latex-preview-ltximg-directory)
>> +(make-obsolete 'org-latex-preview-ltxpng-directory 
>> 'org-latex-preview-ltximg-directory
>> +   "Org mode version 9.0")
>
> See `make-obsolete-variable'.

Remove the above two and only use the below *one* ?

(make-obsolete-variable
 'org-latex-preview-ltxpng-directory
 "Set `org-latex-preview-ltximg-directory' instead." "25.1")





Re: [O] (version 4) [PATCH] New feature: Use dvisvgm to preview latex formular

2016-05-15 Thread Feng Shu
"Feng Shu"  writes:

v4 patch, add some minor change based v3

>From 010baf028bb6dbb706f5abb9f99de0552235f2af Mon Sep 17 00:00:00 2001
From: Feng Shu 
Date: Sat, 14 May 2016 22:42:53 +0800
Subject: [PATCH] New feature: Use dvisvgm to preview latex formular

Tester should set like below:

(setq org-latex-create-formula-image-program 'dvisvgm)

(setq org-latex-pdf-process
  '(:fetcher my-org-latex-pdf-process-format))

(defun my-org-latex-pdf-process-format (&optional texfile snippet caller-info)
  (princ (format "The caller's info: %s" caller-info))
  (cond
   (snippet '("latex -interaction nonstopmode -output-directory %o %f"))
   (t '("%latex -interaction nonstopmode -output-directory %o %f"
"%latex -interaction nonstopmode -output-directory %o %f"
"%latex -interaction nonstopmode -output-directory %o %f"

* ox-latex.el (org-latex-pdf-process): Add a new config method, :fetcher.
(org-latex-compile): Add a new optional argument: caller-info,
 which used to record the caller's info

* ox-html.el (org-html-with-latex): Add dvisvgm support.
(org-html-with-latex): Add dvisvgm support.
(org-html-format-latex): "ltxpng" -> "ltximg".
(org-html-latex-environment): Add dvisvgm support.
(org-html-latex-fragment): Add dvisvgm support.

* org.el (org-latex-create-formula-image-program): Add dvisvgm.
(org-latex-preview-ltximg-directory): Rename from `org-latex-preview-ltximg-directory'.
(org--format-latex-make-overlay): Add optional image-type, which used to deal with svg.
(org-toggle-latex-fragment): "org-ltxpng" -> "org-ltximg".
(org-format-latex): Add dvisvgm support.
(org-create-formula-image): Big refactor, merge dvipng and imagemagick backend's feature.
Add dvisvgm feature.
(org-latex-to-image-backends): Add new variable, which used to set latex2image program.
(org-create-formula-image-with-dvipng): Useless, removed.
(org-create-formula-image-with-imagemagick): Useless, removed.

* org.texi (@LaTeX{} fragments): Add dvisvgm information.
(Previewing @LaTeX{} fragments): Add dvisvgm information.
(Math formatting in HTML export): Add dvisvgm information.
(Working with @LaTeX{} math snippets): Add dvisvgm information.
---
 doc/org.texi |  39 +++---
 lisp/org.el  | 366 +++
 lisp/ox-html.el  |  28 +++--
 lisp/ox-latex.el | 161 +++-
 4 files changed, 354 insertions(+), 240 deletions(-)

diff --git a/doc/org.texi b/doc/org.texi
index 17b01c2..286fabb 100644
--- a/doc/org.texi
+++ b/doc/org.texi
@@ -10393,10 +10393,10 @@ snippets will be identified as @LaTeX{} source code:
 @item
 Environments of any kind@footnote{When MathJax is used, only the
 environments recognized by MathJax will be processed.  When
-@file{dvipng} program or @file{imagemagick} suite is used to create images,
-any @LaTeX{} environment will be handled.}.  The only requirement is that the
-@code{\begin} statement appears on a new line, at the beginning of the line
-or after whitespaces only.
+@file{dvipng} program, @file{dvisvgm} program or @file{imagemagick} suite is
+used to create images, any @LaTeX{} environment will be handled.}.  The only
+requirement is that the @code{\begin} statement appears on a new line, at the
+beginning of the line or after whitespaces only.
 @item
 Text within the usual @LaTeX{} math delimiters.  To avoid conflicts with
 currency specifications, single @samp{$} characters are only recognized as
@@ -10444,10 +10444,10 @@ lines:
 @cindex @LaTeX{} fragments, preview
 
 @vindex org-latex-create-formula-image-program
-If you have a working @LaTeX{} installation and either @file{dvipng} or
-@file{convert} installed@footnote{These are respectively available at
-@url{http://sourceforge.net/projects/dvipng/} and from the @file{imagemagick}
-suite. Choose the converter by setting the variable
+If you have a working @LaTeX{} installation and @file{dvipng}, @file{dvisvgm}
+or @file{convert} installed@footnote{These are respectively available at
+@url{http://sourceforge.net/projects/dvipng/}, @url{http://dvisvgm.bplaced.net/}
+and from the @file{imagemagick} suite. Choose the converter by setting the variable
 @code{org-latex-create-formula-image-program} accordingly.}, @LaTeX{}
 fragments can be processed to produce images of the typeset expressions to be
 used for inclusion while exporting to HTML (see @pxref{@LaTeX{} fragments}),
@@ -11713,6 +11713,7 @@ You could use @code{http} addresses just as well.
 @subsection Math formatting in HTML export
 @cindex MathJax
 @cindex dvipng
+@cindex dvisvgm
 @cindex imagemagick
 
 @LaTeX{} math snippets (@pxref{@LaTeX{} fragments}) can be displayed in two
@@ -11737,13 +11738,18 @@ template can be configure via @code{org-html-mathjax-template}.
 If you pre

Re: [O] (version 3) [PATCH] New feature: Use dvisvgm to preview latex formular

2016-05-15 Thread Feng Shu
"Feng Shu"  writes:

Version 4 patch, minor change based v3

>From 010baf028bb6dbb706f5abb9f99de0552235f2af Mon Sep 17 00:00:00 2001
From: Feng Shu 
Date: Sat, 14 May 2016 22:42:53 +0800
Subject: [PATCH] New feature: Use dvisvgm to preview latex formular

Tester should set like below:

(setq org-latex-create-formula-image-program 'dvisvgm)

(setq org-latex-pdf-process
  '(:fetcher my-org-latex-pdf-process-format))

(defun my-org-latex-pdf-process-format (&optional texfile snippet caller-info)
  (princ (format "The caller's info: %s" caller-info))
  (cond
   (snippet '("latex -interaction nonstopmode -output-directory %o %f"))
   (t '("%latex -interaction nonstopmode -output-directory %o %f"
"%latex -interaction nonstopmode -output-directory %o %f"
"%latex -interaction nonstopmode -output-directory %o %f"

* ox-latex.el (org-latex-pdf-process): Add a new config method, :fetcher.
(org-latex-compile): Add a new optional argument: caller-info,
 which used to record the caller's info

* ox-html.el (org-html-with-latex): Add dvisvgm support.
(org-html-with-latex): Add dvisvgm support.
(org-html-format-latex): "ltxpng" -> "ltximg".
(org-html-latex-environment): Add dvisvgm support.
(org-html-latex-fragment): Add dvisvgm support.

* org.el (org-latex-create-formula-image-program): Add dvisvgm.
(org-latex-preview-ltximg-directory): Rename from `org-latex-preview-ltximg-directory'.
(org--format-latex-make-overlay): Add optional image-type, which used to deal with svg.
(org-toggle-latex-fragment): "org-ltxpng" -> "org-ltximg".
(org-format-latex): Add dvisvgm support.
(org-create-formula-image): Big refactor, merge dvipng and imagemagick backend's feature.
Add dvisvgm feature.
(org-latex-to-image-backends): Add new variable, which used to set latex2image program.
(org-create-formula-image-with-dvipng): Useless, removed.
(org-create-formula-image-with-imagemagick): Useless, removed.

* org.texi (@LaTeX{} fragments): Add dvisvgm information.
(Previewing @LaTeX{} fragments): Add dvisvgm information.
(Math formatting in HTML export): Add dvisvgm information.
(Working with @LaTeX{} math snippets): Add dvisvgm information.
---
 doc/org.texi |  39 +++---
 lisp/org.el  | 366 +++
 lisp/ox-html.el  |  28 +++--
 lisp/ox-latex.el | 161 +++-
 4 files changed, 354 insertions(+), 240 deletions(-)

diff --git a/doc/org.texi b/doc/org.texi
index 17b01c2..286fabb 100644
--- a/doc/org.texi
+++ b/doc/org.texi
@@ -10393,10 +10393,10 @@ snippets will be identified as @LaTeX{} source code:
 @item
 Environments of any kind@footnote{When MathJax is used, only the
 environments recognized by MathJax will be processed.  When
-@file{dvipng} program or @file{imagemagick} suite is used to create images,
-any @LaTeX{} environment will be handled.}.  The only requirement is that the
-@code{\begin} statement appears on a new line, at the beginning of the line
-or after whitespaces only.
+@file{dvipng} program, @file{dvisvgm} program or @file{imagemagick} suite is
+used to create images, any @LaTeX{} environment will be handled.}.  The only
+requirement is that the @code{\begin} statement appears on a new line, at the
+beginning of the line or after whitespaces only.
 @item
 Text within the usual @LaTeX{} math delimiters.  To avoid conflicts with
 currency specifications, single @samp{$} characters are only recognized as
@@ -10444,10 +10444,10 @@ lines:
 @cindex @LaTeX{} fragments, preview
 
 @vindex org-latex-create-formula-image-program
-If you have a working @LaTeX{} installation and either @file{dvipng} or
-@file{convert} installed@footnote{These are respectively available at
-@url{http://sourceforge.net/projects/dvipng/} and from the @file{imagemagick}
-suite. Choose the converter by setting the variable
+If you have a working @LaTeX{} installation and @file{dvipng}, @file{dvisvgm}
+or @file{convert} installed@footnote{These are respectively available at
+@url{http://sourceforge.net/projects/dvipng/}, @url{http://dvisvgm.bplaced.net/}
+and from the @file{imagemagick} suite. Choose the converter by setting the variable
 @code{org-latex-create-formula-image-program} accordingly.}, @LaTeX{}
 fragments can be processed to produce images of the typeset expressions to be
 used for inclusion while exporting to HTML (see @pxref{@LaTeX{} fragments}),
@@ -11713,6 +11713,7 @@ You could use @code{http} addresses just as well.
 @subsection Math formatting in HTML export
 @cindex MathJax
 @cindex dvipng
+@cindex dvisvgm
 @cindex imagemagick
 
 @LaTeX{} math snippets (@pxref{@LaTeX{} fragments}) can be displayed in two
@@ -11737,13 +11738,18 @@ template can be configure via @code{org-html-mathjax-template}.
 If you prefer

Re: [O] (version 3) [PATCH] New feature: Use dvisvgm to preview latex formular

2016-05-14 Thread Feng Shu

This is version 3 patch, the latex-previewing code is refacter
org-create-formula-image-with-dvipng and
org-create-formula-image-with-imagemagick are removed.


>From 164c5f4bd41ba29d65fc2c5454b5c4b596c6eb7c Mon Sep 17 00:00:00 2001
From: Feng Shu 
Date: Sat, 14 May 2016 22:42:53 +0800
Subject: [PATCH] New feature: Use dvisvgm to preview latex formular

Tester should set like below:

(setq org-latex-create-formula-image-program 'dvisvgm)

(setq org-latex-pdf-process
  '(:fetcher my-org-latex-pdf-process-format))

(defun my-org-latex-pdf-process-format (&optional texfile snippet caller-info)
  (princ (format "The caller's info: %s" caller-info))
  (cond
   (snippet '("latex -interaction nonstopmode -output-directory %o %f"))
   (t '("%latex -interaction nonstopmode -output-directory %o %f"
"%latex -interaction nonstopmode -output-directory %o %f"
"%latex -interaction nonstopmode -output-directory %o %f"

* ox-latex.el (org-latex-pdf-process): Add a new config method, :fetcher.
(org-latex-compile): Add a new optional argument: caller-info,
 which used to record the caller's info

* ox-html.el (org-html-with-latex): Add dvisvgm support.
(org-html-with-latex): Add dvisvgm support.
(org-html-format-latex): "ltxpng" -> "ltximg".
(org-html-latex-environment): Add dvisvgm support.
(org-html-latex-fragment): Add dvisvgm support.

* org.el (org-latex-create-formula-image-program): Add dvisvgm.
(org-latex-preview-ltximg-directory): Rename from `org-latex-preview-ltximg-directory'.
(org--format-latex-make-overlay): Add optional image-type, which used to deal with svg.
(org-toggle-latex-fragment): "org-ltxpng" -> "org-ltximg".
(org-format-latex): Add dvisvgm support.
(org-create-formula-image): Big refactor, merge dvipng and imagemagick backend's feature.
Add dvisvgm feature.
(org-latex-to-image-backends): Add new variable, which used to set latex2image program.
(org-create-formula-image-with-dvipng): Useless, removed.
(org-create-formula-image-with-imagemagick): Useless, removed.

* org.texi (@LaTeX{} fragments): Add dvisvgm information.
(Previewing @LaTeX{} fragments): Add dvisvgm information.
(Math formatting in HTML export): Add dvisvgm information.
(Working with @LaTeX{} math snippets): Add dvisvgm information.
---
 doc/org.texi |  39 +++---
 lisp/org.el  | 357 +++
 lisp/ox-html.el  |  28 +++--
 lisp/ox-latex.el | 161 -
 4 files changed, 344 insertions(+), 241 deletions(-)

diff --git a/doc/org.texi b/doc/org.texi
index 17b01c2..286fabb 100644
--- a/doc/org.texi
+++ b/doc/org.texi
@@ -10393,10 +10393,10 @@ snippets will be identified as @LaTeX{} source code:
 @item
 Environments of any kind@footnote{When MathJax is used, only the
 environments recognized by MathJax will be processed.  When
-@file{dvipng} program or @file{imagemagick} suite is used to create images,
-any @LaTeX{} environment will be handled.}.  The only requirement is that the
-@code{\begin} statement appears on a new line, at the beginning of the line
-or after whitespaces only.
+@file{dvipng} program, @file{dvisvgm} program or @file{imagemagick} suite is
+used to create images, any @LaTeX{} environment will be handled.}.  The only
+requirement is that the @code{\begin} statement appears on a new line, at the
+beginning of the line or after whitespaces only.
 @item
 Text within the usual @LaTeX{} math delimiters.  To avoid conflicts with
 currency specifications, single @samp{$} characters are only recognized as
@@ -10444,10 +10444,10 @@ lines:
 @cindex @LaTeX{} fragments, preview
 
 @vindex org-latex-create-formula-image-program
-If you have a working @LaTeX{} installation and either @file{dvipng} or
-@file{convert} installed@footnote{These are respectively available at
-@url{http://sourceforge.net/projects/dvipng/} and from the @file{imagemagick}
-suite. Choose the converter by setting the variable
+If you have a working @LaTeX{} installation and @file{dvipng}, @file{dvisvgm}
+or @file{convert} installed@footnote{These are respectively available at
+@url{http://sourceforge.net/projects/dvipng/}, @url{http://dvisvgm.bplaced.net/}
+and from the @file{imagemagick} suite. Choose the converter by setting the variable
 @code{org-latex-create-formula-image-program} accordingly.}, @LaTeX{}
 fragments can be processed to produce images of the typeset expressions to be
 used for inclusion while exporting to HTML (see @pxref{@LaTeX{} fragments}),
@@ -11713,6 +11713,7 @@ You could use @code{http} addresses just as well.
 @subsection Math formatting in HTML export
 @cindex MathJax
 @cindex dvipng
+@cindex dvisvgm
 @cindex imagemagick
 
 @LaTeX{} math snippets (@pxref{@LaTeX{} fragments}) can be displayed in two
@@ -11737,1

Re: [O] [PATCH] New feature: Use dvisvgm to preview latex formular

2016-05-14 Thread Feng Shu
"Feng Shu"  writes:

This is version 2, make diff more easy read.

>From 66804cf5642256a38beb0b84ad8194562f34bfce Mon Sep 17 00:00:00 2001
From: Feng Shu 
Date: Sat, 14 May 2016 22:42:53 +0800
Subject: [PATCH] New feature: Use dvisvgm to preview latex formular

Tester should set like below:

(setq org-latex-create-formula-image-program 'dvisvgm)
(setq org-latex-pdf-process
  '(:fetcher my-org-latex-pdf-process-format))
(defun my-org-latex-pdf-process-format (&optional texfile snippet caller-info)
  (cond
   (snippet '("latex -interaction nonstopmode -output-directory %o %f"))
   (t '("%latex -interaction nonstopmode -output-directory %o %f"
"%latex -interaction nonstopmode -output-directory %o %f"
"%latex -interaction nonstopmode -output-directory %o %f"

* ox-latex.el (org-latex-pdf-process): Add a new config method, :fetcher.
(org-latex-compile): Add a new optional argument: caller-info,
 which used to record the caller's info

* ox-html.el (org-html-with-latex): Add dvisvgm support.
(org-html-with-latex): Add dvisvgm support.
(org-html-format-latex): "ltxpng" -> "ltximg".
(org-html-latex-environment): Add dvisvgm support.
(org-html-latex-fragment): Add dvisvgm support.

* org.el (org-latex-create-formula-image-program): Add dvisvgm.
(org-latex-preview-ltximg-directory): Rename from `org-latex-preview-ltximg-directory'.
(org--format-latex-make-overlay): Add optional image-type, which used to deal with svg.
(org-toggle-latex-fragment): "org-ltxpng" -> "org-ltximg".
(org-format-latex): Add dvisvgm support.
(org-create-formula-image): Add dvisvgm case.
(org-create-formula-image-with-dvisvgm): New function, deal with latex formula with dvisvgm command.

* org.texi (@LaTeX{} fragments): Add dvisvgm information.
(Previewing @LaTeX{} fragments): Add dvisvgm information.
(Math formatting in HTML export): Add dvisvgm information.
(Working with @LaTeX{} math snippets): Add dvisvgm information.
---
 doc/org.texi |  39 +-
 lisp/org.el  | 101 --
 lisp/ox-html.el  |  19 ---
 lisp/ox-latex.el | 161 +++
 4 files changed, 225 insertions(+), 95 deletions(-)

diff --git a/doc/org.texi b/doc/org.texi
index 17b01c2..286fabb 100644
--- a/doc/org.texi
+++ b/doc/org.texi
@@ -10393,10 +10393,10 @@ snippets will be identified as @LaTeX{} source code:
 @item
 Environments of any kind@footnote{When MathJax is used, only the
 environments recognized by MathJax will be processed.  When
-@file{dvipng} program or @file{imagemagick} suite is used to create images,
-any @LaTeX{} environment will be handled.}.  The only requirement is that the
-@code{\begin} statement appears on a new line, at the beginning of the line
-or after whitespaces only.
+@file{dvipng} program, @file{dvisvgm} program or @file{imagemagick} suite is
+used to create images, any @LaTeX{} environment will be handled.}.  The only
+requirement is that the @code{\begin} statement appears on a new line, at the
+beginning of the line or after whitespaces only.
 @item
 Text within the usual @LaTeX{} math delimiters.  To avoid conflicts with
 currency specifications, single @samp{$} characters are only recognized as
@@ -10444,10 +10444,10 @@ lines:
 @cindex @LaTeX{} fragments, preview
 
 @vindex org-latex-create-formula-image-program
-If you have a working @LaTeX{} installation and either @file{dvipng} or
-@file{convert} installed@footnote{These are respectively available at
-@url{http://sourceforge.net/projects/dvipng/} and from the @file{imagemagick}
-suite. Choose the converter by setting the variable
+If you have a working @LaTeX{} installation and @file{dvipng}, @file{dvisvgm}
+or @file{convert} installed@footnote{These are respectively available at
+@url{http://sourceforge.net/projects/dvipng/}, @url{http://dvisvgm.bplaced.net/}
+and from the @file{imagemagick} suite. Choose the converter by setting the variable
 @code{org-latex-create-formula-image-program} accordingly.}, @LaTeX{}
 fragments can be processed to produce images of the typeset expressions to be
 used for inclusion while exporting to HTML (see @pxref{@LaTeX{} fragments}),
@@ -11713,6 +11713,7 @@ You could use @code{http} addresses just as well.
 @subsection Math formatting in HTML export
 @cindex MathJax
 @cindex dvipng
+@cindex dvisvgm
 @cindex imagemagick
 
 @LaTeX{} math snippets (@pxref{@LaTeX{} fragments}) can be displayed in two
@@ -11737,13 +11738,18 @@ template can be configure via @code{org-html-mathjax-template}.
 If you prefer, you can also request that @LaTeX{} fragments are processed
 into small images that will be inserted into the browser page.  Before the
 availability of MathJax, this was the default method for Org files.  This
-method requires that the @file{dvipng} prog

Re: [O] latex fragment png's size too small

2016-05-14 Thread Feng Shu
"Feng Shu"  writes:

> Nicolas Goaziou  writes:
>
>> tumashu  writes:
>>
>>> The problem is that the pic is too small and nearly can not see the
>>> words in the picture, it will force user config it, if we use a larger
>>> pic, it can work although it is ugly
>>
>> Then is :scale 1.2 enough?
>
> I tested in bare emacs, 1.2 seem ok. 

I have found the other problem, the below two version of
org-create-formula-image-with-dvipng generate different size png,
for they use different dpi.

I think, we should hold :scale to 1.0 and fix size problem in function
`org-create-formula-image-with-dvipng'.

#+BEGIN_SRC emacs-lisp
;; Old version
(defun org-create-formula-image-with-dvipng (string tofile options buffer)
  "This calls dvipng."
  (require 'ox-latex)
  (let* ((tmpdir (if (featurep 'xemacs)
 (temp-directory)
   temporary-file-directory))
 (texfilebase (make-temp-name
   (expand-file-name "orgtex" tmpdir)))
 (texfile (concat texfilebase ".tex"))
 (dvifile (concat texfilebase ".dvi"))
 (pngfile (concat texfilebase ".png"))
 (fnh (if (featurep 'xemacs)
  (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.))
 (fg (or (plist-get options (if buffer :foreground :html-foreground))
 "Black"))
 (bg (or (plist-get options (if buffer :background :html-background))
 "Transparent")))
(princ (format "dpi:%s" dpi))
(if (eq fg 'default) (setq fg (org-dvipng-color :foreground))
  (unless (string= fg "Transparent") (setq fg (org-dvipng-color-format 
fg
(if (eq bg 'default) (setq bg (org-dvipng-color :background))
  (unless (string= bg "Transparent") (setq bg (org-dvipng-color-format 
bg
(let ((latex-header (org-create-formula--latex-header)))
  (with-temp-file texfile
(insert latex-header)
(insert "\n\\begin{document}\n" string "\n\\end{document}\n")))
(let ((dir default-directory))
  (condition-case nil
  (progn
(cd tmpdir)
(call-process "latex" nil nil nil texfile))
(error nil))
  (cd dir))
(if (not (file-exists-p dvifile))
(progn (message "Failed to create dvi file from %s" texfile) nil)
  (condition-case nil
  (if (featurep 'xemacs)
  (call-process "dvipng" nil nil nil
"-fg" fg "-bg" bg
"-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" ".out") do
  (if (file-exists-p (concat texfilebase e))
  (delete-file (concat texfilebase e
pngfile

;; New version
(defun org-create-formula-image-with-dvipng (string tofile options buffer)
  "This calls dvipng."
  (require 'ox-latex)
  (let* ((tmpdir (if (featurep 'xemacs)
 (temp-directory)
   temporary-file-directory))
 (texfilebase (make-temp-name
   (expand-file-name "orgtex" tmpdir)))
 (texfile (concat texfilebase ".tex"))
 (dvifile (concat texfilebase ".dvi"))
 (pngfile (concat texfilebase ".png"))
 (scale (or (plist-get options (if buffer :scale :html-scale)) 1.0))
 ;; This assumes that the display has the same pixel width in
 ;; the horizontal and vertical directions
 (dpi (number-to-string (* scale (if buffer (org--get-display-dpi) 120
 (fg (or (plist-get options (if buffer :foreground :html-foreground))
 "Black"))
 (bg (or (plist-get options (if buffer :background :html-background))
 "Transparent")))
(princ (format "dpi: %s" dpi))
(if (eq fg 'default) (setq fg (org-dvipng-color :foreground))
  (unless (string= fg "Transparent") (setq fg (org-d

Re: [O] latex fragment png's size too small

2016-05-14 Thread Feng Shu
Nicolas Goaziou  writes:

> tumashu  writes:
>
>> The problem is that the pic is too small and nearly can not see the
>> words in the picture, it will force user config it, if we use a larger
>> pic, it can work although it is ugly
>
> Then is :scale 1.2 enough?

I tested in bare emacs, 1.2 seem ok.

> If it is too ugly, it will also force users configuring it anyway.
>
> Regards,

-- 




[O] [PATCH] New feature: Use dvisvgm to preview latex formular

2016-05-14 Thread Feng Shu
>From 4e40deddfb342135b78df83fc5a05ddbce965300 Mon Sep 17 00:00:00 2001
From: Feng Shu 
Date: Fri, 13 May 2016 20:12:22 +0800
Subject: [PATCH] New feature: Use dvisvgm to preview latex formular

Tester should set like below:

(setq org-latex-create-formula-image-program 'dvisvgm)
(setq org-latex-pdf-process
  '(:fetcher my-org-latex-pdf-process-format))
(defun my-org-latex-pdf-process-format (&optional texfile snippet caller-info)
  (cond
   (snippet '("latex -interaction nonstopmode -output-directory %o %f"))
   (t '("%latex -interaction nonstopmode -output-directory %o %f"
"%latex -interaction nonstopmode -output-directory %o %f"
"%latex -interaction nonstopmode -output-directory %o %f"

* ox-latex.el (org-latex-pdf-process): Add a new config method, :fetcher.
(org-latex-compile): Add a new optional argument: caller-info,
 which used to record the caller's info

* ox-html.el (org-html-with-latex): Add dvisvgm support.
(org-html-with-latex): Add dvisvgm support.
(org-html-format-latex): "ltxpng" -> "ltximg".
(org-html-latex-environment): Add dvisvgm support.
(org-html-latex-fragment): Add dvisvgm support.

* org.el (org-latex-create-formula-image-program): Add dvisvgm.
(org-latex-preview-ltximg-directory): Rename from `org-latex-preview-ltximg-directory'.
(org--format-latex-make-overlay): Add optional image-type, which used to deal with svg.
(org-toggle-latex-fragment): "org-ltxpng" -> "org-ltximg".
(org-format-latex): Add dvisvgm support.
(org-create-formula-image): Add dvisvgm case.
(org-create-formula-image-with-dvisvgm): New function, deal with latex formula with dvisvgm command.

* org.texi (@LaTeX{} fragments): Add dvisvgm information.
(Previewing @LaTeX{} fragments): Add dvisvgm information.
(Math formatting in HTML export): Add dvisvgm information.
(Working with @LaTeX{} math snippets): Add dvisvgm information.
---
 doc/org.texi |  39 -
 lisp/org.el  | 110 ---
 lisp/ox-html.el  |  23 
 lisp/ox-latex.el | 171 +++
 4 files changed, 237 insertions(+), 106 deletions(-)

diff --git a/doc/org.texi b/doc/org.texi
index 17b01c2..286fabb 100644
--- a/doc/org.texi
+++ b/doc/org.texi
@@ -10393,10 +10393,10 @@ snippets will be identified as @LaTeX{} source code:
 @item
 Environments of any kind@footnote{When MathJax is used, only the
 environments recognized by MathJax will be processed.  When
-@file{dvipng} program or @file{imagemagick} suite is used to create images,
-any @LaTeX{} environment will be handled.}.  The only requirement is that the
-@code{\begin} statement appears on a new line, at the beginning of the line
-or after whitespaces only.
+@file{dvipng} program, @file{dvisvgm} program or @file{imagemagick} suite is
+used to create images, any @LaTeX{} environment will be handled.}.  The only
+requirement is that the @code{\begin} statement appears on a new line, at the
+beginning of the line or after whitespaces only.
 @item
 Text within the usual @LaTeX{} math delimiters.  To avoid conflicts with
 currency specifications, single @samp{$} characters are only recognized as
@@ -10444,10 +10444,10 @@ lines:
 @cindex @LaTeX{} fragments, preview
 
 @vindex org-latex-create-formula-image-program
-If you have a working @LaTeX{} installation and either @file{dvipng} or
-@file{convert} installed@footnote{These are respectively available at
-@url{http://sourceforge.net/projects/dvipng/} and from the @file{imagemagick}
-suite. Choose the converter by setting the variable
+If you have a working @LaTeX{} installation and @file{dvipng}, @file{dvisvgm}
+or @file{convert} installed@footnote{These are respectively available at
+@url{http://sourceforge.net/projects/dvipng/}, @url{http://dvisvgm.bplaced.net/}
+and from the @file{imagemagick} suite. Choose the converter by setting the variable
 @code{org-latex-create-formula-image-program} accordingly.}, @LaTeX{}
 fragments can be processed to produce images of the typeset expressions to be
 used for inclusion while exporting to HTML (see @pxref{@LaTeX{} fragments}),
@@ -11713,6 +11713,7 @@ You could use @code{http} addresses just as well.
 @subsection Math formatting in HTML export
 @cindex MathJax
 @cindex dvipng
+@cindex dvisvgm
 @cindex imagemagick
 
 @LaTeX{} math snippets (@pxref{@LaTeX{} fragments}) can be displayed in two
@@ -11737,13 +11738,18 @@ template can be configure via @code{org-html-mathjax-template}.
 If you prefer, you can also request that @LaTeX{} fragments are processed
 into small images that will be inserted into the browser page.  Before the
 availability of MathJax, this was the default method for Org files.  This
-method requires that the @file{dvipng} program or @file{imagemagick} suite is
-available on your system.  You can sti

Re: [O] Question about org-publish-project-alist

2015-04-14 Thread Feng Shu


(defvar base-dir "~/Documents/org/")
(defvar pub-dir "~/Public/notes/")

(setq org-publish-project-alist
  `(("org"
 :base-directory ,base-dir
 :base-extension "org"
 :publishing-directory ,pub-dir
 :recursive t
 :publishing-function org-html-publish-to-html
 :exclude "level-..org"
 )
("static"
 :base-directory base-dir
 :base-extension "css\\|js\\|png\\|jpg\\|gif\\|pdf\\|mp3\\|ogg\\|swf"
 :publishing-directory pub-dir
 :recursive t
 :publishing-function org-publish-attachment
 )
("project-root" :components ("org" "static"

-- 




Re: [O] [patch] org-element: Deal with subscript like: "_{x}"

2014-12-17 Thread Feng Shu

This seem to be a wrong patch, sorry!

Feng Shu  writes:
> From a4b14292b96a0f5e5d262087ec3e8de7c209f863 Mon Sep 17 00:00:00 2001
> From: Feng Shu 
> Date: Wed, 17 Dec 2014 21:59:44 +0800
> Subject: [PATCH] org-element: Deal with subscript like: "_{x}"
>
> * lisp/org-element.el (org-element--object-lex): Deal with
>   subscript like: "_{x}".
> ---
>  lisp/org-element.el |3 +++
>  1 个文件被修改,插入 3 行(+)
>
> diff --git a/lisp/org-element.el b/lisp/org-element.el
> index d5d4bb9..bf8b152 100644
> --- a/lisp/org-element.el
> +++ b/lisp/org-element.el
> @@ -4215,6 +4215,9 @@ to an appropriate container (e.g., a paragraph)."
> (?^ (and (memq 'superscript restriction)
>  (org-element-superscript-parser)))
> (?_ (or (and (memq 'subscript restriction)
> +(if (eq org-export-with-sub-superscripts '{})
> +(eq (char-after (+ (point) 1) ) ?{)
> +  t)
>  (org-element-subscript-parser))
> (and (memq 'underline restriction)
>  (org-element-underline-parser
> -- 
> 1.7.10.4

-- 



[O] [patch] org-element: Deal with subscript like: "_{x}"

2014-12-17 Thread Feng Shu
>From a4b14292b96a0f5e5d262087ec3e8de7c209f863 Mon Sep 17 00:00:00 2001
From: Feng Shu 
Date: Wed, 17 Dec 2014 21:59:44 +0800
Subject: [PATCH] org-element: Deal with subscript like: "_{x}"

* lisp/org-element.el (org-element--object-lex): Deal with
  subscript like: "_{x}".
---
 lisp/org-element.el |3 +++
 1 个文件被修改,插入 3 行(+)

diff --git a/lisp/org-element.el b/lisp/org-element.el
index d5d4bb9..bf8b152 100644
--- a/lisp/org-element.el
+++ b/lisp/org-element.el
@@ -4215,6 +4215,9 @@ to an appropriate container (e.g., a paragraph)."
 		  (?^ (and (memq 'superscript restriction)
 			   (org-element-superscript-parser)))
 		  (?_ (or (and (memq 'subscript restriction)
+   (if (eq org-export-with-sub-superscripts '{})
+   (eq (char-after (+ (point) 1) ) ?{)
+ t)
    (org-element-subscript-parser))
 			  (and (memq 'underline restriction)
    (org-element-underline-parser
-- 
1.7.10.4


-- 


[O] Is it possible to use org-babel to deal with bibtex?

2014-12-14 Thread Feng Shu

I want to deal with my bibtex like this, is it possible?

===
* Emacs & org-mode & vim
  :PROPERTIES:
  :noweb-ref: bibkeys
  :END:

I like emacs very much src_bib{emacs1900}, I like Org-mode Very much
src_bib{orgmode1900}.I don't know vim src_bib{vim1900}.

** Reference
#+BEGIN_SRC bib :noweb yes
  <>
#+END_SRC


=

--



[O] ob-R, about :results value verbatim drawer

2014-09-23 Thread Feng Shu

When I run follow code, it just work:

   #+begin_comment
   
   #+BEGIN_SRC R :results value verbatim drawer
   data <- list(a="[[./test1.org]]",b="[[./test2.org]]",c="[[./test3.org]]")
   c(data$a,data$b,data$c)
   #+END_SRC
   
   #+RESULTS:
   :RESULTS:
   [[./test1.org]]
   [[./test2.org]]
   [[./test3.org]]
   :END:
   


but when I add a #+PROPERTY, it show error like below, how to deal with
it ?  thanks ...

  #+PROPERTY: header-args:R :colnames yes :rownames no :exports both
  #+BEGIN_SRC R :results value verbatim drawer
  data <- list(a="[[./test1.org]]",b="[[./test2.org]]",c="[[./test3.org]]")
  c(data$a,data$b,data$c)
  #+END_SRC


  executing R code block...
  Wrote /tmp/babel-1984743i/ob-input-198472lB
  org-babel-R-evaluate-external-process: Wrong type argument: listp, "x
  [[./test1.org]]
  [[./test2.org]]
  [[./test3.org]]
  "



[O] "#+begin_src R :results output drawer" doesn't work.

2014-08-09 Thread Feng Shu

#+begin_src R :results output drawer
"1"
"2"
#+end_src

#+RESULTS:
: 2



-- 



Re: [O] ANN: org-vcard. Export/import vCards. Backwards-compatible with org-contacts.el.

2014-08-03 Thread Feng Shu
Alexis  writes:

>
> * New contacts style: 'tree'.
>

Is this "tree" style possible?

#+begin-comment
* People
** Joan Smith
:PROPERTIES:
:KIND: individual
:FIELDTYPE: name
:END:
*** Cell
:PROPERTIES:
:FIELDTYPE: cells-folder
:END:
  999 991
  999 992
  999 993
  999 994
  999 995
*** Email 
:PROPERTIES:
:FIELDTYPE: emails-folder
:END:
 address1@hidden
 address2@hidden
 address3@hidden
 address4@hidden
 address5@hidden

#+end-comment



Re: [O] ANN: org-vcard. Export/import vCards. Backwards-compatible with org-contacts.el.

2014-08-03 Thread Feng Shu
Alexis  writes:

> Hi all,
>
> i'm pleased to announce the initial release of org-vcard, a package for
> Org-based export and import of vCards:
>
> * Backwards-compatible with org-contacts.el.
>
>   org-vcard comes with a built-in contacts style called 'flat', which
>   adheres to org-contacts' method of structuring contacts and contact
>   information. It not only supports the properties specified in
>   org-contacts.el, but many other properties as well.
>
> * Basic support for vCard 4.0, 3.0 and 2.1.
>
>   org-vcard is working towards full compliance with the vCard 4.0 (RFC
>   6350), 3.0 (RFC 2426 and RFC 4770) and 2.1 specifications.
>
> * New contacts style: 'tree'.

Is it possible support this style?

#+begin_comment
* People
** Joan Smith
:PROPERTIES:
:KIND: individual
:FIELDTYPE: name
:END:
*** Cell
:PROPERTIES:
:FIELDTYPE: cell-folder
:END:
  999 991
  999 992
  999 993
  999 994
  999 995
*** Email 
:PROPERTIES:
:FIELDTYPE: emails-folder
:END:
 address1@hidden
 address2@hidden
 address3@hidden
 address4@hidden
 address5@hidden

#+end_comment




Re: [O] ANN: org-vcard. Export/import vCards. Backwards-compatible with org-contacts.el.

2014-07-31 Thread Feng Shu
Alexis  writes:
> * New contacts style: 'tree'.
>
>   org-vcard introduces a new style for Org contacts, called 'tree'.

I like store the contacts like "tree", may be let org-contacts recognizes
this "tree" is a important thing, are there any plans? 





Re: [O] org-contacts to vCard

2014-07-06 Thread Feng Shu
Alexis  writes:

I like this tree contact style!
> A second value `ORG_CONTACTS_STYLE` can have is 'tree':
>
> ,* People
> ,** Alexis
> ,:PROPERTIES:
> ,:KIND: individual 
> ,:FIELDTYPE: name
> ,:END:
> ,*** Landline
> ,:PROPERTIES:
> ,:FIELDTYPE: landline
> ,:END:
> , 00  
> ,*** Mobile
> ,:PROPERTIES:
> ,:FIELDTYPE: mobile
> ,:END:
> ,  999 999
> ,*** Email 1
> ,:PROPERTIES:
> ,:PREFERRED: 
> ,:FIELDTYPE: email
> ,:END:
> , addres...@example.com
> ,*** Email 2
> ,:PROPERTIES:
> ,:FIELDTYPE: email
> ,:END:
> , addres...@example.com
>




Re: [O] To interrupt org-latex-pdf-process to regexp-replace some string of the .tex intermediate file and continue to export

2014-04-25 Thread Feng Shu
Leu Zhe  writes:

> I am using org-mode to write some article now. Org-mode is really a
> great tool to outline a article with great table and image support.
>
> Org-mode can display inline .png image but not .pdf file. Because now
> org-mode can not control the width or height of shown inline image, so
> i use matplotlib to produce low dpi .png image in PNG folder for
> inline display and higher dpi pdf image in PDF folder for finally
> article export.
>
> In .org file, the image link is like [[file:PNG\*.png]] and
> \includegraphics{PNG\*.png}in the produced .tex file. Then emacs will
> use org-latex-pdf-process to render it to pdf file. What I want is
> that before or in org-latex-pdf-process, a regexp replace function is
> added to replace the \includegraphics{PDF\*.pdf}, and then produce the
> final pdf file.
>
> Can anyone give a hand?

I use R, Maybe this can help you ...

#+begin_src R :exports results :results output drawer :var backend=(symbol-name 
org-export-current-backend)
  require("ascii")
  plot.org  <- function (x, caption)
  {
  pngfile <- paste(caption, ".png", sep="")
  pdffile <- paste(caption, ".pdf", sep="")
  print(paragraph(paste("#+CAPTION: ", caption, sep="")),type="org")
  if (backend != "latex"){
  png(pngfile)
  plot(x)
  dev.off()
  print(paragraph(paste("[[./", pngfile, "]]", 
sep=""),new=FALSE),type="org")
  }else{
  pdf(pdffile)
  plot(x)
  dev.off()
  print(paragraph(paste("[[./", pdffile, "]]", 
sep=""),new=FALSE),type="org")
  }
  }

  plot.org(rnorm(100),"test")
#+end_src

-- 




Re: [O] Images in tables?

2014-03-28 Thread Feng Shu
Peter Davis  writes:

> I'm finishing a PDF document that will contain a number of screen
> shots. I'd like to put them in a table to avoid just having them
> arranged vertically on the page. Is there a way to do that?

#+MACRO:  p   \includegraphics[scale=1]{$1}

| {{{p(a.png)}}} | {{{p(b.png)}}} |
| {{{p(c.png)}}} | {{{p(d.png)}}} |


>
> Specifically, I'm using
>
> #+ATTR_LATEX: :height 6cm
>
> to set the heights of the images. Can that work with a table somehow?
>
> Thanks!
>
> -pd

-- 




Re: [O] How to write a org babel hook, which can manupulate result

2014-03-26 Thread Feng Shu
Daimrod  writes:

> Feng Shu  writes:
>
>> Daimrod  writes:
>>
>>> Feng Shu  writes:
>>>
>>>> Hi:
>>> Hi Feng,
>>>
>>> Look at the :post header argument.
>>> (info "(org) post")
>>
>> How to use elisp in :post directly,
>
> I don't think you can.
>
> You have to use it this way (not tested):
> #+NAME: align-multi-table
> #+BEGIN_SRC emacs-lisp :var content="nil" :results raw
>   (align-multi-table content)
> #+END_SRC
> #+begin_src R :results output raw drawer :post 
> align-multi-table(content=*this*)
>   
> #+end_src

I prefer using a hook function to do this job, The below is my hook:

#+begin_src elisp
(add-hook 'org-babel-after-execute-hook 'eh-org-babel-align-tables)

(defun eh-org-babel-align-tables (&optional info)
  "Align all tables in the result of the current source"
  (interactive)
  (let ((location (org-babel-where-is-src-block-result nil info)))
(when location
  (save-excursion
(goto-char location)
(when (looking-at (concat org-babel-result-regexp ".*$"))
  (while (< (point) (progn (forward-line 1) (org-babel-result-end)))
(when (org-at-table-p)
  (toggle-truncate-lines 1)
  (org-table-align)
  (goto-char (org-table-end)))
(forward-line)))
#+end_src


>
>> for example:
>>
>> #+begin_src R :results output raw drawer :post (align-multi-table)
>>   
>> #+end_src
>> #+begin_comment
>> (defun align-multi-table (&optional content)
>>   (interactive)
>>   (let ((content (or content *this*)))
>> (with-temp-buffer
>>   (insert content)
>>   (goto-char (point-min))
>>   (while (not (eobp))
>>  (when (org-at-table-p)
>>(org-table-align))
>>  (forward-line))
>>   (buffer-string
>> #+end_comment
>>
>>>
>>>> I want to write a hook to menupulate org babel output,
>>>> The problem is: How can I get two points info: [pointA] and [pointB]
>>>> in my hook function?
>>>>
>>>> #+begin_src R :results output raw drawer
>>>> tbl <- data.frame(a=c(1,2,3),b=c(3,2,1))
>>>> print(ascii(tbl),type="org")
>>>> #+END_SRC
>>>>
>>>> #+RESULTS:
>>>> :RESULTS:
>>>> [pointA]
>>>> |   |a |b |
>>>> |---+--+--|
>>>> | 1 | 1.00 | 3.00 |
>>>> | 2 | 2.00 | 2.00 |
>>>> | 3 | 3.00 | 1.00 |
>>>> [pointB]
>>>> :END:

-- 




Re: [O] org-babel R output table with plot

2014-03-26 Thread Feng Shu
John Hendy  writes:

> On Mon, Mar 24, 2014 at 7:00 PM, Feng Shu  wrote:
>> John Hendy  writes:
>>
>>> On Mon, Mar 24, 2014 at 10:22 AM, Feng Shu  wrote:
>>>> Hi everyone
>>>>
>>>> I want to R output table with plot, I use a solution below,
>>>> Who can tell me other solutions?
>>>>
>>>
>>> I sort of follow the below, but I think it would be more helpful to
>>> describe what you *don't* like about the output below. In other words,
>>> what are you trying to achieve that is not working below?
>>>
>>
>> It just suit my need, but I want to know more simper solution, which let
>> me type less code.
>
> Hmmm. Not seeing a ton of ways to optimize, but it might depend on
> your total usage scenario. How many of these types of table/plot
> combinations are you creating? Just a couple sets, or a lot?
>
> The plot command is the only one that looks inefficient since a babel
> block with :file header would automate opening/closing a device... If
> you defined your data.frame in another babel block and used the
> :session argument, you could do something like this:
> #+name: plot
> #+header: :file /path/to/file.png :width 1600 :height 900 :res 200
> #+begin_src R :session r :exports results :results output graphics
>
> plot(data)
>
> #+end_src
>
> After that executes, you'll end up with a named results block which
> you can manually add the #+caption to? I typically use something like
> the above. Your solution is nice as one could add things like
> #+attr_latex or #+begin/end_center code via the paste() function in
> R... while mine saves having to manually do pnt(); plot(); dev.off().

>
> Another option might be to generate all your plots in a loop, perhaps,
> and then stick to just programmatically including them with Org
> syntax? I essentially did that here:
> - http://lists.gnu.org/archive/html/emacs-orgmode/2012-08/msg01167.html
>
> Not really much different than what your'e doing, though, I suppose.

> It would just scale nicely if you have various data sets and always
> generate a table and plot from them all. Then you could create your
> data.frames in a list and then lapply() through them with each of your
> functions, printing the proper Org syntax as the result (with :results
> drawer, as you're already using).

I use loop to generate multi tables.

There is a problem:  only the first table generated from current R src.
can be aligned correctly, which sometime is very annoy.

The below hook can align all the tables generate from R code:

#+begin_src elisp
(add-hook 'org-babel-after-execute-hook 'eh-org-babel-align-tables)

(defun eh-org-babel-align-tables (&optional info)
  "Align all tables in the result of the current source"
  (interactive)
  (let ((location (org-babel-where-is-src-block-result nil info)))
(when location
  (save-excursion
(goto-char location)
(when (looking-at (concat org-babel-result-regexp ".*$"))
  (while (< (point) (progn (forward-line 1) (org-babel-result-end)))
(when (org-at-table-p)
  (toggle-truncate-lines 1)
  (org-table-align)
  (goto-char (org-table-end)))
(forward-line)))
#+end_src


>
> This thread also came to mind, as I was reusing lines like you are,
> and keeping them in separate babel blocks. I got the suggestion to
> call a named block, which might be of interest if you've not done that
> before?
> - General use: 
> https://www.mail-archive.com/emacs-orgmode@gnu.org/msg56684.html- Using a 
> #+call line:
> https://www.mail-archive.com/emacs-orgmode@gnu.org/msg56688.html
>
>
> Sorry I can't be of more help!
>
> John

-- 



Re: [O] How to write a org babel hook, which can manupulate result

2014-03-26 Thread Feng Shu
Daimrod  writes:

> Feng Shu  writes:
>
>> Hi:
> Hi Feng,
>
> Look at the :post header argument.
> (info "(org) post")

How to use elisp in :post directly,
for example:

#+begin_src R :results output raw drawer :post (align-multi-table)
  
#+end_src

#+begin_comment
(defun align-multi-table (&optional content)
  (interactive)
  (let ((content (or content *this*)))
(with-temp-buffer
  (insert content)
  (goto-char (point-min))
  (while (not (eobp))
(when (org-at-table-p)
  (org-table-align))
(forward-line))
  (buffer-string
#+end_comment

>
>> I want to write a hook to menupulate org babel output,
>> The problem is: How can I get two points info: [pointA] and [pointB]
>> in my hook function?
>>
>> #+begin_src R :results output raw drawer
>> tbl <- data.frame(a=c(1,2,3),b=c(3,2,1))
>> print(ascii(tbl),type="org")
>> #+END_SRC
>>
>> #+RESULTS:
>> :RESULTS:
>> [pointA]
>> |   |a |b |
>> |---+--+--|
>> | 1 | 1.00 | 3.00 |
>> | 2 | 2.00 | 2.00 |
>> | 3 | 3.00 | 1.00 |
>> [pointB]
>> :END:

-- 




Re: [O] How to write a org babel hook, which can manupulate result

2014-03-26 Thread Feng Shu
Daimrod  writes:

> Feng Shu  writes:
>
>> Hi:
> Hi Feng,
>
> Look at the :post header argument.
> (info "(org) post")

Thanks ...
>
>> I want to write a hook to menupulate org babel output,
>> The problem is: How can I get two points info: [pointA] and [pointB]
>> in my hook function?
>>
>> #+begin_src R :results output raw drawer
>> tbl <- data.frame(a=c(1,2,3),b=c(3,2,1))
>> print(ascii(tbl),type="org")
>> #+END_SRC
>>
>> #+RESULTS:
>> :RESULTS:
>> [pointA]
>> |   |a |b |
>> |---+--+--|
>> | 1 | 1.00 | 3.00 |
>> | 2 | 2.00 | 2.00 |
>> | 3 | 3.00 | 1.00 |
>> [pointB]
>> :END:

-- 




[O] How to write a org babel hook, which can manupulate result

2014-03-26 Thread Feng Shu
Hi:

I want to write a hook to menupulate org babel output,
The problem is: How can I get two points info: [pointA] and [pointB]
in my hook function?

#+begin_src R :results output raw drawer
tbl <- data.frame(a=c(1,2,3),b=c(3,2,1))
print(ascii(tbl),type="org")
#+END_SRC

#+RESULTS:
:RESULTS:
[pointA]
|   |a |b |
|---+--+--|
| 1 | 1.00 | 3.00 |
| 2 | 2.00 | 2.00 |
| 3 | 3.00 | 1.00 |
[pointB]
:END:



-- 



Re: [O] Better way to specify the latex documentclass of an exported file without changing my configuration?

2014-03-26 Thread Feng Shu
Alan Schmitt  writes:

> Hello,
>
> I'm collaborating on a paper with some colleagues, and I convinced them
> to use org-mode. I'm trying to make sure the paper is as self-contained
> as possible (I don't want them to have to change their emacs
> configuration file).To change the documentclass name of the exported

Maybe you can write a Makefile to change their emacs configure...
> article, I added the following block in a section that is not exported:
> --8<---cut here---start->8---
> #+begin_src emacs-lisp :results silent :exports results
>   (add-to-list 'org-latex-classes
>'("llncs"
>  "\\documentclass{llncs}"
>  ("\\section{%s}" . "\\section*{%s}")
>  ("\\subsection{%s}" . "\\subsection*{%s}")
>  ("\\subsubsection{%s}" . "\\subsubsection*{%s}")))
> #+end_src
> --8<---cut here---end--->8---
>
> My questions are:
> - is there a way to do this without an emacs-lisp block?
> - is there a nicer way to make sure that an emacs-lisp block is
> evaluated upon export than ":exports results :results silent"? (If
> I don't put it there, the block is not evaluated.)
> - is there a way to just say the name of the documentclass without all
> the boilerplate code below? In other words, can I say "this is a llncs
> documentclass with the same sectioning as an article"?

You should defun a classe for llncs.sty before use it. maybe
you can rename llncs.sty to article.sty, and put it to directory which contain
your org file.

>
> Thanks,
>
> Alan

-- 




Re: [O] Basic vcard-to-org-contacts converter

2014-03-24 Thread Feng Shu
Titus von der Malsburg  writes:

> Hi list!
>
> I decided to give org-contacts a try.  Since there doesn't seem to be a
> facility for importing contacts in vcard format, I wrote a little Python
> script for that.  Perhaps someone on this list finds it useful.
>
>   https://gist.github.com/tmalsburg/9747104
>
> The script uses the Python package vobject for parsing vcard files.  On
> Debian-like systems this package is available as python-vobject.  I
> tested the script with contacts exported from Apple's iCloud service and
> that worked well.  However, the vcard format is somewhat messy and I
> don't know what happens with vcard files generated in other contact
> managers.  Use at your own risk.

Import from csv is a solution too, I use the below hack functions to import a
csv file...

#+begin_src

(defun eh-org-contacts-parse-csv-line (line)
  "Build a org contact from a csv line"
  (let ((list (split-string line ",")))
(concat "* " (nth 0 list) "\n"
":PROPERTIES:\n"
":PHONE: " (nth 1 list) "\n"
":EMAIL: " (let ((string (nth 2 list)))
 (if (string-match-p "@" string) string
   (if (> (length string) 0) (concat string 
"@qq.com" "\n"
":NOTE: "  (mapconcat 'identity (nthcdr 3 list) "; ") "\n"
":END:\n")))

(defun eh-org-contacts-csv-import (&optional filename)
  "Convert a csv file to org contacts format and insert current point"
  (interactive)
  (let ((file (if filename filename (read-file-name "CSV file:")))
(buffer (current-buffer))
(point (point))
contacts-string)
  (with-temp-buffer
(insert-file-contents file)
(goto-char (point-min))
(while (< (point) (point-max))
  (setq contacts-string (concat contacts-string 
(eh-org-contacts-parse-csv-line (buffer-substring (point) (progn (end-of-line) 
(point "\n"))
  (forward-line 1)
  (beginning-of-line 1)))
  (switch-to-buffer buffer)
  (goto-char point)
  (insert contacts-string)))

#+end_src

>
> If there's interest, I might migrate the script to a proper Github
> repository and develop it further, i.e., merge your pull-requests ;-)
>
>   Titus

-- 




Re: [O] org-babel R output table with plot

2014-03-24 Thread Feng Shu
John Hendy  writes:

> On Mon, Mar 24, 2014 at 10:22 AM, Feng Shu  wrote:
>> Hi everyone
>>
>> I want to R output table with plot, I use a solution below,
>> Who can tell me other solutions?
>>
>
> I sort of follow the below, but I think it would be more helpful to
> describe what you *don't* like about the output below. In other words,
> what are you trying to achieve that is not working below?
>

It just suit my need, but I want to know more simper solution, which let
me type less code.

>
> John
>
>> thanks!
>>
>> #+begin_src R  :results output raw drawer
>>   require("ascii")
>>
>>   print.org <- function (x, caption)
>>   {
>>   print(paragraph(paste("#+CAPTION: ", caption, sep="")),type="org")
>>   print(ascii(x),type="org")
>>   }
>>   plot.org  <- function (x, caption)
>>   {
>>   pngfile <- paste(caption, ".png", sep="")
>>   print(paragraph(paste("#+CAPTION: ", caption, sep="")),type="org")
>>   png(pngfile)
>>   plot(x)
>>   dev.off()
>>   print(paragraph(paste("[[./", pngfile, "]]", 
>> sep=""),new=FALSE),type="org")
>>
>>   }
>>   data <- data.frame(x=c(1,20,100,800),y=c(200,4,5,29))
>>   print.org(data, "test-table1")
>>   print.org(data, "test-table2")
>>   plot.org(data, "test-pic")
>>
>> #+end_src
>>
>> #+RESULTS:
>> :RESULTS:
>>
>> #+CAPTION: test-table1
>> |   | x  | y  |
>> |---++|
>> | 1 | 1.00   | 200.00 |
>> | 2 | 20.00  | 4.00   |
>> | 3 | 100.00 | 5.00   |
>> | 4 | 800.00 | 29.00  |
>>
>> #+CAPTION: test-table2
>> |   | x  | y  |
>> |---++|
>> | 1 | 1.00   | 200.00 |
>> | 2 | 20.00  | 4.00   |
>> | 3 | 100.00 | 5.00   |
>> | 4 | 800.00 | 29.00  |
>>
>> #+CAPTION: test-pic
>> [[./test-pic.png]]
>> :END:
>>
>>
>> --
>>

-- 




[O] org-babel R output table with plot

2014-03-24 Thread Feng Shu
Hi everyone

I want to R output table with plot, I use a solution below,
Who can tell me other solutions?

thanks!

#+begin_src R  :results output raw drawer
  require("ascii")

  print.org <- function (x, caption)
  {
  print(paragraph(paste("#+CAPTION: ", caption, sep="")),type="org")
  print(ascii(x),type="org")
  }
  plot.org  <- function (x, caption)
  {
  pngfile <- paste(caption, ".png", sep="")
  print(paragraph(paste("#+CAPTION: ", caption, sep="")),type="org")
  png(pngfile)
  plot(x)
  dev.off()
  print(paragraph(paste("[[./", pngfile, "]]", 
sep=""),new=FALSE),type="org")
  
  }
  data <- data.frame(x=c(1,20,100,800),y=c(200,4,5,29))
  print.org(data, "test-table1")
  print.org(data, "test-table2")
  plot.org(data, "test-pic")
  
#+end_src

#+RESULTS:
:RESULTS:

#+CAPTION: test-table1 
|   | x  | y  |
|---++|
| 1 | 1.00   | 200.00 |
| 2 | 20.00  | 4.00   |
| 3 | 100.00 | 5.00   |
| 4 | 800.00 | 29.00  |

#+CAPTION: test-table2 
|   | x  | y  |
|---++|
| 1 | 1.00   | 200.00 |
| 2 | 20.00  | 4.00   |
| 3 | 100.00 | 5.00   |
| 4 | 800.00 | 29.00  |

#+CAPTION: test-pic 
[[./test-pic.png]] 
:END:


-- 



[O] about truncate line depend context

2014-03-24 Thread Feng Shu

Now I set  truncate-lines to -1 in my org file, but the table shows
ugly, So I use below code.

Can I use a hook to do this job?

#+begin_src elisp
(defun eh-org-truncate-lines (&optional arg)
  (interactive "P")
  (cond
   ((or (and (boundp 'org-clock-overlays) org-clock-overlays)
org-occur-highlights
org-latex-fragment-image-overlays)
(and (boundp 'org-clock-overlays) (org-clock-remove-overlays))
(org-remove-occur-highlights)
(org-remove-latex-fragment-image-overlays)
(message "Temporary highlights/overlays removed from current buffer"))
   (t
(let* ((context (org-element-context)) (type (org-element-type context)))
  (case type
((table table-cell table-row item plain-list)
 (toggle-truncate-lines 1))
(t (toggle-truncate-lines -1)))

(defun eh-org-ctrl-c-ctrl-c (&optional arg)
  (interactive)
  (eh-org-truncate-lines arg)
  (org-ctrl-c-ctrl-c arg))

(org-defkey org-mode-map "\C-c\C-c" 'eh-org-ctrl-c-ctrl-c)

#+end_src

-- 



Re: [O] html to org-mode

2014-01-03 Thread Feng Shu
John Kitchin  writes:

> Hi everyone,
>
> I was playing around with org-rss today, and it is pretty cool. I
> would like to customize the way the subheading bodies look though,
> primarily to unescape some html things like <, to get rid of all
> the html tags, convert  to org-mode links, to download 
> so they can be displayed, etc... 
>
> for example a body of an rss entry looks like: 
>
> Philip Herron: Cython Book
> http://redbrain.co.uk/?p=147
> http://redbrain.co.uk/cython-book/ Hey
> all i thought i should really share that i actually wrote a book on
> Cython. The book has detailed examples and even shows you how you can
> extend native C/C++ applications in python by doing it for Tmux.  href="http://bit.ly/195ahQs";>http://bit.ly/195ahQs  href="http://redbrain.co.uk/wp-content/uploads/2013/12/photo.jpg";> class="aligncenter size-full wp-image-148" alt="photo"
> src="http://redbrain.co.uk/wp-content/uploads/2013/12/photo.jpg";
> width="640" height="480" />The code can be found:  href="https://github.com/redbrain/cython-book";>https://github.com/redbrain/cython-book
> Tue, 10 Dec 2013 14:45:08 +
>
> I would like this simplified to something like:
> Philip Herron: Cython Book
>
> http://redbrain.co.uk/?p=147
>
> http://redbrain.co.uk/cython-book/
> Hey all i thought i should really share that i actually wrote a book
> on Cython. The book has detailed examples and even shows you how you
> can extend native C/C++ applications in python by doing it for Tmux.
> http://bit.ly/195ahQs
>
> [[feed-images/photo.jpg]]
>
> The code can be found: https://github.com/redbrain/cython-book
>
> basically, get the html code as close to org as reasonable. i found a
> way to get an html parse tree (libxml-parse-html-region start end),
> but I can't figure out how to convert that to the text I want. 
>
> Has anyone done anything like this?
>
> John

Maybe eww can help you...

>
> ---
> John Kitchin
> Associate Professor
> Doherty Hall A207F
> Department of Chemical Engineering
> Carnegie Mellon University
> Pittsburgh, PA 15213
> 412-268-7803
> http://kitchingroup.cheme.cmu.edu

-- 



Re: [O] How can I convert a org file to a flowchart

2013-12-06 Thread Feng Shu
Rainer M Krug  writes:

> On Fri Dec  6 15:07:56 2013, Bastien wrote:
>> Hi Feng,
>>
>> Feng Shu  writes:
>>
>>> I have to draw a flowchart with many many nodes (about 500) and less
>>> construct types(only sequence construct and condition construct),
>>>
>>> Now I use org file record all the node labels, How can I convert this
>>> org to a flowchar if i use tag and link to record all the construct?
>>
>> AFAIK you can't.
>
> True - but a custom exporter to do this (export to plantuml format?)
> would rally be great

I find the new activity format of plantuml is very interesting

#+begin_src plantuml :file test.png
start
:the first node;
if (do you like org-mode?) then (Yes)
  :Hello friend;
else (I don't like it)
  :Goodbye;
endif
:the last node;
stop
#+end_src

>
> Cheers,
>
> Rainer
>
>>
>
> --
> Rainer M. Krug, PhD (Conservation Ecology, SUN), MSc (Conservation
> Biology, UCT), Dipl. Phys. (Germany)
>
> Centre of Excellence for Invasion Biology
> Stellenbosch University
> South Africa
>
> Tel :   +33 - (0)9 53 10 27 44
> Cell:   +33 - (0)6 85 62 59 98
> Fax :   +33 - (0)9 58 10 27 44
>
> Fax (D):+49 - (0)3 21 21 25 22 44
>
> email:  rai...@krugs.de
>
> Skype:  RMkrug

-- 



Re: [O] How can I convert a org file to a flowchart

2013-12-06 Thread Feng Shu
Rainer M Krug  writes:

> On Fri Dec  6 15:07:56 2013, Bastien wrote:
>> Hi Feng,
>>
>> Feng Shu  writes:
>>
>>> I have to draw a flowchart with many many nodes (about 500) and less
>>> construct types(only sequence construct and condition construct),
>>>
>>> Now I use org file record all the node labels, How can I convert this
>>> org to a flowchar if i use tag and link to record all the construct?
>>
>> AFAIK you can't.
>
> True - but a custom exporter to do this (export to plantuml format?)
> would rally be great

Good idea! Maybe I can export org file  to graphviz's dot file then convert it 
to
a picture...

>
> Cheers,
>
> Rainer
>
>>
>
> --
> Rainer M. Krug, PhD (Conservation Ecology, SUN), MSc (Conservation
> Biology, UCT), Dipl. Phys. (Germany)
>
> Centre of Excellence for Invasion Biology
> Stellenbosch University
> South Africa
>
> Tel :   +33 - (0)9 53 10 27 44
> Cell:   +33 - (0)6 85 62 59 98
> Fax :   +33 - (0)9 58 10 27 44
>
> Fax (D):+49 - (0)3 21 21 25 22 44
>
> email:  rai...@krugs.de
>
> Skype:  RMkrug

-- 



[O] How can I convert a org file to a flowchart

2013-11-27 Thread Feng Shu

Hello:

I have to draw a flowchart with many many nodes (about 500) and less
construct types(only sequence construct and condition construct),

Now I use org file record all the node labels, How can I convert this
org to a flowchar if i use tag and link to record all the construct?


for example:

* A
* B :COND:
* C
* D

to a -> B -> C
 \-> D  


Thanks
-- 



Re: [O] Near real-time preview of PDF/ODT export?

2013-11-25 Thread Feng Shu
Yagnesh Raghava Yakkala  writes:

> On Nov 22 2013, Bastien  wrote:
>
> Hello all,
>
> I have been using a simple bash script with a Makefile to make pdf file to be
> updated with org source on each save while I am editing. It is working fine
> for me. Of course its not exactly real time but fast enough feedback for me.
>
> I am attaching my files hoping that they may be useful for others. one may
> need to edit init.el and Makefile for their use case.  I run something like
> this.
>
> $ watcher.sh paper.org make
>
> Watcher script checks every second to see if the org file is modified and runs
> make command. 
>
We can use auto-shell-command 
[[https://github.com/ongaeshi/auto-shell-command][auto-shell-command]] 

>
>
>
> Thanks.,

-- 



Re: [O] ox-bibtex.el -- how to join sequential citations

2013-11-23 Thread Feng Shu
Eric Schulte  writes:

> Hi,
>
> I've been using ox-bibtex.el for a couple of days now and am really
> enjoying both the bibtex integration and the HTML export through
> bibtex2html.  I have run into one issue which I'm now sure how best to
> fix.
>
> When exporting multiple sequential citations e.g., cite:foo cite:bar
> etc... I would like to see something like the following (latex used for
> this example) "\cite{foo, bar}", but instead I'm getting "\cite{foo}
> \cite{bar}", which leads to poorly formed PDFs (a similar thing happens
> for HTML export).

May be you should use \cite{foo, bar} directly in org file.

>
> My question is how best to fix this, should I write a filter function,
> or does the export engine already have processes in place to handle
> these sorts of export context issues?
>
> Thanks,

-- 



Re: [O] Converting org-mode/org-contacts to VCard (importing to Android)

2013-11-23 Thread Feng Shu
Karl Voit  writes:

> * Rüdiger Sonderfeld  wrote:
>> On Friday 22 November 2013 17:37:01 Karl Voit wrote:
>>> The reason I wrote it in Python is that I don't know ELISP well
>>> enough. The reason I wrote the script instead of using existing
>>> export methods: I only want to export a small sub-set (names, phone
>>> numbers, email addresses, contact image) due to privacy reasons.
>>
>> That should be possible with the existing VCard export.  See `org-contacts-
>> ignore-property' to ignore specific properties.  And `org-contacts-export-as-
>> vcard' takes a NAME parameter to limit the names.
>
> Fair enough :-)
>
> However, I did additional things like checks, filtering, and so
> forth that were important to my data-set. E.g., my contact template
> does contain "0043/" as a pre-filled content for phone numbers. I
> wanted to ignore those fields that got only this template and not a
> complete phone number. I also wanted to get warnings in case some
> data does not fulfill certain other requirements.

use (replace-regexp-in-string "^[0-9]\\{4,4\\}/" "" "0043/333/333")

#+begin_src
(defun org-contacts-vcard-format (contact)
  "Formats CONTACT in VCard 3.0 format."
  (let* ((properties (caddr contact))
 (name (org-contacts-vcard-escape (car contact)))
 (n (org-contacts-vcard-encode-name name))
 (email (cdr (assoc-string org-contacts-email-property properties)))
 (tel (cdr (assoc-string org-contacts-tel-property properties)))
 (ignore-list (cdr (assoc-string org-contacts-ignore-property 
properties)))
 (ignore-list (when ignore-list
(org-contacts-split-property ignore-list)))
 (note (cdr (assoc-string org-contacts-note-property properties)))
 (bday (org-contacts-vcard-escape (cdr (assoc-string 
org-contacts-birthday-property properties
 (addr (cdr (assoc-string org-contacts-address-property properties)))
 (nick (org-contacts-vcard-escape (cdr (assoc-string 
org-contacts-nickname-property properties
 (head (format "BEGIN:VCARD\nVERSION:3.0\nN:%s\nFN:%s\n" n name))
 emails-list result phones-list)
(concat head
(when email (progn
  (setq emails-list 
(org-contacts-remove-ignored-property-values ignore-list 
(org-contacts-split-property email)))
  (setq result "")
  (while emails-list
(setq result (concat result  "EMAIL:" 
(org-contacts-strip-link (car emails-list)) "\n"))
(setq emails-list (cdr emails-list)))
  result))
(when addr
  (format "ADR:;;%s\n" (replace-regexp-in-string "\\, ?" ";" addr)))
(when tel (progn
(setq phones-list 
(org-contacts-remove-ignored-property-values ignore-list 
(org-contacts-split-property tel)))
(setq result "")
(while phones-list
  (setq result (concat result  "TEL:"  
(replace-regexp-in-string "^[0-9]\\{4,4\\}/" ""  (org-link-unescape 
(org-contacts-strip-link (car phones-list "\n"))
  (setq phones-list (cdr phones-list)))
result))
(when bday
  (let ((cal-bday (calendar-gregorian-from-absolute 
(org-time-string-to-absolute bday
(format "BDAY:%04d-%02d-%02d\n"
(calendar-extract-year cal-bday)
(calendar-extract-month cal-bday)
(calendar-extract-day cal-bday
(when nick (format "NICKNAME:%s\n" nick))
(when note (format "NOTE:%s\n" note))
"END:VCARD\n\n")))

#+end_src

>
> I have to admit that I don't know the feature-set of the Org-mode
> export. I would be very surprised, if the Org-mode export method is
> able to follow my custom "photo:" link I am using, grab the image
> file, test if it has a image format that works with VCard
> 2.1 on Android, and encodes it in base64 accordingly.
>
> You see: I want to have ways to tweak the export process. And as
> long as I don't know ELISP that well, I stick to the tools I know.
>
>
> A side remark of mine: a couple of months ago I tried to find out
> how to store address information, phone numbers, and so on in
> org-contact properties. AFAIR I could not find anything except the
> :EMAIL: property. Is there a standard out there that answers
> questions like "separate street from house number?", "how to cope
> with multiple addresses for one contact?", and so forth? I created
> something on my own as you can see on [1].
>
>
> I am happy if you can get benefit from my little project and I am
> also happy when Org-mode offers a great export functionality for the
> rest of us :-)
>
>   1. 
> https://raw.github.com/novoid/org-contacts2vcard/master/testdata/testcontacts.org--
>  
> mail|git|SVN|photos|postings|SMS|phonecal

Re: [O] Converting org-mode/org-contacts to VCard (importing to Android)

2013-11-23 Thread Feng Shu
Karl Voit  writes:

> Hi!
>
> I wrote a Python script that parses an Org-mode file in order to
> generate a VCard 2.1 compatible output file I am using to import to
> my Android 4.4 device:
>
> https://github.com/novoid/org-contacts2vcard
>
> The reason I wrote it in Python is that I don't know ELISP well
> enough. The reason I wrote the script instead of using existing
> export methods: I only want to export a small sub-set (names, phone
> numbers, email addresses, contact image) due to privacy reasons.

the below function  will only export name, phones and email

#+begin_src
(defun org-contacts-vcard-format (contact)
  "Formats CONTACT in VCard 3.0 format."
  (let* ((properties (caddr contact))
 (name (org-contacts-vcard-escape (car contact)))
 (n (org-contacts-vcard-encode-name name))
 (email (cdr (assoc-string org-contacts-email-property properties)))
 (tel (cdr (assoc-string org-contacts-tel-property properties)))
 (ignore-list (cdr (assoc-string org-contacts-ignore-property 
properties)))
 (ignore-list (when ignore-list
(org-contacts-split-property ignore-list)))
 (head (format "BEGIN:VCARD\nVERSION:3.0\nN:%s\nFN:%s\n" n name))
 emails-list result phones-list)
(concat head
(when email (progn
  (setq emails-list 
(org-contacts-remove-ignored-property-values ignore-list 
(org-contacts-split-property email)))
  (setq result "")
  (while emails-list
(setq result (concat result  "EMAIL:" 
(org-contacts-strip-link (car emails-list)) "\n"))
(setq emails-list (cdr emails-list)))
  result))
(when tel (progn
(setq phones-list 
(org-contacts-remove-ignored-property-values ignore-list 
(org-contacts-split-property tel)))
(setq result "")
(while phones-list
  (setq result (concat result  "TEL:" 
(org-link-unescape (org-contacts-strip-link (car phones-list))) "\n"))
  (setq phones-list (cdr phones-list)))
result))
"END:VCARD\n\n")))

#+end_src

>
> So far, it is a one-direction approach and no synchronization
> solution.
>
>
>
> By the way: does somebody know of any somewhat intelligent tool that
> is able to compare two different VCard files? The main issue here is
> the fact that VCard order and property order within a single VCard
> can be different but the VCard file could still contain the same
> information. So line-by-line comparisons like diff do not work here.

This may be difficult, I use org-contacts and use a elisp function to
merge all the contacs which have  same name. then export contacts to a
vcard file.

-- 



Re: [O] Wanted: Caretaker of the ODT backend

2013-09-24 Thread Feng Shu
Carsten Dominik  writes:

> Hi Christian,
>
> On 24.9.2013, at 15:18, Christian Moe  wrote:
>
>> 
>> Hi,
>> 
>> I don't have the developer skillz.
>> 
>> Otherwise I'd be happy to help out any way I can, e.g. tracking issues
>> and requests, digging into ODT format, replicating bugs and testing
>> patches on a more systematic basis.
>
> Thanks, this would be great.
>
>> 
>> (The latter two assuming I can root out the setup/installation weirdness
>> that seems to affect my local ODT export.)
>> 
>> I see Jambunathan has placed his patches in the public domain under a
>> GPL-compatible CC0 license. Other considerations aside, doesn't that
>> mean they could be applied in Org?
>
> Putting them under CC0 means that we could use them, and that Emacs
> could in principle use them as well.  However, Emacs has made the *choice*
> to only include stuff for which they have the copyright assignment to
> the FSF.  (Stefan does reiterate this in the thread following Jambunathans
> message). Since Org is distributed as part of Emacs, this also applies
> to us.
>
> I have looked at the patches.
>
> 1. Implement an alternative format for description lists.  Description
>lists are, I think, already "supported" by the odt exporter, even
>though odt does not seem to support them natively.
> 2. As far as I can see, this mainly implements a simpler way to access
>attributes internally.  It does not fix any bug I would know about.
> 3. Introduces some kind of new way to force page breaks.  I don't
>see why we need it.
> 4. adds jabref support.  Sounds interesting, but I don't know if anyone
>here uses it or would like to use it.

I use this feature now. In my opinion, this is very cool. 
I use org-mode to write paper draft and export the draft to odf file instead of 
pdf file, the 
reason is that I can't develop a suitable latex style 
for our university... so  ox-jabref.el + ox-odt.el become a 
easy approach.

>
> So I don't think any of this is required at this moment.  But it would
> be great if you could keep en eye out for mailing list requests and
> bug reports around this exporter and try to get things fixed when necessary.
>
> Thanks!
>
> - Carsten
>
>
>> 
>> Yours,
>> Christian
>> 
>> 
>> Carsten Dominik writes:
>> 
>>> Hi eager Org mode contributors
>>> 
>>> One more try - it would be really nice to find a volunteer for this task.
>>> I can do this myself - but it would take time away from other tasks.
>>> 
>>> - Carsten
>>> 
>>> On 18.9.2013, at 06:38, Carsten Dominik  wrote:
>>> 
 Hi,
 
 I am looking for someone who knows about the internals of the ODT
 file format, and who would have time to become the responsible
 person for ox-odt.el.  Since we cannot take patches from the
 original author (Jambunathan) anymore, this module is currently
 orphaned.
 
 There are a few recent patches Jambunathan has made and published here:
 
 http://debbugs.gnu.org/cgi/bugreport.cgi?bug=15384>>> 
 We cannot take them (due to FSF rules and for other reasons as
 well) - but the new maintainer can take a look at them and see if
 there is functionality or bug fixes we need and re-implment those.
 For the rest I would hope that you can watch the mailing list and
 Emacs bug reports for issues related to this backend and try to
 fix them, obviously with support from the mailing list.
 Also,maybe there are ideas for additional functionality?
 
 Please write to me if you are interested.
 
 Thank you.
 
 - Carsten
>> 

-- 



[O] A elisp quesion

2013-09-24 Thread Feng Shu

Hello everyone:

How can I convert list '(1 2 3 5 6 8 9 13 48) to '((1 2 3) (5 6) (8 9)(13) 
(48)) ?

Thanks
-- 



[O] An org-contacts merge function, may be it is useful to someone

2013-09-05 Thread Feng Shu

This is a contacts merge function, you can use it to merge duplicate
contacts

---

(defun eh-org-contacts-merge-contacts ()
  "Merge duplicate contacts"
  (interactive)
  (dolist (name (let ((contact-list (org-contacts-filter nil nil)))
  (delete-dups
   (loop for contact in contact-list
 collect (substring-no-properties
  (org-contacts-vcard-escape (car contact)))
;; let UPDATE be the first contact matching NAME
(let* ((contacts (org-contacts-filter (concat "\\b" name "\\b")))
   (update (first contacts)))
  (save-excursion
(with-current-buffer (marker-buffer (second update))
  (goto-char (marker-position (second update)))
  ;; for all other contacts matching NAME as CONTACT
  (dolist (contact (rest contacts))
;; add all properties to UPDATE
(loop with special-properties = (mapcar 'first 
(org-entry-properties nil 'special))
  for (property . value) in (third contact)
  unless (member property special-properties)
  do (if (or (string= property "TAGS") (string= property 
"ALLTAGS"))
 (org-set-tags-to (delete-dups
   (nconc (org-get-tags-at)
  (split-string (if value value 
"") ":" t
   (let ((second-value (org-entry-get nil property)))
 (unless (string= (org-contacts-strip-link (if 
second-value second-value ""))
  (org-contacts-strip-link (if value 
value "")))
   (org-entry-put nil property
  (concat (org-entry-get nil property)
  " " value))
;; delete CONTACT
(save-excursion
  (with-current-buffer (marker-buffer (second contact))
(goto-char (marker-position (second contact)))
(let ((plist (second (org-element-at-point
  (delete-region (plist-get plist :begin)
 (plist-get plist :end)))



[O] csv and vcf export about org-contacts.el

2013-09-02 Thread Feng Shu

Recently, I have found a android app (customer contacts) which can quickly 
search contacts
(csv format), so I hack a csv exporter based the vcf exporter's code, does 
org-contacts
need a csv exporter default?



-- Feng Shu

-- 



Re: [O] require a feature: merge many contacts which have the same name.

2013-09-02 Thread Feng Shu
Hello, Daimrod

I remember that  you have mailed  me a elisp function which can merge contacts,
but now I can't find this function, so could you resend it to me ?  

Thanks!


--- Feng shu



Re: [O] [ANN] Bibliography support ODT + JabRef

2013-07-30 Thread Feng Shu
> Caching of citekey->XML or whatever transformation is one option.
> Another option is to just disable citations for casual exports and
> enable it one for the final output.
> 
> Something like
> 
> cite:t
> 
> for #+OPTIONS.
> 
> For now you can customize `org-odt-citation-transcoders' so that
> citation processing is disabled.
I prefer cache system, the reason may sound a bit funny:

My thesis has more than 50 reference. I use exporting and viewing reference 
output
to check  my thesis reference. this method very simple, but if exporting speed
is too slow, this method nearly useless. 

-- 



Re: [O] [ANN] Bibliography support ODT + JabRef

2013-07-30 Thread feng shu
On Tue, Jul 30, 2013 at 1:07 PM, Jambunathan K wrote:

>
> Nicolas, just jump to the last para.
>
> Feng Shu
>
> Please CC the mailing list.  I don't mind receiving or replying to
> one-to-one mails but things that we exchange will be of interest to
> other members.
>
> feng shu  writes:
>
> > 1. When I add (setq org-odt-data-dir "~/project/org-mode/etc/") to my .
> > emacs file, it works properly, Thanks!
> >
> > 2. Two question:
> > 1. How can I get uppercite: test^[1] instead of test[1]?
> > 2. How can I get compressed cite,like: test^[3, 5, 7-10, 16]
>
> Thanks for the requests.
>
> Numbering is done by ox-jabref.el and not by JabRef application, so
> these requests can indeed be met with 5-15 minute of effort.  But I
> hesitate to
>
> The main problem is there are just too many styles a Bibliographic
> Reference can be typeset - right from what some standard says, to what
> my university wants to what I prefer myself.
>
> This is where some sort of common agreement - even just among the
> members of the community - will help.  I will keep listening to the
> conversation and hopefully an opinion will emerge during the course of
> time.
>

We don't need include all the styles, but we should make the feature easy
hack for end users. we can introduce hook and filter!


>
> > Forgot to mention:
>
> > The speed of converting bib to xml is slow, may be we should introduce
> > a cache system.
>
> If you use "Numbered" transcoders, then the citekeys are processed one
> by one.  So if there are 10 citekeys, then there will be 20 invocations
> of command line.
>
> One way of dealing with this is to choose a transcoder, that doesn't
> enumerate.  In that case the Bibliographic Reference is created enbloc.
> So the number of command line invocations will reduce to 11 = 10 + 1.
> The ASCII document that I circulated gives examples of such transcoders.
>
> > just like previewing latex snippet.
>
> Caching of citekey->XML or whatever transformation is one option.
> Another option is to just disable citations for casual exports and
> enable it one for the final output.
>
> Something like
>
>cite:t
>
> for #+OPTIONS.
>
> For now you can customize `org-odt-citation-transcoders' so that
> citation processing is disabled.
>
>
>
>


Re: [O] [PATCH] [need test]Restruct `org-create-formula-image' function

2013-07-20 Thread Feng Shu
Nick Dokos  writes:

> feng shu  writes:
>
>> `org-create-formula-image-with-dvipng' and
>> `org-create-formula-image-with-imagemagick'
>> share a good deal of logic, so combine them to a function.
>>
>>
>
> I have wondered aloud in the past whether it is necessary to have two
> methods for this. They are pretty much equivalent although the
> imagemagick method is IMO slightly less brittle than the dvipng method.
> So instead of spending time to tie them even more closely together, we
> should investigate whether one of them should go.
>
> Maybe we can have a poll...
imagemagick method is useful for xelatex users, but it compile a snippet
more slower than dvipng method. 

We don't need remove one of them. we can do like this:

1. conbine tex:dvipng and tex:imagemagick to  tex:image
2. remove `org-latex-create-formula-image-program'
3. defcustom `org-create-formula-image-processes' in my patch.
4. update document.

It is very similar `org-latex-pdf-process'

   

-- 



[O] [PATCH] [need test]Restruct `org-create-formula-image' function

2013-07-20 Thread feng shu
`org-create-formula-image-with-dvipng' and
`org-create-formula-image-with-imagemagick'
share a good deal of logic, so combine them to a function.


0001-Restruct-org-create-formula-image-function.patch
Description: Binary data


[O] Please Comment: a potential Innovation about proviewing latex fragement with imagemagick

2013-07-16 Thread feng shu
* Approach of previewing latex fragement  with imagemagick is like this:
**  The original:

1. (emacs buffer font height) -> (evalue a density value) --> (imagemagick
destiny option)
2. (latex fragement) --> (tmp latex file) -> (pdf) -> (png) ( convert with
above destiny option)

** Advantages
1. It works well at the moment.
** disadvantages
2. we get the formula about (font height -> density value) by test and test
and test...


** A pontential approach:
1. (emacs buffer font height) -> (latex macros;
\fontsize{font-size}{fontsize*1.2}) -> (insert tmp latex file )-> pdf ->
png( convert with fixed density, for example: 96)

** Advantages
1. More intuition
2. This approach may be used  the feature "p-with-dvipng", by using this
approach,
Maybe we can code a common function shared with imagemagick ang dvipng.

** disadvantages
1. depend latex command \fontsize.


Any comment?


Feng Shu


Re: [O] [PATCH] bugfix: fix previewing latex fragments with imagemagick

2013-07-14 Thread Feng Shu

This is version 2,

>From 1ea9620cd3051cb982a4fb7ddb6f8a68fd0df4a6 Mon Sep 17 00:00:00 2001
From: Feng Shu 
Date: Sun, 14 Jul 2013 14:18:53 +0800
Subject: [PATCH] Fix generating LaTeX formula images

* lisp/ox-odt.el (org-odt--translate-latex-fragments): Fix imagemagick support.
* lisp/ox-html.el (org-html-latex-environment)
(org-html-latex-fragment): Fix imagemagick support.
* org.el (org-create-formula-image-with-imagemagick): Generate correct
size formula image.
(org-format-latex-header): Change pagestyle command position.
* doc/org.texi (@LaTeX{} fragments)
(Previewing @LaTeX{} fragments)
(Math formatting in HTML export)
(Working with @LaTeX{} math snippets): Add document about creating
formula image with imagemagick.
---
 doc/org.texi|   32 +++-
 lisp/org.el |4 ++--
 lisp/ox-html.el |4 ++--
 lisp/ox-odt.el  |   11 ++-
 4 个文件被修改,插入 33 行(+),删除 18 行(-)

diff --git a/doc/org.texi b/doc/org.texi
index 8db410c..97e6ef6 100644
--- a/doc/org.texi
+++ b/doc/org.texi
@@ -10156,10 +10156,10 @@ snippets will be identified as @LaTeX{} source code:
 @item
 Environments of any kind@footnote{When @file{MathJax} is used, only the
 environments recognized by @file{MathJax} will be processed.  When
-@file{dvipng} is used to create images, any @LaTeX{} environment will be
-handled.}.  The only requirement is that the @code{\begin} and @code{\end}
-statements appear on a new line, at the beginning of the line or after
-whitespaces only.
+@file{dvipng} program or @file{imagemagick} suite is used to create images,
+any @LaTeX{} environment will be handled.}.  The only requirement is that the
+@code{\begin} and @code{\end} statements appear on a new line, at the
+beginning of the line or after whitespaces only.
 @item
 Text within the usual @LaTeX{} math delimiters.  To avoid conflicts with
 currency specifications, single @samp{$} characters are only recognized as
@@ -10197,7 +10197,6 @@ lines:
 
 @example
 #+OPTIONS: tex:t  @r{Do the right thing automatically (MathJax)}
-#+OPTIONS: tex:dvipng @r{Force using dvipng images}
 #+OPTIONS: tex:nil@r{Do not process @LaTeX{} fragments at all}
 #+OPTIONS: tex:verbatim   @r{Verbatim export, for jsMath or so}
 @end example
@@ -11257,6 +11256,7 @@ You could use @code{http} addresses just as well.
 @subsection Math formatting in HTML export
 @cindex MathJax
 @cindex dvipng
+@cindex imagemagick
 
 @LaTeX{} math snippets (@pxref{@LaTeX{} fragments}) can be displayed in two
 different ways on HTML pages.  The default is to use the
@@ -11282,13 +11282,19 @@ this line.
 If you prefer, you can also request that @LaTeX{} fragments are processed
 into small images that will be inserted into the browser page.  Before the
 availability of MathJax, this was the default method for Org files.  This
-method requires that the @file{dvipng} program is available on your system.
-You can still get this processing with
+method requires that the @file{dvipng} program or @file{imagemagick} suite is
+available on your system.  You can still get this processing with
 
 @example
 #+OPTIONS: tex:dvipng
 @end example
 
+or:
+
+@example
+#+OPTIONS: tex:imagemagick
+@end example
+
 @node Text areas in HTML export, CSS support, Math formatting in HTML export, HTML export
 @subsection Text areas in HTML export
 
@@ -12265,17 +12271,25 @@ and open the formula file with the system-registered application.
 @end table
 
 @cindex dvipng
+@cindex imagemagick
 @item PNG images
 
 This option is activated on a per-file basis with
 
 @example
-#+OPTIONS: LaTeX:dvipng
+#+OPTIONS: tex:dvipng
+@end example
+
+or:
+
+@example
+#+OPTIONS: tex:imagemagick
 @end example
 
 With this option, @LaTeX{} fragments are processed into PNG images and the
 resulting images are embedded in the exported document.  This method requires
-that the @file{dvipng} program be available on your system.
+that the @file{dvipng} program or @file{imagemagick} suite be available on
+your system.
 @end enumerate
 
 @node Working with MathML or OpenDocument formula files,  , Working with @LaTeX{} math snippets, Math formatting in ODT export
diff --git a/lisp/org.el b/lisp/org.el
index f8cd447..fb5099e 100644
--- a/lisp/org.el
+++ b/lisp/org.el
@@ -3764,9 +3764,9 @@ images at the same place."
 \\usepackage[usenames]{color}
 \\usepackage{amsmath}
 \\usepackage[mathscr]{eucal}
-\\pagestyle{empty} % do not remove
 \[PACKAGES]
 \[DEFAULT-PACKAGES]
+\\pagestyle{empty} % do not remove
 % The settings below are copied from fullpage.sty
 \\setlength{\\textwidth}{\\paperwidth}
 \\addtolength{\\textwidth}{-3cm}
@@ -18609,7 +18609,7 @@ share a good deal of logic."
   (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.))
+	 (dpi (number-to-string (* scal

Re: [O] [PATCH] bugfix: fix previewing latex fragments with imagemagick

2013-07-14 Thread Feng Shu
Nicolas Goaziou  writes:

> Hello,
>
> feng shu  writes:
>
>> Previewing and exporting latex fragments with imagemagick has been broken
>> when new export system merged.  This is the fix patch.
>
> Thanks for the patch. Here are a few comments.
>
>> Subject: [PATCH] bugfix: fix generating formula image with imagemagick when
>>  previewing and exporting
>
> Prefer "Fix generating LaTeX formula images" as subject.
>
>> -@file{dvipng} is used to create images, any @LaTeX{} environment will be
>> -handled.}.  The only requirement is that the @code{\begin} and @code{\end}
>> -statements appear on a new line, at the beginning of the line or after
>> -whitespaces only.
>> +@file{dvipng} program or @file{imagemagick} suite is used to create images, 
>> +any @LaTeX{} environment will be handled.}.  The only requirement is that 
>> the
>> +@code{\begin} and @code{\end} statements appear on a new line, at the
>> +beginning of the line or after whitespaces only.
>>  @item
>>  Text within the usual @LaTeX{} math delimiters.  To avoid conflicts with
>>  currency specifications, single @samp{$} characters are only recognized as
>> @@ -10196,10 +10196,11 @@ You can also set this variable on a
>> per-file basis using one of these
>>  lines:
>>  
>>  @example
>> -#+OPTIONS: tex:t  @r{Do the right thing automatically (MathJax)}
>> -#+OPTIONS: tex:dvipng @r{Force using dvipng images}
>> -#+OPTIONS: tex:nil@r{Do not process @LaTeX{} fragments at all}
>> -#+OPTIONS: tex:verbatim   @r{Verbatim export, for jsMath or so}
>> +#+OPTIONS: tex:t   @r{Do the right thing automatically 
>> (MathJax)}
>> +#+OPTIONS: tex:dvipng  @r{Force using dvipng images}
>> +#+OPTIONS: tex:imagemagick @r{Force using images converted by 
>> imagemagick}
>> +#+OPTIONS: tex:nil @r{Do not process @LaTeX{} fragments at 
>> all}
>> +#+OPTIONS: tex:verbatim@r{Verbatim export, for jsMath or so}
>>  @end example
>
> It should be:
>
>   @example
>   #+OPTIONS: tex:t  @r{Do the right thing automatically (MathJax)}
>   #+OPTIONS: tex:nil@r{Do not process @LaTeX{} fragments at all}
>   #+OPTIONS: tex:verbatim   @r{Verbatim export, for jsMath or so}
>   @end example
>
> because `org-export-with-latex' provides neither `dvipng' nor
> `imagemagick' options. Those are added by some back-ends (e.g.,
> `org-html-with-latex').
>
I just find "dvipng" and add a similar "imagemagick" line below. Good 
luck

>>  @node Previewing @LaTeX{} fragments, CDLaTeX mode, @LaTeX{}
>> fragments, Embedded @LaTeX{}
>> @@ -10207,8 +10208,8 @@ lines:
>>  @cindex @LaTeX{} fragments, preview
>>  
>>  @vindex org-latex-create-formula-image-program
>> -If you have @file{dvipng} or @file{imagemagick} installed@footnote{Choose 
>> the
>> -converter by setting the variable
>> +If you have @file{dvipng} program  or @file{imagemagick} suite
>> +installed@footnote{Choose the converter by setting the variable
>
> Does this change really matter?
>
>> -@cindex dvipng
>> +@cindex dvipng or imagemagick
>
> Use
>
>   @cindex dvipng
>   @cindex imagemagick
>
> instead.
>
>>  @LaTeX{} math snippets (@pxref{@LaTeX{} fragments}) can be displayed in two
>>  different ways on HTML pages.  The default is to use the
>> @@ -11282,13 +11283,21 @@ this line.
>>  If you prefer, you can also request that @LaTeX{} fragments are processed
>>  into small images that will be inserted into the browser page.  Before the
>>  availability of MathJax, this was the default method for Org files.  This
>> -method requires that the @file{dvipng} program is available on your system.
>> -You can still get this processing with
>> +method requires that the @file{dvipng} program  or @file{imagemagick} suite 
>> is
>> +available on your system.You can still get this processing with
>
> Mind the spaces: too many before "or", not enough before "You".
>
>> +or:
>> +
>> +@example
>> +#+OPTIONS: tex:imagemagick
>> +@end example
>> +
>> +
>> +
>
> Nitpick: No need for so many blank lines.
>
>> -@cindex dvipng
>> +@cindex dvipng or imagemagick
>
> See above.
>
>>  @item PNG images
>>  
>>  This option is activated on a per-file basis with
>> @@ -12273,9 +12282,16 @@ This option is activated on a per-file basis with
>>  #+OPTIONS: LaTeX:dvipng
>>  @end example
>>  
>> +or:
>> +
>> +@e

Re: [O] [PATCH] bugfix: fix previewing latex fragments with imagemagick

2013-07-14 Thread feng shu
On Sun, Jul 14, 2013 at 3:02 PM, feng shu  wrote:

> Previewing and exporting latex fragments with imagemagick has been broken
> when new export system merged.  This is the fix patch.
>


0001-bugfix-fix-generating-formula-image-with-imagemagick.patch
Description: Binary data


[O] [PATCH] bugfix: fix previewing latex fragments with imagemagick

2013-07-14 Thread feng shu
Previewing and exporting latex fragments with imagemagick has been broken
when new export system merged.  This is the fix patch.


Re: [O] [PATCH] Add "latex" option to ox-bibtex.el

2013-07-13 Thread Feng Shu
Nicolas Goaziou  writes:

> Hello,
>
> feng shu  writes:
>
>> I want to add a option which can setting bib for html export and latex
>> export separately,
>> As it for the reason:
>> 1. bibtex2html can't work well with complex bib style, so using a simple
>> style and making it
>> show correctly is reasonable choose,
>> 2. bibtex2html can't find bib style in current dir, for example
>> (./file.sty) ,
>> 3. the biblatex user.
>
> I understand that. Though, you didn't tell me what was wrong with the
> hook I provided.
>
>> In my opinion, the solution seemd more hacky than mine for a user,  
>
> Of course. A hook (or a filter) is a hack. But at least, it doesn't live
> in core.
>
>> It let my org-mode file more unportable.
>
> Portability is not an issue here. If you're really worried about it, you
> need to share your configuration file along with your Org documents
> anyway. If you don't, your documents will never be totally portable.

You are right, totally protable is impossible.  My goal is that my
document can work correct in standard org-mode environment, But it seemd
impossible in real world.  emacs = toss

>
>> Could you share you opinion and reason about my approach:  Is the idea ,
>> separating with  a new option, hacky?  or my code hacky? .
>
> My opinion is that we cannot add options to handle every possible use
> case. That's why filters and hooks exist in the first place. Thus, when
> a feature can be implemented in a couple of lines with a hook/filter,
> I just ask to think twice before adding it to core.
>
> Now, speaking about the patch, you only provide an option to ignore
> "bibliography" keyword when exporting with latex back-end, but you still
> have to write correct bibliography command by hand in the Org buffer.

filter can be used in babel? for example:

#+begin_src emacs-lisp
...
#+end_src

>
> I think a cleaner solution would be to be able to choose both
> bibliography and style according to back-end from within the keyword
> itself. I very much like Babel's "by-backend" approach.
I like Babel's "by-backend" approach too, but it may be  beyond my elisp 
ability... :-(

Before this patch, I tested below code, failed!
I like this approach, but it may be impossible  to realize.

#+BEGIN_HTML
#+BIBLIO
#+END_HTML


>
> That's more work for sure, but, meanwhile I think something like the
> hook I provided is good enough for the job at hand.
>
> What do you think?
>
>
> Regards,

-- 



Re: [O] [PATCH] Add "latex" option to ox-bibtex.el

2013-07-12 Thread feng shu
I want to add a option which can setting bib for html export and latex
export separately,
As it for the reason:
1. bibtex2html can't work well with complex bib style, so using a simple
style and making it
show correctly is reasonable choose,
2. bibtex2html can't find bib style in current dir, for example
(./file.sty) ,
3. the biblatex user.


In my opinion, the solution seemd more hacky than mine for a user,  It let
my org-mode file more unportable.

Could you share you opinion and reason about my approach:  Is the idea ,
separating with  a new option, hacky?  or my code hacky? .



On Fri, Jul 12, 2013 at 9:36 PM, Nicolas Goaziou wrote:

> > Really?  This problem can be resolved with hooks or filters?  Could you
> > give me more informations or a example?
>
> Perhaps something like the following (untested) should do the trick:
>
>   (defun my-bibliography-selector-hook (backend)
> (case backend
>   (latex
>(when (save-excursion
>(re-search-forward "^[ \t]*\\bibliography\\(?:style\\)?{"
> nil t))
>  (while (re-search-forward "^[ \t]*#+BIBLIOGRAPHY:.*$" nil t)
>(when (eq (org-element-type (save-match-data
> (org-element-at-point)))
>  'keyword)
>  (replace-match "")
>   (html
>(when (save-excursion
>(re-search-forward "^[ \t]*#+BIBLIOGRAPHY:.*$" nil t))
>  (while (re-search-forward "^[
> \t]*\\bibliography\\(?:style\\)?{.*$" nil t)
>(replace-match ""))
>
>   (add-hook 'org-export-before-parsing-hook 'my-bibliography-selector-hook)
>
>
> Regards,
>
> --
> Nicolas Goaziou
>


Re: [O] [PATCH] Add "latex" option to ox-bibtex.el

2013-07-12 Thread feng shu
Really?  This problem can be resolved with hooks or filters?  Could you
give me more informations or a example?


-- Forwarded message --
From: Nicolas Goaziou 
Date: Fri, Jul 12, 2013 at 6:36 PM
Subject: Re: [PATCH] Add "latex" option to ox-bibtex.el
To: feng shu 
Cc: "emacs-orgmode@gnu.org" 


Hello,

feng shu  writes:

> From 34d1af7f1b0ecb38000f7a19ad17f3d7bfdf26fa Mon Sep 17 00:00:00 2001
> From: Feng Shu 
> Date: Fri, 12 Jul 2013 15:14:56 +0800
> Subject: [PATCH] Add "latex" optional option to ox-bibtex
>
> * ox-bibtex.el (org-latex-keyword, org-bibtex-get-arguments):
> Add `:latex' properties.
>
> If "latex" option is set to `nil', when export to latex,
> "ox-bibtex"  will not insert bibliography commands in output file.
> you should insert the commands manually, for example:
>
> \#+BIBLIOGRAPHY: foo plain option:-d latex:nil
> \bibliographystyle{otherbibstyle}
> \bibliography{foo}
>
> or:
>
> \#+BIBLIOGRAPHY: foo plain option:-d latex:nil
> \printbibliography

Thanks for your patch.

Though, it seems a bit hackish. Can't you achive the same with hooks or
filters?




Regards,

--
Nicolas Goaziou


[O] [PATCH] Add "latex" option to ox-bibtex.el

2013-07-12 Thread feng shu



0001-Add-latex-optional-option-to-ox-bibtex.patch
Description: Binary data


[O] Fwd: [Feature request] Add :export option to ox-bibtex.el

2013-07-11 Thread feng shu
Forgot to mention:  the main reason of adding this feature is that I want
to use
"biblatex" instead of  "bibtex"  when I export to latex.

-- Forwarded message ------
From: feng shu 
Date: Thu, Jul 11, 2013 at 3:20 PM
Subject: [Feature request] Add :export option to ox-bibtex.el
To: emacs-orgmode@gnu.org


bibtex2html can't recognize the style file in current dir (  -s
./customstyle.bst ) and it can't
deal with customize bib style file very well.

So, is it possible use different bibtex styles when I export to html?

For example:

#+BIBLIOGRAPHY: hbuuthesis plain  limit:t  option:-i export:html
\bibliographystyle{customstyle}
\bibliography{foo}

or:

#+BIBLIOGRAPHY: hbuuthesis plain  limit:t  option:-i export:html
#+BIBLIOGRAPHY: hbuuthesis customstyle  limit:t  option:-i export:latex


[O] [Feature request] Add :export option to ox-bibtex.el

2013-07-11 Thread feng shu
bibtex2html can't recognize the style file in current dir (  -s
./customstyle.bst ) and it can't
deal with customize bib style file very well.

So, is it possible use different bibtex styles when I export to html?

For example:

#+BIBLIOGRAPHY: hbuuthesis plain  limit:t  option:-i export:html
\bibliographystyle{customstyle}
\bibliography{foo}

or:

#+BIBLIOGRAPHY: hbuuthesis plain  limit:t  option:-i export:html
#+BIBLIOGRAPHY: hbuuthesis customstyle  limit:t  option:-i export:latex


Re: [O] [PATCH] Let =`make'= be an option to =`org-latex-pdf-process'=.

2013-07-03 Thread Feng Shu
Suvayu Ali  writes:

> On Wed, Jul 03, 2013 at 02:22:40PM +0800, Feng Shu wrote:
>> Suvayu Ali  writes:
>> 
>> > On Wed, Jul 03, 2013 at 07:09:35AM +0800, feng shu wrote:
>> >> Customize  `org-latex-pdf-process isn't very convenient.
>> >> Is it possible add a  feature like: #+LATEX_PDF_PROCESS:  latexmk
>> >> or add  #OPTIONS:  ;latex_pdf_process  latexmk
>> >
>> > If you don't mind my chiming in, the standard way to customise Emacs
>> > behaviour (across all modes, not just Org) is through
>> > customize-variable.  Org cannot keep on introducing new keywords just
>> > because of convenience.
>> 
>> I don't think so, Convenience is very important in most situation. we can
>> introduce new keywords just for convenience!  #+LATEX_CLASS is a good 
>> example,
>> If we don't want convencience.  we can just customize 
>> `org-latex-default-class
>
> There is a big difference between the two variables.  Consider this:
> org-latex-classes depends per document (most likely you wand different
> documents for different things, hence maybe you also want different
> classes), however you want to choose your LaTeX backend once (at most it
> varies from project to project).  But again, if you use one build system
> for a project you are most likely using the same build system in other
> projects too.  The only difference I can see is when you have something
> like make for projects, but simply LaTeX for a simple document/notes.
> In that case, I would say Bastien's suggestion to use file local
> variables is best suited.  At one point I used something like this
> headline at the end of few Org files:
>
> * COMMENT local setup :ARCHIVE:
>
> # Local Variables:
> # org-latex-to-pdf-process: ("xelatex -interaction nonstopmode
> -output-directory %o %f" "xelatex -interaction nonstopmode
> -output-directory %o %f" "xelatex -interaction nonstopmode
> -output-directory %o %f")
> # End:

Powerful Tips, I like!  Maybe it should be include into org document. 

>
> Hope this helps,

-- 



Re: [O] [PATCH] Let =`make'= be an option to =`org-latex-pdf-process'=.

2013-07-02 Thread Feng Shu
Suvayu Ali  writes:

> On Wed, Jul 03, 2013 at 07:09:35AM +0800, feng shu wrote:
>> Customize  `org-latex-pdf-process isn't very convenient.
>> Is it possible add a  feature like: #+LATEX_PDF_PROCESS:  latexmk
>> or add  #OPTIONS:  ;latex_pdf_process  latexmk
>
> If you don't mind my chiming in, the standard way to customise Emacs
> behaviour (across all modes, not just Org) is through
> customize-variable.  Org cannot keep on introducing new keywords just
> because of convenience.

I don't think so, Convenience is very important in most situation. we can
introduce new keywords just for convenience!  #+LATEX_CLASS is a good example,
If we don't want convencience.  we can just customize `org-latex-default-class

The core is that how many org-mode users or potential users  
can benefit from this keyword!

we can export pdf with latex by using many different schemes and we can export 
pdf
with libreoffice. So adding a keyword which let users choose a pdf export 
scheme  
for current file is not a bad idea.

>
> In any case, this is also a security risk.  This starts an external
> process.  Allowing something like this means one can run an arbitrary
> command just by exporting a file.  I do not think that is wise at all.
> Exactly for this reason we have org-confirm-babel-evaluate defaulting to
> t.
If we only let user select scheme predefined in org-latex-pdf-process, I don't 
think security is a problem. If a user adding a dangerous command in 
'org-latex-pdf-process, he should know what he is doing. It's his choose.



-- 



Re: [O] [PATCH] Let =`make'= be an option to =`org-latex-pdf-process'=.

2013-07-02 Thread feng shu
Customize  `org-latex-pdf-process isn't very convenient.
Is it possible add a  feature like: #+LATEX_PDF_PROCESS:  latexmk
or add  #OPTIONS:  ;latex_pdf_process  latexmk

Feng


On Wed, Jul 3, 2013 at 12:54 AM, Nicolas Goaziou wrote:

> Hello,
>
> feng shu  writes:
>
> > From 63eba2e491a0c410b3841cbad2dd1a9f80416bca Mon Sep 17 00:00:00 2001
> > From: Feng Shu 
> > Date: Tue, 2 Jul 2013 11:52:10 +0800
> > Subject: [PATCH] Let =`make'= be an option to =`org-latex-pdf-process'=.
> >
> > * ox-latex.el (org-latex-pdf-process): let =`make'= be a
> >   preconfigured choice and change the wording of the docstring.
>
> I don't mind applying it, but shouldn't it as simple to provide
> a function that will call "make" instead?
>
> It's impossible to provide every solution in the wild for that. Is this
> one really necessary: it doesn't have complicated arguments.
>
>
> Regards,
>
> --
> Nicolas Goaziou
>


Re: [O] [PATCH] (V3) ox: add Simplified Chinese translations for `org-export-dictionary'

2013-07-02 Thread Feng Shu
Please include this V3 patch to master. Thanks!


Feng



[O] [PATCH] (V3) ox: add Simplified Chinese translations for `org-export-dictionary'

2013-07-02 Thread feng shu



0001-ox-add-Simplified-Chinese-translations-for-org-expor.patch
Description: Binary data


[O] [question] What does "list of listing" mean?

2013-07-01 Thread feng shu
Hi

"List of listing"  = "list of figure" ?


Thanks!

feng


[O] [PATCH](v2) ox: add Simplified Chinese translations for `org-export-dictionary'

2013-07-01 Thread feng shu



0001-ox-add-Simplified-Chinese-translations-for-org-expor.patch
Description: Binary data


[O] [PATCH] ox: add Simplified Chinese translations for `org-export-dictionary'

2013-07-01 Thread feng shu



0001-ox-add-Simplified-Chinese-translations-for-org-expor.patch
Description: Binary data


[O] [PATCH] Let =`make'= be an option to =`org-latex-pdf-process'=.

2013-07-01 Thread feng shu



0001-Let-make-be-an-option-to-org-latex-pdf-process.patch
Description: Binary data


Re: [O] [PATCH] (update) Add :caption attribute to #+ATTR_LATEX property

2013-07-01 Thread feng shu
Thanks all the people! This is V5!


On Tue, Jul 2, 2013 at 5:38 AM, Nicolas Goaziou  wrote:

> Hello,
>
> feng shu  writes:
>
> > Thanks for your help. This is V4 patch.
>
> Thanks for the update. More comments below.
>
> > +@item :caption
> > +By default, you should use @code{#+caption} keyword to add a table
> caption.
> > +If you want to add caption with complex or special latex commands, you
> can use
> > +@code{:caption} attribute. It will precedence over @code{#+caption}
> keyword.
> > +It should be set with raw latex command and nothing in it will be
> > +interpreted by Org.
>
> You need to use upper cases for keywords: @code{#+CAPTION}. Also,
> sentences are expected to end with two spaces and latex should be typed
> @LaTeX{}. Here is a suggestion (note that I'm not a wording expert):
>
>


>   @code{#+CAPTION} keyword is the simplest way to set a caption for
>   a table (@pxref{Images and tables}).  If you need more advanced commands
>   for that task, you can use @code{:caption} attribute instead. Its value
>   should be raw @LaTeX{} code.  It has precedence over @code{#+CAPTION}.
>
> I think it's much good than mine. For me, writing documentation is a painful
thing.


> > +When export the below example to latex, the table caption will be set
> > +with latex command @code{\bicaption@{Heading A@}@{Heading B@}} instead
> of
> > +@code{#+CAPTION} keywords.
>
>   In the example below, @LaTeX{} command @code{\bicaption@{Heading
>   A@}@{Heading B@}} will set the caption. (I think you can drop the rest
>   of the sentence).
>
> > -@code{:width} and @code{:height} attributes.  It is also possible to
> add any
> > -other option with the @code{:options} attribute, as shown in the
> following
> > -example:
> > +@code{:width} and @code{:height} attributes. If you want to set image
> > +caption with special latex command, you can use @code{:caption}
> attribute,
> > +for example:
>
> Besides the missing two spaces at the end of the sentence, I suggest the
> following:
>
>   You can specify specify image width or height with, respectively,
>   @code{:width} and @code{:height} attributes.  It is also possible to add
> any
>   other option with the @code{:options} attribute, as shown in the
> following
>   example:
>
>   EXAMPLE
>
>   If you need a specific command for the caption, use @code{:caption}
>   attribute.  It will override standard @code{#+CAPTION} value, if any.
>
>   EXAMPLE?
>
> Also, you don't seem to document the feature for special blocks.
>
> > -  (short (org-export-get-caption element t)))
> > -(cond
> > - ((and (not main) (equal label-str "")) "")
> > - ((not main) (concat label-str "\n"))
> > - ;; Option caption format with short name.
> > - (short (format "\\caption[%s]{%s%s}\n"
> > - (org-export-data short info)
> > - label-str
> > - (org-export-data main info)))
> > - ;; Standard caption format.
> > - (t (format "\\caption{%s%s}\n" label-str (org-export-data main
> info))
> > +  (short (org-export-get-caption element t))
> > +  (caption-from-attr-latex (org-export-read-attribute :attr_latex
> element :caption)))
> > +(cond ((org-string-nw-p caption-from-attr-latex)
> > +(concat caption-from-attr-latex "\n"))
> > +   ((and (not main) (equal label-str "")))
>
> Why do you drop the return value (empty string) here?
>
> It's my mistake!

>
> Regards,
>
> --
> Nicolas Goaziou
>


0001-Add-caption-attribute-to-ATTR_LATEX-property.patch
Description: Binary data


Re: [O] [PATCH] (update) Add :caption attribute to #+ATTR_LATEX property

2013-06-30 Thread feng shu
Thanks for your help. This is V4 patch.


On Mon, Jul 1, 2013 at 4:27 AM, Bastien  wrote:

> Hi Feng,
>
> feng shu  writes:
>
> > (org-latex--inline-image): Tiny change.
> > org-latex--org-table): Tiny change.
>
> The Emacs usage is to write it like this:
>
>   (org-latex--inline-image, org-latex--org-table): Tiny change.
>
> Thanks!
>
> --
>  Bastien, nitpicking again :)
>


0001-Add-caption-attribute-to-ATTR_LATEX-property.patch
Description: Binary data


Re: [O] [PATCH] (update) Add :caption attribute to #+ATTR_LATEX property

2013-06-30 Thread feng shu
Hi

version 3 patch, add document about :caption attribute.


On Sun, Jun 30, 2013 at 7:46 PM, Nicolas Goaziou wrote:

> Hello,
>
> feng shu  writes:
>
> > This is the updated patch of  "Add :caption attribute to #+ATTR_LATEX
> > property"
> > If possible, please include it to master
>
> Thanks for your patch.
>
> I agree that #+CAPTION isn't ready for complex caption commands (nor
> that it should), so a :caption attribute may be useful. Though, it must
> be documented in the manual (see "12.7.4 LaTeX specific attributes"). In
> particular, documentation should insist on the fact that:
>
>   1. :caption attribute has precedence over #+caption keyword
>   2. :caption attribute is only meaningful special caption commands,
>  i.e., this isn't the standard way to set a caption in Org.
>   3. This is a raw command, nothing in it will be interpreted by Org.
>
> Here are some comments about the code:
> > +  (caption-from-attr-latex (plist-get (org-export-read-attribute
> :attr_latex element) :caption)))
>
> You can use the following slightly shorter sexp:
>
>   (caption-from-attr-latex (org-export-read-attribute :attr_latex element
> :caption))
>
> > +(if (and caption-from-attr-latex (not (equal
> caption-from-attr-latex "")))
> > + (concat caption-from-attr-latex "\n")
> > +  (cond
> > +   ((and (not main) (equal label-str "")))
> > +   ((not main) (concat label-str "\n"))
> > +   ;; Option caption format with short name.
> > +   (short (format "\\caption[%s]{%s%s}\n"
> > +   (org-export-data short info)
> > +   label-str
> > +   (org-export-data main info)))
> > +   ;; Standard caption format.
> > +   (t (format "\\caption{%s%s}\n" label-str (org-export-data main
> info)))
>
> Here you can include the "then" part in the `cond', and use
> `org-string-nw-p':
>
>   (cond ((org-string-nw-p caption-from-attr-latex)
>  (concat caption-from-attr-latex "\n"))
> ((and (not main) (equal label-str "")) "")
> ...)
>
> >  (defun org-latex-guess-inputenc (header)
> >"Set the coding system in inputenc to what the buffer is.
> > @@ -1655,7 +1658,7 @@ used as a communication channel."
> > (cond ((and (not float) (plist-member attr :float)) nil)
> >   ((string= float "wrap") 'wrap)
> >   ((string= float "multicolumn") 'multicolumn)
> > - ((or float (org-element-property :caption parent))
> > + ((or float (org-element-property :caption parent)
> (plist-get attr :caption))
>
> Be careful here: (plist-get attr :caption) will be non-nil if :caption
> is set to the empty string. It may be bulkier to use:
>
>   (org-string-nw-p (plist-get attr :caption))
>
> >'figure
> >(placement
> > (let ((place (plist-get attr :placement)))
> > @@ -2333,7 +2336,7 @@ This function assumes TABLE has `org' as its
> `:type' property and
> >((and (not float) (plist-member attr :float)) nil)
> >((string= float "sidewaystable") "sidewaystable")
> >((string= float "multicolumn") "table*")
> > -  ((or float (org-element-property :caption table))
> > +  ((or float (org-element-property :caption table)
> (plist-get attr :caption))
>
> Ditto.
>
>
> Regards,
>
> --
> Nicolas Goaziou
>


0001-Add-caption-attribute-to-ATTR_LATEX-property.patch
Description: Binary data


Re: [O] [need help] How to add a caption to table with #+attr_latex :caption \bicaption{...}{...}

2013-06-29 Thread Feng Shu
Rasmus  writes:

> Hi Feng,
>
>> In my thesie, I need add a caption to table or figure with
>> \bicaption{中文标题}{English title}
>
> I assume you'd still want to use the #+CAPTION-cookie, no?  If so, one
> solution that comes to mind is writing captions like
> #+CAPTION:  my-Asian-string (sorry about my ignorance)  MYSPLIT  
> my-English-string
>
> and write a filter using (org-split-string text MYSPLIT) and format it
> as (format "\bicaption{%s}{%s}" LIST) if the length is two.  
>
> Org perhaps regexps could be used to identify 'my-Asian-string'.
>
> I'm not sure where to apply the filter, though, but a better solution
> than the one below would use `org-export-get-caption' on the correct
> elements at the correct time. . .

---
#+caption: 中文标题
#+caption: English Title
| 1 | 2  |

---

I think this is the best document construct, simple and  intuitive.

But, realizing this feature need some dirty hack, the main reason is
that \bicaption often a custom latex command, fig caption and table
caption are different in option, for example:

\bicaption[图]{...}[fig]{...}
\bicaption{图}{fig}{...}{...}
\bicaption{...}{...}

\bicaption[表]{...}[Table]{}

...

>
> Here's a dirty, inelegant regexp filter that's run on the final
> tex-string.
> #+begin_src emacs-lisp
> (defun org-latex-filter-split-caption (text backend info)
>   "When ## is present in a string make a bicaption."
>   (when (org-export-derived-backend-p backend 'latex 'beamer)
> (replace-regexp-in-string "caption{\\(.*?\\)[ \t]*##[ 
> \t]+?\\(.*\\)}"
> "bicaption{\\1}{\\2}" text)
> ))
>
>   (add-to-list 'org-export-filter-final-output-functions
>'org-latex-filter-split-caption)
> #+end_src

It is a very useful tip, thanks!
>
> It will export this document 'correctly':
> #+begin_src org
> #+TITLE: my test doc
> #+CAPTION: -‡˜ ## english title
> | 1 | 2 | 3 |
>
> #+CAPTION: english title
> | 2 | 3 |
> #+end_src
>
> Hope this inspires you to solve the problem in a more elegant manner.
>
> –Rasmus

-- 




[O] [PATCH] (update) Add :caption attribute to #+ATTR_LATEX property

2013-06-29 Thread feng shu
This is the updated patch of  "Add :caption attribute to #+ATTR_LATEX
property"
If possible, please include it to master



This feature is very useful when you export org to latex with custom
caption command, for example:

#+ATTR_LATEX: :caption \BiTableCaption{caption 1}{caption 2}
|---+---|
| x | y |
|---+---|
| 1 | 2 |
|---+---|

--


0001-Add-caption-attribute-to-ATTR_LATEX-property.patch
Description: Binary data


[O] [PATCH] Add :caption attribute to #+ATTR_LATEX property

2013-06-29 Thread feng shu
This feature is very useful when you export org to latex with custom
caption command, for example:

#+ATTR_LATEX: :caption \BiTableCaption{caption 1}{caption 2}
|---+---|
| x | y |
|---+---|
| 1 | 2 |
|---+---|


0001-Add-caption-attribute-to-ATTR_LATEX-property.patch
Description: Binary data


[O] [need help] How to add a caption to table with #+attr_latex :caption \bicaption{...}{...}

2013-06-28 Thread feng shu
HI:

In my thesie, I need add a caption to table or figure with
\bicaption{中文标题}{English title}

I can't find the easy way to do this in org-mode ,so  I add :caption  to
#+attr_latex:

for example:

#+attr_latex:  :caption \bicaption{...}{}


But the below function doesn't work as expected, someone can help me?
thanks!

#+begin_src emacs-lisp
(defun org-latex--caption/label-string (element info)
  "Return caption and label LaTeX string for ELEMENT.

INFO is a plist holding contextual information.  If there's no
caption nor label, return the empty string.

For non-floats, see `org-latex--wrap-label'."
  (let* ((label (org-element-property :name element))
 (label-str (if (not (org-string-nw-p label)) ""
  (format "\\label{%s}"
  (org-export-solidify-link-text label
 (main (org-export-get-caption element))
 (short (org-export-get-caption element t))
 (caption-from-latex-attr (plist-get (org-export-read-attribute
:attr_latex element) :caption)))
(cond
 ((and (not main) (equal label-str "")) (format "%s"
caption-from-latex-attr))
 ((not main) (concat label-str "\n" (format "%s"
caption-from-latex-attr)))
 ;; Option caption format with short name.
 (short (format "\\caption[%s]{%s%s}\n"
(org-export-data short info)
label-str
(org-export-data main info)))
 ;; Standard caption format.
 (t (format "\\caption{%s%s}\n" label-str (org-export-data main
info))

#+end_src


Re: [O] [help] How to ignore a head but don't ignore it's subhead when export

2013-06-18 Thread Feng Shu
Charles Berry  writes:

> Feng Shu  gmail.com> writes:
>
>> 
>> 
>> #+begin_org
>> 
>> * headA
>> ** headB
>> 
>> #+end_org
>> 
>> When export to latex, how to ignore headA and don't ignore headB?
>> 
>
> With a tag. See this:
>
> http://article.gmane.org/gmane.emacs.orgmode/67692

It's very useful, thanks very much!

I use it show a beautiful construct of article.

---

* Abstract   :ignoreheading:

#+LATEX: \begin{myabstract}
...

#+LATEX: \end{myabstract}



* bibliography :ignoreheading:
#+LATEX: \bibliographystyle{GBT7714-2005NLang-UTF8}
#+LATEX: \bibliography{hbuuthesis}

---


>
> HTH,
>
> Chuck

-- 



Re: [O] [help] How to ignore a head but don't ignore it's subhead when export

2013-06-18 Thread Feng Shu
Bastien  writes:

> Hi Feng,
>
> Feng Shu  writes:
>
>> #+begin_org
>>
>> * headA
>> ** headB
>>
>> #+end_org
>>
>> When export to latex, how to ignore headA and don't ignore headB?
>
> You can't, sorry.

Thanks for the information

-- 



[O] [Help] How to insert a latex command in table environment when export

2013-06-18 Thread Feng Shu

---input---

#+CAPTION: test
| a | b |
| c | d |


output-
\begin{table}[htb]
\caption{test}

% How can I insert a command in this place? for example:
% \bitablecaption{你好}{Hello}

\centering
\begin{tabular}{ll}
a & b\\
c & d\\
\end{tabular}
\end{table}


Thanks
-- 



[O] [help] How to ignore a head but don't ignore it's subhead when export

2013-06-18 Thread Feng Shu

#+begin_org

* headA
** headB

#+end_org

When export to latex, how to ignore headA and don't ignore headB?


Thanks


-- 



[O] [help] How to export a chapter as appendix

2013-06-16 Thread Feng Shu


--
org:

* This is a appendix

--

latex:

\appendix{This is a appendix}





-- 



Re: [O] [PATCH] Override the default class name with a new one.

2013-06-14 Thread Feng Shu
Nicolas Goaziou  writes:

> Hello,
>
> Feng Shu  writes:
>
>> #+LATEX_CLASS: article
>>
>> %%output:
>>
>> \documentclass[11pt]{article}
>>
>> ...
>>
>> --
>>
>> #+LATEX_CLASS: article
>> #+LATEX_CLASS_NAME: ctexart
>>
>> %%output:
>>
>> \documentclass[11pt]{ctexart}
>>
>> 
>
> Thanks for your patch.
>
> Though, it adds another keyword and another defcustom without providing
> any new functionality. I understand it is a shortcut, but the cons, IMO,
> outweigh the pros : adding a new class to `org-latex-classes' is a bit
> more tedious, but needs to be done only once.
>
> Therefore, unless you convince me this feature brings something new, or
> clearly eases a process, I'll stand on my ground.

Not all the org-mode users are expert of lisp and  not all of the org-mode
users are well in English, so finding the variable `org-latex-classes can
customize latex class and adding  a lisp block to it  may be not a easy
things for many users. 

So I expect org-mode can properly export latex without any configure,
but it is impossible for the complexity of tex system. So 

reusing exist `org-latex-classes items will become  a valuable thing, 
it should be implement. My patch is not best way to implement and it can 
be deny, but the problem can't be ignore. 

1. we can add a function `(defun org-latex-add-deriverd-class (class 
exist-class) ...)  to menupulate `org-latex-classes
2. My patch's approach.
3. others.


>
>
> Regards,

-- 



Re: [O] [PATCH] Override the default class name with a new one.

2013-06-14 Thread Feng Shu
Rasmus  writes:

> Feng Shu  writes:
>
>> #+LATEX_CLASS: article
>> #+LATEX_CLASS_NAME: ctexart
>
> I'm not sure this is the right approach. . .  I can certainly see the
> value of generating classes on the fly, though.  But somehow the
> proposed syntax just seems to counter-intuitive.  I'm not sure how to
> overcome this, but perhaps it would be better to allow for an argument
> to LATEX_CLASS, e.g.
>
> (*)   #+LATEX_CLASS: myclass :class-name ctexart.


CLASS and class-name are confusing,  I think LATEX_CLASS should rename
to LATEX_CLASS_FORMAT or LATEX_CLASS_TEMPLATE, but this will break 
compatibility.

>
> as e.g. the INCLUDE command.  Of course (*) is somewhat different from
> how stuff like this is usually handled, cf. e.g. LATEX_CLASS_OPTIONS.
>
> –Rasmus

-- 



Re: [O] [PATCH] Override the default class name with a new one.

2013-06-14 Thread Feng Shu
Nick Dokos  writes:

> Rasmus  writes:
>
>> Feng Shu  writes:
>>
>>> #+LATEX_CLASS: article
>>> #+LATEX_CLASS_NAME: ctexart
>>
>> I'm not sure this is the right approach. . .  I can certainly see the
>> value of generating classes on the fly, though.  But somehow the
>> proposed syntax just seems to counter-intuitive.  I'm not sure how to
>> overcome this, but perhaps it would be better to allow for an argument
>> to LATEX_CLASS, e.g.
>>
>> (*)   #+LATEX_CLASS: myclass :class-name ctexart.
>>
>
> That was what popped into my head as well - I didn't much care for the
> OP's approach.  Now that I've thought about it some more, I'm not sure I
> like this one much better...
>
>> as e.g. the INCLUDE command.  Of course (*) is somewhat different from
>> how stuff like this is usually handled, cf. e.g. LATEX_CLASS_OPTIONS.
>>
> ...but this sounds a bit more promising: maybe LATEX_CLASS_OPTIONS can
> be eliminated in favor of LATEX_CLASS with arguments:
>
> #+LATEX_CLASS: key :class-name foo :class-options a4paper,12pt

May be we should add this feature too:

#+LaTEX_CLASS: key :class-name foo :class-options+  twoside
#+LaTEX_CLASS: key :class-name foo :class-options-  twoside

>
> where "key" selects from org-latex-classes (and is optional, default
> "article"), class-name is optional and defaults to key (or article if
> key is absent).

-- 



Re: [O] [PATCH] Override the default class name with a new one.

2013-06-13 Thread Feng Shu
Feng Shu  writes:

> #+LATEX_CLASS: article
>
> %%output:
>
> \documentclass[11pt]{article}
>
> ...
>
> --
>
> #+LATEX_CLASS: article
> #+LATEX_CLASS_NAME: ctexart
>
> %%output:
>
> \documentclass[11pt]{ctexart}

Hi:

If possible, please merge this patch to master, thanks!


I think it is a way reusing the exist class defines in `org-latex-classes
If your class is similar with a exist one, 

For example:

#+begin_example

("article"
 "\\documentclass[11pt]{article}"
 ("\\section{%s}" . "\\section*{%s}")
 ("\\subsection{%s}" . "\\subsection*{%s}")
 ("\\subsubsection{%s}" . "\\subsubsection*{%s}")
 ("\\paragraph{%s}" . "\\paragraph*{%s}")
 ("\\subparagraph{%s}" . "\\subparagraph*{%s}"))

("ctexart"
 "\\documentclass[11pt]{ctexart}"
 ("\\section{%s}" . "\\section*{%s}")
 ("\\subsection{%s}" . "\\subsection*{%s}")
 ("\\subsubsection{%s}" . "\\subsubsection*{%s}")
 ("\\paragraph{%s}" . "\\paragraph*{%s}")
 ("\\subparagraph{%s}" . "\\subparagraph*{%s}"))

#+end_example

You don't need to add  "ctexart" to `org-latex-classes,

just type:

#+LATEX_CLASS: article
#+LATEX_CLASS_NAME: ctexart

>
> 
>
> -- 
>
> From 338ce85c306ae400ba8c62bfaecaf8973346faa0 Mon Sep 17 00:00:00 2001
> From: Feng Shu 
> Date: Thu, 13 Jun 2013 13:36:50 +0800
> Subject: [PATCH] Override the default latex class name with a new one
>
> * lisp/ox-latex.el (latex): Add :latex-class-name to :options-alist.
> (org-latex-default-latex-class-name): The default name of LaTeX class file.
> (org-latex-template): Replace default latex class name with :latex-class-name.
>
> Override  the default latex class name in template. It will be very
> useful if you are using a class and it's setting is very similar to
> one which has been defined in the `org-latex-classes, for example:
>
> If you want to use latex class: "ctexart"  and you find that it's
> setting will be very similar to "article", you don't need to add a
> new list to `org-latex-classes, just type:
>
> #+LATEX_CLASS: article
> #+LATEX_CLASS_NAME: ctexart
> ---
>  lisp/ox-latex.el |   16 ++--
>  1 个文件被修改,插入 14 行(+),删除 2 行(-)
>
> diff --git a/lisp/ox-latex.el b/lisp/ox-latex.el
> index 9172cd7..ecfb0ce 100644
> --- a/lisp/ox-latex.el
> +++ b/lisp/ox-latex.el
> @@ -98,6 +98,7 @@
> (if a (org-latex-export-to-pdf t s v b)
>   (org-open-file (org-latex-export-to-pdf nil s v b)))
>:options-alist '((:latex-class "LATEX_CLASS" nil org-latex-default-class t)
> +(:latex-class-name "LATEX_CLASS_NAME" nil 
> org-latex-default-latex-class-name t)
>  (:latex-class-options "LATEX_CLASS_OPTIONS" nil nil t)
>  (:latex-header "LATEX_HEADER" nil nil newline)
>  (:latex-header-extra "LATEX_HEADER_EXTRA" nil nil newline)
> @@ -182,6 +183,11 @@
>:group 'org-export-latex
>:type '(string :tag "LaTeX class"))
>  
> +(defcustom org-latex-default-latex-class-name ""
> +  "The default name  of LaTeX class file."
> +  :group 'org-export-latex
> +  :type '(string :tag "LaTeX class"))
> +
>  (defcustom org-latex-classes
>'(("article"
>   "\\documentclass[11pt]{article}"
> @@ -1061,15 +1067,21 @@ holding export options."
> (format-time-string "%% Created %Y-%m-%d %a %H:%M\n"))
>   ;; Document class and packages.
>   (let ((class (plist-get info :latex-class))
> +(latex-class-name (plist-get info :latex-class-name))
>  (class-options (plist-get info :latex-class-options)))
> (org-element-normalize-string
>   (let* ((header (nth 1 (assoc class org-latex-classes)))
> -(document-class-string
> +(document-class-string-tmp
>   (and (stringp header)
>(if (not class-options) header
>  (replace-regexp-in-string
>   "^[ \t]*documentclass\\(\\(\\[[^]]*\\]\\)?\\)"
> - class-options header t nil 1)
> + class-options header t nil 1
> +(document-class-string
> +  (if (not latex-class-name) document-class-string-tmp
> +(replace-regexp-in-string
> + "^[ \t]*documentclass\\[[^]]*\\]?{\\(.*\\)}"
> + latex-class-name document-class-string-tmp t nil 1
> (if (not document-class-string)
> (user-error "Unknown LaTeX class `%s'" class)
>   (org-latex-guess-babel-language

-- 



[O] [PATCH] Override the default class name with a new one.

2013-06-12 Thread Feng Shu

#+LATEX_CLASS: article

%%output:

\documentclass[11pt]{article}

...

--

#+LATEX_CLASS: article
#+LATEX_CLASS_NAME: ctexart

%%output:

\documentclass[11pt]{ctexart}



-- 
>From 338ce85c306ae400ba8c62bfaecaf8973346faa0 Mon Sep 17 00:00:00 2001
From: Feng Shu 
Date: Thu, 13 Jun 2013 13:36:50 +0800
Subject: [PATCH] Override the default latex class name with a new one

* lisp/ox-latex.el (latex): Add :latex-class-name to :options-alist.
(org-latex-default-latex-class-name): The default name of LaTeX class file.
(org-latex-template): Replace default latex class name with :latex-class-name.

Override  the default latex class name in template. It will be very
useful if you are using a class and it's setting is very similar to
one which has been defined in the `org-latex-classes, for example:

If you want to use latex class: "ctexart"  and you find that it's
setting will be very similar to "article", you don't need to add a
new list to `org-latex-classes, just type:

#+LATEX_CLASS: article
#+LATEX_CLASS_NAME: ctexart
---
 lisp/ox-latex.el |   16 ++--
 1 个文件被修改,插入 14 行(+),删除 2 行(-)

diff --git a/lisp/ox-latex.el b/lisp/ox-latex.el
index 9172cd7..ecfb0ce 100644
--- a/lisp/ox-latex.el
+++ b/lisp/ox-latex.el
@@ -98,6 +98,7 @@
 	  (if a (org-latex-export-to-pdf t s v b)
 		(org-open-file (org-latex-export-to-pdf nil s v b)))
   :options-alist '((:latex-class "LATEX_CLASS" nil org-latex-default-class t)
+		   (:latex-class-name "LATEX_CLASS_NAME" nil org-latex-default-latex-class-name t)
 		   (:latex-class-options "LATEX_CLASS_OPTIONS" nil nil t)
 		   (:latex-header "LATEX_HEADER" nil nil newline)
 		   (:latex-header-extra "LATEX_HEADER_EXTRA" nil nil newline)
@@ -182,6 +183,11 @@
   :group 'org-export-latex
   :type '(string :tag "LaTeX class"))
 
+(defcustom org-latex-default-latex-class-name ""
+  "The default name  of LaTeX class file."
+  :group 'org-export-latex
+  :type '(string :tag "LaTeX class"))
+
 (defcustom org-latex-classes
   '(("article"
  "\\documentclass[11pt]{article}"
@@ -1061,15 +1067,21 @@ holding export options."
 	  (format-time-string "%% Created %Y-%m-%d %a %H:%M\n"))
  ;; Document class and packages.
  (let ((class (plist-get info :latex-class))
+	   (latex-class-name (plist-get info :latex-class-name))
 	   (class-options (plist-get info :latex-class-options)))
(org-element-normalize-string
 	(let* ((header (nth 1 (assoc class org-latex-classes)))
-	   (document-class-string
+	   (document-class-string-tmp
 		(and (stringp header)
 		 (if (not class-options) header
 		   (replace-regexp-in-string
 			"^[ \t]*documentclass\\(\\(\\[[^]]*\\]\\)?\\)"
-			class-options header t nil 1)
+			class-options header t nil 1
+	   (document-class-string
+		 (if (not latex-class-name) document-class-string-tmp
+		   (replace-regexp-in-string
+			"^[ \t]*documentclass\\[[^]]*\\]?{\\(.*\\)}"
+			latex-class-name document-class-string-tmp t nil 1
 	  (if (not document-class-string)
 	  (user-error "Unknown LaTeX class `%s'" class)
 	(org-latex-guess-babel-language
-- 
1.7.10.4



Re: [O] [suggest] We should import latex template system

2013-06-12 Thread Feng Shu
>
> (eval-after-load 'ox-latex
>   '(add-to-list 'org-latex-classes
>   '("myclass" "\\documentclass{article}
> [NO-DEFAULT-PACKAGES]
> [NO-PACKAGES]
> [EXTRA]
> \\usepackage{mychinesestylefile}"
>   ("\\section{%s}" . "\\section*{%s}")
>   ("\\subsection{%s}" . "\\subsection*{%s}")
>   ("\\subsubsection{%s}" . "\\subsubsection*{%s}")
>   ("\\paragraph{%s}" . "\\paragraph*{%s}")
>   ("\\subparagraph{%s}" . "\\subparagraph*{%s}"
>
> And then in any given document:
>
> #+LaTeX_CLASS: myclass

At the moment, I am using the similar solution!  

If you use this way,  org-mode fragement previewing  may be broken if
you setting \pagestyle{fancy}. 


>
> If I need to layer another project-specific style file on top of that, I
> add a second line in the header:
>
> #+LaTeX_HEADER: \usepackage{someparticularpackage}
>
> Any document that might require Chinese starts as a "myclass", and then
> goes from there. I set this up a year ago, and haven't needed to mess
> with it since.

There are many, the first one is "ctex", which may be the most popular
latex solution of  chinese users.

All the university latex templates in China seem to be writen as
"class", instead of "style".

and nearly all  of them are derive from  class "article" or "book"

It is the reason that I want this feature:

#+LaTeX_CLASS: article:myclass

It will use default "article" template, and replace class name to myclass!

>
> Hope that helps,
> Eric

-- 



Re: [O] [suggest] We should import latex template system

2013-06-12 Thread Feng Shu
Nicolas Goaziou  writes:

> Hello,
>
> Feng Shu  writes:
>
>> I don't know other language users, for Chinese latex user, the first
>> thing of write a document may  change the document class, for example,
>> change "article" to "ctexart". If I want use org-mode ,I should add all
>> the "class" common used  to the "org-latex-classes", It will be  a
>> nightmare.
>>
>> In org-latex-class, "article"  and  "ctexart" elements are  very similar, the
>> only different may be their class names.
>>
>> I want such result:
>>
>> 1. I don't need customize 'org-latex-classes
>
> I don't see why customizing `org-latex-classes' _once_ would be
> a nightmare.

If all the CJKV org-mode users need customize this virable _once_ ,
It's a nightmare for org-mode, for all the CJKV org-mode users need to
know how to customize this virable!

If we add all the "class" common used in the world, `org-latex-classes
will be very very long!

>
>
> Regards,

-- 



Re: [O] [suggest] We should import latex template system

2013-06-12 Thread Feng Shu
Feng Shu  writes:

> Viktor Rosenfeld  writes:
>
>> Hi,
>>
>> Feng Shu wrote:
>>
>>> org-mode odt exporter are using 'org-odt-styles-file, which are odt
>>> templetes, I think latex exporter should do like this. for example:
>>
>> I would also like to have a template mechanism for my LaTeX exports.
>> However, I think the way to do it in LaTeX is to write custom *.sty
>> files which can then be included using #+LATEX_HEADER: \usepackage{...}
>> for individual exports or more generally using org-latex-packages-alist.
>
> .sty can be easily resolved.
>
> The problem is that many template should be writen as "class" instead of
> "style".   If I want to use a custom class , I need to do:
>
> 1. (add-to-list 'org-latex-classes ...)
> 2. (setq org-latex-default-class ...)
>
>
> I don't know other language users, for Chinese latex user, the first
> thing of write a document may  change the document class, for example,
> change "article" to "ctexart". If I want use org-mode ,I should add all
> the "class" common used  to the "org-latex-classes", It will be  a
> nightmare.
>
> In org-latex-class, "article"  and  "ctexart" elements are  very similar, the
> only different may be their class names.
>
> I want such result:
>
> 1. I don't need customize 'org-latex-classes
> 2. #+LATEX_CLASS: ctexart  can work!

#+LATEX_ARTICLE_CLASS: ctexart   ?
#+LATEX_CLASS:  article:ctexart  ?

>
>>
>> I've been wanting to learn how to do it but I did not find the time yet.
>> (Any pointers to good tutorials would be appreciated.)
>>
>> Cheers,
>> Viktor
>>
>>> 
>>>
>>> org-latex-styles-file  or  org-latex-templete-file
>>> 
>>> 
>>> we can include many different language's templates into org, and no need
>>> touch the ox-latex.el and the user can write theirs template easily,
>>> 
>>> 
>>> 
>>> we can use "locale" to determine which template will be used
>>> 
>>> 
>>> 
>>> converting latex fragements can use templates too, like:
>>> 
>>> 
>>> org-latex-fragment-templete-file
>>> 
>>> 
>>> 
>>> -- 
>>> 

-- 



  1   2   >