emacs-orgmode@gnu.org archives
 help / color / mirror / code / Atom feed
From: Jambunathan K <kjambunathan@gmail.com>
To: emacs-orgmode Mode <emacs-orgmode@gnu.org>
Subject: Re: [odt] regression in using an equation sourced via latex_header
Date: Wed, 02 Nov 2011 00:40:32 +0530	[thread overview]
Message-ID: <81hb2n64lz.fsf@gmail.com> (raw)
In-Reply-To: <871utr7rj3.fsf@gmail.com> (Myles English's message of "Tue, 01 Nov 2011 16:10:08 +0000")


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	other threads:[~2011-11-01 19:10 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2011-11-01 16:10 [odt] regression in using an equation sourced via latex_header Myles English
2011-11-01 19:10 ` Jambunathan K [this message]
2011-11-01 19:14   ` Jambunathan K
2011-11-02 21:38     ` Myles English
2011-11-03 14:59       ` Myles English
2011-11-03 18:21         ` Plastex + MathToWeb (was Re: [odt] regression in using an equation sourced via latex_header) Jambunathan K

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

  List information: https://www.orgmode.org/

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=81hb2n64lz.fsf@gmail.com \
    --to=kjambunathan@gmail.com \
    --cc=emacs-orgmode@gnu.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
Code repositories for project(s) associated with this public inbox

	https://git.savannah.gnu.org/cgit/emacs/org-mode.git

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).