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

Issue #39: LaTeX math support #3

Closed
wants to merge 17 commits into from
Closed

Conversation

dakusui
Copy link
Owner

@dakusui dakusui commented Oct 29, 2018

This is a pull request that offers an implementation of Issue-stathissideris#39 (LaTeX math mode support)

NOTE: This pull request is opened for review and discussions. Another pull request will be created when it becomes necessary.

README

Following is a documentation about this feature. This will appear in README.md after discussions are concluded.

Usage and syntax

Command line

(snip)

 -e,--encoding <ENCODING>       The encoding of the input file.
 -h,--html                      In this case the input is an HTML file.
                                The contents of the <pre
                                class="textdiagram"> tags are rendered as
                                diagrams and saved in the images directory
                                and a new HTML file is produced with the
                                appropriate <img> tags.
    --help                      Prints usage help.
-L,--latex-math                 Enable LaTeX math mode.

(snip)

Syntax

(snip)

LaTeX mode.

If you place LaTeX formulae inside 2 $s, it will be rendered using jlatexmath. That is, if you have a following input files.


$Box_1$                    $Box^2$
+---------------------+    +------+   /---------\
|$\sum_{i=0}^{n}x^i$  |    |$cBLU$|   |         |
|                     +--->|cRED  +-=-+cGRE$C_k$|
|{io}                 |    |cXYZ  |   |{o}      |
+----------+----------+    +---+--+   \---------/
           |                   |
           |                   :
           |                   V
           |           +-------------------+
           +---------->*$A_i$ hello $B^i$  |
                       |              +----+
                       |              |c8FA|
                       +--------------+----+

$|Set| = o-*-Freunde-*-nicht=*=diese-=-*- * töne$

o Quick brown fox jumps over
* a lazy dog.

$Q_u^i$, $C_k$, $B_r^{own}$, $F_{ox}$ jumps

over a lazy $d\cdot\frac{o}{g}$.


$\forall x \in X, \quad \exists y \leq \epsilon$


$\sin A \cos B =$

    $ \frac{1}{2}\left[ \sin(A-B)+\sin(A+B) \right]$


$\frac{d}{dx}\left( \int_{0}^{x} f(u)\,du\right)=f(x).$


 $v \sim \mathcal{N} (m,\sigma^2)$

This will be rendered as follows.

art-latexmath-1

Limitations

This feature is only available when you are generating .png files.

Discussions

  • This enhancement introduces a new semantics to a certain character in a text and it means potentially hurts a compatibility. And for this product, we need keep the backward compatibility because there are quite a few users who use ditaa as automatic document generation backend. Thus, this feature must be disabled by default.
  • .svg support is discussed separately in Issue-44.

Tasks

  • Implement tests
  • Fix a bug where * is rendered as a bullet point (or a connector?) even if it is placed inside $ and $.
  • Remove pom.xml
    • Backport chages made in pom.xml to project.clj
  • Provide a documentation.
  • Implement an option to enable this feature. This must be disabled by default.
  • Make tests work under leiningen.

@dakusui
Copy link
Owner Author

dakusui commented Nov 3, 2018

pom.xml to work on ditaa as a Java project (mvn) is found here.

@paulvi
Copy link

paulvi commented Nov 27, 2018

Well, this repository deserves its own name...

@rudolph9
Copy link

rudolph9 commented Jun 4, 2019

This would be an awesome feature! Are there any updates for this pull request?

@dakusui
Copy link
Owner Author

dakusui commented Jun 4, 2019

@rudolph9
The change itself should be working.
This pull request is (kept) opened to show the changes to be made on the @stathissideris's original repository:

https://github.com/stathissideris/ditaa

Otherwise it will not be publicly available.
The history is,

  1. My IDE code formatted all the files unintentionally.
  2. I made the enhancement over it after the code formatting somehow without noticing it.
  3. So the diff to the original repo became so huge to review.
  4. I created this pull request from the enhanced version (2) to the code formatted version(1)

The next thing to be done is to rework Step 2. over the original repository.
Right now I do not have much time to work on it.
If someone could help it, it will be much much appreciated.

If you want to try the feature only, you can simply clone the branch (https://github.com/dakusui/ditaa/tree/issue-39-latex-math-support) and build it.

@dakusui
Copy link
Owner Author

dakusui commented Aug 24, 2019

The re-worked version was pull requested to the original repository and this is not necessary anymore.
Please refer to stathissideris#54

@dakusui dakusui closed this Aug 24, 2019
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

Successfully merging this pull request may close these issues.

3 participants