Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Inline stem macros inside AsciiDoc table cells are generated without considering to_dir #78

Open
lmoellendorf opened this issue Apr 15, 2020 · 3 comments

Comments

@lmoellendorf
Copy link

lmoellendorf commented Apr 15, 2020

Steps to Reproduce

sample.adoc

based on sample.adoc

= Precompiled Math
:math:
:stem: latexmath

== Equations in normal blocks

[latexmath]
++++
k_{n+1} = n^2 + k_n^2 - k_{n-1}
++++

Some useful text! Formula for quadratic root:

[stem]
++++
x = \frac{-b \pm \sqrt{b^2 - 4ac}}{2a}
++++

Inline equation works too! latexmath:[a^2+b^2=c^2]. Or as stem
stem:[a^2+b^2=c^2]. Pretty nice, huh?

== Equations in table cells

Equations in asciidoc style table cells work, too!

[%header]
|===
| Demo | Contents
| Inline Equation in *Asciidoc* Cells
a|

This is an *inline* equation: latexmath:[E=m \cdot c^2].

| Block Equation in *Asciidoc* Cells
a| The following is a stem block:
[stem]
++++
a^2+b^2=c^2+d^2
++++

|===

asciidoctor invocation

pwd is /doc

asciidoctor  --destination-dir=/doc/build -a imagesdir=images -r asciidoctor-mathematical /doc/sample.adoc

Expected Result

All generated images should got into /doc/build/images

Actual Result

$ find ./ -name 'stem-*'
./images/stem-e21aaf56997f76dcc4584ad75fd32494.png
./images/stem-f5419604efe38ee8591c30c2a37fe800.png
./build/images/stem-560f2ca395ac37caca2a4729e62691d2.png
./build/images/stem-e1affc0a43f89ae2da953b789d29e42c.png
./build/images/stem-0b241139835e83278d5b9e608a543ce0.png

However, there are relative paths to images in the generated HTML for all generated images:

 $ grep 'stem-' sample.html
<img src="images/stem-560f2ca395ac37caca2a4729e62691d2.png" alt="$$k_{n+1} = n^2 + k_n^2 - k_{n-1}$$" width="125" height="14">
<img src="images/stem-0b241139835e83278d5b9e608a543ce0.png" alt="$$x = \frac{-b \pm \sqrt{b^2 - 4ac}}{2a}$$" width="118" height="33">
<p>Inline equation works too! <span class="image"><img src="images/stem-e1affc0a43f89ae2da953b789d29e42c.png" alt="stem e1affc0a43f89ae2da953b789d29e42c" width="66" height="10"></span>. Or as stem
<span class="image"><img src="images/stem-e1affc0a43f89ae2da953b789d29e42c.png" alt="stem e1affc0a43f89ae2da953b789d29e42c" width="66" height="10"></span>. Pretty nice, huh?</p>
<p>This is an <strong>inline</strong> equation: <span class="image"><img src="images/stem-e21aaf56997f76dcc4584ad75fd32494.png" alt="stem e21aaf56997f76dcc4584ad75fd32494" width="58" height="10"></span>.</p>
<img src="images/stem-f5419604efe38ee8591c30c2a37fe800.png" alt="$$a^2+b^2=c^2+d^2$$" width="94" height="12">

Remarks

If I remove the a attribute from the table cell to test with non-adoc cells, asciidoctor fails with:

asciidoctor: FAILED: /doc/sample.adoc: Failed to load AsciiDoc document - undefined method `lines=' for #<Asciidoctor::Table::Cell:0x0000564584ebe888>
Did you mean?  lines
               lineno
  Use --trace for backtrace

This is bug #73?


I've noticed that the behavior is like expected if using asciidoctor-pdf instead of asciidoctor.

@ProgramFan
Copy link
Contributor

Which version is used in this issue?

@lmoellendorf
Copy link
Author

asciidoctor-2.0.10
asciidoctor-pdf-1.5.3
asciidoctor-mathematical-0.3.1

@eastack
Copy link

eastack commented Oct 19, 2021

Is there any progress, this also bothers me

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants