1
0
mirror of https://github.com/octoleo/plantuml.git synced 2024-11-13 17:06:32 +00:00

Merge pull request #1710 from The-Lum/PatchBranch

fix: math two-dimensional matrices and add tests
This commit is contained in:
PlantUML 2024-03-10 19:23:12 +01:00 committed by GitHub
commit 3499373851
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
2 changed files with 5 additions and 2 deletions

View File

@ -905,8 +905,8 @@ public class ASCIIMathTeXImg {
subarr = new ArrayList<String>(Arrays.asList(
newFrag.substring(pos.get(i) + 8, subpos.get(pos.get(i)).get(1))));
for (int j = 2; j < subpos.get(pos.get(i)).size(); j++) {
subarr.add(newFrag.substring(subpos.get(i).get(j - 1) + 1,
subpos.get(i).get(j)));
subarr.add(newFrag.substring(subpos.get(pos.get(i)).get(j - 1) + 1,
subpos.get(pos.get(i)).get(j)));
}
subarr.add(newFrag.substring(
subpos.get(pos.get(i)).get(subpos.get(pos.get(i)).size() - 1) + 1,

View File

@ -17,6 +17,9 @@ class MathTest {
" '[[a,b],[c,d]]', {\\left[\\begin{matrix}{a}&{b}\\\\{c}&{d}\\end{matrix}\\right]} ",
" color(red)(x), {\\textcolor{red}{{x}}} ",
" color(red)(t)=color(blue)(x), {\\textcolor{red}{{t}}}={\\textcolor{blue}{{x}}} ",
" f, {f} ",
" f_g, {{f}_{{g}}} ",
" '[[1,2,3],[4,5,6]]', {\\left[\\begin{matrix}{1}&{2}&{3}\\\\{4}&{5}&{6}\\end{matrix}\\right]} ",
})
public void testMath(String input, String expected) {
final String res = new ASCIIMathTeXImg().getTeX(input);