* Exporting LaTeX source blocks with HTML backend @ 2014-03-03 17:43 Xavier Garrido 2014-03-03 19:24 ` Richard Lawrence 0 siblings, 1 reply; 9+ messages in thread From: Xavier Garrido @ 2014-03-03 17:43 UTC (permalink / raw) To: emacs-orgmode@gnu.org Dear Orgers, I am facing one issue when I am exporting from orgmode to html. I like to write LaTeX code within #+BEGIN_SRC latex ... #+END_SRC block mainly to take benefit/advantage of the syntax highlighting (debugging long LaTeX equations is "simpler"). The problem is that these code blocks are not exported at all by the html export backend whereas the LaTeX backend does. Of course, an easy solution will be to remove the #+BEGIN_SRC/#+END_SRC lines and both latex and html exporters will just do it right. But, as I said, syntax highlighting is really useful and I can't imagine living without it. I have tried different things from adding a "before parsing hook" which delete lines containing #+BEGIN_SRC/#+END_SRC (then I get problem with other source block such as 'sh' that I want to be exported to 'pre' code in html) to trying to play with filters (so far, I do not get any getting LaTeX source block when exporting to html). As a summary I would like to do the following #+BEGIN_SRC org * Test LaTeX block Syntax highlighting is always nice but the following block is not exported in html. An option will be to remove the #+BEGIN_SRC latex/#+END_SRC lines #+BEGIN_SRC latex \begin{align*} x&=x\\ y&=y \end{align*} #+END_SRC * Test shell block Here, I would like to keep the following source block as it is to get it exported properly by html backend (namely as <pre> code) #+BEGIN_SRC sh uname -a #+END_SRC #+END_SRC Thanks for your help, Xavier ^ permalink raw reply [flat|nested] 9+ messages in thread
* Re: Exporting LaTeX source blocks with HTML backend 2014-03-03 17:43 Exporting LaTeX source blocks with HTML backend Xavier Garrido @ 2014-03-03 19:24 ` Richard Lawrence 2014-03-03 19:39 ` Xavier Garrido 0 siblings, 1 reply; 9+ messages in thread From: Richard Lawrence @ 2014-03-03 19:24 UTC (permalink / raw) To: emacs-orgmode; +Cc: Xavier Garrido Hi Xavier, Xavier Garrido <xavier.garrido@gmail.com> writes: > I am facing one issue when I am exporting from orgmode to html. I like > to write LaTeX code within #+BEGIN_SRC latex ... #+END_SRC block mainly > to take benefit/advantage of the syntax highlighting (debugging long > LaTeX equations is "simpler"). The problem is that these code blocks are > not exported at all by the html export backend whereas the LaTeX backend > does. Of course, an easy solution will be to remove the > #+BEGIN_SRC/#+END_SRC lines and both latex and html exporters will just > do it right. But, as I said, syntax highlighting is really useful and I > can't imagine living without it. I don't quite understand what you're looking for here. Are you wanting these blocks to be exported as source code? Or do you want them to be interpreted somehow? Removing the BEGIN_SRC/END_SRC lines will just result in raw LaTeX code getting dumped into your HTML, and a browser won't know what to do with that (at least not without help...are you wanting MathJax to interpret it?). > As a summary I would like to do the following > > #+BEGIN_SRC org > * Test LaTeX block > Syntax highlighting is always nice but the following block is not > exported in html. An option will be to remove the #+BEGIN_SRC > latex/#+END_SRC lines > > #+BEGIN_SRC latex > \begin{align*} > x&=x\\ > y&=y > \end{align*} > #+END_SRC When I export this using the HTML exporter, the LaTeX code is wrapped in a <div> with class="org-src-container", and the actual code appears inside a <pre> tag. Is this the behavior you see? Is that not what you want? If you are instead looking to get something in your HTML output that looks like the result of compiling the LaTeX code, I am not exactly sure how to accomplish this, but it looks like there is some useful information in the section "Math formatting in HTML export" in the Org manual about either using MathJax or preprocessing LaTeX code into images with dvipng. Hope that helps, Richard (If possible, please encrypt your reply to me using my PGP key: Key ID: CF6FA646 Fingerprint: 9969 43E1 CF6F A646. See http://www.ocf.berkeley.edu/~rwl/encryption.html for more information.) ^ permalink raw reply [flat|nested] 9+ messages in thread
* Re: Exporting LaTeX source blocks with HTML backend 2014-03-03 19:24 ` Richard Lawrence @ 2014-03-03 19:39 ` Xavier Garrido 2014-03-03 19:55 ` Ista Zahn 2014-03-03 20:54 ` Richard Lawrence 0 siblings, 2 replies; 9+ messages in thread From: Xavier Garrido @ 2014-03-03 19:39 UTC (permalink / raw) To: Richard Lawrence; +Cc: emacs-orgmode@gnu.org Hi Richard, Le 03/03/2014 20:24, Richard Lawrence a écrit : >> I am facing one issue when I am exporting from orgmode to html. I like >> to write LaTeX code within #+BEGIN_SRC latex ... #+END_SRC block mainly >> to take benefit/advantage of the syntax highlighting (debugging long >> LaTeX equations is "simpler"). The problem is that these code blocks are >> not exported at all by the html export backend whereas the LaTeX backend >> does. Of course, an easy solution will be to remove the >> #+BEGIN_SRC/#+END_SRC lines and both latex and html exporters will just >> do it right. But, as I said, syntax highlighting is really useful and I >> can't imagine living without it. > I don't quite understand what you're looking for here. Are you wanting > these blocks to be exported as source code? Or do you want them to be > interpreted somehow? I would like to get them interpreted as raw LaTeX code in such way MathJax can reinterpret them as you said. > Removing the BEGIN_SRC/END_SRC lines will just result in raw LaTeX code > getting dumped into your HTML, and a browser won't know what to do with > that (at least not without help...are you wanting MathJax to interpret > it?). > >> As a summary I would like to do the following >> >> #+BEGIN_SRC org >> * Test LaTeX block >> Syntax highlighting is always nice but the following block is not >> exported in html. An option will be to remove the #+BEGIN_SRC >> latex/#+END_SRC lines >> >> #+BEGIN_SRC latex >> \begin{align*} >> x&=x\\ >> y&=y >> \end{align*} >> #+END_SRC > When I export this using the HTML exporter, the LaTeX code is wrapped in > a <div> with class="org-src-container", and the actual code appears > inside a <pre> tag. Is this the behavior you see? Is that not what you > want? In my case, the code is not even wrapped into org-src-container class, it just does not appear at all. > > If you are instead looking to get something in your HTML output that > looks like the result of compiling the LaTeX code, I am not exactly sure > how to accomplish this, but it looks like there is some useful > information in the section "Math formatting in HTML export" in the Org > manual about either using MathJax or preprocessing LaTeX code into > images with dvipng. Actually, I just want to get the LaTeX code translated into raw code. As I wrote, there is one solution, pretty easy to implement and may be used by most of the org users : write raw LaTeX inside org document and use MathJax for example, to interpret it in a convenient way. It is going to work for both exporter html and latex. The point here is that using raw LaTeX code makes me lose the syntax highlighting which is really useful for debugging long LaTeX equation. Cheers, Xavier > Hope that helps, > Richard > > > (If possible, please encrypt your reply to me using my PGP key: > Key ID: CF6FA646 > Fingerprint: 9969 43E1 CF6F A646. > See http://www.ocf.berkeley.edu/~rwl/encryption.html for more information.) ^ permalink raw reply [flat|nested] 9+ messages in thread
* Re: Exporting LaTeX source blocks with HTML backend 2014-03-03 19:39 ` Xavier Garrido @ 2014-03-03 19:55 ` Ista Zahn 2014-03-03 23:31 ` Xavier Garrido 2014-03-07 21:37 ` Eric S Fraga 2014-03-03 20:54 ` Richard Lawrence 1 sibling, 2 replies; 9+ messages in thread From: Ista Zahn @ 2014-03-03 19:55 UTC (permalink / raw) To: Xavier Garrido; +Cc: Richard Lawrence, emacs-orgmode@gnu.org Hi Xavier, I think #+begin_src latex :results drawer :exports results \begin{align*} x&=x\\ y&=y \end{align*} #+end_src will give both syntax highlighting (in the code block) as well as properly displayed equations in both latex and html export. Best, Ista On Mon, Mar 3, 2014 at 2:39 PM, Xavier Garrido <xavier.garrido@gmail.com> wrote: > Hi Richard, > > Le 03/03/2014 20:24, Richard Lawrence a écrit : > >>> I am facing one issue when I am exporting from orgmode to html. I like >>> to write LaTeX code within #+BEGIN_SRC latex ... #+END_SRC block mainly >>> to take benefit/advantage of the syntax highlighting (debugging long >>> LaTeX equations is "simpler"). The problem is that these code blocks are >>> not exported at all by the html export backend whereas the LaTeX backend >>> does. Of course, an easy solution will be to remove the >>> #+BEGIN_SRC/#+END_SRC lines and both latex and html exporters will just >>> do it right. But, as I said, syntax highlighting is really useful and I >>> can't imagine living without it. >> >> I don't quite understand what you're looking for here. Are you wanting >> these blocks to be exported as source code? Or do you want them to be >> interpreted somehow? > > > I would like to get them interpreted as raw LaTeX code in such way MathJax > can reinterpret them as you said. > > >> Removing the BEGIN_SRC/END_SRC lines will just result in raw LaTeX code >> getting dumped into your HTML, and a browser won't know what to do with >> that (at least not without help...are you wanting MathJax to interpret >> it?). >> >>> As a summary I would like to do the following >>> >>> #+BEGIN_SRC org >>> * Test LaTeX block >>> Syntax highlighting is always nice but the following block is not >>> exported in html. An option will be to remove the #+BEGIN_SRC >>> latex/#+END_SRC lines >>> >>> #+BEGIN_SRC latex >>> \begin{align*} >>> x&=x\\ >>> y&=y >>> \end{align*} >>> #+END_SRC >> >> When I export this using the HTML exporter, the LaTeX code is wrapped in >> a <div> with class="org-src-container", and the actual code appears >> inside a <pre> tag. Is this the behavior you see? Is that not what you >> want? > > In my case, the code is not even wrapped into org-src-container class, it > just does not appear at all. > > > >> >> If you are instead looking to get something in your HTML output that >> looks like the result of compiling the LaTeX code, I am not exactly sure >> how to accomplish this, but it looks like there is some useful >> information in the section "Math formatting in HTML export" in the Org >> manual about either using MathJax or preprocessing LaTeX code into >> images with dvipng. > > > Actually, I just want to get the LaTeX code translated into raw code. As I > wrote, there is one solution, pretty easy to implement and may be used by > most of the org users : write raw LaTeX inside org document and use MathJax > for example, to interpret it in a convenient way. It is going to work for > both exporter html and latex. The point here is that using raw LaTeX code > makes me lose the syntax highlighting which is really useful for debugging > long LaTeX equation. > > Cheers, > Xavier > >> Hope that helps, >> Richard >> >> >> (If possible, please encrypt your reply to me using my PGP key: >> Key ID: CF6FA646 >> Fingerprint: 9969 43E1 CF6F A646. >> See http://www.ocf.berkeley.edu/~rwl/encryption.html for more >> information.) > > > ^ permalink raw reply [flat|nested] 9+ messages in thread
* Re: Exporting LaTeX source blocks with HTML backend 2014-03-03 19:55 ` Ista Zahn @ 2014-03-03 23:31 ` Xavier Garrido 2014-03-07 21:37 ` Eric S Fraga 1 sibling, 0 replies; 9+ messages in thread From: Xavier Garrido @ 2014-03-03 23:31 UTC (permalink / raw) To: Ista Zahn, Xavier Garrido; +Cc: Richard Lawrence, emacs-orgmode@gnu.org Hi Ista, Le 03/03/2014 20:55, Ista Zahn a écrit : > Hi Xavier, > > I think > > #+begin_src latex :results drawer :exports results > \begin{align*} > x&=x\\ > y&=y > \end{align*} > #+end_src > > will give both syntax highlighting (in the code block) as well as > properly displayed equations in both latex and html export. > This one works. Thanks for your help. Xavier > Best, > Ista > > On Mon, Mar 3, 2014 at 2:39 PM, Xavier Garrido <xavier.garrido@gmail.com> wrote: >> Hi Richard, >> >> Le 03/03/2014 20:24, Richard Lawrence a écrit : >> >>>> I am facing one issue when I am exporting from orgmode to html. I like >>>> to write LaTeX code within #+BEGIN_SRC latex ... #+END_SRC block mainly >>>> to take benefit/advantage of the syntax highlighting (debugging long >>>> LaTeX equations is "simpler"). The problem is that these code blocks are >>>> not exported at all by the html export backend whereas the LaTeX backend >>>> does. Of course, an easy solution will be to remove the >>>> #+BEGIN_SRC/#+END_SRC lines and both latex and html exporters will just >>>> do it right. But, as I said, syntax highlighting is really useful and I >>>> can't imagine living without it. >>> >>> I don't quite understand what you're looking for here. Are you wanting >>> these blocks to be exported as source code? Or do you want them to be >>> interpreted somehow? >> >> >> I would like to get them interpreted as raw LaTeX code in such way MathJax >> can reinterpret them as you said. >> >> >>> Removing the BEGIN_SRC/END_SRC lines will just result in raw LaTeX code >>> getting dumped into your HTML, and a browser won't know what to do with >>> that (at least not without help...are you wanting MathJax to interpret >>> it?). >>> >>>> As a summary I would like to do the following >>>> >>>> #+BEGIN_SRC org >>>> * Test LaTeX block >>>> Syntax highlighting is always nice but the following block is not >>>> exported in html. An option will be to remove the #+BEGIN_SRC >>>> latex/#+END_SRC lines >>>> >>>> #+BEGIN_SRC latex >>>> \begin{align*} >>>> x&=x\\ >>>> y&=y >>>> \end{align*} >>>> #+END_SRC >>> >>> When I export this using the HTML exporter, the LaTeX code is wrapped in >>> a <div> with class="org-src-container", and the actual code appears >>> inside a <pre> tag. Is this the behavior you see? Is that not what you >>> want? >> >> In my case, the code is not even wrapped into org-src-container class, it >> just does not appear at all. >> >> >> >>> >>> If you are instead looking to get something in your HTML output that >>> looks like the result of compiling the LaTeX code, I am not exactly sure >>> how to accomplish this, but it looks like there is some useful >>> information in the section "Math formatting in HTML export" in the Org >>> manual about either using MathJax or preprocessing LaTeX code into >>> images with dvipng. >> >> >> Actually, I just want to get the LaTeX code translated into raw code. As I >> wrote, there is one solution, pretty easy to implement and may be used by >> most of the org users : write raw LaTeX inside org document and use MathJax >> for example, to interpret it in a convenient way. It is going to work for >> both exporter html and latex. The point here is that using raw LaTeX code >> makes me lose the syntax highlighting which is really useful for debugging >> long LaTeX equation. >> >> Cheers, >> Xavier >> >>> Hope that helps, >>> Richard >>> >>> >>> (If possible, please encrypt your reply to me using my PGP key: >>> Key ID: CF6FA646 >>> Fingerprint: 9969 43E1 CF6F A646. >>> See http://www.ocf.berkeley.edu/~rwl/encryption.html for more >>> information.) >> >> >> ^ permalink raw reply [flat|nested] 9+ messages in thread
* Re: Exporting LaTeX source blocks with HTML backend 2014-03-03 19:55 ` Ista Zahn 2014-03-03 23:31 ` Xavier Garrido @ 2014-03-07 21:37 ` Eric S Fraga 1 sibling, 0 replies; 9+ messages in thread From: Eric S Fraga @ 2014-03-07 21:37 UTC (permalink / raw) To: Ista Zahn; +Cc: emacs-orgmode@gnu.org Ista Zahn <istazahn@gmail.com> writes: > Hi Xavier, > > I think > > #+begin_src latex :results drawer :exports results > \begin{align*} > x&=x\\ > y&=y > \end{align*} > #+end_src > > will give both syntax highlighting (in the code block) as well as > properly displayed equations in both latex and html export. This doesn't work for me in HTML. I get the code exported as is, not the actual equations. You must have some other configuration settings that allow for this? For this to work for me, I have to invoke conditional entries for :results and for :exports to create an image for HTML. I would love to hear what HTML and what Latex you get generated with the above. thanks, eric -- : Eric S Fraga (0xFFFCF67D), Emacs 24.3.50.2, Org release_8.2.5h-683-ga85683 ^ permalink raw reply [flat|nested] 9+ messages in thread
* Re: Exporting LaTeX source blocks with HTML backend 2014-03-03 19:39 ` Xavier Garrido 2014-03-03 19:55 ` Ista Zahn @ 2014-03-03 20:54 ` Richard Lawrence 2014-03-03 23:33 ` Xavier Garrido 1 sibling, 1 reply; 9+ messages in thread From: Richard Lawrence @ 2014-03-03 20:54 UTC (permalink / raw) To: Xavier Garrido; +Cc: emacs-orgmode@gnu.org Xavier Garrido <xavier.garrido@gmail.com> writes: >>> #+BEGIN_SRC latex >>> \begin{align*} >>> x&=x\\ >>> y&=y >>> \end{align*} >>> #+END_SRC >> When I export this using the HTML exporter, the LaTeX code is wrapped in >> a <div> with class="org-src-container", and the actual code appears >> inside a <pre> tag. Is this the behavior you see? Is that not what you >> want? > In my case, the code is not even wrapped into org-src-container class, > it just does not appear at all. Hmm. If Ista's solution doesn't work for you, you may want to look into why this is happening. Maybe you have a variable or option set somewhere that is suppressing export of these blocks for some reason. I am using the "maint" version of the exporter (8.2.5h) and I don't use HTML export much, so I am pretty sure what I see is the current default behavior. Best, Richard (If possible, please encrypt your reply to me using my PGP key: Key ID: CF6FA646 Fingerprint: 9969 43E1 CF6F A646. See http://www.ocf.berkeley.edu/~rwl/encryption.html for more information.) ^ permalink raw reply [flat|nested] 9+ messages in thread
* Re: Exporting LaTeX source blocks with HTML backend 2014-03-03 20:54 ` Richard Lawrence @ 2014-03-03 23:33 ` Xavier Garrido 2014-03-08 11:39 ` Eric S Fraga 0 siblings, 1 reply; 9+ messages in thread From: Xavier Garrido @ 2014-03-03 23:33 UTC (permalink / raw) To: Richard Lawrence, Xavier Garrido; +Cc: emacs-orgmode@gnu.org Le 03/03/2014 21:54, Richard Lawrence a écrit : > Xavier Garrido <xavier.garrido@gmail.com> writes: > >>>> #+BEGIN_SRC latex >>>> \begin{align*} >>>> x&=x\\ >>>> y&=y >>>> \end{align*} >>>> #+END_SRC > >>> When I export this using the HTML exporter, the LaTeX code is wrapped in >>> a <div> with class="org-src-container", and the actual code appears >>> inside a <pre> tag. Is this the behavior you see? Is that not what you >>> want? > >> In my case, the code is not even wrapped into org-src-container class, >> it just does not appear at all. > > Hmm. If Ista's solution doesn't work for you, you may want to look into > why this is happening. Maybe you have a variable or option set > somewhere that is suppressing export of these blocks for some reason. I > am using the "maint" version of the exporter (8.2.5h) and I don't use > HTML export much, so I am pretty sure what I see is the current default > behavior. The non export is due to this setup #+BEGIN_SRC emacs-lisp (org-babel-do-load-languages 'org-babel-load-languages '((emacs-lisp . t) (latex . t))) #+END_SRC Cheers, Xavier > > Best, > Richard > > > (If possible, please encrypt your reply to me using my PGP key: > Key ID: CF6FA646 > Fingerprint: 9969 43E1 CF6F A646. > See http://www.ocf.berkeley.edu/~rwl/encryption.html for more information.) > ^ permalink raw reply [flat|nested] 9+ messages in thread
* Re: Exporting LaTeX source blocks with HTML backend 2014-03-03 23:33 ` Xavier Garrido @ 2014-03-08 11:39 ` Eric S Fraga 0 siblings, 0 replies; 9+ messages in thread From: Eric S Fraga @ 2014-03-08 11:39 UTC (permalink / raw) To: Xavier Garrido; +Cc: Richard Lawrence, emacs-orgmode@gnu.org Xavier Garrido <xavier.garrido@gmail.com> writes: [...] > The non export is due to this setup > > #+BEGIN_SRC emacs-lisp > (org-babel-do-load-languages > 'org-babel-load-languages > '((emacs-lisp . t) > (latex . t))) > #+END_SRC Actually, this wasn't enough for me (I already had both of these enabled). The problem, in my case, was that I had org-html-with-latex set to t (the default, I guess) which relies on mathjax. If you want an image created, this needs to be set to either 'dvipng or 'imagemagick or via tex: option in the org file. -- : Eric S Fraga (0xFFFCF67D), Emacs 24.3.50.2, Org release_8.2.5h-683-ga85683 ^ permalink raw reply [flat|nested] 9+ messages in thread
end of thread, other threads:[~2014-03-08 11:39 UTC | newest] Thread overview: 9+ messages (download: mbox.gz follow: Atom feed -- links below jump to the message on this page -- 2014-03-03 17:43 Exporting LaTeX source blocks with HTML backend Xavier Garrido 2014-03-03 19:24 ` Richard Lawrence 2014-03-03 19:39 ` Xavier Garrido 2014-03-03 19:55 ` Ista Zahn 2014-03-03 23:31 ` Xavier Garrido 2014-03-07 21:37 ` Eric S Fraga 2014-03-03 20:54 ` Richard Lawrence 2014-03-03 23:33 ` Xavier Garrido 2014-03-08 11:39 ` 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).