emacs-orgmode@gnu.org archives
 help / color / mirror / code / Atom feed
* How to export LaTeX amsmath align bmatrix to ODT?
@ 2017-06-10  4:54 edgar
  2017-06-10  5:13 ` edgar
  0 siblings, 1 reply; 8+ messages in thread
From: edgar @ 2017-06-10  4:54 UTC (permalink / raw)
  To: emacs-orgmode

Hello,

I have been making progress with my export procedure to ODT. I would 
like to know if someone knows how to export the following LaTeX block to 
ODT correctly:

\[\begin{align} \begin{bmatrix} a = 1 & b=2 \\ c=3 & d = 4 \end{bmatrix} 
\end{align}\]

\[\begin{align}  a = & 1 + 2 + 3 + 4 \\ c = &  4 \end{bmatrix} 
\end{align}\]

As always, any help is welcome :) .


Edgar

-------------------------------------------------

ONLY AT VFEmail! - Use our Metadata Mitigator to keep your email out of the NSA's hands!
$24.95 ONETIME Lifetime accounts with Privacy Features!  
15GB disk! No bandwidth quotas!
Commercial and Bulk Mail Options!  

^ permalink raw reply	[flat|nested] 8+ messages in thread

* Re: How to export LaTeX amsmath align bmatrix to ODT?
  2017-06-10  4:54 How to export LaTeX amsmath align bmatrix to ODT? edgar
@ 2017-06-10  5:13 ` edgar
  2017-06-12 21:36   ` edgar
       [not found]   ` <449a60f5bed6445984cc8ccc8f3c3a63@HE1PR01MB1898.eurprd01.prod.exchangelabs.com>
  0 siblings, 2 replies; 8+ messages in thread
From: edgar @ 2017-06-10  5:13 UTC (permalink / raw)
  To: emacs-orgmode

On 2017-06-10 04:54, edgar@openmail.cc wrote:
> Hello,
> 
> I have been making progress with my export procedure to ODT. I would
> like to know if someone knows how to export the following LaTeX block
> to ODT correctly:
> 
> \[\begin{align} \begin{bmatrix} a = 1 & b=2 \\ c=3 & d = 4
> \end{bmatrix} \end{align}\]
> https://www.vfemail.net/roundcube/?_task=mail&_action=compose&_id=289067995593b7fd683a1f#
> \[\begin{align}  a = & 1 + 2 + 3 + 4 \\ c = &  4 \end{bmatrix} 
> \end{align}\]
> 
> As always, any help is welcome :) .
> 
> 
> Edgar

By the way, I tried with latexmlmath and mathtoweb.jar without success.

-------------------------------------------------

ONLY AT VFEmail! - Use our Metadata Mitigator to keep your email out of the NSA's hands!
$24.95 ONETIME Lifetime accounts with Privacy Features!  
15GB disk! No bandwidth quotas!
Commercial and Bulk Mail Options!  

^ permalink raw reply	[flat|nested] 8+ messages in thread

* Re: How to export LaTeX amsmath align bmatrix to ODT?
  2017-06-10  5:13 ` edgar
@ 2017-06-12 21:36   ` edgar
  2017-06-14 14:10     ` Nicolas Goaziou
       [not found]   ` <449a60f5bed6445984cc8ccc8f3c3a63@HE1PR01MB1898.eurprd01.prod.exchangelabs.com>
  1 sibling, 1 reply; 8+ messages in thread
From: edgar @ 2017-06-12 21:36 UTC (permalink / raw)
  To: emacs-orgmode

On 2017-06-10 05:13, edgar@openmail.cc wrote:
> On 2017-06-10 04:54, edgar@openmail.cc wrote:
>> Hello,
>> 
>> I have been making progress with my export procedure to ODT. I would
>> like to know if someone knows how to export the following LaTeX block
>> to ODT correctly:
>> 
>> \[\begin{align} \begin{bmatrix} a = 1 & b=2 \\ c=3 & d = 4
>> \end{bmatrix} \end{align}\]
>> https://www.vfemail.net/roundcube/?_task=mail&_action=compose&_id=289067995593b7fd683a1f#
>> \[\begin{align}  a = & 1 + 2 + 3 + 4 \\ c = &  4 \end{bmatrix} 
>> \end{align}\]
>> 
>> As always, any help is welcome :) .
>> 
>> 
>> Edgar
> 
> By the way, I tried with latexmlmath and mathtoweb.jar without success.

Ok. I got it (with a minor glitch). If someone can help me to get the 
right colors on the screen (my screen is black; the \tensor symbol is 
also black), I would appreciate it. Now I can export to ODT with my 
custom symbols and the bmatrix environment.

For the record, I had modified org-preview-latex-process-alist to get 
custom symbols, and this got in the way of the LaTeX bmatrix environment 
(I don't know how; I was loading a file with with :latex-header as 
"\\input{preamble.tex}").

My partial answer (it is partial, because the \tensor preview renders in 
a different color than the rest of symbols): Instead of modifying 
org-preview-latex-process-alist, the answer I modified 
org-format-tex-header. I added the following at the end of M-x 
customize-variable org-format-tex-header (I leave it here for posterity; 
I added some symbols: tensor, derivative, vector, Roman numeral, etc.)

\usepackage{stackengine}
\stackMath
% Does not work
% \newcommand\tenq[2]{%
% \def\useanchorwidth{T}%
%  \ifnum#1>1%
%    
\stackunder[0pt]{\tenq[\numexpr#1-1\relax]{#2}}{\scriptscriptstyle\sim}%
%  \else%
%    \stackunder[1pt]{#2}{\scriptscriptstyle\sim}%
%  \fi%
%}

% Change del operator to d
% 
http://tex.stackexchange.com/questions/178946/better-automatic-spacing-of-differential-d
\renewcommand{\d}[1]{\mathop{\mathrm{d}{#1}}\!{}}
\newcommand{\del}[1]{\d{\left(#1\right)}}
\newcommand{\diff}[2]{
   \frac{\d{}}{\d{#2}}
   \left(#1\right)}
\newcommand{\deriv}[2]{
   \frac{\del{#1}}{\d{#2}}}

% https://tex.stackexchange.com/a/229547
\renewcommand{\vec}[1]{
   \hbox{\oalign{$#1$\crcr\hidewidth$\scriptscriptstyle\sim$\hidewidth}}}
% --- Define \dvec and \ddvec for dotted and double-dotted vectors.
\newcommand{\dvec}[1]{\dot{\vec{#1}}}
\newcommand{\ddvec}[1]{\ddot{\vec{#1}}}

% 
https://tex.stackexchange.com/questions/229543/double-tilde-symbol-under-letter
\newcommand{\dtens}[1]{
   
\stackunder[0pt]{\stackunder[1pt]{#1}{\scriptscriptstyle\sim}}{\scriptscriptstyle\sim}}

\newcommand{\ftens}[1]{
   
\stackunder[0pt]{\stackunder[0pt]{\stackunder[0pt]{\stackunder[1pt]{#1}{\scriptscriptstyle\sim}}{\scriptscriptstyle\sim}}{\scriptscriptstyle\sim}}{\scriptscriptstyle\sim}
}

% Define \tensor and \mtensor (matrix)
\newcommand{\tensor}[1]{\dtens{#1}}
\newcommand{\tens}[1]{\ftens{#1}}

\newcommand{\mtensor}[1]{%
   \left[{\tensor{#1}}\right]}
% --- Define \dtens and \ddtens for dotted and double-dotted tensors.
\newcommand{\dtens}[1]{\dot{\tensor{#1}}}
\newcommand{\ddtens}[1]{\ddot{\tensor{#1}}}
% --- Define \dmtens and \ddmtens for dotted and double-dotted tensors.
\newcommand{\dmtens}[1]{\dot{\mtensor{#1}}}
\newcommand{\ddmtens}[1]{\ddot{\mtensor{#1}}}

% Trace
\newcommand{\Tr}[1]{\mathop{\mathrm{tr}}\!{}\left(#1\right)}

% Have a thicker line for the mean value
%\newcommand*{\mean}[1]{\overbracket[0.65pt][-1pt]{#1}}
% amssymb, amsmath
% adapt: 
http://tex.stackexchange.com/questions/22100/the-bar-and-overline-commands
\newcommand{\mean}[1]{\mkern 
3mu\overbracket[0.65pt][-1pt]{\mkern-3mu#1\mkern-3mu}\mkern 3mu}

% Roman number III
\def\III{I\hspace{-2pt}I\hspace{-2pt}I}

-------------------------------------------------

ONLY AT VFEmail! - Use our Metadata Mitigator to keep your email out of the NSA's hands!
$24.95 ONETIME Lifetime accounts with Privacy Features!  
15GB disk! No bandwidth quotas!
Commercial and Bulk Mail Options!  

^ permalink raw reply	[flat|nested] 8+ messages in thread

* Re: How to export LaTeX amsmath align bmatrix to ODT?
  2017-06-12 21:36   ` edgar
@ 2017-06-14 14:10     ` Nicolas Goaziou
       [not found]       ` <3c4faaee17eb7e7fdd5aea5136742bd5@openmail.cc>
  0 siblings, 1 reply; 8+ messages in thread
From: Nicolas Goaziou @ 2017-06-14 14:10 UTC (permalink / raw)
  To: edgar; +Cc: emacs-orgmode

Hello,

edgar@openmail.cc writes:

> On 2017-06-10 05:13, edgar@openmail.cc wrote:
>> On 2017-06-10 04:54, edgar@openmail.cc wrote:
>>> Hello,
>>>
>>> I have been making progress with my export procedure to ODT. I would
>>> like to know if someone knows how to export the following LaTeX block
>>> to ODT correctly:
>>>
>>> \[\begin{align} \begin{bmatrix} a = 1 & b=2 \\ c=3 & d = 4
>>> \end{bmatrix} \end{align}\]
>>> https://www.vfemail.net/roundcube/?_task=mail&_action=compose&_id=289067995593b7fd683a1f#
>>> \[\begin{align}  a = & 1 + 2 + 3 + 4 \\ c = &  4 \end{bmatrix}
>>> \end{align}\]

I'm a bit lost here. In particular, I'm able to export the example above
out-of-the-box, provided I add "#+options: tex:dvipng" or some such in
the document.

> For the record, I had modified org-preview-latex-process-alist to get
> custom symbols, and this got in the way of the LaTeX bmatrix
> environment (I don't know how; I was loading a file with
> with :latex-header as "\\input{preamble.tex}").
>
> My partial answer (it is partial, because the \tensor preview renders
> in a different color than the rest of symbols): Instead of modifying
> org-preview-latex-process-alist, the answer I modified
> org-format-tex-header. I added the following at the end of M-x 
> customize-variable org-format-tex-header (I leave it here for
> posterity; I added some symbols: tensor, derivative, vector, Roman
> numeral, etc.)

I don't think you need to modify `org-format-latex-header' at all. There
is `org-latex-packages-alist' for that.

So, is there a bug in the ODT export back-end? If so, could you post an
ECM? Loads of LaTeX code doesn't help understanding the issue.

Regards,

-- 
Nicolas Goaziou

^ permalink raw reply	[flat|nested] 8+ messages in thread

* Re: How to export LaTeX amsmath align bmatrix to ODT?
       [not found]   ` <449a60f5bed6445984cc8ccc8f3c3a63@HE1PR01MB1898.eurprd01.prod.exchangelabs.com>
@ 2017-06-16  8:18     ` Eric S Fraga
  0 siblings, 0 replies; 8+ messages in thread
From: Eric S Fraga @ 2017-06-16  8:18 UTC (permalink / raw)
  To: emacs-orgmode

[-- Attachment #1: Type: text/plain, Size: 800 bytes --]

On Monday, 12 Jun 2017 at 21:36, edgar@openmail.cc wrote:

[...]

> Ok. I got it (with a minor glitch). If someone can help me to get the 
> right colors on the screen (my screen is black; the \tensor symbol is 
> also black), I would appreciate it. Now I can export to ODT with my 
> custom symbols and the bmatrix environment.

Check out org-format-latex-options.  I have, for the same or similar scenario:

#+begin_src emacs-lisp
  (setq org-format-latex-options
        '(:foreground "white" :background "black" :scale 3
                      :html-foreground "Black" :html-background "Transparent"
                      :html-scale 1.0
                      :matchers ("begin" "$1" "$" "$$" "\\(" "\\[")))
#+end_src

-- 
: Eric S Fraga (0xFFFCF67D), Emacs 26.0.50, Org release_9.0.7-531-g530113

[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 194 bytes --]

^ permalink raw reply	[flat|nested] 8+ messages in thread

* Fwd: Re: How to export LaTeX amsmath align bmatrix to ODT?
       [not found]       ` <3c4faaee17eb7e7fdd5aea5136742bd5@openmail.cc>
@ 2017-06-25  0:35         ` edgar
  2017-06-25 21:11           ` Nicolas Goaziou
  0 siblings, 1 reply; 8+ messages in thread
From: edgar @ 2017-06-25  0:35 UTC (permalink / raw)
  To: emacs-orgmode

[-- Attachment #1: Type: text/plain, Size: 4805 bytes --]

I forgot to send this to the list. Sorry.

-------- Original Message --------
Subject: Re: How to export LaTeX amsmath align bmatrix to ODT?
Date: 2017-06-15 22:57
 From: edgar@openmail.cc
To: Nicolas Goaziou <mail@nicolasgoaziou.fr>

Hello Nicolas,

Thank you for your help. My comments are under each block:

On 2017-06-14 14:10, Nicolas Goaziou wrote:
> Hello,
> 
> 
>> On 2017-06-10 05:13, edgar wrote:
>>> On 2017-06-10 04:54, edgar wrote:
>>>> Hello,
>>>> 
>>>> I have been making progress with my export procedure to ODT. I would
>>>> like to know if someone knows how to export the following LaTeX 
>>>> block
>>>> to ODT correctly:
>>>> 
>>>> \[\begin{align} \begin{bmatrix} a = 1 & b=2 \\ c=3 & d = 4
>>>> \end{bmatrix} \end{align}\]
>>>> https://www.vfemail.net/roundcube/?_task=mail&_action=compose&_id=289067995593b7fd683a1f#
>>>> \[\begin{align}  a = & 1 + 2 + 3 + 4 \\ c = &  4 \end{bmatrix}
>>>> \end{align}\]
> 
> I'm a bit lost here. In particular, I'm able to export the example 
> above
> out-of-the-box, provided I add "#+options: tex:dvipng" or some such in
> the document.
> 

Yes, indeed, without modifying any variable, the code exports correctly, 
but I had modified org-preview-latex-process-alist to include my 
symbols.tex file like this:

On 2017-06-05 07:00, edgar wrote:

     I managed to get the special symbols by

     1. M-x customize-variable org-preview-latex-process-alist
     2. Doing [Ins] into the dvipng (or imagemagick) section
     3. typing :latex-header in the Key: field
     4. typing "\\input{./symbols.tex}" in the Value: field

After I did that, some symbols would export correctly, but others would 
not. I was not importing any LaTeX packages within that file. I use this 
file to export PDF (through LaTeX: C-c C-e l p). One of the things that 
did not work was the matrix environment. I thought that it was better to 
start a new question regarding the matrix, because I thought it was 
independent of the symbols.

This is related to the following:

>> For the record, I had modified org-preview-latex-process-alist to get
>> custom symbols, and this got in the way of the LaTeX bmatrix
>> environment (I don't know how; I was loading a file with
>> with :latex-header as "\\input{preamble.tex}").
>> 
>> My partial answer (it is partial, because the \tensor preview renders
>> in a different color than the rest of symbols): Instead of modifying
>> org-preview-latex-process-alist, the answer I modified
>> org-format-tex-header. I added the following at the end of M-x
>> customize-variable org-format-tex-header (I leave it here for
>> posterity; I added some symbols: tensor, derivative, vector, Roman
>> numeral, etc.)
> 
> I don't think you need to modify `org-format-latex-header' at all. 
> There
> is `org-latex-packages-alist' for that.
I don't really know how to modify org-latex-packages-alist to have a 
latex command like this in my tex file:

\newcommmand{\mysymbol}[1]{\mathrm{my_{#1}}}

I do have a bunch of packages with custom options over there :P !

> 
> So, is there a bug in the ODT export back-end? If so, could you post an
> ECM? Loads of LaTeX code doesn't help understanding the issue.
> 
I think that the only bug is that I don't know how to use it very well 
;) . I don't know what a ECM is :S , sorry. I typed ECM emacs on a web 
search engine, and only got ECB. Is it the same? If you are willing to 
tell me how to get one, I'll do my best.

Right now, I am having a glitch on the screen. I get some of my custom 
symbols in black (all the others are in light gray) on a black 
background (my screen has a black background; see attached picture: 
there is an I with two tildes underneath next to the p). I would like to 
know if you or someone else can help me to get a light gray on that 
symbol too. I suspect that it may have to do with the stackengine 
(LaTeX) package, because all of my other symbols are doing well. This is 
the snippet of code that I have in org-format-latex-header to define the 
\tensor symbol

\newcommand{\tensor}[1]{
   
\stackunder[0pt]{\stackunder[1pt]{#1}{\scriptscriptstyle\sim}}{\scriptscriptstyle\sim}}

I also opened a new emacs with -Q, did a (require 'org), yanked my 
configuration of org-format-latex-header and created a new Org file. 
Then, changed the theme to a dark one and I typed $\tensor{F}$ $a$. For 
the $\tensor{F}$ I get a white square with a black font face. For the 
$a$ I get the same set of colors as the theme (dark background, 
light-gray font face).

Thank you a lot for you time!


Edgar

-------------------------------------------------

ONLY AT VFEmail! - Use our Metadata Mitigator to keep your email out of the NSA's hands!
$24.95 ONETIME Lifetime accounts with Privacy Features!  
15GB disk! No bandwidth quotas!
Commercial and Bulk Mail Options!  

[-- Attachment #2: org-ltximg_968041b7b2f6ea14aa6a6df6b779409cb85988b9.png --]
[-- Type: application/octet-stream, Size: 368 bytes --]

^ permalink raw reply	[flat|nested] 8+ messages in thread

* Re: Fwd: Re: How to export LaTeX amsmath align bmatrix to ODT?
  2017-06-25  0:35         ` Fwd: " edgar
@ 2017-06-25 21:11           ` Nicolas Goaziou
  2017-06-26 14:31             ` edgar
  0 siblings, 1 reply; 8+ messages in thread
From: Nicolas Goaziou @ 2017-06-25 21:11 UTC (permalink / raw)
  To: edgar; +Cc: emacs-orgmode

Hello,

edgar@openmail.cc writes:

> I don't really know how to modify org-latex-packages-alist to have
> a latex command like this in my tex file:
>
> \newcommmand{\mysymbol}[1]{\mathrm{my_{#1}}}
>
> I do have a bunch of packages with custom options over there :P !

I fixed a bug in "ox-odt.el". Now, when using convertion to png, you can
add

 #+latex_header: \newcommmand{\mysymbol}[1]{\mathrm{my_{#1}}}

Hopefully, it should solve, at least partly, your issue.

Regards,

-- 
Nicolas Goaziou

^ permalink raw reply	[flat|nested] 8+ messages in thread

* Re: Fwd: Re: How to export LaTeX amsmath align bmatrix to ODT?
  2017-06-25 21:11           ` Nicolas Goaziou
@ 2017-06-26 14:31             ` edgar
  0 siblings, 0 replies; 8+ messages in thread
From: edgar @ 2017-06-26 14:31 UTC (permalink / raw)
  To: Nicolas Goaziou; +Cc: emacs-orgmode

On 2017-06-25 21:11, Nicolas Goaziou wrote:
> I fixed a bug in "ox-odt.el". Now, when using convertion to png, you 
> can
> add
> 
>  #+latex_header: \newcommmand{\mysymbol}[1]{\mathrm{my_{#1}}}
> 
> Hopefully, it should solve, at least partly, your issue.
Hey! That's great! Thank you very much.


Edgar

-------------------------------------------------

ONLY AT VFEmail! - Use our Metadata Mitigator to keep your email out of the NSA's hands!
$24.95 ONETIME Lifetime accounts with Privacy Features!  
15GB disk! No bandwidth quotas!
Commercial and Bulk Mail Options!  

^ permalink raw reply	[flat|nested] 8+ messages in thread

end of thread, other threads:[~2017-06-26 14:31 UTC | newest]

Thread overview: 8+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2017-06-10  4:54 How to export LaTeX amsmath align bmatrix to ODT? edgar
2017-06-10  5:13 ` edgar
2017-06-12 21:36   ` edgar
2017-06-14 14:10     ` Nicolas Goaziou
     [not found]       ` <3c4faaee17eb7e7fdd5aea5136742bd5@openmail.cc>
2017-06-25  0:35         ` Fwd: " edgar
2017-06-25 21:11           ` Nicolas Goaziou
2017-06-26 14:31             ` edgar
     [not found]   ` <449a60f5bed6445984cc8ccc8f3c3a63@HE1PR01MB1898.eurprd01.prod.exchangelabs.com>
2017-06-16  8:18     ` Eric S Fraga

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).