emacs-orgmode@gnu.org archives
 help / color / mirror / code / Atom feed
* Latex strikethrough or cancel?
@ 2015-10-08  3:35 Lawrence Bottorff
  2015-10-08  7:06 ` Suvayu Ali
                   ` (2 more replies)
  0 siblings, 3 replies; 10+ messages in thread
From: Lawrence Bottorff @ 2015-10-08  3:35 UTC (permalink / raw)
  To: emacs-orgmode Mailinglist

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

I've got a fraction done this way in an org file:

\[
 \frac{1}{(2^3)(5)}
 \]

and I'd like to strike though or cancel the (5) part. The Latex method I've
found says do it this way:

...
\usepackage[makeroom]{cancel}
...

\[
 \frac{1}{(2^3)\cancel{(5)}}
 \]

But it's ignored and comes back verbatim. Of course +(5)+ doesn't work
either, again, coming back verbatim with the pluses. How can I do this?

LB

[-- Attachment #2: Type: text/html, Size: 682 bytes --]

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

* Re: Latex strikethrough or cancel?
  2015-10-08  3:35 Latex strikethrough or cancel? Lawrence Bottorff
@ 2015-10-08  7:06 ` Suvayu Ali
  2015-10-08  7:31 ` Nick Dokos
  2015-10-08  7:49 ` Eric S Fraga
  2 siblings, 0 replies; 10+ messages in thread
From: Suvayu Ali @ 2015-10-08  7:06 UTC (permalink / raw)
  To: emacs-orgmode

Hi Lawrence,

On Thu, Oct 08, 2015 at 03:35:43AM +0000, Lawrence Bottorff wrote:
> I've got a fraction done this way in an org file:
> 
> \[
>  \frac{1}{(2^3)(5)}
>  \]
> 
> and I'd like to strike though or cancel the (5) part. The Latex method I've
> found says do it this way:
> 
> ...
> \usepackage[makeroom]{cancel}
> ...
> 
> \[
>  \frac{1}{(2^3)\cancel{(5)}}
>  \]
> 
> But it's ignored and comes back verbatim. Of course +(5)+ doesn't work
> either, again, coming back verbatim with the pluses. How can I do this?

Unless the \cancel{..} is not exported properly, this is a LaTeX
question.  I think you will have better luck finding an answer if you
ask a community dedicated to LaTeX, e.g. TeX.SX.

Cheers,

-- 
Suvayu

Open source is the future. It sets us free.

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

* Re: Latex strikethrough or cancel?
  2015-10-08  3:35 Latex strikethrough or cancel? Lawrence Bottorff
  2015-10-08  7:06 ` Suvayu Ali
@ 2015-10-08  7:31 ` Nick Dokos
  2015-10-08 15:12   ` Nick Dokos
  2015-10-08  7:49 ` Eric S Fraga
  2 siblings, 1 reply; 10+ messages in thread
From: Nick Dokos @ 2015-10-08  7:31 UTC (permalink / raw)
  To: emacs-orgmode

Lawrence Bottorff <borgauf@gmail.com> writes:

> I've got a fraction done this way in an org file:
>
> \[
>  \frac{1}{(2^3)(5)}
>  \]
>
> and I'd like to strike though or cancel the (5) part. The Latex method I've found says do it this way:
>
> ...
> \usepackage[makeroom]{cancel}
> ...
>
> \[
>  \frac{1}{(2^3)\cancel{(5)}}
>  \]
>
> But it's ignored and comes back verbatim. Of course +(5)+ doesn't work either, again, coming back verbatim with the pluses. How can I do this?
>

Not sure what you tried, but it all works fine here for PDF export. The
following latex file works:

--8<---------------cut here---------------start------------->8---
\documentclass{article}
\usepackage[makeroom]{cancel}


\begin{document}

\[
\frac{1}{(2^3)\cancel{(5)}}
\]

\end{document}

%%% Local Variables: 
%%% mode: latex
%%% TeX-master: t
%%% End: 
--8<---------------cut here---------------end--------------->8---

and the following org file works as well:

--8<---------------cut here---------------start------------->8---
#+LATEX_HEADER: \usepackage[makeroom]{cancel}

* Some math
\[
\frac{1}{(2^3)\cancel{(5)}}
\]
--8<---------------cut here---------------end--------------->8---


You must mean HTML export - MathJax apparently does not know about
\cancel. There is an extension mechanism:

  https://docs.mathjax.org/en/latest/extension-writing.html

but that's as far as my knowledge extends. If you make it work, please
share.

Alternatively, you can use the (generally inferior) method of exporting
math as images - adding

#+OPTIONS: tex:imagemagick

works OK (assuming you have imagemagick installed of course).
There is also

#+OPTIONS: tex:dvipng

if you have dvipng instead.

--
Nick

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

* Re: Latex strikethrough or cancel?
  2015-10-08  3:35 Latex strikethrough or cancel? Lawrence Bottorff
  2015-10-08  7:06 ` Suvayu Ali
  2015-10-08  7:31 ` Nick Dokos
@ 2015-10-08  7:49 ` Eric S Fraga
  2015-10-08 14:29   ` Lawrence Bottorff
  2 siblings, 1 reply; 10+ messages in thread
From: Eric S Fraga @ 2015-10-08  7:49 UTC (permalink / raw)
  To: Lawrence Bottorff; +Cc: emacs-orgmode Mailinglist

On Thursday,  8 Oct 2015 at 03:35, Lawrence Bottorff wrote:
> \usepackage[makeroom]{cancel}

Put this in a #+latex_header line?
-- 
: Eric S Fraga (0xFFFCF67D), Emacs 24.5.1, Org release_8.3.1-239-gd01560

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

* Re: Latex strikethrough or cancel?
  2015-10-08  7:49 ` Eric S Fraga
@ 2015-10-08 14:29   ` Lawrence Bottorff
  2015-10-08 17:35     ` Eric S Fraga
  0 siblings, 1 reply; 10+ messages in thread
From: Lawrence Bottorff @ 2015-10-08 14:29 UTC (permalink / raw)
  To: emacs-orgmode Mailinglist

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

Sticking this after my initialization #+ stuff finally worked:

#+begin_html
<script type="text/x-mathjax-config">
 MathJax.Hub.Config({
   TeX: {extensions: ["cancel.js"]},
   tex2jax: {
     inlineMath: [ ['$','$'], ['\\(','\\)'] ],
     processEscapes: true
   }
 });
</script>
#+end_html

although I, the eternal beginner, don't quite understand other than MathJax
is pulling in this cancel.js and applying it. Got it off the MathJax Google
Group. I'm sure there's a better way to roll it into Emacs/org-mode
or org-html-mathjax-template?

[-- Attachment #2: Type: text/html, Size: 1272 bytes --]

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

* Re: Latex strikethrough or cancel?
  2015-10-08  7:31 ` Nick Dokos
@ 2015-10-08 15:12   ` Nick Dokos
  2015-10-08 16:30     ` Lawrence Bottorff
  0 siblings, 1 reply; 10+ messages in thread
From: Nick Dokos @ 2015-10-08 15:12 UTC (permalink / raw)
  To: emacs-orgmode

Nick Dokos <ndokos@gmail.com> writes:

> ...
> You must mean HTML export - MathJax apparently does not know about
> \cancel. There is an extension mechanism:
>
>   https://docs.mathjax.org/en/latest/extension-writing.html
>
> but that's as far as my knowledge extends. If you make it work, please
> share.
>

It's actually simple - the documentation tells you exactly how to do it
using the cancel package as an example :-) - see the section "TeX and
LaTeX extensions" in

   https://docs.mathjax.org/en/v2.5-latest/tex.html

All you need to do to incorporate that into org is to make it add the
script when you export. That is done by appending it to
org-html-mathjax-template:

--8<---------------cut here---------------start------------->8---
(setq org-html-mathjax-template (concat org-html-mathjax-template "
<script type=\"text/x-mathjax-config\">
MathJax.Hub.Register.StartupHook(\"TeX Jax Ready\",function () {
  MathJax.Hub.Insert(MathJax.InputJax.TeX.Definitions.macros,{
    cancel: [\"Extension\",\"cancel\"],
    bcancel: [\"Extension\",\"cancel\"],
    xcancel: [\"Extension\",\"cancel\"],
    cancelto: [\"Extension\",\"cancel\"]
  });
});
</script>
"))
--8<---------------cut here---------------end--------------->8---

--
Nick

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

* Re: Latex strikethrough or cancel?
  2015-10-08 15:12   ` Nick Dokos
@ 2015-10-08 16:30     ` Lawrence Bottorff
  0 siblings, 0 replies; 10+ messages in thread
From: Lawrence Bottorff @ 2015-10-08 16:30 UTC (permalink / raw)
  To: emacs-orgmode Mailinglist

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

Yes, Nick, I put it in my init and it worked. Amazing to me is how an elisp
concat just works, so I don't have to hack around with the
org-html-mathjax-template (Too close to Halloween). Thanks, everyone.

On Thu, Oct 8, 2015 at 3:12 PM, Nick Dokos <ndokos@gmail.com> wrote:

> Nick Dokos <ndokos@gmail.com> writes:
>
> > ...
> > You must mean HTML export - MathJax apparently does not know about
> > \cancel. There is an extension mechanism:
> >
> >   https://docs.mathjax.org/en/latest/extension-writing.html
> >
> > but that's as far as my knowledge extends. If you make it work, please
> > share.
> >
>
> It's actually simple - the documentation tells you exactly how to do it
> using the cancel package as an example :-) - see the section "TeX and
> LaTeX extensions" in
>
>    https://docs.mathjax.org/en/v2.5-latest/tex.html
>
> All you need to do to incorporate that into org is to make it add the
> script when you export. That is done by appending it to
> org-html-mathjax-template:
>
> --8<---------------cut here---------------start------------->8---
> (setq org-html-mathjax-template (concat org-html-mathjax-template "
> <script type=\"text/x-mathjax-config\">
> MathJax.Hub.Register.StartupHook(\"TeX Jax Ready\",function () {
>   MathJax.Hub.Insert(MathJax.InputJax.TeX.Definitions.macros,{
>     cancel: [\"Extension\",\"cancel\"],
>     bcancel: [\"Extension\",\"cancel\"],
>     xcancel: [\"Extension\",\"cancel\"],
>     cancelto: [\"Extension\",\"cancel\"]
>   });
> });
> </script>
> "))
> --8<---------------cut here---------------end--------------->8---
>
> --
> Nick
>
>
>

[-- Attachment #2: Type: text/html, Size: 2482 bytes --]

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

* Re: Latex strikethrough or cancel?
  2015-10-08 14:29   ` Lawrence Bottorff
@ 2015-10-08 17:35     ` Eric S Fraga
  2015-10-10 15:28       ` Lawrence Bottorff
  0 siblings, 1 reply; 10+ messages in thread
From: Eric S Fraga @ 2015-10-08 17:35 UTC (permalink / raw)
  To: Lawrence Bottorff; +Cc: emacs-orgmode Mailinglist

On Thursday,  8 Oct 2015 at 14:29, Lawrence Bottorff wrote:
> Sticking this after my initialization #+ stuff finally worked:
>
> #+begin_html
> <script type="text/x-mathjax-config">

[...]

Ah, it wasn't clear that you wanted export to HTML; the assumption I
made was you were exporting to LaTeX.  I'm glad you found the solution.
-- 
: Eric S Fraga (0xFFFCF67D), Emacs 25.0.50.2, Org release_8.3.2-161-gd2ac25

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

* Re: Latex strikethrough or cancel?
  2015-10-08 17:35     ` Eric S Fraga
@ 2015-10-10 15:28       ` Lawrence Bottorff
  2015-10-11  0:49         ` Nick Dokos
  0 siblings, 1 reply; 10+ messages in thread
From: Lawrence Bottorff @ 2015-10-10 15:28 UTC (permalink / raw)
  To: emacs-orgmode Mailinglist

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

Actually I spoke too soon. Putting

(setq org-html-mathjax-template (concat org-html-mathjax-template "
<script type=\"text/x-mathjax-config\">
MathJax.Hub.Register.StartupHook(\"TeX Jax Ready\",function () {
  MathJax.Hub.Insert(MathJax.InputJax.TeX.Definitions.macros,{
    cancel: [\"Extension\",\"cancel\"],
    bcancel: [\"Extension\",\"cancel\"],
    xcancel: [\"Extension\",\"cancel\"],
    cancelto: [\"Extension\",\"cancel\"]
  });
});
</script>
"))
​
in my init didn't fly when I rebooted, although it seemed to work before
when I stuck it in my init and did eval-buffer. Going back to

#+begin_html
<script type="text/x-mathjax-config">
 MathJax.Hub.Config({
   TeX: {extensions: ["cancel.js"]},
   tex2jax: {
     inlineMath: [ ['$','$'], ['\\(','\\)'] ],
     processEscapes: true
   }
 });
</script>
#+end_html

Would appreciate any advice on how to incorporate the \cancel code
into org-html-mathjax-template.

[-- Attachment #2: Type: text/html, Size: 1862 bytes --]

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

* Re: Latex strikethrough or cancel?
  2015-10-10 15:28       ` Lawrence Bottorff
@ 2015-10-11  0:49         ` Nick Dokos
  0 siblings, 0 replies; 10+ messages in thread
From: Nick Dokos @ 2015-10-11  0:49 UTC (permalink / raw)
  To: emacs-orgmode

Lawrence Bottorff <borgauf@gmail.com> writes:

> Actually I spoke too soon. Putting
>
> (setq org-html-mathjax-template (concat org-html-mathjax-template "
> <script type=\"text/x-mathjax-config\">
> MathJax.Hub.Register.StartupHook(\"TeX Jax Ready\",function () {
>   MathJax.Hub.Insert(MathJax.InputJax.TeX.Definitions.macros,{
>     cancel: [\"Extension\",\"cancel\"],
>     bcancel: [\"Extension\",\"cancel\"],
>     xcancel: [\"Extension\",\"cancel\"],
>     cancelto: [\"Extension\",\"cancel\"]
>   });
> });
> </script>
> "))
> ​
> in my init didn't fly when I rebooted, although it seemed to work
> before when I stuck it in my init and did eval-buffer.
> ...
> Would appreciate any advice on how to incorporate the \cancel code
> into org-html-mathjax-template.
>

The code assumes that org-html-mathjax-template has been initialized
already, so either

(require 'ox-html)

beforehand or use eval-after-load:

(eval-after-load "ox-html"
                 (setq org-html-mathjax-template ....))

-- 
Nick

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

end of thread, other threads:[~2015-10-11  0:49 UTC | newest]

Thread overview: 10+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2015-10-08  3:35 Latex strikethrough or cancel? Lawrence Bottorff
2015-10-08  7:06 ` Suvayu Ali
2015-10-08  7:31 ` Nick Dokos
2015-10-08 15:12   ` Nick Dokos
2015-10-08 16:30     ` Lawrence Bottorff
2015-10-08  7:49 ` Eric S Fraga
2015-10-08 14:29   ` Lawrence Bottorff
2015-10-08 17:35     ` Eric S Fraga
2015-10-10 15:28       ` Lawrence Bottorff
2015-10-11  0:49         ` Nick Dokos

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