Skip to content
GitLab
Menu
Projects
Groups
Snippets
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Sign in
Toggle navigation
Menu
Open sidebar
monticore
EmbeddedMontiArc
generators
MathPrettyPrinter
Commits
36846ccd
Commit
36846ccd
authored
Jul 07, 2018
by
0xJMR
Browse files
Fixes issue with spacing.
parent
ac7875e7
Pipeline
#61285
passed with stages
in 1 minute and 48 seconds
Changes
1
Pipelines
1
Hide whitespace changes
Inline
Side-by-side
src/main/java/de/monticore/lang/monticar/mpp/montimath/TeXMathPrettyPrinter.java
View file @
36846ccd
...
...
@@ -10,6 +10,7 @@ import de.monticore.lang.monticar.types2._ast.ASTDimension;
import
de.monticore.lang.monticar.types2._ast.ASTElementType
;
import
de.monticore.lang.matrixexpressions._ast.*
;
import
de.monticore.numberunit._ast.ASTTimeDiv
;
import
de.monticore.numberunit._ast.ASTUnitBaseDimWithPrefix
;
public
class
TeXMathPrettyPrinter
extends
MathPrettyPrinter
implements
TeXMathStructuredVisitor
{
protected
boolean
needsParenthesis
;
...
...
@@ -22,7 +23,7 @@ public class TeXMathPrettyPrinter extends MathPrettyPrinter implements TeXMathSt
@Override
public
void
visit
(
ASTElementType
node
)
{
String
printedNode
=
String
.
format
(
"\\mathbb{%s}"
,
node
.
getName
());
String
printedNode
=
String
.
format
(
"\\mathbb{%s}
\\;
"
,
node
.
getName
());
this
.
printer
.
print
(
printedNode
);
}
...
...
@@ -67,9 +68,9 @@ public class TeXMathPrettyPrinter extends MathPrettyPrinter implements TeXMathSt
public
void
revisit
(
ASTMathAssignmentDeclarationStatement
node
)
{
String
printedNode
=
String
.
format
(
"\\text{%s}"
,
node
.
getName
());
this
.
printer
.
print
(
"~"
);
//
this.printer.print("~");
this
.
printer
.
print
(
printedNode
);
this
.
printer
.
print
(
"~"
);
//
this.printer.print("~");
}
@Override
...
...
@@ -80,7 +81,7 @@ public class TeXMathPrettyPrinter extends MathPrettyPrinter implements TeXMathSt
this
.
printer
.
print
(
printedNode
);
}
this
.
printer
.
print
(
"~"
);
//
this.printer.print("~");
}
@Override
...
...
@@ -90,7 +91,7 @@ public class TeXMathPrettyPrinter extends MathPrettyPrinter implements TeXMathSt
@Override
public
void
endVisit
(
ASTMathDeclarationStatement
node
)
{
this
.
printer
.
print
(
"~"
);
//
this.printer.print("~");
this
.
printer
.
print
(
node
.
getName
());
this
.
printSemicolon
();
this
.
printer
.
println
();
...
...
@@ -100,10 +101,12 @@ public class TeXMathPrettyPrinter extends MathPrettyPrinter implements TeXMathSt
public
void
visit
(
ASTTimeDiv
node
)
{
//TODO: Create LaTeX
if
(
node
.
isPresentIsDiv
())
{
this
.
printer
.
print
(
"\\;"
);
this
.
printer
.
print
(
node
.
getIsDiv
());
}
if
(
node
.
isPresentIsTime
())
{
this
.
printer
.
print
(
"\\;"
);
this
.
printer
.
print
(
"\\cdot"
);
}
}
...
...
@@ -271,4 +274,10 @@ public class TeXMathPrettyPrinter extends MathPrettyPrinter implements TeXMathSt
this
.
printer
.
print
(
printedNode
);
}
@Override
public
void
visit
(
ASTUnitBaseDimWithPrefix
node
)
{
this
.
printer
.
print
(
"\\;"
);
this
.
printer
.
print
(
node
.
getName
());
}
}
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment