lihugang / mep2

The Math Editor for Photos Version 2
GNU General Public License v3.0
0 stars 0 forks source link

Multi-Line Text Command Support #6

Closed lihugang closed 1 year ago

lihugang commented 1 year ago

Is your feature request related to a problem? Please describe. In current version of MEP(2.1.1), we must type text command in one line, for example

text rwd 0.5 0.5 Hello World \\ e^{i \pi}+1=0$

It’s too inconvenient for us to use.

Describe the solution you'd like Offer a syntax like

text rwd 0.5 0.5 `
  Hello World
  $x=\frac{-b \pm \sqrt{b^2-4ac}}$
  $e^{i \pi}+1=0$
`

Add a new macro to support multiple-line texts.
In each line, it will trim the spaces of contents by removing spaces in the starting and ending, add concatenate them with \n.
The preprocessing code of the previous example is text rwd 0.5 0.5 Hello World\\$x=\frac{-b \pm \sqrt{b^2-4ac}}\\e^{i \pi}+1=0$

lihugang commented 1 year ago

There's a problem is that after processing, multi-line macro will be converted into one-line, and the line number will be wrong. We add comments into the end of code after preprocessing, these comments contains line number, and the error handler will use these comments to generate error report.

lihugang commented 1 year ago

solve with ecbdd68