emacs-orgmode@gnu.org archives
 help / color / mirror / code / Atom feed
* Org html conversion with XyJax
@ 2023-01-27  8:59 Partha Pratim Ghosh
  2023-01-27 12:53 ` Ihor Radchenko
  0 siblings, 1 reply; 7+ messages in thread
From: Partha Pratim Ghosh @ 2023-01-27  8:59 UTC (permalink / raw)
  To: Help Emacs Orgmode

Dear All,

I want to convert my notes written in Org-mode with LaTeX to html so
that they can be seen as a web page using a browser.

Since the notes involve several Xy-pic diagrams, and there is already an
extension of MathJax for using Xy-pic, known as
[[https://github.com/sonoisa/XyJax-v3][XyJax]], the same link shows how
to configure the html to load the proper xypic.js

My query: is it possible to configure the usage of MathJax in Org mode
so that the above mentioned script can be used instead and the
conversion be done smoothly from Org mode conversion.

With my regards and all the very best wishes,

partha



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

* Re: Org html conversion with XyJax
  2023-01-27  8:59 Org html conversion with XyJax Partha Pratim Ghosh
@ 2023-01-27 12:53 ` Ihor Radchenko
  2023-01-27 18:38   ` Partha Pratim Ghosh
  0 siblings, 1 reply; 7+ messages in thread
From: Ihor Radchenko @ 2023-01-27 12:53 UTC (permalink / raw)
  To: Partha Pratim Ghosh; +Cc: Help Emacs Orgmode

Partha Pratim Ghosh <ghosh.parthapratim.unisa@gmail.com> writes:

> I want to convert my notes written in Org-mode with LaTeX to html so
> that they can be seen as a web page using a browser.
>
> Since the notes involve several Xy-pic diagrams, and there is already an
> extension of MathJax for using Xy-pic, known as
> [[https://github.com/sonoisa/XyJax-v3][XyJax]], the same link shows how
> to configure the html to load the proper xypic.js
>
> My query: is it possible to configure the usage of MathJax in Org mode
> so that the above mentioned script can be used instead and the
> conversion be done smoothly from Org mode conversion.

See org-html-mathjax-template and
https://docs.mathjax.org/en/latest/input/tex/extensions.html

Also, you may utilize HTML_HEAD and HTML_HEAD_EXTRA keywords to add
arbitrary config to html header.

-- 
Ihor Radchenko // yantar92,
Org mode contributor,
Learn more about Org mode at <https://orgmode.org/>.
Support Org development at <https://liberapay.com/org-mode>,
or support my work at <https://liberapay.com/yantar92>


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

* Re: Org html conversion with XyJax
  2023-01-27 12:53 ` Ihor Radchenko
@ 2023-01-27 18:38   ` Partha Pratim Ghosh
  2023-01-27 20:41     ` Rudolf Adamkovič
  0 siblings, 1 reply; 7+ messages in thread
From: Partha Pratim Ghosh @ 2023-01-27 18:38 UTC (permalink / raw)
  To: Ihor Radchenko; +Cc: Help Emacs Orgmode

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

Dear Ihor,

Please accept my thanks for your prompt reply. However I have the
following problems.

1. Here is my org file:

[-- Attachment #2: org file --]
[-- Type: text, Size: 293 bytes --]

#-*- mode: org -*-
#+TITLE: test
#+AUTHOR: Partha

#+latex_header:\usepackage{Documents/tex/essentials/symbols}

* first section

this is my trial for /OER/

Can I use \LaTeX ? Let us try: $f: A\rightarrow B$ is a function

** use of more

$\xymatrix{ {A} \ar@{o->}[r] & {B} }$

\Arr{f}{A}{B}

[-- Attachment #3: Type: text/plain, Size: 39 bytes --]


2. The file exports perfectly to pdf:

[-- Attachment #4: exported pdf --]
[-- Type: application/pdf, Size: 121589 bytes --]

[-- Attachment #5: Type: text/plain, Size: 64 bytes --]


3. The html export is not correct as the rendered image shows:

[-- Attachment #6: rendered image --]
[-- Type: image/png, Size: 159648 bytes --]

[-- Attachment #7: Type: text/plain, Size: 35 bytes --]


The actual exported html file is:

[-- Attachment #8: exported html file --]
[-- Type: text/html, Size: 9554 bytes --]

[-- Attachment #9: Type: text/plain, Size: 1193 bytes --]


Problems:
1. seems that the xypic is not being picked up

2. nor are the macros from the style file added on the first line

3. math symbols within "$", "$" come within "\(", "\).

Please can you help or suggest way forward?

With my regards and all the very best wishes,

partha


Ihor Radchenko <yantar92@posteo.net> writes:

> Partha Pratim Ghosh <ghosh.parthapratim.unisa@gmail.com> writes:
>
>> I want to convert my notes written in Org-mode with LaTeX to html so
>> that they can be seen as a web page using a browser.
>>
>> Since the notes involve several Xy-pic diagrams, and there is already an
>> extension of MathJax for using Xy-pic, known as
>> [[https://github.com/sonoisa/XyJax-v3][XyJax]], the same link shows how
>> to configure the html to load the proper xypic.js
>>
>> My query: is it possible to configure the usage of MathJax in Org mode
>> so that the above mentioned script can be used instead and the
>> conversion be done smoothly from Org mode conversion.
>
> See org-html-mathjax-template and
> https://docs.mathjax.org/en/latest/input/tex/extensions.html
>
> Also, you may utilize HTML_HEAD and HTML_HEAD_EXTRA keywords to add
> arbitrary config to html header.


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

* Re: Org html conversion with XyJax
  2023-01-27 18:38   ` Partha Pratim Ghosh
@ 2023-01-27 20:41     ` Rudolf Adamkovič
  2023-01-28  6:57       ` tomas
  2023-01-28 19:53       ` Partha Pratim Ghosh
  0 siblings, 2 replies; 7+ messages in thread
From: Rudolf Adamkovič @ 2023-01-27 20:41 UTC (permalink / raw)
  To: Partha Pratim Ghosh, Ihor Radchenko; +Cc: Help Emacs Orgmode

Partha Pratim Ghosh <ghosh.parthapratim.unisa@gmail.com> writes:

> #-*- mode: org -*-

FYI: You do not need this line if the file has an '.org' extension.

> #+TITLE: test
> #+AUTHOR: Partha

> #+latex_header:\usepackage{Documents/tex/essentials/symbols}

Note that this header applies to LaTeX and will not work with MathJax.

You can make Org to use actual LaTeX in HTML by adding

#+OPTIONS: tex:dvisvgm

to your document.

> Can I use \LaTeX ? Let us try: $f: A\rightarrow B$ is a function

MathJax ignores \LaTeX but renders the function correctly.

(I tried with plain 'emacs -Q' on Emacs 30.)

> $\xymatrix{ {A} \ar@{o->}[r] & {B} }$

MathJax does not recognize this, hence the "Misplaced &" error.

You have two options here: either (1) install the MathJax extension you
mentioned or (2) make Org to use LaTeX for HTML.

If you decide to go the MathJax/JavaScript route, please note that you need to
use Emacs 29 or later, where Org uses MathJax 3 and not 2.

> \Arr{f}{A}{B}

MathJax does not recognize this either.

> 2. The file exports perfectly to pdf:

That happens because Org always uses LaTeX for PDF documents.  If you want it to
use LaTeX for HTML too, see the OPTIONS above.

Rudy
-- 
"Chop your own wood and it will warm you twice."
-- Henry Ford; Francis Kinloch, 1819; Henry David Thoreau, 1854

Rudolf Adamkovič <salutis@me.com> [he/him]
Studenohorská 25
84103 Bratislava
Slovakia


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

* Re: Org html conversion with XyJax
  2023-01-27 20:41     ` Rudolf Adamkovič
@ 2023-01-28  6:57       ` tomas
  2023-01-28 19:53       ` Partha Pratim Ghosh
  1 sibling, 0 replies; 7+ messages in thread
From: tomas @ 2023-01-28  6:57 UTC (permalink / raw)
  To: emacs-orgmode

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

On Fri, Jan 27, 2023 at 09:41:59PM +0100, Rudolf Adamkovič wrote:
> Partha Pratim Ghosh <ghosh.parthapratim.unisa@gmail.com> writes:
> 
> > #-*- mode: org -*-
> 
> FYI: You do not need this line if the file has an '.org' extension.

*and* if your auto-mode-alist happens to be the right one. And if
someone else hasn't given other name to the file. And...

FWIW, I put that in always: I don't like metadata embedded in a
file name (it reminds me fatally of MS-DOS ;-)

[...]

Thanks for your other suggestions!

[Not the OP, but learning]

Cheers
-- 
t

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

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

* Re: Org html conversion with XyJax
  2023-01-27 20:41     ` Rudolf Adamkovič
  2023-01-28  6:57       ` tomas
@ 2023-01-28 19:53       ` Partha Pratim Ghosh
  2023-02-04 14:11         ` Ihor Radchenko
  1 sibling, 1 reply; 7+ messages in thread
From: Partha Pratim Ghosh @ 2023-01-28 19:53 UTC (permalink / raw)
  To: Rudolf Adamkovič; +Cc: Ihor Radchenko, Help Emacs Orgmode

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

Dear Rudolf,

Please accept my thanks for your kind and prompt reply.

I still have some queries, which I provide inline as well as in the end.

Rudolf Adamkovič <salutis@me.com> writes:

> Partha Pratim Ghosh <ghosh.parthapratim.unisa@gmail.com> writes:
>
>> #-*- mode: org -*-
>
> FYI: You do not need this line if the file has an '.org' extension.
>
>> #+TITLE: test
>> #+AUTHOR: Partha
>
>> #+latex_header:\usepackage{Documents/tex/essentials/symbols}
>
> Note that this header applies to LaTeX and will not work with MathJax.
>
> You can make Org to use actual LaTeX in HTML by adding
>
> #+OPTIONS: tex:dvisvgm
>
> to your document.
>

Thanks; this suggestion worked --- at least the xymatrix figure came
out; however, the arrow was almost not present:

[-- Attachment #2: test output --]
[-- Type: text/html, Size: 9336 bytes --]

[-- Attachment #3: Type: text/plain, Size: 2236 bytes --]


I believe this is a rendering problem. Also the mathematics symbols get
/tiny/; could rendering of mathematics made bigger, a little bolder, and
xymatrix diagram arrows made visible?

>> Can I use \LaTeX ? Let us try: $f: A\rightarrow B$ is a function
>
> MathJax ignores \LaTeX but renders the function correctly.
>
> (I tried with plain 'emacs -Q' on Emacs 30.)
>
>> $\xymatrix{ {A} \ar@{o->}[r] & {B} }$
>
> MathJax does not recognize this, hence the "Misplaced &" error.
>
> You have two options here: either (1) install the MathJax extension you
> mentioned or (2) make Org to use LaTeX for HTML.
>
> If you decide to go the MathJax/JavaScript route, please note that you need to
> use Emacs 29 or later, where Org uses MathJax 3 and not 2.
>

Thanks, I am on 28.2, the latest on Linux Mint archive; I think I shall
have to download and compile from gnu archives for the latest one. 

>> \Arr{f}{A}{B}
>

This is a problem; please see also below.

> MathJax does not recognize this either.
>
>> 2. The file exports perfectly to pdf:
>
> That happens because Org always uses LaTeX for PDF documents.  If you want it to
> use LaTeX for HTML too, see the OPTIONS above.
>
> Rudy

I have a huge amount of macros which are constantly used, especially
because the area of my work (Category Theory) demands use of plenty of
inline diagrams as well as displayed diagrams; for inline diagrams it is
best to have macros to speed up the typing. I believe you are saying
that while these are recognised by LaTeX for PDF documents, the html
converter just neglects them.

Firstly, is it possible to convert these macros to a form which is
acceptable by hrml converter?

I believe the answer is _Yes_, since the same commands between "$", "$"
works; but can this be automated? The suggestion is: would it be
possible to write some quick code to be used by the converter before
starting the process of conversion, so that a list of macros used is
made up, each of such macros automatically converted in a form usable
for html, and then used in the conversion disregarding the actual macro
file; the converted macros could then be placed somewhere in the header
of the converted html file.

With my regards and all the very best wishes,

partha


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

* Re: Org html conversion with XyJax
  2023-01-28 19:53       ` Partha Pratim Ghosh
@ 2023-02-04 14:11         ` Ihor Radchenko
  0 siblings, 0 replies; 7+ messages in thread
From: Ihor Radchenko @ 2023-02-04 14:11 UTC (permalink / raw)
  To: Partha Pratim Ghosh; +Cc: Rudolf Adamkovič, Help Emacs Orgmode

Partha Pratim Ghosh <ghosh.parthapratim.unisa@gmail.com> writes:

> Thanks; this suggestion worked --- at least the xymatrix figure came
> out; however, the arrow was almost not present:
> test

Note that your attached html lacks images and thus cannot be viewed.

> I believe this is a rendering problem. Also the mathematics symbols get
> /tiny/; could rendering of mathematics made bigger, a little bolder, and
> xymatrix diagram arrows made visible?

Check out org-format-latex-options. In particular, :scale.

> I have a huge amount of macros which are constantly used, especially
> because the area of my work (Category Theory) demands use of plenty of
> inline diagrams as well as displayed diagrams; for inline diagrams it is
> best to have macros to speed up the typing. I believe you are saying
> that while these are recognised by LaTeX for PDF documents, the html
> converter just neglects them.
>
> Firstly, is it possible to convert these macros to a form which is
> acceptable by hrml converter?

We rely on MathJax, which, AFAIK, supports a subset of LaTeX. To get
full LaTeX support, you have to use LaTeX, which we allow, via images,
as Rudolf suggested.

-- 
Ihor Radchenko // yantar92,
Org mode contributor,
Learn more about Org mode at <https://orgmode.org/>.
Support Org development at <https://liberapay.com/org-mode>,
or support my work at <https://liberapay.com/yantar92>


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

end of thread, other threads:[~2023-02-04 14:11 UTC | newest]

Thread overview: 7+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2023-01-27  8:59 Org html conversion with XyJax Partha Pratim Ghosh
2023-01-27 12:53 ` Ihor Radchenko
2023-01-27 18:38   ` Partha Pratim Ghosh
2023-01-27 20:41     ` Rudolf Adamkovič
2023-01-28  6:57       ` tomas
2023-01-28 19:53       ` Partha Pratim Ghosh
2023-02-04 14:11         ` Ihor Radchenko

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