asciidoctor / asciidoctor-latex

:triangular_ruler: Add LaTeX features to AsciiDoc & convert AsciiDoc to LaTeX
http://asciidoctor.org
Other
111 stars 26 forks source link

Multiple errors and dysfunctional .tex file #85

Open jfernandz opened 4 years ago

jfernandz commented 4 years ago

When I convert my MWE to a .tex file and then I try to produce a .pdf output with xelatex I'm getting a lot of errors which apparently point to a malformed .tex file. I don't know if this is related with my xetex install or the asciidoctor-latex itself. This is my MWE

:stem: latexmath

= Table example with latex syntax

== Testing

I'm also testing a few admonitions

[NOTE]
.First admonition
Here you have a note. 
====
.Table inside a block
[cols=".^,<.^a,>.^a"]
|===
| (Test) \[X_nY_m\]
| * \(X\) with \(i\)
* \(Y\) with \(j\)
| [cols=">.^"]
!===
! FOO ! BAR
!===
|===
====

IMPORTANT: Here a second admonition with no title.

.Image
image::./picture.jpg[Picture!]

I've already seen several issues mentioning lack of support for asterisk lists or tables and fontspec/pdflatex problems. I would say there is also bad support for \[\] enclosures and nested tables. Anyway ... this is the xelatex output when I try to produce the .pdf file (basically the log):

latex-example.log

It seems to have a few syntax errors. When I try to use pdflatex instead I cannot use fontspec as #79 suggests. And also I need to switch the \[\] enclosure for a $$ one. In fact, the tabular equivalent environment produced in .tex file is this one

\admonition{NOTE}{Here you have a note.}
\begin{example}
\begin{center}
\begin{tabular}{|c|c|c|}
\hline
(Test) \[X_nY_m\] & \ & \ \\ 
\hline
\end{tabular}
\end{center}
\end{example}

Which I think is far to be what it should be (actually the \(\) are not being recognised either). The nested table and asterisk list is not rendered at all.

I would like a full support for all those features, otherwise I'm not sure if this asciidoctor-latex could be considered as fully functional.

jfernandz commented 4 years ago

After a few conversations in ascidoctor-mathematical repo I've realised \[\] and \(\) are not part of asciidoc syntax. That's because I've modified and extended my MWE a little bit.

:stem: latexmath
:icons: font

= Table example with latex syntax

== Testing

I'm also testing a few admonitions

[NOTE]
.First admonition
Here you have a note. 
====
.Table inside a block
[cols=".^a,<.^a,>.^a"]
|===
| (Testing text)
[stem]
++++
X_nY_m
++++

| * stem:[X] with stem:[n=i]
* stem:[Y] with stem:[m=j]
| [cols=">.^"]
!===
! Nested ! Table ! Inside
!===
|===
====

IMPORTANT: Here a second admonition with no title.

.Now a ordered list
. First item with a `stem` macro: stem:[\quad \rightarrow \quad a^2 - y_0] 
. Second item with a `[stem]` block
.. For the first subitem
+
[stem]
++++
y = Ln\left(\frac{a}{a_0}\right)
++++

.Picture of a strange plane.
image::./picture.jpg[Picture!]

I'm trying to test stem macros and blocks in different situations. Particularly I'm getting this document body for the .tex file after give the .adoc file to asciidoctor-latex.

%% Begin Document %%

\begin{document}
\maketitle
\hypertarget{x-testing}{\section*{Testing}}
I’m also testing a few admonitions

\admonition{NOTE}{Here you have a note.}
\begin{example}
\begin{center}
\begin{tabular}{|c|c|c|}
\hline
( & \ & \ \\ 
\hline
\end{tabular}
\end{center}
\end{example}

\admonition{IMPORTANT}{Here a second admonition with no title.}
\begin{enumerate}

\item{First item with a \textttlatexmath macro: \quad \rightarrow \quad a^2 - y_0}

\item{Second item with a \texttt{[stem]} block}

\begin{enumerate}

\item{For the first subitem}

\[
y = Ln\left(\frac{a}{a_0}\right)
\]
\end{enumerate}

\end{enumerate}

\begin{figure}[h]{}
\centering\includegraphics[width=2.5truein]{./picture.jpg}
\caption{}

\end{figure}

\end{document}

Obviously there a malformed body as you can see, there lack a lot of math expressions originally included in the .adoc file, mainly those inside table; but also the in-line math in the first item in the ordered list.