make LaTeX code usable in normal environment

This commit is contained in:
ucrhh 2021-03-11 14:55:21 +01:00
parent 9767002ad1
commit 73376c0667
4 changed files with 10 additions and 7 deletions

View File

@ -31,6 +31,8 @@ public class ShareDialog extends Dialog implements LocaleChangeObserver {
private static final String CLOSE_ICON_ID = "closeIcon";
private static final String RIGHT_ARROW_WHITE = "\\\\rightwhitearrow";
private static final String MATH_OPEN = "\\[";
private static final String MATH_CLOSE = "\\]";
private final TextField urlField;
private final TextArea packageAreaTree;
@ -67,7 +69,7 @@ public class ShareDialog extends Dialog implements LocaleChangeObserver {
latexAreaTree = new TextArea();
packageAreaUnification = new TextArea();
latexAreaUnification = new TextArea();
initializeFields(url, latexCodeTree, latexCodeUnification);
initializeFields(url, latexCodeTree, MATH_OPEN + latexCodeUnification + MATH_CLOSE);
UI.getCurrent().getPage().executeJs("window.autoSelect($0)", FIELD_CLASS);

View File

@ -58,8 +58,8 @@ public final class LatexCreatorConstants {
protected static final String LATEX_NEW_LINE = "\\\\";
protected static final String CIRC = "\\circ";
protected static final String COLOR_RED = "\\color{#f00}";
protected static final String COLOR_HIGHLIGHT = "\\color{#006AF5}";
protected static final String COLOR_RED = "\\color{Red}";
protected static final String COLOR_HIGHLIGHTED = "\\color{RoyalBlue}";
protected static final String EMPTY_SET = "\\emptyset";
protected static final String LAMBDA = "\\lambda";
protected static final String LATEX_SPACE = "\\ ";

View File

@ -291,7 +291,7 @@ public class LatexCreatorConstraints implements StepVisitor {
sb.append(COLOR_RED);
} else if (markLastTwoConstraints && (i < 2)) {
sb.append(CURLY_LEFT);
sb.append(COLOR_HIGHLIGHT);
sb.append(COLOR_HIGHLIGHTED);
}
sb.append(new LatexCreatorType(unificationConstraints.get(i).getFirstType()).getLatex());
sb.append(EQUALS);
@ -310,7 +310,7 @@ public class LatexCreatorConstraints implements StepVisitor {
if (original.contains(originalType)) {
StringBuilder highlightedChange2 = new StringBuilder();
highlightedChange2.append(CURLY_LEFT);
highlightedChange2.append(COLOR_HIGHLIGHT);
highlightedChange2.append(COLOR_HIGHLIGHTED);
highlightedChange2.append(new LatexCreatorType(s.getType()).getLatex());
highlightedChange2.append(CURLY_RIGHT);
latex.append(original.replace(originalType, highlightedChange2.toString()));

View File

@ -85,5 +85,6 @@ share.neededPackagesTree=\
\\usepackage{bussproofs}\n\
\\usepackage{amsmath}
share.neededPackagesUnification=\
\\usepackage{xcolor}\n\
\\usepackage{amsmath}
\\usepackage[dvipsnames]{xcolor}\n\
\\usepackage{amsmath}\n\
\\usepackage{stix}