asciidoctor / asciidoctor-mathematical

An extension for Asciidoctor that converts the content of STEM blocks and inline macros using Mathematical.
MIT License
50 stars 45 forks source link

Asciimath matrix not rendered correctly #108

Closed peter-jerry-ye closed 3 years ago

peter-jerry-ye commented 3 years ago

Problem

The asciimath matrix is not rendered correctly

Input

= Test
:stem: 

== Content
stem:[[[1,2,3\], [4,5,6\]\]]

Command

asciidoctor-pdf -r asciidoctor-mathematical Test.adoc

Expected

image

Output

image

Gem Versions

Ascii85 (1.1.0) asciidoctor (2.0.16) asciidoctor-mathematical (0.3.5) asciidoctor-pdf (1.6.1) asciimath (2.0.3)

ProgramFan commented 3 years ago

Have your tried to use asciimath macro directly? To my best knowledge, the above case shall not work since it does not specify the stem type. We encourage to use the concrete stem macro directly.

peter-jerry-ye commented 3 years ago

Have your tried to use asciimath macro directly?

You mean like this:

= Test
:stem:

== Content
asciimath:[[[1,2,3\],[4,5,6\]\]]

It doesn't work either, nor with this one

= Test
:stem:

== Content
[asciimath]
++++
[[1,2,3\],[4,5,6\]\]
++++

To my best knowledge, the above case shall not work since it does not specify the stem type. We encourage to use the concrete stem macro directly.

This is the exact example given in the official document of asciidoc, so I don't see why it shall not work.

ProgramFan commented 3 years ago

There used to be an asciimath handler, it seems the the handler does not work.

ProgramFan commented 3 years ago

How about [[1,2,3],[4,5,6]] in block stem? The handler is still there in the code and shall work.

peter-jerry-ye commented 3 years ago

How about [[1,2,3],[4,5,6]] in block stem?

It renders correctly.

ProgramFan commented 3 years ago

OK. This seems a problem in the expression itself. You do not have to escape them in block macros. The inline macro can not handle [] at the moment, unfortunately.

Fethbita commented 2 months ago

Is it possible to open this issue back? The [] still does not work for the inline macro, and this is the example given in the documentation.

A matrix can be written as stem:[[[a,b\],[c,d\]\]((n),(k))].

should be: image

but results in: image

And even inside a block stem, the example does not work:

A matrix can be written as 
[stem]
++++
[[[a,b],[c,d]]((n),(k))]
++++

results in: image

which is not how it looks in the documentation.