metanorma / tex2mn

Write Metanorma documents in LaTeX
https://www.metanorma.com
MIT License
2 stars 0 forks source link

Support for source code environment in AsciiDoc output #107

Open manuelfuenmayor opened 4 years ago

manuelfuenmayor commented 4 years ago

verbatim and listingsenvironments are usually used for typesetting source code in LaTeX, and it seems we don't have support for them yet. For example,

Verbatim source code in LaTeX:

\begin{verbatim}
class HelloWorldApp {
  public static void main(String[] args) {
    //Display the string
    System.out.println("Hello World!");
  }
}
\end{verbatim}

results in:

class HelloWorldApp {
  public static void main(String[] args) {
    //Display the string
    System.out.println("Hello World!");
  }
}

Though the expected result should be like:

----
class HelloWorldApp {
  public static void main(String[] args) {
    //Display the string
    System.out.println("Hello World!");
  }
}
----

And, in regard to listings environment. (Maybe this one is more complicated to handle.)

Listings source code in LaTeX:

\begin{lstlisting}[language=java]
class HelloWorldApp {
  public static void main(String[] args) {
    //Display the string
    System.out.println("Hello World!");
  }
}
\end{lstlisting}

results in

**class** HelloWorldApp {  **public** **static** **void** main(String[] args) {    __//Display the string__    System.out.println(”Hello␣World!”);  }}

And the expected result (if possible):

[source,java]
----
class HelloWorldApp {
  public static void main(String[] args) {
    //Display the string
    System.out.println("Hello World!");
  }
}
----