emacs-orgmode
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [O] [odt] regression in using an equation sourced via latex_header


From: Jambunathan K
Subject: Re: [O] [odt] regression in using an equation sourced via latex_header
Date: Wed, 02 Nov 2011 00:40:32 +0530
User-agent: Gnus/5.13 (Gnus v5.13) Emacs/24.0.91 (windows-nt)

Myles

Thanks for exercising the latex-to-mathml changes. I am happy that there
is someone out there interested in and using stuff that I have spent
some efforts on.

> Hello,
>
> If I have a latex file mystyle.tex that contains:
>
> \newcommand{\myBigEquation}{b=23}
>
> and then have this in my org file:
>
> #+LATEX_HEADER: \usepackage{/path/to/mystyle}
>
> I can use it conveniently like this:
>
> \begin{equation}
>      \myBigEquation
> \end{equation}
>
> and that exports fine to pdf but not to odt.  I am fairly sure it used
> to work (around 7th Oct).  Can anyone confirm this?

I am using the very latest version in the git. While exporting to odt
using

1. dvipng 
   - I see no issues [1]

2. mathml
   - You need to register your command file with -ncf argument.

     For example, if I put the mystyle.tex in the same directory as
     exported .org file and add the -ncf argument to the converter as
     below

     #+begin_src emacs-lisp
     (setq org-latex-to-mathml-convert-command
           "java -jar %j -ncf mystyle.tex -unicode -force -df %o %I ")
     #+end_src

     I see that your sample file gets exported just fine.

Side Note:
==========

1. You don't have to export the whole file to see whether the
   latex-mathml conversion is sane.

   You can mark - as in marking a region - the LaTeX fragment in your
   org file and do a M-x org-create-math-formula. You will see something
   like this echoed in you *Messages* buffer.

,---- M-x org-create-math-formula
| Mark set [2 times]
| Mark activated
| Wrote ~/tmp-myles/ltxmathml-in3272esr
| Running java -jar ~/tmp-odt/mathtoweb.jar -ncf mystyle.tex -unicode -force 
-df ltxmathml-out3272r2x ltxmathml-in3272esr 
| <?xml version="1.0" encoding="UTF-8"?>
| <math xmlns="http://www.w3.org/1998/Math/MathML";>
| <mrow>
|       <mspace width="1.00em" />
|       <mi>b</mi>
|       <mo>=</mo>
|       <mn>23</mn>
| </mrow>
| </math>
`----

2. I am copy pasting the extra "stuff" that gets attached to the latex
   fragment before it get "latex" ed and "dvipng"ed.

   latex-to-mathml converter ignores *all* of the stuff that goes in
   org-format-latex-header, org-export-latex-default-packages-alist,
   org-export-latex-packages-alist, org-format-latex-header-extra
   variables.

   I think I should build an "ncf" file on the fly based on these
   variables and pass it to the command line converter.

   Since I don't know much of latex, can you or someone in the list give
   me pointers on what would constitute an ncf argument as expected by
   mathtoweb.

   I will make the needed changes as required.
   
,---- See org-create-formula-image
|     (with-temp-file texfile
|       (insert (org-splice-latex-header
|              org-format-latex-header
|              org-export-latex-default-packages-alist
|              org-export-latex-packages-alist t
|              org-format-latex-header-extra))
|       (insert "\n\\begin{document}\n" string "\n\\end{document}\n")
|       (require 'org-latex)
|       (org-export-latex-fix-inputenc))
`----

,---- temporary tex file [see LATEX-HEADER at the end]
| \documentclass{article}
| \usepackage[usenames]{color}
| \usepackage{amsmath}
| \usepackage[mathscr]{eucal}
| \pagestyle{empty}             % do not remove
| \usepackage{pdfpages}
| \usepackage[utf8]{inputenc}
| \usepackage[T1]{fontenc}
| % Package fixltx2e omitted
| \usepackage{graphicx}
| % Package longtable omitted
| % Package float omitted
| % Package wrapfig omitted
| \usepackage{soul}
| \usepackage{t1enc}
| \usepackage{textcomp}
| \usepackage{amssymb}
| % Package hyperref omitted
| \tolerance=1000
| % The settings below are copied from fullpage.sty
| \setlength{\textwidth}{\paperwidth}
| \addtolength{\textwidth}{-3cm}
| \setlength{\oddsidemargin}{1.5cm}
| \addtolength{\oddsidemargin}{-2.54cm}
| \setlength{\evensidemargin}{\oddsidemargin}
| \setlength{\textheight}{\paperheight}
| \addtolength{\textheight}{-\headheight}
| \addtolength{\textheight}{-\headsep}
| \addtolength{\textheight}{-\footskip}
| \addtolength{\textheight}{-3cm}
| \setlength{\topmargin}{1.5cm}
| \addtolength{\topmargin}{-2.54cm}
| 
| \usepackage{jambu}
| \begin{document}
| \begin{equation}
|      \myBigEquation
| \end{equation}
| \end{document}
`----

Footnotes: 

[1]  LaTeX novice here. 

The method I used is this: Put that style file in one of the local
directories and register that directory as a root with the MikTex
package manager. Then use this directive:
\usepackage{jambu}

ps: I am on Windows using Cygwin. So getting the directory path right
with escaping - what with spaces in directories - is always a
hair-splitting experience for me.

     
> Myles
>
>



-- 



reply via email to

[Prev in Thread] Current Thread [Next in Thread]