Skip to content

Commit 15c762a

Browse files
Merge pull request #1864 from kamalsaleh/master
Update few LaTeXOutput methods (for Julia)
2 parents 77cc86e + 56d4c88 commit 15c762a

8 files changed

Lines changed: 115 additions & 105 deletions

File tree

AdditiveClosuresForCAP/PackageInfo.g

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@ SetPackageInfo( rec(
1010

1111
PackageName := "AdditiveClosuresForCAP",
1212
Subtitle := "Additive closures for pre-additive categories",
13-
Version := "2026.07-02",
13+
Version := "2026.07-03",
1414
Date := (function ( ) if IsBound( GAPInfo.SystemEnvironment.GAP_PKG_RELEASE_DATE ) then return GAPInfo.SystemEnvironment.GAP_PKG_RELEASE_DATE; else return Concatenation( ~.Version{[ 1 .. 4 ]}, "-", ~.Version{[ 6, 7 ]}, "-01" ); fi; end)( ),
1515
License := "GPL-2.0-or-later",
1616

@@ -131,7 +131,7 @@ PackageDoc := rec(
131131

132132
Dependencies := rec(
133133
GAP := ">= 4.13.0",
134-
NeededOtherPackages := [ [ "CAP", ">= 2026.07-01" ],
134+
NeededOtherPackages := [ [ "CAP", ">= 2026.07-03" ],
135135
[ "GradedRingForHomalg", ">= 2026.04-01" ],
136136
[ "MonoidalCategories", ">= 2026.06-01" ],
137137
],

AdditiveClosuresForCAP/gap/AdditiveClosure.gi

Lines changed: 35 additions & 34 deletions
Original file line numberDiff line numberDiff line change
@@ -1740,7 +1740,6 @@ InstallMethod( DisplayString,
17401740

17411741
end );
17421742

1743-
#= comment for Julia
17441743
##
17451744
InstallMethod( LaTeXOutput,
17461745
[ IsAdditiveClosureObject ],
@@ -1757,9 +1756,9 @@ InstallMethod( LaTeXOutput,
17571756
List( objs,
17581757
function( pair )
17591758
local s;
1760-
s := Concatenation( "{", LaTeXOutput( pair[ 1 ] ), "}" );
1759+
s := Concatenation( LATEX_LBRACE, LaTeXOutput( pair[ 1 ] ), LATEX_RBRACE );
17611760
if pair[ 2 ] <> 1 then
1762-
s := Concatenation( s, "^{\\oplus ", String( pair[ 2 ] ), "}" );
1761+
s := Concatenation( s, "^", LATEX_LBRACE, "\\oplus ", String( pair[ 2 ] ), LATEX_RBRACE );
17631762
fi;
17641763
return s;
17651764
end ),
@@ -1771,37 +1770,39 @@ end );
17711770
##
17721771
InstallMethod( LaTeXOutput,
17731772
[ IsAdditiveClosureMorphism ],
1774-
1775-
function( morphism )
1776-
local matrix, str;
1777-
1778-
matrix := MorphismMatrix( morphism );
1779-
1780-
if ForAny( List( [ Source( morphism ), Range( morphism ) ], ObjectList ), IsEmpty ) then
1781-
str := "\\\\";
1782-
else
1783-
str := JoinStringsWithSeparator(
1784-
List( matrix, row -> JoinStringsWithSeparator(
1785-
List( row, m -> LaTeXOutput( m : OnlyDatum := true ) ),
1786-
"\&" ) ),
1787-
"\\\\ \n"
1788-
);
1789-
fi;
1790-
1791-
str := Concatenation( "\\begin{pmatrix}", str, "\\end{pmatrix}" );
1792-
1793-
if ValueOption( "OnlyDatum" ) = true then
1794-
return str;
1795-
fi;
1796-
1797-
return Concatenation(
1798-
LaTeXOutput( Source( morphism ) ),
1799-
"\\xrightarrow{", str, "}",
1800-
LaTeXOutput( Range( morphism ) )
1801-
);
1802-
1803-
end );
1804-
# =#
1773+
FunctionWithNamedArguments(
1774+
[ [ "OnlyDatum", false ] ],
1775+
function( CAP_NAMED_ARGUMENTS, morphism )
1776+
local matrix, str;
1777+
1778+
matrix := MorphismMatrix( morphism );
1779+
1780+
if ForAny( List( [ Source( morphism ), Range( morphism ) ], ObjectList ), IsEmpty ) then
1781+
str := "\\\\";
1782+
else
1783+
str := JoinStringsWithSeparator(
1784+
List( matrix, row -> JoinStringsWithSeparator(
1785+
List( row, m -> LaTeXOutput( m : OnlyDatum := true ) ),
1786+
"&" ) ),
1787+
"\\\\ \n"
1788+
);
1789+
fi;
1790+
1791+
str := Concatenation( "\\begin", LATEX_LBRACE, "pmatrix", LATEX_RBRACE, str, "\\end", LATEX_LBRACE, "pmatrix", LATEX_RBRACE );
1792+
1793+
if CAP_NAMED_ARGUMENTS.OnlyDatum = true then
1794+
return str;
1795+
fi;
1796+
1797+
return Concatenation(
1798+
LaTeXOutput( Source( morphism ) ),
1799+
"\\xrightarrow", LATEX_LBRACE, str, LATEX_RBRACE,
1800+
LaTeXOutput( Range( morphism ) )
1801+
);
1802+
1803+
end
1804+
)
1805+
);
18051806

18061807
####################################
18071808
##

AdditiveClosuresForCAP/gap/CategoryOfRows.gi

Lines changed: 28 additions & 27 deletions
Original file line numberDiff line numberDiff line change
@@ -1493,48 +1493,49 @@ InstallMethod( DisplayString,
14931493

14941494
end );
14951495

1496-
#= comment for Julia
14971496
##
14981497
InstallMethod( LaTeXOutput,
14991498
[ IsCategoryOfRowsObject ],
15001499

15011500
function( obj )
15021501

1503-
return Concatenation( LaTeXOutput( UnderlyingRing( CapCategory( obj ) ) ), "^{1 \\times ", String( RankOfObject( obj ) ), "}" );
1502+
return Concatenation( LaTeXOutput( UnderlyingRing( CapCategory( obj ) ) ), "^", LATEX_LBRACE, "1 \\times ", String( RankOfObject( obj ) ), LATEX_RBRACE );
15041503

15051504
end );
15061505

15071506
##
15081507
InstallMethod( LaTeXOutput,
15091508
[ IsCategoryOfRowsMorphism ],
1510-
1511-
function( mor )
1512-
local matrix;
1513-
1514-
matrix := LaTeXOutput( UnderlyingMatrix( mor ) );
1515-
1516-
if ValueOption( "OnlyDatum" ) = true then
1517-
1518-
return Concatenation(
1519-
"""{\color{blue}{""",
1520-
matrix,
1521-
"""}}"""
1522-
);
1509+
FunctionWithNamedArguments(
1510+
[ [ "OnlyDatum", false ] ],
1511+
function( CAP_NAMED_ARGUMENTS, mor )
1512+
local matrix;
15231513

1524-
else
1514+
matrix := LaTeXOutput( UnderlyingMatrix( mor ) );
15251515

1526-
return Concatenation(
1527-
LaTeXOutput( Source( mor ) ),
1528-
"""{\color{blue}{\xrightarrow{""",
1529-
matrix,
1530-
"""}}}""",
1531-
LaTeXOutput( Range( mor ) )
1532-
);
1516+
if CAP_NAMED_ARGUMENTS.OnlyDatum = true then
1517+
1518+
return Concatenation(
1519+
LATEX_LBRACE, "\\color", LATEX_LBRACE, "blue", LATEX_RBRACE, LATEX_LBRACE,
1520+
matrix,
1521+
LATEX_RBRACE, LATEX_RBRACE
1522+
);
1523+
1524+
else
1525+
1526+
return Concatenation(
1527+
LaTeXOutput( Source( mor ) ),
1528+
LATEX_LBRACE, "\\color", LATEX_LBRACE, "blue", LATEX_RBRACE, LATEX_LBRACE, "\\xrightarrow", LATEX_LBRACE,
1529+
matrix,
1530+
LATEX_RBRACE, LATEX_RBRACE, LATEX_RBRACE,
1531+
LaTeXOutput( Range( mor ) )
1532+
);
1533+
1534+
fi;
15331535

1534-
fi;
1535-
1536-
end );
1537-
# =#
1536+
end
1537+
)
1538+
);
15381539

15391540
####################################
15401541
##

CAP/PackageInfo.g

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@ SetPackageInfo( rec(
1010

1111
PackageName := "CAP",
1212
Subtitle := "Categories, Algorithms, Programming",
13-
Version := "2026.07-02",
13+
Version := "2026.07-03",
1414
Date := (function ( ) if IsBound( GAPInfo.SystemEnvironment.GAP_PKG_RELEASE_DATE ) then return GAPInfo.SystemEnvironment.GAP_PKG_RELEASE_DATE; else return Concatenation( ~.Version{[ 1 .. 4 ]}, "-", ~.Version{[ 6, 7 ]}, "-01" ); fi; end)( ),
1515
License := "GPL-2.0-or-later",
1616

CAP/gap/ToolsForCategories.gi

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,12 @@
88
# some options should affect the whole function stack and should hence not be consumed by FunctionWithNamedArguments
99
BindGlobal( "CAP_INTERNAL_GLOBAL_OPTIONS", [ "no_precompiled_code" ] );
1010

11+
## LaTeX bracket constants: used in Concatenation to avoid transpiler { -> [ conversion in Julia
12+
#= comment for Julia
13+
BindGlobal( "LATEX_LBRACE", "{" );
14+
BindGlobal( "LATEX_RBRACE", "}" );
15+
# =#
16+
1117
InstallGlobalFunction( "FunctionWithNamedArguments", function ( specification, func )
1218

1319
Assert( 0, IsList( specification ) );

FreydCategoriesForCAP/PackageInfo.g

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@ SetPackageInfo( rec(
1010

1111
PackageName := "FreydCategoriesForCAP",
1212
Subtitle := "Freyd categories - Formal (co)kernels for additive categories",
13-
Version := "2026.06-04",
13+
Version := "2026.07-01",
1414
Date := (function ( ) if IsBound( GAPInfo.SystemEnvironment.GAP_PKG_RELEASE_DATE ) then return GAPInfo.SystemEnvironment.GAP_PKG_RELEASE_DATE; else return Concatenation( ~.Version{[ 1 .. 4 ]}, "-", ~.Version{[ 6, 7 ]}, "-01" ); fi; end)( ),
1515
License := "GPL-2.0-or-later",
1616

@@ -101,7 +101,7 @@ PackageDoc := rec(
101101

102102
Dependencies := rec(
103103
GAP := ">= 4.13.0",
104-
NeededOtherPackages := [ [ "CAP", ">= 2026.05-07" ],
104+
NeededOtherPackages := [ [ "CAP", ">= 2026.07-03" ],
105105
[ "MatricesForHomalg", ">= 2026.04-01" ],
106106
[ "GradedRingForHomalg", ">= 2026.04-01" ],
107107
[ "AdditiveClosuresForCAP", ">= 2026.06-02" ],

FreydCategoriesForCAP/gap/AdelmanCategory.gi

Lines changed: 10 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -1405,6 +1405,7 @@ InstallMethod( Display,
14051405
Display( CorelationMorphism( object ) );
14061406

14071407
end );
1408+
# =#
14081409

14091410
##
14101411
InstallMethod( LaTeXOutput,
@@ -1426,20 +1427,20 @@ InstallMethod( LaTeXOutput,
14261427

14271428
corel_dat := LaTeXOutput( corel : OnlyDatum := true );
14281429

1429-
m := Concatenation( """{ \color{blue}{""", m, "} }" );
1430+
m := Concatenation( LATEX_LBRACE, " \\color", LATEX_LBRACE, "blue", LATEX_RBRACE, LATEX_LBRACE, m, LATEX_RBRACE, " ", LATEX_RBRACE );
14301431

14311432
return Concatenation(
1432-
"""{ \big(""",
1433+
LATEX_LBRACE, " \\big(",
14331434
r,
1434-
"\\xrightarrow{",
1435+
"\\xrightarrow", LATEX_LBRACE,
14351436
rel_dat,
1436-
"}",
1437+
LATEX_RBRACE,
14371438
m,
1438-
"\\xrightarrow{",
1439+
"\\xrightarrow", LATEX_LBRACE,
14391440
corel_dat,
1440-
"}",
1441+
LATEX_RBRACE,
14411442
c,
1442-
"""\big)}"""
1443+
"\\big)", LATEX_RBRACE
14431444
);
14441445

14451446
end );
@@ -1454,14 +1455,13 @@ InstallMethod( LaTeXOutput,
14541455

14551456
return Concatenation(
14561457
LaTeXOutput( Source( mor ) ),
1457-
"""{\color{blue}{\xrightarrow{""",
1458+
LATEX_LBRACE, "\\color", LATEX_LBRACE, "blue", LATEX_RBRACE, LATEX_LBRACE, "\\xrightarrow", LATEX_LBRACE,
14581459
datum,
1459-
"""}}}""",
1460+
LATEX_RBRACE, LATEX_RBRACE, LATEX_RBRACE,
14601461
LaTeXOutput( Range( mor ) )
14611462
);
14621463

14631464
end );
1464-
# =#
14651465

14661466
####################################
14671467
##

FreydCategoriesForCAP/gap/FreydCategory.gi

Lines changed: 31 additions & 29 deletions
Original file line numberDiff line numberDiff line change
@@ -2000,12 +2000,11 @@ InstallMethod( DisplayString,
20002000

20012001
end );
20022002

2003-
#= comment for Julia
20042003
##
20052004
InstallMethod( LaTeXOutput,
20062005
[ IsFreydCategoryObject ],
20072006
function( object )
2008-
local rel, corel, r, m, c, rel_dat, corel_dat;
2007+
local rel, r, m, rel_dat;
20092008

20102009
rel := ObjectDatum( object );
20112010

@@ -2018,45 +2017,48 @@ InstallMethod( LaTeXOutput,
20182017
return Concatenation(
20192018
"\\big(",
20202019
r,
2021-
"\\xrightarrow{",
2020+
"\\xrightarrow", LATEX_LBRACE,
20222021
rel_dat,
2023-
"}",
2022+
LATEX_RBRACE,
20242023
m,
2025-
"\\big)_{\\mathcal{A}}"
2024+
"\\big)_", LATEX_LBRACE, "\\mathcal", LATEX_LBRACE, "A", LATEX_RBRACE, LATEX_RBRACE
20262025
);
20272026

20282027
end );
20292028

20302029
##
20312030
InstallMethod( LaTeXOutput,
20322031
[ IsFreydCategoryMorphism ],
2033-
function( mor )
2034-
local datum;
2035-
2036-
datum := LaTeXOutput( MorphismDatum( mor ) : OnlyDatum := true );
2037-
2038-
if ValueOption( "OnlyDatum" ) = true then
2039-
2040-
return Concatenation(
2041-
"""{\color{blue}{""",
2042-
datum,
2043-
"""}}"""
2044-
);
2032+
FunctionWithNamedArguments(
2033+
[ [ "OnlyDatum", false ] ],
2034+
function( CAP_NAMED_ARGUMENTS, mor )
2035+
local datum;
20452036

2046-
else
2037+
datum := LaTeXOutput( MorphismDatum( mor ) : OnlyDatum := true );
20472038

2048-
return Concatenation(
2049-
"{ \\tiny ", LaTeXOutput( Source( mor ) ), "}",
2050-
"""{\color{blue}{\xrightarrow{""",
2051-
datum,
2052-
"""}}}""",
2053-
"{ \\tiny ", LaTeXOutput( Range( mor ) ), "}"
2054-
);
2039+
if CAP_NAMED_ARGUMENTS.OnlyDatum = true then
2040+
2041+
return Concatenation(
2042+
LATEX_LBRACE, "\\color", LATEX_LBRACE, "blue", LATEX_RBRACE, LATEX_LBRACE,
2043+
datum,
2044+
LATEX_RBRACE, LATEX_RBRACE
2045+
);
2046+
2047+
else
2048+
2049+
return Concatenation(
2050+
LATEX_LBRACE, " \\tiny ", LaTeXOutput( Source( mor ) ), LATEX_RBRACE,
2051+
LATEX_LBRACE, "\\color", LATEX_LBRACE, "blue", LATEX_RBRACE, LATEX_LBRACE, "\\xrightarrow", LATEX_LBRACE,
2052+
datum,
2053+
LATEX_RBRACE, LATEX_RBRACE, LATEX_RBRACE,
2054+
LATEX_LBRACE, " \\tiny ", LaTeXOutput( Range( mor ) ), LATEX_RBRACE
2055+
);
2056+
2057+
fi;
20552058

2056-
fi;
2057-
2058-
end );
2059-
# =#
2059+
end
2060+
)
2061+
);
20602062

20612063
####################################################################################
20622064
##

0 commit comments

Comments
 (0)