diff --git a/base/reflectx/structs.go b/base/reflectx/structs.go index c63239201c..775383df06 100644 --- a/base/reflectx/structs.go +++ b/base/reflectx/structs.go @@ -299,6 +299,7 @@ func SetFieldsFromMap(obj any, vals map[string]any) error { fld, err := FieldByPath(objv, k) if err != nil { errs = append(errs, err) + continue } err = SetRobust(PointerValue(fld).Interface(), v) if err != nil { diff --git a/content/content.go b/content/content.go index aa646320a5..5031cc77e1 100644 --- a/content/content.go +++ b/content/content.go @@ -108,6 +108,9 @@ type Content struct { // The previous and next page, if applicable. They must be stored on this struct // to avoid stale local closure variables. prevPage, nextPage *bcontent.Page + + // if non-nil, a message is sent when content page is rendered + renderChan chan struct{} } func init() { @@ -478,6 +481,13 @@ func (ct *Content) loadPage(w *core.Frame) error { return nil } +func (ct *Content) RenderWidget() { + ct.Splits.RenderWidget() + if ct.renderChan != nil { + ct.renderChan <- struct{}{} + } +} + // makeTableOfContents makes the table of contents and adds it to [Content.leftFrame] // based on the headings in the given frame. func (ct *Content) makeTableOfContents(w *core.Frame, pg *bcontent.Page) { @@ -676,3 +686,21 @@ func (ct *Content) PageRefs(page *bcontent.Page) *core.Frame { fr.SetScene(ct.Scene) return fr } + +// LoadEachPage is a helper function to iterate through loading each page, +// which is used for updating the math cache. +func (ct *Content) LoadEachPage(after func()) error { + ct.renderChan = make(chan struct{}) + go func() { + for _, pg := range ct.pages { + fmt.Println("\n#### page:", pg.URL) + ct.OpenEvent(pg.URL, nil) + <-ct.renderChan + fmt.Println("rendered:", pg.URL) + } + if after != nil { + after() + } + }() + return nil +} diff --git a/content/examples/basic/basic.go b/content/examples/basic/basic.go index cfc37dc37b..1301c882ae 100644 --- a/content/examples/basic/basic.go +++ b/content/examples/basic/basic.go @@ -5,20 +5,32 @@ package main import ( + "bytes" "embed" + "cogentcore.org/core/base/errors" "cogentcore.org/core/content" "cogentcore.org/core/core" + "cogentcore.org/core/events" "cogentcore.org/core/htmlcore" - _ "cogentcore.org/core/text/tex" + "cogentcore.org/core/icons" + "cogentcore.org/core/keymap" + "cogentcore.org/core/text/tex/texcache" "cogentcore.org/core/tree" _ "cogentcore.org/core/yaegicore" ) +//go:generate go run ./genmath.go + //go:embed content var econtent embed.FS +//go:embed mathcache.json.gz +var mathcache []byte + func main() { + texcache.ReadGzip(bytes.NewBuffer(mathcache)) + texcache.SetShapeMath() // only use cached! // rasterx.UseGlyphCache = false content.Settings.SiteTitle = "Cogent Content Example" content.OfflineURL = "https://example.com" @@ -29,6 +41,14 @@ func main() { core.NewToolbar(bar).Maker(func(p *tree.Plan) { ct.MakeToolbar(p) ct.MakeToolbarPDF(p) + tree.Add(p, func(w *core.Button) { + w.SetText("SaveMath").SetIcon(icons.Search).SetKey(keymap.Find). + SetTooltip("Save cached math rendering") + w.OnClick(func(e events.Event) { + e.SetHandled() + errors.Log(texcache.SaveAs("mathcache.json")) + }) + }) }) }) b.RunMainWindow() diff --git a/content/examples/basic/genmath.go b/content/examples/basic/genmath.go new file mode 100644 index 0000000000..536ef8a31a --- /dev/null +++ b/content/examples/basic/genmath.go @@ -0,0 +1,42 @@ +// Copyright (c) 2024, Cogent Core. All rights reserved. +// Use of this source code is governed by a BSD-style +// license that can be found in the LICENSE file. + +//go:build ignore + +package main + +import ( + "embed" + "fmt" + + "cogentcore.org/core/base/errors" + "cogentcore.org/core/content" + "cogentcore.org/core/core" + "cogentcore.org/core/events" + _ "cogentcore.org/core/text/tex" + "cogentcore.org/core/text/tex/texcache" +) + +//go:embed content +var econtent embed.FS + +//go:embed mathcache.json.gz +var mathcache embed.FS + +func main() { + texcache.OpenFS(mathcache, "mathcache.json.gz") // note: doesn't work on web / js + content.Settings.SiteTitle = "Generate Cache Math" + content.OfflineURL = "https://example.com" + b := core.NewBody("Generate Cache Math") + ct := content.NewContent(b).SetContent(econtent) + b.OnShow(func(e events.Event) { + ct.LoadEachPage(func() { + texcache.DeleteUnused() + errors.Log(texcache.SaveAs("mathcache.json.gz")) + fmt.Println("ALL DONE!") + core.TheApp.QuitReq() + }) + }) + b.RunMainWindow() +} diff --git a/content/examples/basic/mathcache.json.gz b/content/examples/basic/mathcache.json.gz new file mode 100644 index 0000000000..1a0b339fe9 Binary files /dev/null and b/content/examples/basic/mathcache.json.gz differ diff --git a/content/typegen.go b/content/typegen.go index a9df91b5c8..4befed7fd4 100644 --- a/content/typegen.go +++ b/content/typegen.go @@ -8,7 +8,7 @@ import ( "cogentcore.org/core/types" ) -var _ = types.AddType(&types.Type{Name: "cogentcore.org/core/content.Content", IDName: "content", Doc: "Content manages and displays the content of a set of pages.", Embeds: []types.Field{{Name: "Splits"}}, Fields: []types.Field{{Name: "Source", Doc: "Source is the source filesystem for the content.\nIt should be set using [Content.SetSource] or [Content.SetContent]."}, {Name: "Context", Doc: "Context is the [htmlcore.Context] used to render the content,\nwhich can be modified for things such as adding wikilink handlers."}, {Name: "References", Doc: "References is a list of references used for generating citation text\nfor literature reference wikilinks in the format [[@CiteKey]]."}, {Name: "pages", Doc: "pages are the pages that constitute the content."}, {Name: "pagesByName", Doc: "pagesByName has the [bcontent.Page] for each [bcontent.Page.Name]\ntransformed into lowercase. See [Content.pageByName] for a helper\nfunction that automatically transforms into lowercase."}, {Name: "pagesByURL", Doc: "pagesByURL has the [bcontent.Page] for each [bcontent.Page.URL]."}, {Name: "pagesByCategory", Doc: "pagesByCategory has the [bcontent.Page]s for each of all [bcontent.Page.Categories]."}, {Name: "categories", Doc: "categories has all unique [bcontent.Page.Categories], sorted such that the categories\nwith the most pages are listed first. \"Other\" is always last, and is used for pages that\ndo not have a category, unless they are a category themselves."}, {Name: "history", Doc: "history is the history of pages that have been visited.\nThe oldest page is first."}, {Name: "historyIndex", Doc: "historyIndex is the current position in [Content.history]."}, {Name: "currentPage", Doc: "currentPage is the currently open page."}, {Name: "renderedPage", Doc: "renderedPage is the most recently rendered page."}, {Name: "leftFrame", Doc: "leftFrame is the frame on the left side of the widget,\nused for displaying the table of contents and the categories."}, {Name: "rightFrame", Doc: "rightFrame is the frame on the right side of the widget,\nused for displaying the page content."}, {Name: "tocNodes", Doc: "tocNodes are all of the tree nodes in the table of contents\nby kebab-case heading name."}, {Name: "currentHeading", Doc: "currentHeading is the currently selected heading in the table of contents,\nif any (in kebab-case)."}, {Name: "inPDFRender", Doc: "inPDFRender indicates that it is rendering a PDF now, turning off\nelements that are not appropriate for that."}, {Name: "prevPage", Doc: "The previous and next page, if applicable. They must be stored on this struct\nto avoid stale local closure variables."}, {Name: "nextPage", Doc: "The previous and next page, if applicable. They must be stored on this struct\nto avoid stale local closure variables."}}}) +var _ = types.AddType(&types.Type{Name: "cogentcore.org/core/content.Content", IDName: "content", Doc: "Content manages and displays the content of a set of pages.", Embeds: []types.Field{{Name: "Splits"}}, Fields: []types.Field{{Name: "Source", Doc: "Source is the source filesystem for the content.\nIt should be set using [Content.SetSource] or [Content.SetContent]."}, {Name: "Context", Doc: "Context is the [htmlcore.Context] used to render the content,\nwhich can be modified for things such as adding wikilink handlers."}, {Name: "References", Doc: "References is a list of references used for generating citation text\nfor literature reference wikilinks in the format [[@CiteKey]]."}, {Name: "pages", Doc: "pages are the pages that constitute the content."}, {Name: "pagesByName", Doc: "pagesByName has the [bcontent.Page] for each [bcontent.Page.Name]\ntransformed into lowercase. See [Content.pageByName] for a helper\nfunction that automatically transforms into lowercase."}, {Name: "pagesByURL", Doc: "pagesByURL has the [bcontent.Page] for each [bcontent.Page.URL]."}, {Name: "pagesByCategory", Doc: "pagesByCategory has the [bcontent.Page]s for each of all [bcontent.Page.Categories]."}, {Name: "categories", Doc: "categories has all unique [bcontent.Page.Categories], sorted such that the categories\nwith the most pages are listed first. \"Other\" is always last, and is used for pages that\ndo not have a category, unless they are a category themselves."}, {Name: "history", Doc: "history is the history of pages that have been visited, per tab."}, {Name: "current", Doc: "current is the current location, in current tab."}, {Name: "rendered", Doc: "rendered is the most recently rendered location, in current tab."}, {Name: "leftFrame", Doc: "leftFrame is the frame on the left side of the widget,\nused for displaying the table of contents and the categories."}, {Name: "rightFrame", Doc: "rightFrame is the frame on the right side of the widget,\nused for displaying the page content."}, {Name: "tabs", Doc: "tabs are the tabs, only for non-web"}, {Name: "toolbar", Doc: "top toolbar, if present"}, {Name: "tocNodes", Doc: "tocNodes are all of the tree nodes in the table of contents\nby kebab-case heading name."}, {Name: "inPDFRender", Doc: "inPDFRender indicates that it is rendering a PDF now, turning off\nelements that are not appropriate for that."}, {Name: "prevPage", Doc: "The previous and next page, if applicable. They must be stored on this struct\nto avoid stale local closure variables."}, {Name: "nextPage", Doc: "The previous and next page, if applicable. They must be stored on this struct\nto avoid stale local closure variables."}, {Name: "renderChan", Doc: "if non-nil, a message is sent when content page is rendered"}}}) // NewContent returns a new [Content] with the given optional parent: // Content manages and displays the content of a set of pages. diff --git a/go.mod b/go.mod index ba5064df0b..9b8b2f5751 100644 --- a/go.mod +++ b/go.mod @@ -13,6 +13,7 @@ require ( github.com/bramvdbogaerde/go-scp v1.6.0 github.com/chewxy/math32 v1.11.2 github.com/cogentcore/reisen v0.0.0-20240814194831-4d884b6e7666 + github.com/cogentcore/star-tex v0.7.2-0.20260625151004-a16970c7d698 github.com/cogentcore/yaegi v0.0.0-20260116172027-700fbf8949f3 github.com/coreos/go-oidc/v3 v3.17.0 github.com/ericchiang/css v1.4.0 @@ -45,11 +46,11 @@ require ( golang.org/x/text v0.37.0 golang.org/x/tools v0.44.0 gopkg.in/yaml.v3 v3.0.1 - star-tex.org/x/tex v0.7.1 ) require ( - codeberg.org/go-pdf/fpdf v0.11.0 // indirect + codeberg.org/go-pdf/fpdf v0.11.1 // indirect + git.sr.ht/~sbinet/overlayfs v0.1.1 // indirect github.com/aymanbagabas/go-osc52/v2 v2.0.1 // indirect github.com/davecgh/go-spew v1.1.2-0.20180830191138-d8f796af33cc // indirect github.com/dlclark/regexp2 v1.11.5 // indirect @@ -77,6 +78,6 @@ require ( golang.org/x/mod v0.35.0 // indirect golang.org/x/sync v0.20.0 // indirect gopkg.in/check.v1 v1.0.0-20201130134442-10cb98267c6c // indirect - modernc.org/knuth v0.5.4 // indirect + modernc.org/knuth v0.5.5 // indirect modernc.org/token v1.1.0 // indirect ) diff --git a/go.sum b/go.sum index 76e26a9ea8..ca56ef6723 100644 --- a/go.sum +++ b/go.sum @@ -1,7 +1,9 @@ -codeberg.org/go-pdf/fpdf v0.11.0 h1:n3I8WISQ1cr0S2rvx9DOlE/GypbcimMWqLpel3slHmY= -codeberg.org/go-pdf/fpdf v0.11.0/go.mod h1:Y0DGRAdZ0OmnZPvjbMp/1bYxmIPxm0ws4tfoPOc4LjU= +codeberg.org/go-pdf/fpdf v0.11.1 h1:U8+coOTDVLxHIXZgGvkfQEi/q0hYHYvEHFuGNX2GzGs= +codeberg.org/go-pdf/fpdf v0.11.1/go.mod h1:Y0DGRAdZ0OmnZPvjbMp/1bYxmIPxm0ws4tfoPOc4LjU= git.sr.ht/~sbinet/cmpimg v0.1.0 h1:E0zPRk2muWuCqSKSVZIWsgtU9pjsw3eKHi8VmQeScxo= git.sr.ht/~sbinet/cmpimg v0.1.0/go.mod h1:FU12psLbF4TfNXkKH2ZZQ29crIqoiqTZmeQ7dkp/pxE= +git.sr.ht/~sbinet/overlayfs v0.1.1 h1:HvCHXT1cs8RMSjNLQXxPPosB2hgR3tRC8RniH0f3ESg= +git.sr.ht/~sbinet/overlayfs v0.1.1/go.mod h1:TmrIWKlxyPJJ7vchTqk85DUcW6IDsIa7ONLvSGIw438= github.com/Bios-Marcel/wastebasket/v2 v2.0.3 h1:TkoDPcSqluhLGE+EssHu7UGmLgUEkWg7kNyHyyJ3Q9g= github.com/Bios-Marcel/wastebasket/v2 v2.0.3/go.mod h1:769oPCv6eH7ugl90DYIsWwjZh4hgNmMS3Zuhe1bH6KU= github.com/DATA-DOG/go-sqlmock v1.3.3/go.mod h1:f/Ixk793poVmq4qj/V1dPUg2JEAKC73Q5eFN3EC/SaM= @@ -29,6 +31,8 @@ github.com/chewxy/math32 v1.11.2 h1:IufN08Zwr1NKuWfY+4Tz55BcwKmyKKNdOP7KtumehnM= github.com/chewxy/math32 v1.11.2/go.mod h1:dOB2rcuFrCn6UHrze36WSLVPKtzPMRAQvBvUwkSsLqs= github.com/cogentcore/reisen v0.0.0-20240814194831-4d884b6e7666 h1:gmXMw/Xcva/2V5qRO920q4am1odNE0xFEGBzG7y7cus= github.com/cogentcore/reisen v0.0.0-20240814194831-4d884b6e7666/go.mod h1:HoDh/nWYrLffGjfVxUmbJHb0yZvcV3TwrN73WurddNs= +github.com/cogentcore/star-tex v0.7.2-0.20260625151004-a16970c7d698 h1:GsehCn/Dw8hhYAonDQO48EJz63sAAF4wxEhHmHt/xKA= +github.com/cogentcore/star-tex v0.7.2-0.20260625151004-a16970c7d698/go.mod h1:pdlQowLCSMiGfeOM6M7yz09OmR2fzlmFYcvR/u6QaRQ= github.com/cogentcore/yaegi v0.0.0-20260116172027-700fbf8949f3 h1:y3Djpt/g3QTjFdj8cpvy/r8FsZsEa7PqHGjgsKXbta0= github.com/cogentcore/yaegi v0.0.0-20260116172027-700fbf8949f3/go.mod h1:XkOm++pRmWlk85p+hw71ZItfTeRdzqG23+2xjP9eb+M= github.com/coreos/go-oidc/v3 v3.17.0 h1:hWBGaQfbi0iVviX4ibC7bk8OKT5qNr4klBaCHVNvehc= @@ -209,11 +213,9 @@ gopkg.in/check.v1 v1.0.0-20201130134442-10cb98267c6c/go.mod h1:JHkPIbrfpd72SG/EV gopkg.in/yaml.v3 v3.0.0-20200313102051-9f266ea9e77c/go.mod h1:K4uyk7z7BCEPqu6E+C64Yfv1cQ7kz7rIZviUmN+EgEM= gopkg.in/yaml.v3 v3.0.1 h1:fxVm/GzAzEWqLHuvctI91KS9hhNmmWOoWu0XTYJS7CA= gopkg.in/yaml.v3 v3.0.1/go.mod h1:K4uyk7z7BCEPqu6E+C64Yfv1cQ7kz7rIZviUmN+EgEM= -modernc.org/knuth v0.5.4 h1:F8mDs7ME3oN9eyx01n6/xVmJ4F5U/qEhSYPnPXaZrps= -modernc.org/knuth v0.5.4/go.mod h1:e5SBb35HQBj2aFwbBO3ClPcViLY3Wi0LzaOd7c/3qMk= +modernc.org/knuth v0.5.5 h1:6lap2U/ISm8aC/4NU58ALFCRllNPaK0EZcIGY/oDgUg= +modernc.org/knuth v0.5.5/go.mod h1:e5SBb35HQBj2aFwbBO3ClPcViLY3Wi0LzaOd7c/3qMk= modernc.org/token v1.1.0 h1:Xl7Ap9dKaEs5kLoOQeQmPWevfnk/DM5qcLcYlA8ys6Y= modernc.org/token v1.1.0/go.mod h1:UGzOrNV1mAFSEB63lOFHIpNRUVMvYTc6yu1SMY/XTDM= rsc.io/pdf v0.1.1 h1:k1MczvYDUvJBe93bYd7wrZLLUEcLZAuF824/I4e5Xr4= rsc.io/pdf v0.1.1/go.mod h1:n8OzWcQ6Sp37PL01nO98y4iUCRdTGarVfzxY20ICaU4= -star-tex.org/x/tex v0.7.1 h1:4qGAByRyY0WQsOjtcHlxz+FgrYxz8fzxIds2Gjepp5U= -star-tex.org/x/tex v0.7.1/go.mod h1:Y3y0U7sZTltTh/CDZIx0oAtMjG7eMaTuTtvDZGdyhJo= diff --git a/paint/pdf/text.go b/paint/pdf/text.go index 8bab1bb2d0..75c11fcb66 100644 --- a/paint/pdf/text.go +++ b/paint/pdf/text.go @@ -134,7 +134,7 @@ func (r *PDF) textRun(style *styles.Paint, m math32.Matrix2, run *shapedgt.Run, psty := *style psty.Stroke.Color = run.StrokeColor psty.Fill.Color = fill - r.Path(*run.Math.Path, &psty, math32.Identity2()) + r.Path(run.Math.Path, &psty, math32.Identity2()) r.w.PopStack() return } diff --git a/paint/renderers/htmlcanvas/path.go b/paint/renderers/htmlcanvas/path.go index 2387134767..b6288fc8cb 100644 --- a/paint/renderers/htmlcanvas/path.go +++ b/paint/renderers/htmlcanvas/path.go @@ -15,7 +15,7 @@ import ( "cogentcore.org/core/paint/render" ) -func (rs *Renderer) writePath(pt *ppath.Path) { +func (rs *Renderer) writePath(pt ppath.Path) { rs.ctx.Call("beginPath") for scanner := pt.Scanner(); scanner.Scan(); { end := scanner.End() @@ -48,7 +48,7 @@ func (rs *Renderer) RenderPath(pt *render.Path) { rs.setTransform(&pt.Context) if style.HasFill() || style.HasStroke() { - rs.writePath(&pt.Path) + rs.writePath(pt.Path) } rs.curRect = pt.Path.FastBounds().ToRect() // TODO: more performance optimized approach (such as only computing for gradients)? diff --git a/paint/renderers/rasterx/text.go b/paint/renderers/rasterx/text.go index 50138ee43d..9bcf12a888 100644 --- a/paint/renderers/rasterx/text.go +++ b/paint/renderers/rasterx/text.go @@ -121,7 +121,7 @@ func (rs *Renderer) TextRun(ctx *render.Context, run *shapedgt.Run, ln *shaped.L lineW := max(fsz/16, 1) // 1 at 16, bigger if biggerr if run.Math.Path != nil { rs.Path.Clear() - PathToRasterx(&rs.Path, *run.Math.Path, ctx.Cumulative, off) + PathToRasterx(&rs.Path, run.Math.Path, ctx.Cumulative, off) rf := &rs.Raster.Filler rf.SetWinding(true) rf.SetColor(fill) diff --git a/text/paginate/paginate.go b/text/paginate/paginate.go index cd5ae79e70..eeaf21a515 100644 --- a/text/paginate/paginate.go +++ b/text/paginate/paginate.go @@ -9,7 +9,6 @@ import ( "cogentcore.org/core/math32" "cogentcore.org/core/paint" "cogentcore.org/core/styles/units" - _ "cogentcore.org/core/text/tex" ) // Paginate organizes the given input widget content into frames diff --git a/text/parse/languages/golang/parsedir.go b/text/parse/languages/golang/parsedir.go index beddd0d767..8b71cc683d 100644 --- a/text/parse/languages/golang/parsedir.go +++ b/text/parse/languages/golang/parsedir.go @@ -9,6 +9,7 @@ import ( "log" "os" "path/filepath" + "slices" "strings" "sync" "unicode" @@ -165,6 +166,9 @@ func (gl *GoLang) ParseDirImpl(fs *parse.FileState, path string, opts parse.Lang // fmt.Printf("No go files, bailing\n") return nil } + files = slices.DeleteFunc(files, func(s string) bool { + return strings.Contains(s, "_test.go") || strings.HasPrefix(s, "_") + }) for i, pt := range files { files[i] = filepath.Join(pkgPathAbs, pt) } diff --git a/text/shaped/run.go b/text/shaped/run.go index 36a5f970d0..630d3016e6 100644 --- a/text/shaped/run.go +++ b/text/shaped/run.go @@ -47,7 +47,7 @@ type Run interface { // Math holds the output of a TeX math expression. type Math struct { - Path *ppath.Path + Path ppath.Path BBox math32.Box2 } diff --git a/text/shaped/shaped_test.go b/text/shaped/shaped_test.go index bd0abbcbbe..11524f58c9 100644 --- a/text/shaped/shaped_test.go +++ b/text/shaped/shaped_test.go @@ -324,6 +324,7 @@ func TestEmoji(t *testing.T) { } func TestMathInline(t *testing.T) { + t.Skip("this requires full latex install on CI, not worth it -- just test locally") tests := []struct { name string math string @@ -350,6 +351,7 @@ func TestMathInline(t *testing.T) { } func TestMathDisplay(t *testing.T) { + t.Skip("this requires full latex install on CI, not worth it -- just test locally") tests := []struct { name string math string diff --git a/text/shaped/shaper.go b/text/shaped/shaper.go index ee95c35650..05d0a1d610 100644 --- a/text/shaped/shaper.go +++ b/text/shaped/shaper.go @@ -23,8 +23,11 @@ var ( // given math expression, in TeX syntax. // Import _ cogentcore.org/core/text/tex to set this function // (incurs a significant additional memory footprint due to fonts - // and other packages). - ShapeMath func(expr string, fontHeight float32) (*ppath.Path, error) + // and other packages), or call texcache.SetShapeMath() from + // cogentcore.org/core/text/texcache for fully cached version that + // saves on all the memory, but requires all equations to be generated + // in advance and saved. + ShapeMath func(expr string, fontHeight float32) (ppath.Path, error) ) // Shaper is a text shaping system that can shape the layout of [rich.Text], diff --git a/text/tex/charmaps.go b/text/tex/charmaps.go index 48b4fec169..f93d46b2b8 100644 --- a/text/tex/charmaps.go +++ b/text/tex/charmaps.go @@ -7,6 +7,32 @@ package tex +type charMaps int32 //enums:enum + +const ( + CMR charMaps = iota + CMMI + CMSY + CMEX + CMTT +) + +func (cm charMaps) Table() map[uint32]rune { + switch cm { + case CMR: + return cmapCMR + case CMMI: + return cmapCMMI + case CMSY: + return cmapCMSY + case CMEX: + return cmapCMEX + case CMTT: + return cmapCMTT + } + return nil +} + var cmapCMR = map[uint32]rune{ 0x00: '\u0393', 0x01: '\u0394', @@ -103,7 +129,7 @@ var cmapCMR = map[uint32]rune{ 0x5C: '\u201C', 0x5D: '\u005D', 0x5E: '\u0302', - 0x5F: '\u0307', + 0x5F: '\u02D9', 0x60: '\u2018', 0x61: '\u0061', 0x62: '\u0062', @@ -185,8 +211,8 @@ var cmapCMMI = map[uint32]rune{ 0x2B: '\u21C1', 0x2C: '\u21AA', 0x2D: '\u21A9', - 0x2E: '\u25B9', - 0x2F: '\u25C3', + 0x2E: '\u22B3', + 0x2F: '\u22B2', 0x30: '\u0030', 0x31: '\u0031', 0x32: '\u0032', @@ -273,7 +299,7 @@ var cmapCMSY = map[uint32]rune{ 0x00: '\u2212', 0x01: '\u00B7', 0x02: '\u00D7', - 0x03: '\u22C6', + 0x03: '\u2217', 0x04: '\u00F7', 0x05: '\u22C4', 0x06: '\u00B1', @@ -286,8 +312,8 @@ var cmapCMSY = map[uint32]rune{ 0x0D: '\u25CB', 0x0E: '\u2218', 0x0F: '\u2219', - 0x10: '\u2243', - 0x11: '\u224D', + 0x10: '\u224D', + 0x11: '\u2261', 0x12: '\u2286', 0x13: '\u2287', 0x14: '\u2264', @@ -295,7 +321,7 @@ var cmapCMSY = map[uint32]rune{ 0x16: '\u227C', 0x17: '\u227D', 0x18: '\u223C', - 0x19: '\u2245', + 0x19: '\u2248', 0x1A: '\u2282', 0x1B: '\u2283', 0x1C: '\u226A', @@ -309,7 +335,7 @@ var cmapCMSY = map[uint32]rune{ 0x24: '\u2194', 0x25: '\u2197', 0x26: '\u2198', - 0x27: '\u2242', + 0x27: '\u2243', 0x28: '\u21D0', 0x29: '\u21D2', 0x2A: '\u21D1', @@ -501,7 +527,7 @@ var cmapCMEX = map[uint32]rune{ 0x5A: '\u222B', // ∫ mag2 0x5B: '\u22C3', // ⋃ mag2 0x5C: '\u22C2', // ⋂ mag2 - 0x5D: '\u2A03', // ⨄ mag2 + 0x5D: '\u2A04', // ⨄ mag2 0x5E: '\u22C0', // ⋀ mag2 0x5F: '\u22C1', // ⋁ mag2 @@ -534,7 +560,7 @@ var cmapCMEX = map[uint32]rune{ 0x79: '\u2193', // ↓ 0x7A: '\u23DC', // ⏜ only left half 0x7B: '\u23DC', // ⏜ only right half - 0x7C: '\u23DD', // ⏝ only left + 0x7C: '\u23DD', // 0x7D: '\u23DD', // ⏝ only right 0x7E: '\u21D1', // ⇑ 0x7F: '\u21D3', // ⇓ diff --git a/text/tex/dvi.go b/text/tex/dvi.go index 32b36f5bf3..2235d5661e 100644 --- a/text/tex/dvi.go +++ b/text/tex/dvi.go @@ -14,16 +14,19 @@ import ( "cogentcore.org/core/paint/ppath" ) -var debug = false +var Debug = false type state struct { h, v, w, x, y, z int32 } -// DVIToPath parses a DVI file (output from TeX) and returns *ppath.Path. +// note: use dvitype --show-opcodes to show the dvi in human-readable format, +// with command opcodes + +// DVIToPath parses a DVI file (output from TeX) and returns ppath.Path. // fontSizeDots specifies the actual font size in dots (actual pixels) // for a 10pt font in the DVI system. -func DVIToPath(b []byte, fonts *dviFonts, fontSizeDots float32) (*ppath.Path, error) { +func DVIToPath(b []byte, fonts *dviFonts, fontSizeDots float32) (ppath.Path, error) { // state var fnt uint32 // font index s := state{} @@ -36,29 +39,40 @@ func DVIToPath(b []byte, fonts *dviFonts, fontSizeDots float32) (*ppath.Path, er fontScale := fontSizeDots / 8 // factor for scaling font itself fontScaleFactor := fontSizeDots / 2.8 // factor for scaling the math + // default font + fnts[0] = fonts.Get("cmr10", 1) + // first position of baseline which will be the path's origin firstChar := true - h0 := int32(0) + // min pos v0 := int32(0) + h0 := int32(0) - p := &ppath.Path{} + p := ppath.Path{} r := &dviReader{b, 0} for 0 < r.len() { + if Debug { + fmt.Printf("## At: %d\n", r.i) + } cmd := r.readByte() if cmd <= 127 { // set_char if firstChar { - h0, v0 = s.h, s.v + v0 = s.v + h0 = s.h firstChar = false } + // v0 = min(v0, s.v) // note: this doesn't work in general + h0 = min(h0, s.h) c := uint32(cmd) - if _, ok := fnts[fnt]; !ok { + fntd, ok := fnts[fnt] + if !ok { return nil, fmt.Errorf("bad command: font %v undefined at position %v", fnt, r.i) } - if debug { - fmt.Printf("\nchar font #%d, cid: %d, rune: %s, pos: (%v,%v)\n", fnt, c, string(rune(c)), f*float32(s.h), f*float32(s.v)) + w := int32(fnts[fnt].Draw(&p, f*float32(s.h), f*float32(s.v), c, fontScale) / f) + if Debug { + fmt.Printf("\nchar font %d, cid: %d, 0x%x, rune: %s, pos: (%v,%v) = (%v,%v) w: %v to h: %v\n", fntd.cmapType, c, c, string(rune(c)), s.h, s.v, f*float32(s.h), f*float32(s.v), w, s.h+w) } - w := int32(fnts[fnt].Draw(p, f*float32(s.h), f*float32(s.v), c, fontScale) / f) s.h += w } else if 128 <= cmd && cmd <= 131 { // set @@ -75,7 +89,7 @@ func DVIToPath(b []byte, fonts *dviFonts, fontSizeDots float32) (*ppath.Path, er return nil, fmt.Errorf("bad command: font %v undefined at position %v", fnt, r.i) } // fmt.Println("print:", string(rune(c)), s.v) - s.h += int32(fnts[fnt].Draw(p, f*float32(s.h), f*float32(s.v), c, fontScale) / f) + s.h += int32(fnts[fnt].Draw(&p, f*float32(s.h), f*float32(s.v), c, fontScale) / f) } else if cmd == 132 { // set_rule height := r.readInt32() @@ -103,7 +117,7 @@ func DVIToPath(b []byte, fonts *dviFonts, fontSizeDots float32) (*ppath.Path, er return nil, fmt.Errorf("bad command: font %v undefined at position %v", fnt, r.i) } // fmt.Println("print:", string(rune(c)), s.v) - fnts[fnt].Draw(p, f*float32(s.h), f*float32(s.v), c, fontScale) + fnts[fnt].Draw(&p, f*float32(s.h), f*float32(s.v), c, fontScale) } else if cmd == 137 { // put_rule height := r.readInt32() @@ -129,13 +143,23 @@ func DVIToPath(b []byte, fonts *dviFonts, fontSizeDots float32) (*ppath.Path, er } else if cmd == 141 { // push stack = append(stack, s) + if Debug { + fmt.Printf("push to: %d\n", len(stack)) + } } else if cmd == 142 { // pop + // if len(stack) == 0 { + // return nil, fmt.Errorf("bad command: stack is empty at position %v", r.i) + // } if len(stack) == 0 { - return nil, fmt.Errorf("bad command: stack is empty at position %v", r.i) + fmt.Printf("bad command: stack is empty at position %v\n", r.i) + } else { + s = stack[len(stack)-1] + stack = stack[:len(stack)-1] + if Debug { + fmt.Printf("pop to: %d\n", len(stack)) + } } - s = stack[len(stack)-1] - stack = stack[:len(stack)-1] } else if 143 <= cmd && cmd <= 146 { // right n := int(cmd - 142) @@ -144,10 +168,16 @@ func DVIToPath(b []byte, fonts *dviFonts, fontSizeDots float32) (*ppath.Path, er } d := r.readInt32N(n) s.h += d + if Debug { + fmt.Printf("right %d to %d\n", d, s.h) + } } else if 147 <= cmd && cmd <= 151 { // w if cmd == 147 { s.h += s.w + if Debug { + fmt.Printf("right w %d to %d\n", s.w, s.h) + } } else { n := int(cmd - 147) if r.len() < n { @@ -156,11 +186,17 @@ func DVIToPath(b []byte, fonts *dviFonts, fontSizeDots float32) (*ppath.Path, er d := r.readInt32N(n) s.w = d s.h += d + if Debug { + fmt.Printf("right arg w %d to %d\n", d, s.h) + } } } else if 152 <= cmd && cmd <= 156 { // x if cmd == 152 { s.h += s.x + if Debug { + fmt.Printf("right x %d to %d\n", s.x, s.h) + } } else { n := int(cmd - 152) if r.len() < n { @@ -169,6 +205,9 @@ func DVIToPath(b []byte, fonts *dviFonts, fontSizeDots float32) (*ppath.Path, er d := r.readInt32N(n) s.x = d s.h += d + if Debug { + fmt.Printf("right spec x %d to %d\n", s.x, s.h) + } } } else if 157 <= cmd && cmd <= 160 { // down @@ -177,26 +216,36 @@ func DVIToPath(b []byte, fonts *dviFonts, fontSizeDots float32) (*ppath.Path, er return nil, fmt.Errorf("bad command: %v at position %v", cmd, r.i) } d := r.readInt32N(n) - // fmt.Println("down:", d, s.v) s.v += d + if Debug { + fmt.Printf("down %d to %d\n", d, s.v) + } } else if 161 <= cmd && cmd <= 165 { // y if cmd == 161 { s.v += s.y + if Debug { + fmt.Printf("down y %d to %d\n", s.y, s.v) + } } else { - n := int(cmd - 152) + n := int(cmd - 161) if r.len() < n { return nil, fmt.Errorf("bad command: %v at position %v", cmd, r.i) } d := r.readInt32N(n) s.y = d s.v += d + if Debug { + fmt.Printf("down spec y %d to %d\n", s.y, s.v) + } } } else if 166 <= cmd && cmd <= 170 { // z if cmd == 166 { s.v += s.z - fmt.Println("z down", s.z, s.v) + if Debug { + fmt.Printf("down z %d to %d\n", s.z, s.v) + } } else { n := int(cmd - 166) if r.len() < n { @@ -205,11 +254,14 @@ func DVIToPath(b []byte, fonts *dviFonts, fontSizeDots float32) (*ppath.Path, er d := r.readInt32N(n) s.z = d s.v += d + if Debug { + fmt.Printf("down spec z %d to %d\n", s.z, s.v) + } } } else if 171 <= cmd && cmd <= 234 { // fnt_num fnt = uint32(cmd - 171) - } else if 235 <= cmd && cmd <= 242 { + } else if 235 <= cmd && cmd <= 238 { // fnt n := int(cmd - 234) if r.len() < n { @@ -218,7 +270,7 @@ func DVIToPath(b []byte, fonts *dviFonts, fontSizeDots float32) (*ppath.Path, er fnt = r.readUint32N(n) } else if 239 <= cmd && cmd <= 242 { // xxx - n := int(cmd - 242) + n := int(cmd - 238) if r.len() < n { return nil, fmt.Errorf("bad command: %v at position %v", cmd, r.i) } @@ -226,7 +278,11 @@ func DVIToPath(b []byte, fonts *dviFonts, fontSizeDots float32) (*ppath.Path, er if r.len() < k { return nil, fmt.Errorf("bad command: %v at position %v", cmd, r.i) } - _ = r.readBytes(k) + ignore := r.readBytes(k) + _ = ignore + if Debug { + fmt.Println("cmd:", cmd, "len:", k, "bytes:", string(ignore)) + } } else if 243 <= cmd && cmd <= 246 { // fnt_def n := int(cmd - 242) @@ -247,7 +303,7 @@ func DVIToPath(b []byte, fonts *dviFonts, fontSizeDots float32) (*ppath.Path, er // this is 1 for 10pt font: name := r.readString(int(l)) fnts[k] = fonts.Get(name, fscale) - if debug { + if Debug { fmt.Printf("\ndefine font #:%d name: %s, size: %v, mag: %v, design: %v, scale: %v\n", k, name, size, mag, design, fscale) } } else if cmd == 247 { @@ -257,9 +313,12 @@ func DVIToPath(b []byte, fonts *dviFonts, fontSizeDots float32) (*ppath.Path, er den := r.readUint32() mag = r.readUint32() f = fontScaleFactor * float32(num) / float32(den) * float32(mag) / 1000.0 / 10000.0 // in units/mm - // fmt.Println("num:", num, "mag:", mag, "den:", den, "f:", f) n := int(r.readByte()) - _ = r.readString(n) // comment + cmt := r.readString(n) // comment + _ = cmt + if Debug { + fmt.Println("num:", num, "mag:", mag, "den:", den, "f:", f, "cmt len:", n, "cmt:", cmt) + } } else if cmd == 248 { _ = r.readUint32() // pointer to final bop _ = r.readUint32() // num @@ -282,7 +341,7 @@ func DVIToPath(b []byte, fonts *dviFonts, fontSizeDots float32) (*ppath.Path, er } } // fmt.Println("start offsets:", h0, v0) - *p = p.Translate(-f*float32(h0), -f*float32(v0)) + p = p.Translate(-f*float32(h0), -f*float32(v0)) return p, nil } diff --git a/text/tex/fonts.go b/text/tex/fonts.go index b08d03e260..60b38d8b93 100644 --- a/text/tex/fonts.go +++ b/text/tex/fonts.go @@ -189,6 +189,7 @@ type dviFonts struct { type dviFont struct { face *font.Face + cmapType charMaps cmap map[uint32]rune size float32 italic bool @@ -215,10 +216,10 @@ func (fs *dviFonts) Get(name string, scale float32) *dviFont { // fmt.Println("font name:", fontname, fontsize, scale) if fs.mathSyms == nil { - fs.mathSyms = fs.loadFont("cmsy", cmapCMSY, 10.0, scale, lmmath.TTF) + fs.mathSyms = fs.loadFont("cmsy", CMSY, 10.0, scale, lmmath.TTF) } - cmap := cmapCMR + cmap := CMR f, ok := fs.font[name] if !ok { var fontSizes map[float32][]byte @@ -234,7 +235,7 @@ func (fs *dviFonts) Get(name string, scale float32) *dviFont { 5.0: lmroman5bold.TTF, } case "cmbsy": - cmap = cmapCMSY + cmap = CMSY fontSizes = map[float32][]byte{ fontsize: lmmath.TTF, } @@ -247,7 +248,7 @@ func (fs *dviFonts) Get(name string, scale float32) *dviFont { 10.0: lmroman10bolditalic.TTF, } case "cmcsc": - cmap = cmapCMTT + cmap = CMTT fontSizes = map[float32][]byte{ 10.0: lmromancaps10regular.TTF, } @@ -256,17 +257,17 @@ func (fs *dviFonts) Get(name string, scale float32) *dviFont { 10.0: lmromandunh10regular.TTF, } case "cmex": - cmap = cmapCMEX + cmap = CMEX fontSizes = map[float32][]byte{ fontsize: lmmath.TTF, } case "cmitt": - cmap = cmapCMTT + cmap = CMTT fontSizes = map[float32][]byte{ 10.0: lmmono10italic.TTF, } case "cmmi": - cmap = cmapCMMI + cmap = CMMI fontSizes = map[float32][]byte{ 12.0: lmroman12italic.TTF, 10.0: lmroman10italic.TTF, @@ -275,7 +276,7 @@ func (fs *dviFonts) Get(name string, scale float32) *dviFont { 7.0: lmroman7italic.TTF, } case "cmmib": - cmap = cmapCMMI + cmap = CMMI fontSizes = map[float32][]byte{ 10.0: lmroman10bolditalic.TTF, } @@ -335,12 +336,12 @@ func (fs *dviFonts) Get(name string, scale float32) *dviFont { 8.0: lmsansquot8oblique.TTF, } case "cmsy": - cmap = cmapCMSY + cmap = CMSY fontSizes = map[float32][]byte{ fontsize: lmmath.TTF, } case "cmtcsc": - cmap = cmapCMTT + cmap = CMTT fontSizes = map[float32][]byte{ 10.0: lmmonocaps10regular.TTF, } @@ -355,7 +356,7 @@ func (fs *dviFonts) Get(name string, scale float32) *dviFont { 7.0: lmroman7italic.TTF, } case "cmtt": - cmap = cmapCMTT + cmap = CMTT fontSizes = map[float32][]byte{ 12.0: lmmono12regular.TTF, 10.0: lmmono10regular.TTF, @@ -387,17 +388,35 @@ func (fs *dviFonts) Get(name string, scale float32) *dviFont { return f } -func (fs *dviFonts) loadFont(fontname string, cmap map[uint32]rune, fontsize, scale float32, data []byte) *dviFont { +func (fs *dviFonts) loadFont(fontname string, cmap charMaps, fontsize, scale float32, data []byte) *dviFont { faces, err := font.ParseTTC(bytes.NewReader(data)) if err != nil { // todo: should still work presumably? - errors.Log(err) + panic(fmt.Errorf("dviFonts error: no font found %s: %w", fontname, err)) + return nil } face := faces[0] fsize := scale * fontsize isItalic := 0 < len(fontname) && fontname[len(fontname)-1] == 'i' isEx := fontname == "cmex" - return &dviFont{face: face, cmap: cmap, size: fsize, italic: isItalic, ex: isEx, mathSyms: fs.mathSyms} + return &dviFont{face: face, cmapType: cmap, cmap: cmap.Table(), size: fsize, italic: isItalic, ex: isEx, mathSyms: fs.mathSyms} +} + +type xxbearing struct { + cmap charMaps + x int32 +} + +// glyphs for which bearings should be used: most are better without. +// outline versions of font data are kinda weird it seems here. +// value is extra adjustment to apply. +var useXBearings = map[uint32]xxbearing{ + 0x16: {CMR, 0}, // h-bar + 0x30: {CMSY, -200}, // ' (prime) + 0x36: {CMSY, -720}, // / in neq + 0x5E: {CMR, 0}, // ^ + 0x7E: {CMMI, -150}, // -> vec + 0x7F: {CMR, -150}, // .. ddot } const ( @@ -520,8 +539,16 @@ var cmexScales = map[uint32]float32{ } +const ( + italicYX = 0.2 +) + +// Draw renders the font, and returns the width advance func (f *dviFont) Draw(p *ppath.Path, x, y float32, cid uint32, scale float32) float32 { r := f.cmap[cid] + if r == 0x337 { + r = ' ' + } face := f.face gid, ok := face.Cmap.Lookup(r) if !ok { @@ -529,69 +556,92 @@ func (f *dviFont) Draw(p *ppath.Path, x, y float32, cid uint32, scale float32) f face = f.mathSyms.face gid, ok = face.Cmap.Lookup(r) if !ok { - fmt.Println("rune not found in mathSyms:", string(r)) + fmt.Printf("rune not found in mathSyms, cid: %x, hex: %x, string: %q\n", cid, r, string(r)) } } else { fmt.Println("rune not found:", string(r)) } } - hadv := face.HorizontalAdvance(gid) // fmt.Printf("rune: 0x%0x gid: %d, r: 0x%0X\n", cid, gid, int(r)) + // adcb + // cbad + outline := face.GlyphData(gid).(font.GlyphOutline) sc := scale * f.size / float32(face.Upem()) xsc := float32(1) // fmt.Println("draw scale:", sc, "f.size:", f.size, "face.Upem()", face.Upem()) + ext, has := face.GlyphExtents(gid) + var xb, yb float32 + if has { + xb = ext.XBearing + yb = ext.YBearing + ex, useX := useXBearings[cid] + if useX { + if f.cmapType == ex.cmap { + x -= sc * (xb + float32(ex.x)) + } + } + } + if f.ex { - ext, _ := face.GlyphExtents(gid) exsc, has := cmexScales[cid] - yb := ext.YBearing if has { sc *= exsc - switch cid { - case 0x5A, 0x49: // \int and \oint are off in large size - yb += 200 - case 0x12, 0x13, 0x14, 0x15, 0x16, 0x17, 0x18, 0x19, 0x1A, 0x1B, 0x1C, 0x1D, 0x1E, 0x1F: - // larger delims are too thick - xsc = .7 - case 0x20, 0x21, 0x22, 0x23, 0x28, 0x29, 0x2A, 0x2B: - // same for even larger ones - xsc = .6 - case 0x3C, 0x3D: // braces middles need shifting - yb += 150 - case 0x3A, 0x3B: // braces bottom shifting - yb += 400 - // below are fixes for all the square root elements - case 0x71: - x += sc * 80 - xsc = .6 - case 0x72: - x -= sc * 80 - xsc = .6 - case 0x73: - x -= sc * 80 - xsc = .5 - case 0x74: - yb += 600 - case 0x75: - x += sc * 560 - case 0x76: - x += sc * 400 - yb -= 36 - } + // fmt.Printf("%x: ex scale %g\n", cid, exsc) + } + ybb := yb + switch cid { + case 0x12, 0x13, 0x14, 0x15, 0x16, 0x17, 0x18, 0x19, 0x1A, 0x1B, 0x1C, 0x1D, 0x1E, 0x1F: + // larger delims are too thick + xsc = .7 + case 0x20, 0x21, 0x22, 0x23, 0x28, 0x29, 0x2A, 0x2B: + // same for even larger ones + xsc = .6 + case 0x3C, 0x3D: // braces middles need shifting + ybb += 150 + case 0x3A, 0x3B: // braces bottom shifting + ybb += 400 + case 0x5A, 0x49: // \int and \oint are off in large size + ybb += 200 + case 0x64: // ^ big + ybb -= 400 + x += sc * 600 + // below are fixes for all the square root elements + case 0x70: + x += sc * 120 + case 0x71: + x += sc * 80 + xsc = .6 + case 0x72: + x -= sc * 80 + xsc = .6 + case 0x73: + x -= sc * 80 + xsc = .5 + case 0x74: + ybb += 150 + case 0x75: + x += sc * 560 + case 0x76: + x += sc * 400 + ybb -= 36 } - y += sc * yb + y += sc * ybb } - if f.italic { - // angle := f.face.Post.ItalicAngle - // angle := float32(-15) // degrees - // x -= scale * f.size * face.LineMetric(font.XHeight) / 2.0 * math32.Tan(-angle*math.Pi/180.0) + doItal := false + if f.italic && f.cmapType == CMMI && cid == 0x40 { + // fmt.Printf("italic sym: 0x%X font: %d\n", cid, f.cmapType) + doItal = true } - for _, s := range outline.Segments { p0 := math32.Vec2(s.Args[0].X*xsc*sc+x, -s.Args[0].Y*sc+y) + if doItal { + p0.X += italicYX * s.Args[0].Y * xsc * sc + } + // fmt.Println(s.Args[0].X, s.Args[0].Y, s.Args[0]) switch s.Op { case opentype.SegmentOpMoveTo: p.MoveTo(p0.X, p0.Y) @@ -599,15 +649,25 @@ func (f *dviFont) Draw(p *ppath.Path, x, y float32, cid uint32, scale float32) f p.LineTo(p0.X, p0.Y) case opentype.SegmentOpQuadTo: p1 := math32.Vec2(s.Args[1].X*xsc*sc+x, -s.Args[1].Y*sc+y) + if doItal { + p1.X += italicYX * s.Args[1].Y * xsc * sc + } p.QuadTo(p0.X, p0.Y, p1.X, p1.Y) case opentype.SegmentOpCubeTo: p1 := math32.Vec2(s.Args[1].X*xsc*sc+x, -s.Args[1].Y*sc+y) p2 := math32.Vec2(s.Args[2].X*xsc*sc+x, -s.Args[2].Y*sc+y) + if doItal { + p1.X += italicYX * s.Args[1].Y * xsc * sc + p2.X += italicYX * s.Args[2].Y * xsc * sc + } p.CubeTo(p0.X, p0.Y, p1.X, p1.Y, p2.X, p2.Y) } } p.Close() + hadv := face.HorizontalAdvance(gid) + if hadv == 0 { + hadv = 500 + } adv := sc * hadv - // fmt.Println("hadv:", face.HorizontalAdvance(gid), "adv:", adv) return adv } diff --git a/text/tex/tex.go b/text/tex/tex.go index 3e72f28ff8..77199e9d9a 100644 --- a/text/tex/tex.go +++ b/text/tex/tex.go @@ -6,62 +6,87 @@ package tex import ( "bytes" + "embed" "fmt" + "io/fs" + "os" + "path/filepath" "strings" "sync" + "cogentcore.org/core/base/errors" + "cogentcore.org/core/base/fsx" "cogentcore.org/core/paint/ppath" + "cogentcore.org/core/system" "cogentcore.org/core/text/shaped" - "star-tex.org/x/tex" + "cogentcore.org/core/text/tex/texcache" + tex "github.com/cogentcore/star-tex" ) +//go:embed texmf +var texmf embed.FS + var ( - texEngine *tex.Engine + texEngine *tex.LaTeXEngine texFonts *dviFonts texMu sync.Mutex + // this is set to path where texmf files were installed + texmfAt string - preamble = `\nopagenumbers - -\def\frac#1#2{{{#1}\over{#2}}} + // note: must be standalone to work properly for inline paths. + // standalone cannot use standard \begin{equation} so using $\displaymath + preamble = `\documentclass{standalone} +\usepackage{amsmath} +\begin{document} +` + postamble = ` +\end{document} ` ) func init() { - shaped.ShapeMath = TeXMath -} - -type cacheKey struct { - fontSizeDots float32 - formula string + shaped.ShapeMath = LaTeXMath } -// cache results of TeX processing because it is rather slow. -var cache = map[cacheKey]*ppath.Path{} - -// TeXMath parses a plain TeX math expression and returns a path -// rendering that expression. This is NOT LaTeX and only \frac is defined -// as an additional math utility function, for fractions. -// To activate display math mode, add an additional $ $ surrounding the -// expression: one set of $ $ is automatically included to produce inline -// math mode rendering. +// LaTeXMath parses a LaTeX math expression and returns a path +// rendering that expression. To activate display math mode, add an additional $ +// surrounding the expression: one set of $ $ is automatically included to produce +// inline math mode rendering by default. +// The additional $ activates displaystyle math. // fontSizeDots specifies the actual font size in dots (actual pixels) // for a 10pt font in the DVI system. -func TeXMath(formula string, fontSizeDots float32) (*ppath.Path, error) { +func LaTeXMath(expr string, fontSizeDots float32) (ppath.Path, error) { texMu.Lock() defer texMu.Unlock() - ckey := cacheKey{fontSizeDots: fontSizeDots, formula: formula} - if p, ok := cache[ckey]; ok { + expr = strings.TrimSpace(expr) + if len(expr) == 0 { + return nil, fmt.Errorf("LaTeXMath: empty expr") + } + + p := texcache.Get(expr, fontSizeDots) + if p != nil { return p, nil } - r := strings.NewReader(fmt.Sprintf(`%s $%s$ -\bye -`, preamble, formula)) + InstallTexMF() + + txt := preamble + if expr[0] == '$' { + txt += "$\\displaystyle " + expr[1:len(expr)-1] + " $" + } else { + txt += "$" + expr + "$" + } + txt += postamble + if Debug { + fmt.Println("Input:") + fmt.Println(txt) + } + r := strings.NewReader(txt) w := &bytes.Buffer{} stdout := &bytes.Buffer{} if texEngine == nil { - texEngine = tex.New() + texEngine = tex.NewLaTeX() } texEngine.Stdout = stdout if err := texEngine.Process(w, r); err != nil { @@ -74,10 +99,68 @@ func TeXMath(formula string, fontSizeDots float32) (*ppath.Path, error) { } p, err := DVIToPath(w.Bytes(), texFonts, fontSizeDots) if err != nil { + fmt.Println("got DVIToPath error:", err) fmt.Println(stdout.String()) - cache[ckey] = nil return nil, err } - cache[ckey] = p + texcache.Add(expr, fontSizeDots, p) return p, nil } + +// InstallTexMF installs the specific TeX class and style files that +// we depend on, if not yet installed. Returns true if we just did +// the install. Must be called under texMu lock. +func InstallTexMF() bool { + if texmfAt != "" { + return false + } + + if system.TheApp == nil { + // presumably testing, just use local files and be done! + dir := "./texmf" + texmfAt = dir + os.Setenv("TEXMF", dir) + return true + } + + dir := system.TheApp.CogentCoreDataDir() + tdir := filepath.Join(dir, "texmf") + ex, err := fsx.DirExists(tdir) + if ex { + texmfAt = tdir + os.Setenv("TEXMF", tdir) + return true + } + err = os.MkdirAll(tdir, 0777) + if errors.Log(err) != nil { + return false + } + fs.WalkDir(texmf, ".", func(path string, d fs.DirEntry, err error) error { + if err != nil { + return errors.Log(err) + } + if d.IsDir() { + op := filepath.Join(dir, path) + err = os.MkdirAll(op, 0777) + if errors.Log(err) != nil { + return err + } + return nil + } + // fmt.Println(path) + b, err := fs.ReadFile(texmf, path) + if err != nil { + return errors.Log(err) + } + op := filepath.Join(dir, path) + // fmt.Println(op) + err = os.WriteFile(op, b, 0666) + if err != nil { + return errors.Log(err) + } + return nil + }) + texmfAt = tdir + os.Setenv("TEXMF", tdir) + return true +} diff --git a/text/tex/tex_test.go b/text/tex/tex_test.go index 74195623eb..c1c7f738e8 100644 --- a/text/tex/tex_test.go +++ b/text/tex/tex_test.go @@ -5,6 +5,7 @@ package tex_test import ( + "fmt" "image/color" "testing" @@ -33,6 +34,9 @@ func TestTex(t *testing.T) { name string tex string }{ + {`abs-text`, `|x|`}, + {`dot-text`, `\dot x`}, + {`ddot-text`, `\ddot x`}, {`sum-text`, `y = \sum_{i=0}^{100} f(x_i)`}, {`sum-disp`, `$y = \sum_{i=0}^{100} f(x_i)$`}, {`int-text`, `y = \int_{i=0}^{100} f(x_i)`}, @@ -56,20 +60,91 @@ func TestTex(t *testing.T) { {`frac-text`, `a = \left( \frac{\overline{f}(x^2)}{\prod_i^j \sum_i^j f_i(x_j^2)} \right)`}, {`frac-disp`, `$a = \left( \frac{\overline{f}(x^2)}{\prod_i^j \sum_i^j f_i(x_j^2)} \right)$`}, {`partial-text`, `y = \partial x`}, + {`partial-disp`, `$\frac{\partial^2f}{\partial x^2}$`}, + {`array-disp`, `$\Phi = \left(\begin{array}{c} +\Phi^+ \\ +\Phi^0 \\ +\end{array}\right)$`}, + {`neq-text`, `a \neq b`}, + {`hat-text`, `\hat{p}`}, + {`hbar-text`, `\hat{p} = -i \hbar \vec{\nabla}`}, + {`binom-disp`, `$\binom{n}{k} = \frac{n!}{k!(n-k)!}$`}, + {`bigfrac-disp`, `$\frac{1+\frac{a}{b}} {\displaystyle 1+\frac{1}{1+\frac{1}{a}}}$`}, + {`cfrac-disp`, `$a_0+\cfrac{1}{a_1+\cfrac{1}{a_2+\cfrac{1}{a_3+\cdots}}}$`}, + {`lim-text`, `\lim_{h \to 0} (x-h)`}, + {`lim-disp`, `$\lim_{h \to 0 } \frac{f(x+h)-f(x)}{h}$`}, + {`forall-disp`, `$\forall x \in \mathbf{R}: \qquad x^{2} \geq 0$`}, + {`forall2-disp`, `$x^{2} \geq 0\qquad \text{for all }x\in\mathbf{R}$`}, + {`expers-disp`, `$p^3_{ij} \; m_\text{Knuth} \; \sum_{k=1}^3 k \\[5pt] a^x+y \neq a^{x+y} \; e^{x^2} \neq {e^x}^2$`}, + {`sqrt-disp`, `$\sqrt{p^2}$`}, + {`roots-disp`, `$\sqrt{x} \Leftrightarrow x^{1/2} \; \sqrt[3]{2} \; \sqrt{x^{2} + \sqrt{y}} \; \surd[x^2 + y^2]$`}, + {`lines-disp`, `$0.\overline{3} = \underline{\underline{1/3}}$`}, + {`underbrace-disp`, `$\underbrace{\overbrace{a+b+c}^6 \cdot \overbrace{d+e+f}^7}_\text{meaning of life} = 42$`}, + {`widehat-disp`, `$f''(x) = 2 \hat{XY} \quad \widehat{XY} \quad \bar{x_0} \quad \bar{x}_0$`}, + {`prime-text`, `$f''(x)$`}, + {`vecs-disp`, `$\vec{a} \qquad \vec{AB} \qquad \overrightarrow{AB}$`}, + {`stackrel-text`, `f_n(x) \stackrel{*}{\approx} 1`}, + {`sum-big-disp`, `$\sum^n_{\substack{0 0. +\end{array} \right.$`}, + {`cases-disp`, `$|x| = +\begin{cases} +-x & \text{if } x < 0,\\ +0 & \text{if } x = 0,\\ +x & \text{if } x > 0. +\end{cases}$`}, + {`matrix-ams-disp`, `$\begin{matrix} +1 & 2 \\ +3 & 4 +\end{matrix} \qquad +\begin{bmatrix} +p_{11} & p_{12} & \ldots +& p_{1n} \\ +p_{21} & p_{22} & \ldots +& p_{2n} \\ +\vdots & \vdots & \ddots +& \vdots \\ +p_{m1} & p_{m2} & \ldots +& p_{mn} +\end{bmatrix}$`}, + {`phantom-disp`, `${}^{14}_{6}\text{C} +\qquad \text{versus} \qquad +{}^{14}_{\phantom{1}6}\text{C}$`}, + {`real-disp`, `$\Re \qquad \mathcal{R}$`}, + // {``, `$$`}, + // {``, `$$`}, + // {``, `$$`}, + // {``, `$$`}, + // {``, `$$`}, } for _, test := range tests { - // if test.name != "partial-text" { + // Debug = true + // if test.name != "forall2-disp" { // continue // } RunTest(t, test.name, 400, 150, func(pc *paint.Painter) { + fmt.Println("\n\n#### ", test.name) pc.Fill.Color = colors.Uniform(color.Black) // fmt.Println("font size dots:", pc.Text.FontSize.Dots) - pp, err := TeXMath(test.tex, pc.Text.FontSize.Dots) + pp, err := LaTeXMath(test.tex, pc.Text.FontSize.Dots) assert.NoError(t, err) assert.NotNil(t, pp) - *pp = pp.Translate(0, 40) - pc.State.Path = *pp + pp = pp.Translate(0, 40) + pc.State.Path = pp pc.Draw() // reference text // sh := shaped.NewShaper() @@ -77,5 +152,233 @@ func TestTex(t *testing.T) { // lns := sh.WrapLines(tx, &pc.Font, &pc.Text, &rich.Settings, math32.Vec2(1000, 50)) // pc.DrawText(lns, math32.Vec2(0, 70)) }) + // break } } + +func TestRelations(t *testing.T) { + tests := []string{ + `<`, `>`, `=`, `\leq`, `\le`, `\geq`, `\ge`, `\equiv`, + `\ll`, `\gg`, `\doteq`, `\prec`, `\succ`, `\sim`, + `\preceq`, `\succeq`, `\simeq`, `\subset`, `\supset`, `\approx`, + `\subseteq`, `\supseteq`, `\cong`, `\sqsubseteq`, `\sqsupseteq`, + `\bowtie`, `\in`, `\ni`, `\owns`, `\propto`, `\vdash`, `\dashv`, + `\models`, `\mid`, `\parallel`, `\perp`, `\smile`, `\frown`, + `\asymp`, `:`, `\notin`, `\neq`, `\ne`, + } + // `\sqsubset`, `\sqsupset`, `\Join`, // latexsym + width := 600 + RunTest(t, "all-relations", width, 300, func(pc *paint.Painter) { + pc.Fill.Color = colors.Uniform(color.Black) + fsize := pc.Text.FontSize.Dots + y := fsize + x := 0.5 * fsize + for _, test := range tests { + // Debug = true + // if test != `\mid` { + // continue + // } + pp, err := LaTeXMath(test, fsize) + assert.NoError(t, err) + assert.NotNil(t, pp) + pp = pp.Translate(x, y) + pc.State.Path = pp + pc.Draw() + + x += fsize * 1.5 + if len(test) > 1 { + pp, err = LaTeXMath(`\backslash \text{`+test[1:]+`}`, fsize) + assert.NoError(t, err) + assert.NotNil(t, pp) + pp = pp.Translate(x, y) + pc.State.Path = pp + pc.Draw() + } + x += 8 * fsize + if x > float32(width) { + y += fsize * 1.5 + x = 0.5 * fsize + } + } + }) +} + +func TestOperators(t *testing.T) { + tests := []string{ + `+`, `-`, `\pm`, `\mp`, `\triangleleft`, `\cdot`, `\div`, + `\triangleright`, `\times`, `\setminus`, `\star`, `\cup`, + `\cap`, `\ast`, `\sqcup`, `\sqcap`, `\circ`, `\vee`, `\lor`, + `\wedge`, `\land`, `\bullet`, `\oplus`, `\ominus`, `\diamond`, + `\odot`, `\oslash`, `\uplus`, `\otimes`, `\bigcirc`, + `\amalg`, `\bigtriangleup`, `\dagger`, `\ddagger`, `\wr`, + `\bigtriangledown`, + } + width := 600 + RunTest(t, "all-operators", width, 300, func(pc *paint.Painter) { + pc.Fill.Color = colors.Uniform(color.Black) + fsize := pc.Text.FontSize.Dots + y := fsize + x := 0.5 * fsize + for _, test := range tests { + // Debug = true + // if test != `\ast` { + // continue + // } + pp, err := LaTeXMath(test, fsize) + assert.NoError(t, err) + assert.NotNil(t, pp) + pp = pp.Translate(x, y) + pc.State.Path = pp + pc.Draw() + + x += fsize * 1.5 + if len(test) > 1 { + pp, err = LaTeXMath(`\backslash \text{`+test[1:]+`}`, fsize) + assert.NoError(t, err) + assert.NotNil(t, pp) + pp = pp.Translate(x, y) + pc.State.Path = pp + pc.Draw() + } + x += 8 * fsize + if x > float32(width) { + y += fsize * 1.5 + x = 0.5 * fsize + } + } + }) +} + +func TestBigOperators(t *testing.T) { + tests := []string{ + `\sum`, `\bigcup`, `\bigvee`, `\prod`, `\bigcap`, `\bigwedge`, `\coprod`, + `\bigsqcup`, `\biguplus`, `\int`, `\oint`, `\bigodot`, + `\bigoplus`, `\bigotimes`, + } + width := 600 + RunTest(t, "big-operators", width, 300, func(pc *paint.Painter) { + pc.Fill.Color = colors.Uniform(color.Black) + fsize := pc.Text.FontSize.Dots + y := fsize + x := 0.5 * fsize + for _, test := range tests { + // Debug = true + // if test != `\biguplus` { + // continue + // } + pp, err := LaTeXMath(`$`+test+`$`, fsize) + assert.NoError(t, err) + assert.NotNil(t, pp) + pp = pp.Translate(x, y) + pc.State.Path = pp + pc.Draw() + + x += fsize * 2 + if len(test) > 1 { + pp, err = LaTeXMath(`\backslash \text{`+test[1:]+`}`, fsize) + assert.NoError(t, err) + assert.NotNil(t, pp) + pp = pp.Translate(x, y+fsize) + pc.State.Path = pp + pc.Draw() + } + x += 8 * fsize + if x > float32(width) { + y += fsize * 2.5 + x = 0.5 * fsize + } + } + }) +} + +func TestArrows(t *testing.T) { + tests := []string{ + `\leftarrow`, `\gets`, `\longleftarrow`, `\rightarrow`, `\to`, `\longrightarrow`, + `\leftrightarrow`, `\longleftrightarrow`, `\Leftarrow`, `\Longleftarrow`, + `\Rightarrow`, `\Longrightarrow`, `\Leftrightarrow`, `\Longleftrightarrow`, + `\mapsto`, `\longmapsto`, `\hookleftarrow`, `\hookrightarrow`, `\leftharpoonup`, + `\rightharpoonup`, `\leftharpoondown`, `\rightharpoondown`, `\rightleftharpoons`, + `\iff`, `\uparrow`, `\downarrow`, `\updownarrow`, `\Uparrow`, `\Downarrow`, + `\Updownarrow`, `\nearrow`, `\searrow`, `\swarrow`, `\nwarrow`, + } + // todo: mapsto and hook are sent as double chars, rendering both + width := 600 + RunTest(t, "all-arrows", width, 500, func(pc *paint.Painter) { + pc.Fill.Color = colors.Uniform(color.Black) + fsize := pc.Text.FontSize.Dots + y := fsize + x := 0.5 * fsize + for _, test := range tests { + // Debug = true + // if test != `\mapsto` { + // continue + // } + pp, err := LaTeXMath(test, fsize) + assert.NoError(t, err) + assert.NotNil(t, pp) + pp = pp.Translate(x, y) + pc.State.Path = pp + pc.Draw() + + x += fsize * 3 + if len(test) > 1 { + pp, err = LaTeXMath(`\backslash \text{`+test[1:]+`}`, fsize) + assert.NoError(t, err) + assert.NotNil(t, pp) + pp = pp.Translate(x, y) + pc.State.Path = pp + pc.Draw() + } + x += 18 * fsize + if x > float32(width) { + y += fsize * 1.5 + x = 0.5 * fsize + } + } + }) +} + +func TestSymbols(t *testing.T) { + tests := []string{ + `\dots`, `\cdots`, `\vdots`, `\ddots`, `\hbar`, `\imath`, `\jmath`, `\ell`, + `\Re`, `\Im`, `\aleph`, `\wp`, `\forall`, `\exists`, + `\partial`, `'`, `\prime`, `\emptyset`, `\infty`, + `\nabla`, `\triangle`, `\bot`, `\top`, `\angle`, + `\surd`, `\diamondsuit`, `\heartsuit`, `\clubsuit`, `\spadesuit`, `\neg`, `\lnot`, + `\flat`, `\natural`, `\sharp`, + } + width := 600 + RunTest(t, "all-symbols", width, 300, func(pc *paint.Painter) { + pc.Fill.Color = colors.Uniform(color.Black) + fsize := pc.Text.FontSize.Dots + y := fsize + x := 0.5 * fsize + for _, test := range tests { + // Debug = true + // if test != `\mid` { + // continue + // } + pp, err := LaTeXMath(test, fsize) + assert.NoError(t, err) + assert.NotNil(t, pp) + pp = pp.Translate(x, y) + pc.State.Path = pp + pc.Draw() + + x += fsize * 1.5 + if len(test) > 1 { + pp, err = LaTeXMath(`\backslash \text{`+test[1:]+`}`, fsize) + assert.NoError(t, err) + assert.NotNil(t, pp) + pp = pp.Translate(x, y) + pc.State.Path = pp + pc.Draw() + } + x += 8 * fsize + if x > float32(width) { + y += fsize * 2 + x = 0.5 * fsize + } + } + }) +} diff --git a/text/tex/texcache/texcache.go b/text/tex/texcache/texcache.go new file mode 100644 index 0000000000..f644b2401d --- /dev/null +++ b/text/tex/texcache/texcache.go @@ -0,0 +1,243 @@ +// Copyright (c) 2026, Cogent Core. All rights reserved. +// Use of this source code is governed by a BSD-style +// license that can be found in the LICENSE file. + +package texcache + +import ( + "compress/gzip" + "fmt" + "io" + "io/fs" + "os" + "path/filepath" + "strings" + "sync" + + "cogentcore.org/core/base/errors" + "cogentcore.org/core/base/iox/jsonx" + "cogentcore.org/core/paint/ppath" + "cogentcore.org/core/text/shaped" +) + +var ( + // cache is a cache of equations and a corresponding SVG-encoded path string + cache map[string]*cached + + // mu guards all operations on cache + mu sync.Mutex +) + +// cached is one cache entry +type cached struct { + // svg encoded path string + Path string + + // font size in dots that it was encoded in + // use scale transform to render in new target size. + FontSizeDots float32 + + // actual loaded, scaled PPath. + pp ppath.Path + + // call DeleteUnused to remove any that haven't been accessed or added. + used bool +} + +// SetShapeMath sets the standard text shaping math function to use only +// cached math paths, not live generation of paths from TeX. This saves +// a lot of memory in the resulting executable, and is recommended for +// any math-heavy uses where all the equations can be cached in advance +// (e.g., the content system). +func SetShapeMath() { + shaped.ShapeMath = func(expr string, fontSizeDots float32) (ppath.Path, error) { + expr = strings.TrimSpace(expr) + p := Get(expr, fontSizeDots) + if p != nil { + return p, nil + } + return nil, fmt.Errorf("texcache: no cached path for expression: %q", expr) + } +} + +// Get tries to get a cached path for given equation at given fontsize in dots. +// returns nil if not available. +func Get(expr string, fontSizeDots float32) ppath.Path { + mu.Lock() + defer mu.Unlock() + + cd, ok := cache[expr] + if !ok { + return nil + } + cd.used = true + if cd.pp == nil { // lazy loading + p, err := ppath.ParseSVGPath(cd.Path) + if err != nil { + fmt.Println("texcache parsing error -- shouldn't happen!", err) + delete(cache, expr) + return nil + } + cd.pp = p + } + if cd.FontSizeDots == fontSizeDots { + return cd.pp + } + sc := fontSizeDots / cd.FontSizeDots + np := cd.pp.Scale(sc, sc) + cache[expr] = &cached{FontSizeDots: fontSizeDots, pp: np, used: true} + return np +} + +// Add adds a new entry +func Add(expr string, fontSizeDots float32, pp ppath.Path) { + mu.Lock() + defer mu.Unlock() + + if cache == nil { + cache = make(map[string]*cached) + } + cache[expr] = &cached{FontSizeDots: fontSizeDots, pp: pp, used: true} +} + +// ReadGzip reads cache entries from gzipped reader input. +func ReadGzip(r io.Reader) error { + mu.Lock() + defer mu.Unlock() + + var c map[string]*cached + err := readGzip(&c, r) + if err != nil { + return err + } + setCache(c) + return nil +} + +func readGzip(c *map[string]*cached, r io.Reader) error { + gzr, err := gzip.NewReader(r) + defer gzr.Close() + if err != nil { + return errors.Log(err) + } + err = jsonx.Read(c, gzr) + if err != nil { + return errors.Log(err) + } + return nil +} + +func setCache(c map[string]*cached) { + if cache == nil { + cache = c + return + } + for k, v := range c { + cache[k] = v + } +} + +// OpenFS opens saved cache entries from given file system (e.g., for embed). +// If the filename ends in .gz, it is unzipped for reading. +func OpenFS(fsys fs.FS, filename string) error { + mu.Lock() + defer mu.Unlock() + + var c map[string]*cached + + ext := filepath.Ext(string(filename)) + if ext == ".gz" { + fp, err := os.Open(filename) + defer fp.Close() + if err != nil { + return errors.Log(err) + } + err = readGzip(&c, fp) + if err != nil { + return err + } + } else { + err := jsonx.OpenFS(&c, fsys, filename) + if err != nil { + return errors.Log(err) + } + } + setCache(c) + return nil +} + +// Open opens saved cache entries from given file +// If the filename ends in .gz, it is unzipped for reading. +func Open(filename string) error { + mu.Lock() + defer mu.Unlock() + + var c map[string]*cached + ext := filepath.Ext(string(filename)) + if ext == ".gz" { + fp, err := os.Open(filename) + defer fp.Close() + if err != nil { + return errors.Log(err) + } + err = readGzip(&c, fp) + if err != nil { + return err + } + } else { + err := jsonx.Open(&c, filename) + if err != nil { + return errors.Log(err) + } + } + setCache(c) + return nil +} + +// DeleteUnused deletes any cache entries that have not been +// accessed since the cache was loaded. +// Use this in generate functions that save all generated cache. +func DeleteUnused() { + for k, v := range cache { + if !v.used { + delete(cache, k) + } + } +} + +// SaveAs saves cache entries to given file +// If the filename ends in .gz, it is zipped. +// When generating, can call DeleteUnused to filter +// all unused items. +func SaveAs(filename string) error { + mu.Lock() + defer mu.Unlock() + + if cache == nil { + return fmt.Errorf("texcache.SaveAs: no cache entries!") + } + for _, v := range cache { + v.Path = v.pp.ToSVG() + } + + ext := filepath.Ext(string(filename)) + if ext == ".gz" { + fp, err := os.Create(filename) + defer fp.Close() + if err != nil { + return errors.Log(err) + } + gzr := gzip.NewWriter(fp) + err = jsonx.Write(cache, gzr) + gzr.Close() + if err != nil { + return errors.Log(err) + } + } else { + err := jsonx.Save(cache, filename) + if err != nil { + return errors.Log(err) + } + } + return nil +} diff --git a/text/tex/texmf/amsbsy.sty b/text/tex/texmf/amsbsy.sty new file mode 100644 index 0000000000..20a116ca41 --- /dev/null +++ b/text/tex/texmf/amsbsy.sty @@ -0,0 +1,72 @@ +%% +%% This is file `amsbsy.sty', +%% generated with the docstrip utility. +%% +%% The original source files were: +%% +%% amsbsy.dtx +%% +%% Copyright (C) 1995, 1999 American Mathematical Society. +%% Copyright (C) 2016-2025 LaTeX Project and American Mathematical Society. +%% +%% This work may be distributed and/or modified under the +%% conditions of the LaTeX Project Public License, either version 1.3c +%% of this license or (at your option) any later version. +%% The latest version of this license is in +%% https://www.latex-project.org/lppl.txt +%% and version 1.3c or later is part of all distributions of LaTeX +%% version 2005/12/01 or later. +%% +%% This work has the LPPL maintenance status `maintained'. +%% +%% The Current Maintainer of this work is the LaTeX Project. +%% +\NeedsTeXFormat{LaTeX2e}% LaTeX 2.09 can't be used (nor non-LaTeX) +[1994/12/01]% LaTeX date must December 1994 or later +\ProvidesPackage{amsbsy}[1999/11/29 v1.2d Bold Symbols] +\RequirePackage{amsgen} +\DeclareRobustCommand{\boldsymbol}[1]{% + \begingroup + \let\@nomath\@gobble \mathversion{bold}% + \math@atom{#1}{% + \mathchoice% + {\hbox{$\m@th\displaystyle#1$}}% + {\hbox{$\m@th\textstyle#1$}}% + {\hbox{$\m@th\scriptstyle#1$}}% + {\hbox{$\m@th\scriptscriptstyle#1$}}}% + \endgroup} +\def\math@atom#1#2{% + \binrel@{#1}\binrel@@{#2}} +\DeclareRobustCommand{\pmb}{% + \ifmmode\else \expandafter\pmb@@\fi\mathpalette\pmb@} +\def\pmb@@#1#2#3{\leavevmode\setboxz@h{#3}% + \dimen@-\wdz@ + \kern-.5\ex@\copy\z@ + \kern\dimen@\kern.25\ex@\raise.4\ex@\copy\z@ + \kern\dimen@\kern.25\ex@\box\z@ +} +\newdimen\pmbraise@ +\def\pmb@#1#2{\setbox8\hbox{$\m@th#1{#2}$}% + \setboxz@h{$\m@th#1\mkern.5mu$}\pmbraise@\wdz@ + \binrel@{#2}% + \dimen@-\wd8 % + \binrel@@{% + \mkern-.8mu\copy8 % + \kern\dimen@\mkern.4mu\raise\pmbraise@\copy8 % + \kern\dimen@\mkern.4mu\box8 }% +} +\def\binrel@#1{\begingroup + \setboxz@h{\thinmuskip0mu + \medmuskip\m@ne mu\thickmuskip\@ne mu + \setbox\tw@\hbox{$#1\m@th$}\kern-\wd\tw@ + ${}#1{}\m@th$}% + \edef\@tempa{\endgroup\let\noexpand\binrel@@ + \ifdim\wdz@<\z@ \mathbin + \else\ifdim\wdz@>\z@ \mathrel + \else \relax\fi\fi}% + \@tempa +} +\let\binrel@@\relax +\endinput +%% +%% End of file `amsbsy.sty'. diff --git a/text/tex/texmf/amsgen.sty b/text/tex/texmf/amsgen.sty new file mode 100644 index 0000000000..b39c5bf2b1 --- /dev/null +++ b/text/tex/texmf/amsgen.sty @@ -0,0 +1,136 @@ +%% +%% This is file `amsgen.sty', +%% generated with the docstrip utility. +%% +%% The original source files were: +%% +%% amsgen.dtx +%% +%% Copyright (C) 1995, 1999 American Mathematical Society. +%% Copyright (C) 2016-2025 LaTeX Project and American Mathematical Society. +%% +%% This work may be distributed and/or modified under the +%% conditions of the LaTeX Project Public License, either version 1.3c +%% of this license or (at your option) any later version. +%% The latest version of this license is in +%% https://www.latex-project.org/lppl.txt +%% and version 1.3c or later is part of all distributions of LaTeX +%% version 2005/12/01 or later. +%% +%% This work has the LPPL maintenance status `maintained'. +%% +%% The Current Maintainer of this work is the LaTeX Project. +%% +\NeedsTeXFormat{LaTeX2e}% LaTeX 2.09 can't be used (nor non-LaTeX) +[1994/12/01]% LaTeX date must December 1994 or later +\ProvidesFile{amsgen.sty}[1999/11/30 v2.0 generic functions] +\providecommand{\@saveprimitive}[2]{\begingroup\escapechar`\\\relax + \edef\@tempa{\string#1}\edef\@tempb{\meaning#1}% + \ifx\@tempa\@tempb \global\let#2#1% + \else + \edef\@tempb{\meaning#2}% + \ifx\@tempa\@tempb + \else + \@latex@error{Unable to properly define \string#2; primitive + \noexpand#1no longer primitive}\@eha + \fi + \fi + \endgroup} +\let\@xp=\expandafter +\let\@nx=\noexpand +\newtoks\@emptytoks +\def\@oparg#1[#2]{\@ifnextchar[{#1}{#1[#2]}} +\long\def\@ifempty#1{\@xifempty#1@@..\@nil} +\long\def\@xifempty#1#2@#3#4#5\@nil{% + \ifx#3#4\@xp\@firstoftwo\else\@xp\@secondoftwo\fi} +\long\def\@ifnotempty#1{\@ifempty{#1}{}} +\def\FN@{\futurelet\@let@token} +\def\DN@{\def\next@} +\def\RIfM@{\relax\ifmmode} +\def\setboxz@h{\setbox\z@\hbox} +\def\wdz@{\wd\z@} +\def\boxz@{\box\z@} +\def\relaxnext@{\let\@let@token\relax} +\long\def\new@ifnextchar#1#2#3{% + \let\reserved@d= #1% + \def\reserved@a{#2}\def\reserved@b{#3}% + \futurelet\@let@token\new@ifnch +} +\def\new@ifnch{% + \ifx\@let@token\reserved@d \let\reserved@b\reserved@a \fi + \reserved@b +} +\def\@ifstar#1#2{\new@ifnextchar *{\def\reserved@a*{#1}\reserved@a}{#2}} +\@ifundefined{every@math@size}{% +\let\every@math@size=\every@size +\def\glb@settings{% + \expandafter\ifx\csname S@\f@size\endcsname\relax + \calculate@math@sizes + \fi + \csname S@\f@size\endcsname + \ifmath@fonts + \begingroup + \escapechar\m@ne + \csname mv@\math@version \endcsname + \globaldefs\@ne + \let \glb@currsize \f@size + \math@fonts + \endgroup + \the\every@math@size + \else + \fi +} +\def\set@fontsize#1#2#3{% + \@defaultunits\@tempdimb#2pt\relax\@nnil + \edef\f@size{\strip@pt\@tempdimb}% + \@defaultunits\@tempskipa#3pt\relax\@nnil + \edef\f@baselineskip{\the\@tempskipa}% + \edef\f@linespread{#1}% + \let\baselinestretch\f@linespread + \def\size@update{% + \baselineskip\f@baselineskip\relax + \baselineskip\f@linespread\baselineskip + \normalbaselineskip\baselineskip + \setbox\strutbox\hbox{% + \vrule\@height.7\baselineskip + \@depth.3\baselineskip + \@width\z@}% +%%% \the\every@size + \let\size@update\relax}% + } +}{}% end \@ifundefined test +\newdimen\ex@ +\addto@hook\every@math@size{\compute@ex@} +\def\compute@ex@{% + \begingroup + \dimen@-\f@size\p@ + \ifdim\dimen@<-20\p@ + \global\ex@ 1.5\p@ + \else + \advance\dimen@10\p@ \multiply\dimen@\tw@ + \edef\@tempa{\ifdim\dimen@>\z@ -\fi}% + \dimen@ \ifdim\dimen@<\z@ -\fi \dimen@ + \advance\dimen@-\@m sp % fudge factor + \vfuzz\p@ + \def\do{\ifdim\dimen@>\z@ + \vfuzz=.97\vfuzz + \advance\dimen@ -\p@ + \@xp\do \fi}% + \do + \dimen@\p@ \advance\dimen@-\vfuzz + \global\ex@\p@ + \global\advance\ex@ \@tempa\dimen@ + \fi + \endgroup +} +\def\@addpunct#1{\ifnum\spacefactor>\@m \else#1\fi} +\def\frenchspacing{\sfcode`\.1006\sfcode`\?1005\sfcode`\!1004% + \sfcode`\:1003\sfcode`\;1002\sfcode`\,1001 } +\def\nomath@env{\@amsmath@err{% + \string\begin{\@currenvir} allowed only in paragraph mode% +}\@ehb% "You've lost some text" +} +\def\Invalid@@{Invalid use of \string} +\endinput +%% +%% End of file `amsgen.sty'. diff --git a/text/tex/texmf/amsmath.sty b/text/tex/texmf/amsmath.sty new file mode 100644 index 0000000000..2da704c7e5 --- /dev/null +++ b/text/tex/texmf/amsmath.sty @@ -0,0 +1,2954 @@ +%% +%% This is file `amsmath.sty', +%% generated with the docstrip utility. +%% +%% The original source files were: +%% +%% amsmath.dtx +%% +%% Copyright (C) 1995, 1999, 2000, 2013 American Mathematical Society. +%% Copyright (C) 2016-2025 LaTeX Project and American Mathematical Society. +%% +%% This work may be distributed and/or modified under the +%% conditions of the LaTeX Project Public License, either version 1.3c +%% of this license or (at your option) any later version. +%% The latest version of this license is in +%% https://www.latex-project.org/lppl.txt +%% and version 1.3c or later is part of all distributions of LaTeX +%% version 2005/12/01 or later. +%% +%% This work has the LPPL maintenance status `maintained'. +%% +%% The Current Maintainer of this work is the LaTeX Project. +%% +\NeedsTeXFormat{LaTeX2e}% LaTeX 2.09 can't be used (nor non-LaTeX) +[1994/12/01]% LaTeX date must be December 1994 or later +\DeclareRelease{}{1994-06-01}{amsmath-2018-12-01.sty} +\DeclareRelease{}{2018-12-01}{amsmath-2018-12-01.sty} +\DeclareCurrentRelease{}{2019-04-01} +\ProvidesPackage{amsmath}[2025/07/09 v2.17z AMS math features] +\edef\@temp{\catcode 96=\number\catcode 96 } +\catcode\string `\`=12 +\def\do#1{\catcode\number`#1=\number\catcode`#1} +\edef\@temp{% + \noexpand\AtEndOfPackage{% + \@temp + \do\"\do\'\do\(\do\)\do\*\do\+\do\,\do\-\do\.% + \do\/\do\<\do\=\do\>\do\[\do\]\do\^\do\_\relax + }% +} +\@temp +\def\do#1{\catcode\number`#1=12 } +\do\"\do\'\do\(\do\)\do\*\do\+\do\,\do\-\do\. +\do\/\do\<\do\=\do\>\do\[\do\] +\catcode`\^=7 \catcode`\_=8 +\DeclareOption{intlimits}{\let\ilimits@\displaylimits} +\DeclareOption{nointlimits}{\let\ilimits@\nolimits} +\DeclareOption{sumlimits}{\let\slimits@\displaylimits} +\DeclareOption{nosumlimits}{\let\slimits@\nolimits} +\DeclareOption{namelimits}{\PassOptionsToPackage{namelimits}{amsopn}} +\DeclareOption{nonamelimits}{% + \PassOptionsToPackage{nonamelimits}{amsopn}} +\newif\ifctagsplit@ +\newif\iftagsleft@ +\DeclareOption{leqno}{\tagsleft@true} +\DeclareOption{reqno}{\tagsleft@false} +\DeclareOption{centertags}{\ctagsplit@true} +\DeclareOption{tbtags}{\ctagsplit@false} +\DeclareOption{cmex10}{% + \ifnum\cmex@opt=\@ne \def\cmex@opt{0}% + \else \def\cmex@opt{10}\fi +} +\@ifundefined{cmex@opt}{\def\cmex@opt{7}}{} +%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% +\newif\if@fleqn +\newskip\@mathmargin +\@mathmargin\@centering +\DeclareOption{fleqn}{% + \@fleqntrue + \@mathmargin = -1sp + \let\mathindent=\@mathmargin + \AtBeginDocument{% + \ifdim\@mathmargin= -1sp + \@mathmargin\leftmargini minus\leftmargini + \fi + }% +} +\DeclareOption{alignedleftspaceyes}{\def\alignedspace@left{\null\,}} +\DeclareOption{alignedleftspaceno}{\def\alignedspace@left{\null}} +\DeclareOption{alignedleftspaceyesifneg}{% +\def\alignedspace@left{% + \edef\@tempa{\expandafter\@car\the\lastskip\@nil}% + \if-\@tempa\null\,% + \else + \edef\@tempa{\expandafter\@car\the\lastkern\@nil}% + \if-\@tempa\null\,% + \else\null + \fi + \fi}% +} +\DeclareOption{?}{} +\ExecuteOptions{% + nointlimits,sumlimits,namelimits,centertags,alignedleftspaceyesifneg} +\ProcessOptions\par +\@ifpackagewith{amsmath}{?}{% + \typeout{^^J% +Documentation for the amsmath package is found in amsldoc.dvi^^J% +(or .pdf or .tex).^^J% +^^J% +See also https://www.ams.org/tex/amslatex.html.^^J% +^^J% +Note: Using the first edition of The LaTeX Companion (1994) without^^J% +errata as a guide for amsmath use is not recommended.^^J% + }% +}{% + \typeout{% +For additional information on amsmath, use the \lq ?\rq\space option.% + }% +} +\ifnum\cmex@opt=7 \relax + \DeclareFontShape{OMX}{cmex}{m}{n}{% + <-8>cmex7<8>cmex8<9>cmex9% + <10><10.95><12><14.4><17.28><20.74><24.88>cmex10% + }{}% + \expandafter\let\csname OMX/cmex/m/n/10\endcsname\relax +\else + \ifnum\cmex@opt=\z@ % need to override cmex7 fontdef from amsfonts + \begingroup + \fontencoding{OMX}\fontfamily{cmex}% + \expandafter\let\csname OMX+cmex\endcsname\relax + \try@load@fontshape + \endgroup + \expandafter\let\csname OMX/cmex/m/n/10\endcsname\relax + \def\cmex@opt{10}% + \fi +\fi +\RequirePackage{amstext}[1995/01/25] +\RequirePackage{amsbsy}[1995/01/20] +\RequirePackage{amsopn}[1995/01/20] +\@ifpackageloaded{stix}{% + \let\ams@newcommand\providecommand + \let\ams@renewcommand\providecommand + \let\ams@def\providecommand + \let\ams@DeclareRobustCommand\providecommand +}{% + \let\ams@newcommand\newcommand + \let\ams@renewcommand\renewcommand + \let\ams@def\def + \let\ams@DeclareRobustCommand\DeclareRobustCommand +} +\def\@amsmath@err{\PackageError{amsmath}} +\providecommand{\AmS}{{\protect\AmSfont + A\kern-.1667em\lower.5ex\hbox{M}\kern-.125emS}} +\newcommand{\AmSfont}{% + \usefont{OMS}{cmsy}{\if\@xp\@car\f@series\@nil bb\else m\fi}{n}} +\ifx\leavevmode@ifvmode\@undefined % kernel is < 2018/12 +\def\@mathmeasure#1#2#3{\setbox#1\hbox{\frozen@everymath\@emptytoks + \m@th$#2#3$}} +\else +\def\@mathmeasure#1#2#3{\setbox#1\hbox{% + \m@th$#2#3$}} +\fi +\@ifundefined{inf@bad}{% + \newcount\inf@bad \inf@bad=1000000 \relax +}{} +\let\tmspace\@undefined +\let\,\@undefined +\let\!\@undefined +\let\:\@undefined +\let\negmedspace\@undefined +\let\negthickspace\@undefined +\ifx\leavevmode@ifvmode\@undefined +\DeclareRobustCommand\tmspace[3]{% + \ifmmode\mskip#1#2\else\kern#1#3\fi\relax} +\else +\DeclareRobustCommand\tmspace[3]{% + \ifmmode\mskip#1#2\else\leavevmode@ifvmode\kern#1#3\fi\relax} +\fi +\DeclareRobustCommand\,{\tmspace+\thinmuskip{.1667em}} +\let\thinspace\, +\DeclareRobustCommand\!{\tmspace-\thinmuskip{.1667em}} +\let\negthinspace\! +\DeclareRobustCommand\:{\tmspace+\medmuskip{.2222em}} +\let\medspace\: +\DeclareRobustCommand\negmedspace{\tmspace-\medmuskip{.2222em}} +\renewcommand\;{\tmspace+\thickmuskip{.2777em}} +\let\thickspace\; +\DeclareRobustCommand\negthickspace{\tmspace-\thickmuskip{.2777em}} +\newcommand{\mspace}[1]{\mskip#1\relax} +\def\@tempa#1#2\@nil{% + \ifx\delimiter#1\@tempcnta#2\relax\else\@tempcnta\z@\fi +} +\@xp\@tempa\vert\@empty\@nil +\ifnum\@tempcnta>\z@ + \advance\@tempcnta "4000000 + \protected\xdef\lvert{\delimiter\number\@tempcnta\space } + \advance\@tempcnta "1000000 + \protected\xdef\rvert{\delimiter\number\@tempcnta\space } +\else + \ifx\@@undefined\lvert + % Fall back to cmex encoding since we don't know what else to do. + \DeclareMathDelimiter{\lvert} + {\mathopen}{symbols}{"6A}{largesymbols}{"0C} + \DeclareMathDelimiter{\rvert} + {\mathclose}{symbols}{"6A}{largesymbols}{"0C} + \fi +\fi +\@xp\@tempa\Vert\@empty\@nil +\ifnum\@tempcnta>\z@ + \advance\@tempcnta "4000000 + \protected\xdef\lVert{\delimiter\number\@tempcnta\space } + \advance\@tempcnta "1000000 + \protected\xdef\rVert{\delimiter\number\@tempcnta\space } +\else + \ifx\@@undefined\lVert + \DeclareMathDelimiter{\lVert} + {\mathopen}{symbols}{"6B}{largesymbols}{"0D} + \DeclareMathDelimiter{\rVert} + {\mathclose}{symbols}{"6B}{largesymbols}{"0D} + \fi +\fi +\@saveprimitive\over\@@over +\@saveprimitive\atop\@@atop +\@saveprimitive\above\@@above +\@saveprimitive\overwithdelims\@@overwithdelims +\@saveprimitive\atopwithdelims\@@atopwithdelims +\@saveprimitive\abovewithdelims\@@abovewithdelims +\DeclareRobustCommand{\primfrac}[1]{% + \PackageWarning{amsmath}{% +Foreign command \@backslashchar#1;\MessageBreak +\protect\frac\space or \protect\genfrac\space should be used instead% +\MessageBreak + } + \global\@xp\let\csname#1\@xp\endcsname\csname @@#1\endcsname + \csname#1\endcsname +} +\renewcommand{\over}{\primfrac{over}} +\renewcommand{\atop}{\primfrac{atop}} +\renewcommand{\above}{\primfrac{above}} +\renewcommand{\overwithdelims}{\primfrac{overwithdelims}} +\renewcommand{\atopwithdelims}{\primfrac{atopwithdelims}} +\renewcommand{\abovewithdelims}{\primfrac{abovewithdelims}} +\ifx\directlua\@undefined +\DeclareRobustCommand{\frac}[2]{{\begingroup#1\endgroup\@@over#2}} +\else +\DeclareRobustCommand{\frac}[2]{{\Ustack{\begingroup#1\endgroup\@@over#2}}} +\fi +\DeclareRobustCommand{\dfrac}{\genfrac{}{}{}0} +\DeclareRobustCommand{\tfrac}{\genfrac{}{}{}1} +\DeclareRobustCommand{\binom}{\genfrac()\z@{}} +\DeclareRobustCommand{\dbinom}{\genfrac(){0pt}0} +\DeclareRobustCommand{\tbinom}{\genfrac(){0pt}1} +\ifx\directlua\@undefined +\ifx\XeTeXcharclass\@undefined +\DeclareRobustCommand{\genfrac}[4]{% + \def\@tempa{#1#2}% + \edef\@tempb{\@nx\@genfrac\@mathstyle{#4}% + \csname @@\ifx @#3@over\else above\fi + \ifx\@tempa\@empty \else withdelims\fi\endcsname} + \@tempb{#1#2#3}} +\else +\def\genfrac@rule#1#2#3#4{% +\hbox{$\left#1\vcenter{\hrule \@width\z@ + \@height + \ifdim\fontdimen#2#3\tw@=\z@ + #4\fontdimen6#3\tw@ + \else + \fontdimen#2#3\tw@ + \fi + }\right.$}} +\def\genfrac@choice#1#2{% +\ifx @#2@\else +\ifx c#1\kern-\nulldelimiterspace\fi +{\delimitershortfall\z@\delimiterfactor\@m + \mathsurround\z@\nulldelimiterspace\z@ +\mathchoice +{\genfrac@rule{#2}{20}\textfont{2.39}}% +{\genfrac@rule{#2}{21}\textfont{1}}% +{\genfrac@rule{#2}{21}\scriptfont{1.45}}% +{\genfrac@rule{#2}{21}\scriptscriptfont{1.35}}% +}% +\ifx o#1\kern-\nulldelimiterspace\fi +\fi +} +\DeclareRobustCommand{\genfrac}[6]{{% +\@mathstyle{#4}% +\genfrac@choice o{#1}% +{\begingroup#5\endgroup\ifx @#3@\@@over\else\@@above\fi#3\relax#6}% +\genfrac@choice c{#2}% +}} +\fi +\else +\def\genfrac@rule#1#2#3{% +\hbox{$\left#1\vcenter{\hrule \@width\z@ + \@height + \ifdim\Umathfractiondelsize#2=\z@ + #3\fontdimen6#3\tw@ + \else + \Umathfractiondelsize#2% + \fi + }\right.$}} +\def\genfrac@choice#1#2{% +\ifx @#2@\else +\ifx c#1\kern-\nulldelimiterspace\fi +{\delimitershortfall\z@\delimiterfactor\@m + \mathsurround\z@\nulldelimiterspace\z@ +\mathchoice +{\genfrac@rule{#2}\displaystyle{2.39}}% +{\genfrac@rule{#2}\textstyle{1}}% +{\genfrac@rule{#2}\scriptstyle{1.45}}% +{\genfrac@rule{#2}\scriptscriptstyle{1.35}}% +}% +\ifx o#1\kern-\nulldelimiterspace\fi +\fi +} +\DeclareRobustCommand{\genfrac}[6]{{% +\@mathstyle{#4}% +\genfrac@choice o{#1}% +{\Ustack {\begingroup#5\endgroup\ifx @#3@\@@over\else\@@above\fi#3\relax#6}}% +\genfrac@choice c{#2}% +}} +\fi +\def\@genfrac#1#2#3#4#5{{#1{\begingroup#4\endgroup#2#3\relax#5}}} +\def\@mathstyle#1{% + \ifx\@empty#1\@empty\relax + \else\ifcase#1\displaystyle % case 0 + \or\textstyle\or\scriptstyle\else\scriptscriptstyle\fi\fi} +\begingroup +\edef\@tempa{\string\mathchar"} +\edef\@tempd{\string\Umathchar"} +\def\@tempb#1"#2\@nil{#1"} +\edef\@tempc{\expandafter\@tempb\meaning\coprod "\@nil} +\ifx\@tempc\@tempd\let\@tempc\@tempa\fi +\ifx\@tempa\@tempc + \global\let\coprod@\coprod + \gdef\coprod{\DOTSB\coprod@\slimits@} + \global\let\bigvee@\bigvee + \gdef\bigvee{\DOTSB\bigvee@\slimits@} + \global\let\bigwedge@\bigwedge + \gdef\bigwedge{\DOTSB\bigwedge@\slimits@} + \global\let\biguplus@\biguplus + \gdef\biguplus{\DOTSB\biguplus@\slimits@} + \global\let\bigcap@\bigcap + \gdef\bigcap{\DOTSB\bigcap@\slimits@} + \global\let\bigcup@\bigcup + \gdef\bigcup{\DOTSB\bigcup@\slimits@} + \global\let\prod@\prod + \gdef\prod{\DOTSB\prod@\slimits@} + \global\let\sum@\sum + \gdef\sum{\DOTSB\sum@\slimits@} + \global\let\bigotimes@\bigotimes + \gdef\bigotimes{\DOTSB\bigotimes@\slimits@} + \global\let\bigoplus@\bigoplus + \gdef\bigoplus{\DOTSB\bigoplus@\slimits@} + \global\let\bigodot@\bigodot + \gdef\bigodot{\DOTSB\bigodot@\slimits@} + \global\let\bigsqcup@\bigsqcup + \gdef\bigsqcup{\DOTSB\bigsqcup@\slimits@} +\fi +\endgroup +\newcommand{\leftroot}{\@amsmath@err{\Invalid@@\leftroot}\@eha} +\newcommand{\uproot}{\@amsmath@err{\Invalid@@\uproot}\@eha} +\newcount\uproot@ +\newcount\leftroot@ +\renewcommand{\root}{\relaxnext@ + \DN@{\ifx\@let@token\uproot\let\next@\nextii@\else + \ifx\@let@token\leftroot\let\next@\nextiii@\else + \let\next@\plainroot@\fi\fi\next@}% + \def\nextii@\uproot##1{\uproot@##1\relax\FN@\nextiv@}% + \def\nextiv@{\ifx\@let@token\@sptoken\DN@. {\FN@\nextv@}\else + \DN@.{\FN@\nextv@}\fi\next@.}% + \def\nextv@{\ifx\@let@token\leftroot\let\next@\nextvi@\else + \let\next@\plainroot@\fi\next@}% + \def\nextvi@\leftroot##1{\leftroot@##1\relax\plainroot@}% + \def\nextiii@\leftroot##1{\leftroot@##1\relax\FN@\nextvii@}% + \def\nextvii@{\ifx\@let@token\@sptoken + \DN@. {\FN@\nextviii@}\else + \DN@.{\FN@\nextviii@}\fi\next@.}% + \def\nextviii@{\ifx\@let@token\uproot\let\next@\nextix@\else + \let\next@\plainroot@\fi\next@}% + \def\nextix@\uproot##1{\uproot@##1\relax\plainroot@}% + \bgroup\uproot@\z@\leftroot@\z@\FN@\next@} +\def\plainroot@#1\of#2{\setbox\rootbox\hbox{% + $\m@th\scriptscriptstyle{#1}$}% + \mathchoice{\r@@t\displaystyle{#2}}{\r@@t\textstyle{#2}} + {\r@@t\scriptstyle{#2}}{\r@@t\scriptscriptstyle{#2}}\egroup} + +\@ifundefined{sqrtsign}{\let\sqrtsign\@@sqrt}{} +\def\r@@t#1#2{\setboxz@h{$\m@th#1\sqrtsign{#2}$}% + \dimen@\ht\z@\advance\dimen@-\dp\z@ + \setbox\@ne\hbox{$\m@th#1\mskip\uproot@ mu$}% + \advance\dimen@ by1.667\wd\@ne + \mkern-\leftroot@ mu\mkern5mu\raise.6\dimen@\copy\rootbox + \mkern-10mu\mkern\leftroot@ mu\boxz@} +\@ifundefined{varGamma}{% + \DeclareMathSymbol{\varGamma}{\mathord}{letters}{"00} + \DeclareMathSymbol{\varDelta}{\mathord}{letters}{"01} + \DeclareMathSymbol{\varTheta}{\mathord}{letters}{"02} + \DeclareMathSymbol{\varLambda}{\mathord}{letters}{"03} + \DeclareMathSymbol{\varXi}{\mathord}{letters}{"04} + \DeclareMathSymbol{\varPi}{\mathord}{letters}{"05} + \DeclareMathSymbol{\varSigma}{\mathord}{letters}{"06} + \DeclareMathSymbol{\varUpsilon}{\mathord}{letters}{"07} + \DeclareMathSymbol{\varPhi}{\mathord}{letters}{"08} + \DeclareMathSymbol{\varPsi}{\mathord}{letters}{"09} + \DeclareMathSymbol{\varOmega}{\mathord}{letters}{"0A} +}{} +\@saveprimitive\overline\@@overline +\DeclareRobustCommand{\overline}[1]{\@@overline{#1}} +\DeclareRobustCommand{\boxed}[1]{\fbox{\m@th$\displaystyle#1$}} +\newcommand{\implies}{\DOTSB\;\Longrightarrow\;} +\newcommand{\impliedby}{\DOTSB\;\Longleftarrow\;} +\def\And{\DOTSB\;\mathchar"3026 \;} +\newcommand{\nobreakdash}{\leavevmode + \toks@\@emptytoks \def\@tempa##1{\toks@\@xp{\the\toks@-}\FN@\next@}% + \DN@{\ifx\@let@token-\@xp\@tempa + \else\setboxz@h{\the\toks@\nobreak}\unhbox\z@\fi}% + \FN@\next@ +} +\DeclareRobustCommand{\colon}{\nobreak\mskip2mu\mathpunct{}\nonscript + \mkern-\thinmuskip{:}\mskip6muplus1mu\relax} +\let\ifgtest@\iffalse % initial value +\def\gtest@true{\global\let\ifgtest@\iftrue} +\def\gtest@false{\global\let\ifgtest@\iffalse} +\let\DOTSI\relax +\let\DOTSB\relax +\let\DOTSX\relax +{\uccode`7=`\\ \uccode`8=`m \uccode`9=`a \uccode`0=`t \uccode`!=`h + \uppercase{% + \gdef\math@#1#2#3#4#5#6\math@{\gtest@false\ifx 7#1\ifx 8#2% + \ifx 9#3\ifx 0#4\ifx !#5\xdef\meaning@{#6}\gtest@true + \fi\fi\fi\fi\fi}}} +{\uccode`7=`c \uccode`8=`h \uccode`9=`\" + \uppercase{\gdef\mathch@#1#2#3#4#5#6\mathch@{\gtest@false + \ifx 7#1\ifx 8#2\ifx 9#5\gtest@true\xdef\meaning@{9#6}\fi\fi\fi}}} +{\uccode`(=`U \uccode`)=`m + \uppercase{\gdef\Umathch@#1#2#3#4"#5"#6\Umathch@{\gtest@false + \ifx(#2\ifx)#3\gtest@true + \ifcase"#5 \or\or\gdef\thedots@{\dotsb@}\or\gdef\thedots@{\dotsb@}\fi + \fi\fi + }}} +\ifx\Umathcharnumdef\@undefined +\gdef\thecharacter@#1\thecharacter@{} +\else +{\uccode`(=`t \uccode`)=`c + \uppercase{\gdef\thecharacter@#1#2#3#4#5\thecharacter@{% + \ifx(#1\ifx)#4% + \@xp\getmathcode@\meaning@\getmathcode@ + \fi\fi +}}} +\def\getmathcode@#1 #2 #3#4\getmathcode@{% + \Umathcharnumdef\@tempa\Umathcodenum`#3\relax + \edef\meaning@{\meaning\@tempa}% + \@xp\Umathch@\meaning@\Umathch@ +} +\fi +\newcount\classnum@ +\def\getmathch@#1.#2\getmathch@{\classnum@#1 \divide\classnum@4096 + \ifcase\number\classnum@\or\or\gdef\thedots@{\dotsb@}\or + \gdef\thedots@{\dotsb@}\fi} +{\uccode`4=`b \uccode`5=`i \uccode`6=`n + \uppercase{\gdef\mathbin@#1#2#3{\relaxnext@ + \def\nextii@##1\mathbin@{\ifx\@sptoken\@let@token\gtest@true\fi}% + \gtest@false\DN@##1\mathbin@{}% + \ifx 4#1\ifx 5#2\ifx 6#3\DN@{\FN@\nextii@}\fi\fi\fi\next@}}} +{\uccode`4=`r \uccode`5=`e \uccode`6=`l + \uppercase{\gdef\mathrel@#1#2#3{\relaxnext@ + \def\nextii@##1\mathrel@{\ifx\@sptoken\@let@token\gtest@true\fi}% + \gtest@false\DN@##1\mathrel@{}% + \ifx 4#1\ifx 5#2\ifx 6#3\DN@{\FN@\nextii@}\fi\fi\fi\next@}}} +{\uccode`5=`m \uccode`6=`a \uccode`7=`c + \uppercase{\gdef\macro@#1#2#3#4\macro@{\gtest@false + \ifx 5#1\ifx 6#2\ifx 7#3\gtest@true + \xdef\meaning@{\macro@@#4\macro@@}\fi\fi\fi}}} +\def\macro@@#1->#2\macro@@{#2} +\newcount\DOTSCASE@ +{\uccode`6=`\\ \uccode`7=`D \uccode`8=`O \uccode`9=`T \uccode`0=`S + \uppercase{\gdef\DOTS@#1#2#3#4#5{\gtest@false\DN@##1\DOTS@{}% + \ifx 6#1\ifx 7#2\ifx 8#3\ifx 9#4\ifx 0#5\let\next@\DOTS@@ + \fi\fi\fi\fi\fi + \next@}}} +{\uccode`3=`B \uccode`4=`I \uccode`5=`X + \uppercase{\gdef\DOTS@@#1{\relaxnext@ + \def\nextii@##1\DOTS@{\ifx\@sptoken\@let@token\gtest@true\fi}% + \DN@{\FN@\nextii@}% + \ifx 3#1\global\DOTSCASE@\z@\else + \ifx 4#1\global\DOTSCASE@\@ne\else + \ifx 5#1\global\DOTSCASE@\tw@\else\DN@##1\DOTS@{}% + \fi\fi\fi\next@}}} +{\uccode`5=`\\ \uccode`6=`n \uccode`7=`o \uccode`8=`t + \uppercase{\gdef\not@#1#2#3#4{\relaxnext@ + \def\nextii@##1\not@{\ifx\@sptoken\@let@token\gtest@true\fi}% + \gtest@false\DN@##1\not@{}% + \ifx 5#1\ifx 6#2\ifx 7#3\ifx 8#4\DN@{\FN@\nextii@}\fi\fi\fi + \fi\next@}}} +{\uccode`9=`\l % + \uppercase{\gdef\striplong@#1#2#3\relax{% + \ifx9#2 \@xp\@xp\@xp\zap@to@space\fi}}} +\def\zap@to@space#1 {} +\def\keybin@{\gtest@true + \ifx\@let@token+\else\ifx\@let@token=\else + \ifx\@let@token<\else\ifx\@let@token>\else + \ifx\@let@token-\else\ifx\@let@token*\else\ifx\@let@token:\else + \gtest@false\fi\fi\fi\fi\fi\fi\fi} +\@ifundefined{@ldots}{\def\@ldots{\mathellipsis}}{} +\DeclareRobustCommand{\ldots}{% + \ifmmode \mathellipsis \else \textellipsis \fi +} +\DeclareRobustCommand{\dots}{% + \ifmmode \@xp\mdots@\else \@xp\textellipsis \fi +} +\def\tdots@{\leavevmode\unskip\relaxnext@ + \DN@{$\m@th\@ldots\, + \ifx\@let@token,\,$\else\ifx\@let@token.\,$\else + \ifx\@let@token;\,$\else\ifx\@let@token:\,$\else + \ifx\@let@token?\,$\else\ifx\@let@token!\,$\else + $ \fi\fi\fi\fi\fi\fi}% + \ \FN@\next@} +\def\mdots@{\FN@\mdots@@} +\def\mdots@@{\gdef\thedots@{\dotso@}% + \ifx\@let@token\boldsymbol + \gdef\thedots@\boldsymbol{\boldsymboldots@}% + \else + \ifx,\@let@token \gdef\thedots@{\dotsc}% + \else + \ifx\not\@let@token + \gdef\thedots@{\dotsb@}% + \else + \keybin@ + \ifgtest@ % if \keybin@ test + \gdef\thedots@{\dotsb@}% + \else + \xdef\meaning@{\meaning\@let@token. .........}% + \xdef\meaning@@{\@xp\striplong@\meaning@\relax\meaning@}% + \@xp\math@\meaning@\math@ + \ifgtest@ % if \mathxxx test + \@xp\mathch@\meaning@\mathch@ + \ifgtest@ % if \mathchar + \@xp\getmathch@\meaning@\getmathch@ + \fi % end if \mathchar + \else % \not \mathxxx + \@xp\Umathch@\meaning@"0"\Umathch@ + \ifgtest@ % if \Umathchar + \else % else not \Umathchar + \@xp\macro@\meaning@@\macro@ + \ifgtest@ % if macro test + \@xp\not@\meaning@\not@ + \ifgtest@ % if macro starts \not test + \gdef\thedots@{\dotsb@}% + \else% else not \not + \@xp\DOTS@\meaning@\DOTS@ + \ifgtest@ % \if DOTS + \ifcase\number\DOTSCASE@ %ifcase dots + \gdef\thedots@{\dotsb@}% + \or\gdef\thedots@{\dotsi}\else + \fi % endifcase dots + \else % not macro starts \DOTS + \@xp\math@\meaning@\math@ + \ifgtest@ % \if macro starts \mathxxxx + \@xp\mathbin@\meaning@\mathbin@ + \ifgtest@ % if macro starts \mathbin + \gdef\thedots@{\dotsb@}% + \else % not macro starting \mathbin + \@xp\mathrel@\meaning@\mathrel@ + \ifgtest@ % if macro starts \mathrel + \gdef\thedots@{\dotsb@}% + \fi % endif macro starts \mathrel (no else) + \fi % endif macro starts \mathbin + \fi % endif macro starts with \mathxxx (no else) + \fi % endif macro starts \DOTS else + \fi % end macro starting \not \ifgtest@ test (no else) + \else + \@xp\thecharacter@\meaning@\thecharacter@ + \fi % end macro \ifgtest@ test (no else) + \fi % end if \Umathchar test + \fi % end \math@ \ifgtest@ + \fi % end \keybin@ \ifgtest@ test (no else) + \fi % end if \not (no else) + \fi % end if comma (no else) + \fi % end if boldsymbol (no else) + \thedots@} +\def\boldsymboldots@#1{% + \bold@true\let\@let@token=#1\let\delayed@=#1\mdots@@ + \boldsymbol#1\bold@false} +\ams@def\@cdots{\mathinner{\cdotp\cdotp\cdotp}} +\newcommand{\dotsi}{\!\@cdots} +\let\dotsb@\@cdots +\def\rightdelim@{\gtest@true + \ifx\@let@token)\else + \ifx\@let@token]\else + \ifx\@let@token\rbrack\else + \ifx\@let@token\}\else + \ifx\@let@token\rbrace\else + \ifx\@let@token\rangle\else + \ifx\@let@token\rceil\else + \ifx\@let@token\rfloor\else + \ifx\@let@token\rgroup\else + \ifx\@let@token\rmoustache\else + \ifx\@let@token\right\else + \ifx\@let@token\bigr\else + \ifx\@let@token\biggr\else + \ifx\@let@token\Bigr\else + \ifx\@let@token\Biggr\else\gtest@false + \fi\fi\fi\fi\fi\fi\fi\fi\fi\fi\fi\fi\fi\fi\fi} +\def\extra@{% + \rightdelim@\ifgtest@ + \else\ifx\@let@token$\gtest@true + \else\xdef\meaning@{\meaning\@let@token..........}% + \@xp\macro@\meaning@\macro@\ifgtest@ + \@xp\DOTS@\meaning@\DOTS@ + \ifgtest@ + \ifnum\DOTSCASE@=\tw@\gtest@true\else\gtest@false + \fi\fi\fi\fi\fi} +\newif\ifbold@ +\def\dotso@{\relaxnext@ + \ifbold@ + \let\@let@token\delayed@ + \def\nextii@{\extra@\@ldots\ifgtest@\,\fi}% + \else + \def\nextii@{\DN@{\extra@\@ldots\ifgtest@\,\fi}\FN@\next@}% + \fi + \nextii@} +\def\extrap@#1{% + \DN@{#1\,}% + \ifx\@let@token,\else + \ifx\@let@token;\else + \ifx\@let@token.\else\extra@ + \ifgtest@\else + \let\next@#1\fi\fi\fi\fi\next@} +\ams@DeclareRobustCommand{\cdots}{\DN@{\extrap@\@cdots}\FN@\next@} +\let\dotsb\cdots +\let\dotsm\cdots +\DeclareRobustCommand{\dotso}{\relax + \ifmmode \DN@{\extrap@\@ldots}% + \else \let\next@\tdots@\fi + \FN@\next@} +\DeclareRobustCommand{\dotsc}{% + \DN@{\ifx\@let@token;\@ldots\,% + \else \ifx\@let@token.\@ldots\,% + \else \extra@\@ldots \ifgtest@\,\fi + \fi\fi}% + \FN@\next@} +\renewcommand{\longrightarrow}{% + \DOTSB\protect\relbar\protect\joinrel\rightarrow} +\renewcommand{\Longrightarrow}{% + \DOTSB\protect\Relbar\protect\joinrel\Rightarrow} +\renewcommand{\longleftarrow}{% + \DOTSB\leftarrow\protect\joinrel\protect\relbar} +\renewcommand{\Longleftarrow}{% + \DOTSB\Leftarrow\protect\joinrel\protect\Relbar} +\renewcommand{\longleftrightarrow}{\DOTSB\leftarrow\joinrel\rightarrow} +\renewcommand{\Longleftrightarrow}{\DOTSB\Leftarrow\joinrel\Rightarrow} +\renewcommand{\mapsto}{\DOTSB\mapstochar\rightarrow} +\renewcommand{\longmapsto}{\DOTSB\mapstochar\longrightarrow} +\renewcommand{\hookrightarrow}{\DOTSB\lhook\joinrel\rightarrow} +\renewcommand{\hookleftarrow}{\DOTSB\leftarrow\joinrel\rhook} +\renewcommand{\iff}{\DOTSB\;\Longleftrightarrow\;} +\renewcommand{\doteq}{% + \DOTSB\mathrel{\mathop{\kern0pt =}\limits^{\textstyle.}}} +\newif\if@display +\everydisplay\@xp{\the\everydisplay \@displaytrue} +\renewcommand{\int}{\DOTSI\intop\ilimits@} +\renewcommand{\oint}{\DOTSI\ointop\ilimits@} +\def\intkern@{\mkern-6mu\mathchoice{\mkern-3mu}{}{}{}} +\def\intdots@{\mathchoice{\@cdots}% + {{\cdotp}\mkern1.5mu{\cdotp}\mkern1.5mu{\cdotp}}% + {{\cdotp}\mkern1mu{\cdotp}\mkern1mu{\cdotp}}% + {{\cdotp}\mkern1mu{\cdotp}\mkern1mu{\cdotp}}} +\ams@newcommand{\iint}{\DOTSI\MultiIntegral{2}} +\ams@newcommand{\iiint}{\DOTSI\MultiIntegral{3}} +\ams@newcommand{\iiiint}{\DOTSI\MultiIntegral{4}} +\newcommand{\idotsint}{\DOTSI\MultiIntegral{0}} +\DeclareRobustCommand{\MultiIntegral}[1]{% + \edef\ints@c{\noexpand\intop + \ifnum#1=\z@\noexpand\intdots@\else\noexpand\intkern@\fi + \ifnum#1>\tw@\noexpand\intop\noexpand\intkern@\fi + \ifnum#1>\thr@@\noexpand\intop\noexpand\intkern@\fi + \noexpand\intop + \noexpand\ilimits@ + }% + \futurelet\@let@token\ints@a +} +\def\ints@a{% + \ifx\limits\@let@token \ints@b + \else \ifx\displaylimits\@let@token \ints@b + \else\ifx\ilimits@\displaylimits \ints@b + \fi\fi\fi + \ints@c +} +\def\ints@b{% + \mkern-7mu\mathchoice{\mkern-2mu}{}{}{}% + \mathop\bgroup + \mkern7mu\mathchoice{\mkern2mu}{}{}{}% + \let\ilimits@\egroup +}% +\newbox\Mathstrutbox@ +\setbox\Mathstrutbox@=\hbox{} +\def\Mathstrut@{\copy\Mathstrutbox@} +\ifx\Umathcharnumdef\@undefined +\def\resetMathstrut@{% + \begingroup + \setbox\z@\hbox{% + \mathchardef\@tempa\mathcode`\(\relax + \def\@tempb##1"##2##3{\the\textfont"##3\char"}% + \expandafter\@tempb\meaning\@tempa \relax + }% + \edef\@tempa{% + \ht\Mathstrutbox@\the\ht\z@\relax + \dp\Mathstrutbox@\the\dp\z@\relax}% + \expandafter\endgroup\@tempa +} +\else +\def\resetMathstrut@{% + \begingroup + \Umathcharnumdef\@tempa\Umathcodenum`\(\relax + \def\@tempb##1"##2"##3"##4\relax{% + \endgroup + \ht\Mathstrutbox@=\fontcharht\textfont"##3 "##4\relax + \dp\Mathstrutbox@=\fontchardp\textfont"##3 "##4\relax}% + \expandafter\@tempb\meaning\@tempa \relax +} +\fi +\addto@hook\every@math@size{\resetMathstrut@} +\newbox\strutbox@ +\def\strut@{\copy\strutbox@} +\def\reset@strutbox@{% + \global\setbox\strutbox@\hbox{% + \lower.5\normallineskiplimit + \vbox{\kern-\normallineskiplimit\copy\strutbox}}} +\addto@hook\every@math@size{\reset@strutbox@} +\AtBeginDocument{\reset@strutbox@} +\DeclareRobustCommand{\big}{\bBigg@\@ne} +\DeclareRobustCommand{\Big}{\bBigg@{1.5}} +\DeclareRobustCommand{\bigg}{\bBigg@\tw@} +\DeclareRobustCommand{\Bigg}{\bBigg@{2.5}} +\ifx\leavevmode@ifvmode\@undefined +\def\bBigg@#1#2{% + {\@mathmeasure\z@{\nulldelimiterspace\z@}% + {\left#2\vcenter to#1\big@size{}\right.}% + \box\z@}} +\else +\def\bBigg@#1#2{\leavevmode@ifvmode + {\@mathmeasure\z@{\nulldelimiterspace\z@}% + {\left#2\vcenter to#1\big@size{}\right.}% + \box\z@}} +\fi +\addto@hook\every@math@size{% + \global\big@size 1.2\ht\Mathstrutbox@ + \global\advance\big@size 1.2\dp\Mathstrutbox@ } +\newdimen\big@size +\def\accentclass@{7} +\def\noaccents@{\def\accentclass@{0}} +\DeclareFontEncoding{OML}{}{\noaccents@} +\DeclareFontEncoding{OMS}{}{\noaccents@} +\ams@newcommand{\dddot}[1]{% + {\mathop{\kern\z@#1}\limits^{\vbox to-1.4\ex@{\kern-\tw@\ex@ + \hbox{\,\normalfont...}\vss}}}} +\ams@newcommand{\ddddot}[1]{% + {\mathop{\kern\z@#1}\limits^{\vbox to-1.4\ex@{\kern-\tw@\ex@ + \hbox{\,\normalfont....}\vss}}}} +\AtBeginDocument{% + \MakeRobust\dddot + \MakeRobust\ddddot + } +\def\set@mathaccent#1#2#3#4{% + \xdef#2{% + \@nx\mathaccentV + {\@xp\@gobble\string#2}\hexnumber@#1#4}% + \MakeRobust#2% +} +\def\@tempa#1{% + \@ifundefined{\@xp\@gobble\string#1\space}% + {\@xp\@tempb\meaning#1\@nil#1}% + {\@xp\@xp\@xp\@tempb\@xp\meaning + \csname\@xp\@gobble\string#1\space\endcsname\@nil#1}% +} +\def\@tempb#1>#2#3 #4\@nil#5{% + \@xp\ifx\csname#3\endcsname\mathaccent + \@tempc#4?"7777\@nil#5% + \else + \@xp\ifx\csname#3\endcsname\Umathaccent + \@tempd#4\@nil#5% + \else + \PackageWarningNoLine{amsmath}{% + Unable to redefine math accent \string#5}% + \fi\fi} +\def\@tempc#1"#2#3#4#5#6\@nil#7{% + \@xp\let\csname\@xp\@gobble\string#7\space\endcsname\@undefined + \chardef\@tempd="#3\relax\set@mathaccent\@tempd{#7}{#2}{#4#5}} +\def\@tempd#1\@nil#2{% + \PackageWarningNoLine{amsmath}{% + Unable to redefine \string\Umathaccent\space\string#2}% +} +\@tempa{\hat} +\@tempa{\check} +\@tempa{\tilde} +\@tempa{\acute} +\@tempa{\grave} +\@tempa{\dot} +\@tempa{\ddot} +\@tempa{\breve} +\@tempa{\bar} +\@tempa{\vec} +\@ifundefined{mathring}{% + \DeclareMathAccent{\mathring}{\mathalpha}{operators}{"17} +}{% + \@tempa{\mathring} +} +%%\@tempa\widetilde +%%\@tempa\widehat +\newcommand{\acc@check}{} +\newcommand{\acc@error}{} +\def\acc@check{\@ifnextchar\@empty\relax\acc@error} +\def\acc@error{% + \@amsmath@err{% + Improper argument for math accent:\MessageBreak + Extra braces must be added to prevent wrong output% + }\@ehc +} +\newcount\macc@depth +\long\def\@gobblethree#1#2#3{} +\def\mathaccentV#1#2#3#4#5{% + \ifmmode + \gdef\macc@tmp{\macc@depth\@ne}% + \setbox\z@\hbox{% + \let\mathaccentV\macc@test + \let\use@mathgroup\@gobbletwo \let\select@group\@gobblethree + \frozen@everymath{}$#5$% + }% + \macc@tmp + \ifnum\macc@depth=\@ne + \global\let\macc@nucleus\@empty + \mathaccent"\accentclass@ + \else + \@xp\macc@nested + \fi + #2#3#4{#5}% + \macc@nucleus + \else + \@xp\nonmatherr@\csname#1\endcsname + \fi +} +\def\macc@test#1#2#3#4{\xdef\macc@tmp{\macc@tmp\advance\macc@depth\@ne}} +\def\macc@group{-1} +\def\macc@nested#1#2#3#4{% + \begingroup + \let\math@bgroup\@empty \let\math@egroup\macc@set@skewchar + \mathsurround\z@ \frozen@everymath{\mathgroup\macc@group\relax}% + \macc@set@skewchar\relax + \let\mathaccentV\macc@nested@a + \macc@nested@a\relax#1#2#3{#4}% + \endgroup +} +\let\macc@palette\mathpalette +\def\macc@nested@a#1#2#3#4#5{% + \ifnum\macc@group=\mathgroup + \else \macc@set@skewchar\relax \edef\macc@group{\the\mathgroup}% + \fi + \mathchardef\macc@code "\accentclass@ #2#3#4\relax + \macc@palette\macc@a{#5}% +} +\def\macc@set@skewchar#1{% + \begingroup + \ifnum\mathgroup=\m@ne \let\@tempa\@ne + \else + \ifnum\skewchar\textfont\mathgroup=\m@ne \let\@tempa\@ne + \else \let\@tempa\mathgroup + \fi + \fi + \count@=\skewchar\textfont\@tempa + \advance\count@"7100 + \edef\@tempa{\endgroup + \mathchardef\noexpand\macc@skewchar=\number\count@\relax}% + \@tempa + #1% +} +\def\macc@a#1#2{% + \begingroup + \let\macc@style#1\relax + \def\macc@palette##1{##1\macc@style}% + \advance\macc@depth\m@ne + \ifnum\macc@depth=\z@ + \gdef\macc@nucleus{#2}% + \setbox\z@\hbox{$#1#2\@empty{}\macc@skewchar$}% + \setbox\tw@\hbox{$#1#2\@empty\macc@skewchar$}% + \dimen@\tw@\wd\tw@ \advance\dimen@-\tw@\wd\z@ + \xdef\macc@kerna{\the\dimen@\relax}% + \setbox4\hbox{$#1#2\acc@check\@empty$}% + \global\setbox\@ne\hbox to\wd4{}% + \ht\@ne\ht4 \dp\@ne\dp4 + \xdef\macc@kernb{\the\wd4\relax}% + \mathaccent\macc@code{\box\@ne\kern\macc@kerna}% + \else + \mathaccent\macc@code{\let\macc@adjust\@empty #1#2\@empty}% + \macc@adjust + \fi + \endgroup +} +\def\macc@adjust{% + \dimen@\macc@kerna\advance\dimen@\macc@kernb + \kern-\dimen@ +} +\def\Hat{\hat} +\def\Check{\check} +\def\Tilde{\tilde} +\def\Acute{\acute} +\def\Grave{\grave} +\def\Dot{\dot} +\def\Ddot{\ddot} +\def\Breve{\breve} +\def\Bar{\bar} +\def\Vec{\vec} +\def\nonmatherr@#1{\@amsmath@err{\protect + #1 allowed only in math mode}\@ehd} +\DeclareRobustCommand{\bmod}{\nonscript\mskip-\medmuskip\mkern5mu\mathbin + {\operator@font mod}\penalty900 + \mkern5mu\nonscript\mskip-\medmuskip} +\DeclareRobustCommand{\pod}[1]{\allowbreak + \if@display\mkern18mu\else\mkern8mu\fi(#1)} +\DeclareRobustCommand{\pmod}[1]{\pod{{\operator@font mod}\mkern6mu#1}} +\DeclareRobustCommand{\mod}[1]{\allowbreak\if@display\mkern18mu + \else\mkern12mu\fi{\operator@font mod}\,\,#1} +\DeclareRobustCommand{\cfrac}[3][c]{{\displaystyle\frac{% + \strut\ifx r#1\hfill\fi#2\ifx l#1\hfill\fi}{#3}}% + \kern-\nulldelimiterspace} +\DeclareRobustCommand{\overset}[2]{\binrel@{#2}% + \binrel@@{\mathop{\kern\z@#2}\limits^{#1}}} +\DeclareRobustCommand{\underset}[2]{\binrel@{#2}% + \binrel@@{\mathop{\kern\z@#2}\limits_{#1}}} +\DeclareRobustCommand{\overunderset}[3]{\binrel@{#3}% + \binrel@@{\mathop{\kern\z@#3}\limits^{#1}_{#2}}} +\DeclareRobustCommand{\sideset}[3]{% + \@mathmeasure\z@\displaystyle{#3}% + \global\setbox\@ne\vbox to\ht\z@{}\dp\@ne\dp\z@ + \setbox\tw@\box\@ne + \@mathmeasure4\displaystyle{\copy\tw@#1}% + \@mathmeasure6\displaystyle{#3\nolimits#2}% + \dimen@-\wd6 \advance\dimen@\wd4 \advance\dimen@\wd\z@ + \hbox to\dimen@{}\mathop{\kern-\dimen@\box4\box6}% +} +\ifx\leavevmode@ifvmode\@undefined +\DeclareRobustCommand{\smash}[1][tb]{% + \def\mb@t{\ht}\def\mb@b{\dp}\def\mb@tb{\ht\z@\z@\dp}% + \edef\finsm@sh{\csname mb@#1\endcsname\z@\z@\box\z@}% + \ifmmode \@xp\mathpalette\@xp\mathsm@sh + \else \@xp\makesm@sh + \fi +} +\else +\DeclareRobustCommand{\smash}[1][tb]{% + \def\mb@t{\ht}\def\mb@b{\dp}\def\mb@tb{\ht\z@\z@\dp}% + \edef\finsm@sh{\csname mb@#1\endcsname\z@\z@ \leavevmode@ifvmode\box\z@}% + \ifmmode \@xp\mathpalette\@xp\mathsm@sh + \else \@xp\makesm@sh + \fi +} +\fi +\@ifundefined{Umathcode} + {% + \mathchardef\std@minus\mathcode`\-\relax + \mathchardef\std@equal\mathcode`\=\relax + } + {% + \Umathcharnumdef\std@minus\Umathcodenum`\-\relax + \Umathcharnumdef\std@equal\Umathcodenum`\=\relax + } +\@ifundefined{Umathcode} + {% + \AtBeginDocument{% + \mathchardef\std@minus\mathcode`\-\relax + \mathchardef\std@equal\mathcode`\=\relax + }% + } + {% + \AtBeginDocument{% + \Umathcharnumdef\std@minus\Umathcodenum`\-\relax + \Umathcharnumdef\std@equal\Umathcodenum`\=\relax + }% + } +\ams@DeclareRobustCommand\relbar{\mathrel{\mathpalette\mathsm@sh\std@minus}} +\ams@DeclareRobustCommand\Relbar{\mathrel\std@equal} +\def\arrowfill@#1#2#3#4{% + $\m@th\thickmuskip0mu\medmuskip\thickmuskip\thinmuskip\thickmuskip + \relax#4#1\mkern-7mu% + \cleaders\hbox{$#4\mkern-2mu#2\mkern-2mu$}\hfill + \mkern-7mu#3$% +} +\def\leftarrowfill@{\arrowfill@\leftarrow\relbar\relbar} +\def\rightarrowfill@{\arrowfill@\relbar\relbar\rightarrow} +\def\leftrightarrowfill@{\arrowfill@\leftarrow\relbar\rightarrow} +\def\Leftarrowfill@{\arrowfill@\Leftarrow\Relbar\Relbar} +\def\Rightarrowfill@{\arrowfill@\Relbar\Relbar\Rightarrow} +\def\Leftrightarrowfill@{\arrowfill@\Leftarrow\Relbar\Rightarrow} +\def\overarrow@#1#2#3{\vbox{\ialign{##\crcr#1#2\crcr + \noalign{\nointerlineskip}$\m@th\hfil#2#3\hfil$\crcr}}} +\ams@renewcommand{\overrightarrow}{% + \mathpalette{\overarrow@\rightarrowfill@}} +\ams@renewcommand{\overleftarrow}{% + \mathpalette{\overarrow@\leftarrowfill@}} +\ams@newcommand{\overleftrightarrow}{% + \mathpalette{\overarrow@\leftrightarrowfill@}} +\AtBeginDocument{% + \expandafter\let\csname overleftarrow \endcsname\@undefined + \expandafter\let\csname overrightarrow \endcsname\@undefined + \MakeRobust\overrightarrow + \MakeRobust\overleftarrow + \MakeRobust\overleftrightarrow + } +\def\underarrow@#1#2#3{% + \vtop{\ialign{##\crcr$\m@th\hfil#2#3\hfil$\crcr + \noalign{\nointerlineskip\kern1.3\ex@}#1#2\crcr}}} +\ams@newcommand{\underrightarrow}{% + \mathpalette{\underarrow@\rightarrowfill@}} +\ams@newcommand{\underleftarrow}{% + \mathpalette{\underarrow@\leftarrowfill@}} +\ams@newcommand{\underleftrightarrow}{% + \mathpalette{\underarrow@\leftrightarrowfill@}} +\AtBeginDocument{% + \MakeRobust\underrightarrow + \MakeRobust\underleftarrow + \MakeRobust\underleftrightarrow + } +\def\ext@arrow#1#2#3#4#5#6#7{% + \mathrel{\mathop{% + \setbox\z@\hbox{#5\displaystyle}% + \setbox\tw@\vbox{\m@th + \hbox{$\scriptstyle\mkern#3mu{#6}\mkern#4mu$}% + \hbox{$\scriptstyle\mkern#3mu{#7}\mkern#4mu$}% + \copy\z@ + }% + \hbox to\wd\tw@{\unhbox\z@}}% + \limits + \@ifnotempty{#7}{^{\if0#1\else\mkern#1mu\fi + #7\if0#2\else\mkern#2mu\fi}}% + \@ifnotempty{#6}{_{\if0#1\else\mkern#1mu\fi + #6\if0#2\else\mkern#2mu\fi}}}% +} +\DeclareRobustCommand{\xrightarrow}[2][]{\ext@arrow 0359\rightarrowfill@{#1}{#2}} +\DeclareRobustCommand{\xleftarrow}[2][]{\ext@arrow 3095\leftarrowfill@{#1}{#2}} +\ifx\directlua\@undefined +\newenvironment{subarray}[1]{% + \vcenter\bgroup + \Let@ \restore@math@cr \default@tag + \baselineskip\fontdimen10 \scriptfont\tw@ + \advance\baselineskip\fontdimen12 \scriptfont\tw@ + \lineskip\thr@@\fontdimen8 \scriptfont\thr@@ + \lineskiplimit\lineskip + \ialign\bgroup\ifx c#1\hfil\fi + $\m@th\scriptstyle##$\hfil\crcr +}{% + \crcr\egroup\egroup +} +\else +\newenvironment{subarray}[1]{% + \vcenter\bgroup + \Let@ \restore@math@cr \default@tag + \baselineskip \Umathstacknumup \scriptstyle + \advance\baselineskip \Umathstackdenomdown \scriptstyle + \lineskip \Umathstackvgap \scriptstyle + \lineskiplimit \lineskip + \ialign\bgroup\ifx c#1\hfil\fi + \Ustartmath + \m@th\scriptstyle## + \Ustopmath + \hfil\crcr +}{% + \crcr\egroup\egroup +} +\fi +\DeclareRobustCommand{\substack}[1]{\subarray{c}#1\endsubarray} +\newenvironment{smallmatrix}{\null\,\vcenter\bgroup + \Let@\restore@math@cr\default@tag + \baselineskip6\ex@ \lineskip1.5\ex@ \lineskiplimit\lineskip + \ialign\bgroup\hfil$\m@th\scriptstyle##$\hfil&&\thickspace\hfil + $\m@th\scriptstyle##$\hfil\crcr +}{% + \crcr\egroup\egroup\,% +} +\renewenvironment{matrix}{% + \matrix@check\matrix\env@matrix +}{% + \endarray \hskip -\arraycolsep +} +\def\env@matrix{\hskip -\arraycolsep + \let\@ifnextchar\new@ifnextchar + \array{*\c@MaxMatrixCols c}} +\newcount\c@MaxMatrixCols \c@MaxMatrixCols=10 +\def\matrix@check#1{% + \@xp\ifx\csname\@currenvir\endcsname#1% + \else\matrix@error#1% + \@xp\@gobble + \fi +} +\def\matrix@error#1{% + \@amsmath@err{% +Old form `\string#1' should be \string\begin{\@xp\@gobble\string#1}% + }{% +`\string#1{...}' is old Plain-TeX syntax whose use is +ill-advised in LaTeX.% + }% +} +\renewenvironment{pmatrix}{% + \left(% + \matrix@check\pmatrix\env@matrix +}{ + \endmatrix\right)% +} +\newenvironment{bmatrix}{\left[\env@matrix}{\endmatrix\right]} +\newenvironment{Bmatrix}{% + \left\lbrace\env@matrix +}{% + \endmatrix\right\rbrace +} +\newenvironment{vmatrix}{\left\lvert\env@matrix}{\endmatrix\right\rvert} +\newenvironment{Vmatrix}{\left\lVert\env@matrix}{\endmatrix\right\rVert} +\let\hdots\@ldots +\newcommand{\hdotsfor}[1]{% + \ifx[#1\@xp\shdots@for\else\hdots@for\@ne{#1}\fi} +\newmuskip\dotsspace@ +\def\shdots@for#1]{\hdots@for{#1}} +\def\hdots@for#1#2{\multicolumn{#2}c% + {\m@th\dotsspace@1.5mu\mkern-#1\dotsspace@ + \xleaders\hbox{$\m@th\mkern#1\dotsspace@.\mkern#1\dotsspace@$}% + \hfill + \mkern-#1\dotsspace@}% + } +\renewenvironment{cases}{% + \matrix@check\cases\env@cases +}{% + \endarray\right.% +} +\def\env@cases{% + \let\@ifnextchar\new@ifnextchar + \left\lbrace + \def\arraystretch{1.2}% + \array{@{}l@{\quad}l@{}}% +} +\newcounter{parentequation}% Counter for ``parent equation''. +\@ifundefined{ignorespacesafterend}{% + \def\ignorespacesafterend{\global\@ignoretrue}% +}{} +\newenvironment{subequations}{% + \refstepcounter{equation}% + \protected@edef\theparentequation{\theequation}% + \setcounter{parentequation}{\value{equation}}% + \setcounter{equation}{0}% + \def\theequation{\theparentequation\alph{equation}}% + \ignorespaces +}{% + \setcounter{equation}{\value{parentequation}}% + \ignorespacesafterend +} +\DeclareCommandCopy\numberwithin\counterwithin +\DeclareRobustCommand{\eqref}[1]{\textup{\tagform@{\ref{#1}}}} +\newcount\dspbrk@lvl +\dspbrk@lvl=-1 +\interdisplaylinepenalty\@M +\DeclareRobustCommand{\allowdisplaybreaks}[1][4]{% + \interdisplaylinepenalty\getdsp@pen{#1}\relax +} +\def\getdsp@pen#1{% + \ifcase #1\@M \or 9999 \or 6999 \or 2999 \or \z@\fi +} +\DeclareRobustCommand{\displaybreak}{\new@ifnextchar[\dspbrk@{\dspbrk@[4]}} +\chardef\dspbrk@context=\sixt@@n +\def\dspbrk@[#1]{% + \ifmeasuring@ + \else + \ifcase\dspbrk@context % case 0 --- OK + \global\dspbrk@lvl #1\relax + \or % case 1 --- inside a box + \nogood@displaybreak + \else % other cases --- outside of a display + \@amsmath@err{\Invalid@@\displaybreak}\@eha + \fi + \fi +} +\def\nogood@displaybreak{% + \@amsmath@err{\protect +\displaybreak\space cannot be applied here}% +{One of the enclosing environments creates an + unbreakable box\MessageBreak +(e.g., split, aligned, gathered, ...).}% +} +\protected\def\math@cr{\relax\iffalse{\fi\ifnum0=`}\fi + \@ifstar{\global\@eqpen\@M\math@cr@}% + {\global\@eqpen + \ifnum\dspbrk@lvl <\z@ \interdisplaylinepenalty + \else -\@getpen\dspbrk@lvl \fi + \math@cr@}} +\def\math@cr@{\new@ifnextchar[\math@cr@@{\math@cr@@[\z@]}} +\def\math@cr@@[#1]{\ifnum0=`{\fi \iffalse}\fi\math@cr@@@ + \noalign{\vskip#1\relax}} +\def\Let@{\let\\\math@cr} +\def\restore@math@cr{\def\math@cr@@@{\cr}} +\restore@math@cr +\newcommand{\intertext}{\@amsmath@err{\Invalid@@\intertext}\@eha} +\def\intertext@{% + \def\intertext##1{% + \ifvmode\else\\\@empty\fi + \noalign{% + \penalty\postdisplaypenalty\vskip\belowdisplayskip + \vbox{\normalbaselines + \ifdim\linewidth=\columnwidth + \else \parshape\@ne \@totalleftmargin \linewidth + \fi + \noindent\ignorespaces##1\par}% + \penalty\predisplaypenalty\vskip\abovedisplayskip% + }% +}} +\newhelp\tag@help + {tag cannot be used at this point.\space + If you don't understand why^^Jyou should consult + the documentation.^^JBut don't worry: just continue, and I'll + forget what happened.} +\def\gobble@tag{\@ifstar\@gobble\@gobble} +\def\invalid@tag#1{\@amsmath@err{#1}{\the\tag@help}\gobble@tag} +\def\dft@tag{\invalid@tag{\string\tag\space not allowed here}} +\def\default@tag{\let\tag\dft@tag} +\default@tag +\def\maketag@@{\@ifstar\maketag@@@\tagform@} +\def\maketag@@@#1{\hbox{\m@th\normalfont#1}} +\def\tagform@#1{\maketag@@@{(\ignorespaces#1\unskip\@@italiccorr)}} +\iftagsleft@ + \def\@eqnnum{\hbox to1sp{}\rlap{\normalfont\normalcolor + \hskip -\displaywidth\tagform@\theequation}} +\else + \def\@eqnnum{{\normalfont\normalcolor \tagform@\theequation}} +\fi +\newcommand{\thetag}{\leavevmode\tagform@} +\let\df@tag\@empty +\def\make@df@tag{% + \def\@currentcounter{equation}% + \@ifstar\make@df@tag@@\make@df@tag@@@} +\def\make@df@tag@@#1{% + \gdef\df@tag{\maketag@@@{#1}\def\@currentlabel{#1}}} +\def\make@df@tag@@@#1{\gdef\df@tag{\tagform@{#1}% + \toks@\@xp{\p@equation{#1}}\edef\@currentlabel{\the\toks@}}} +\AddToHook{begindocument/end}{\let\ltx@label\label} +\AddToHook{build/page/reset}{\let \ltx@label \@gobble@with@sphack@om} +\def\label@in@display{% + \ifx\df@label\@empty\else + \@amsmath@err{Multiple \string\label's: + label '\df@label' will be lost}\@eha + \fi + \gdef\df@label +} +\toks@\@xp{\@arrayparboxrestore \let\label\ltx@label}% +\edef\@arrayparboxrestore{\the\toks@} +\let\df@label\@empty +\def\make@display@tag{% + \if@eqnsw \incr@eqnum \print@eqnum + \else \iftag@ \df@tag \global\let\df@tag\@empty \fi + \fi + \ifmeasuring@ + \else + \ifx\df@label\@empty + \else + \@xp\ltx@label\@xp{\df@label}% + \global\let\df@label\@empty + \fi + \fi +} +\def\tag@in@align{% + \relax + \iftag@ + \DN@{\invalid@tag{Multiple \string\tag}}% + \else + \global\tag@true + \nonumber + \let\next@\make@df@tag + \fi + \next@ +} +\newcommand{\raisetag}[1]{\skip@#1\relax + \xdef\raise@tag{\vskip\iftagsleft@\else-\fi\the\skip@\relax}% +} +\let\raise@tag\@empty +\newcommand{\notag}{\nonumber} +\renewcommand{\nonumber}{% + \if@eqnsw + \ifx\incr@eqnum\@empty \addtocounter{equation}\m@ne \fi + \fi + \let\print@eqnum\@empty \let\incr@eqnum\@empty + \global\@eqnswfalse +} +\def\print@eqnum{\tagform@\theequation} +\def\incr@eqnum{\refstepcounter{equation}\let\incr@eqnum\@empty} +\providecommand\dollardollar@begin{$$} +\providecommand\dollardollar@end{$$} +\newif\ifinalign@ +\newif\ifingather@ +\@xp\def\@xp\@arrayparboxrestore\@xp{\@arrayparboxrestore + \ingather@false\inalign@false \default@tag + \let\spread@equation\@spread@equation + \let\reset@equation\@empty + \def\print@eqnum{\tagform@\theequation}% + \def\incr@eqnum{\refstepcounter{equation}\let\incr@eqnum\@empty}% +} +\newif\iftag@ +\newif\ifst@rred +\newif\ifmeasuring@ +\newif\ifshifttag@ +\newcount\row@ +\newcount\column@ +\def\column@plus{% + \global\advance\column@\@ne +} +\newcount\maxfields@ +\def\add@amp#1{\if m#1&\@xp\add@amp\fi} +\def\add@amps#1{% + \begingroup + \count@#1\advance\count@-\column@ + \edef\@tempa{\endgroup + \@xp\add@amp\romannumeral\number\count@ 000q}% + \@tempa +} +\newhelp\andhelp@ +{An extra & here is so disastrous that you should probably exit^^J +and fix things up.} +\newdimen\eqnshift@ +\newdimen\alignsep@ +\newdimen\tagshift@ +\newcommand{\mintagsep}{.5\fontdimen6\textfont\tw@} +\newcommand{\minalignsep}{10pt} +\newdimen\tagwidth@ +\newdimen\totwidth@ +\newdimen\lineht@ +\def\tag@width#1{% + \ifcase\@xp#1\tag@lengths\fi +} + +\def\savetaglength@{% + \begingroup + \let\or\relax + \xdef\tag@lengths{\tag@lengths\or \the\wdz@}% + \endgroup +} + +\def\shift@tag#1{% + \ifcase\@xp#1\tag@shifts\fi\relax +} + +\let\tag@shifts\@empty +\def\saveshift@#1{% + \begingroup + \let\or\relax + \xdef\tag@shifts{\or#1\tag@shifts}% + \endgroup +} +\def\spread@equation{\reset@strutbox@ + \openup\jot \let\spread@equation\@empty} +\let\@spread@equation\spread@equation +\def\displ@y{\@display@init{}} +\def\@display@init#1{% + \global\lineht@\z@ + \global\dt@ptrue \spread@equation + \everycr{% + \noalign{% + #1% + \ifdt@p + \global\dt@pfalse + \vskip-\lineskiplimit + \vskip\normallineskiplimit + \else + \penalty\@eqpen \global\dspbrk@lvl\m@ne + \fi + }% + }% +} +\def\displ@y@{\@display@init{% + \global\column@\z@ \global\dspbrk@lvl\m@ne + \global\tag@false \global\let\raise@tag\@empty +}} +\def\black@#1{% + \noalign{% + \ifdim#1>\displaywidth + \dimen@\prevdepth + \nointerlineskip + \vskip-\ht\strutbox@ + \vskip-\dp\strutbox@ + \vbox{\noindent\hbox to\displaywidth{% + \hbox to#1{\strut@\hfill}}}% + \prevdepth\dimen@ + \fi + }% +} +\def\savecounters@{% + \begingroup + \def\@elt##1{% + \global\csname c@##1\endcsname\the\csname c@##1\endcsname}% + \xdef\@gtempa{% + \cl@@ckpt + \let\@nx\restorecounters@\@nx\@empty + }% + \endgroup + \let\restorecounters@\@gtempa +} +\let\restorecounters@\@empty +\def\savealignstate@{% + \begingroup + \let\or\relax + \xdef\@gtempa{% + \global\totwidth@\the\totwidth@ + \global\row@\the\row@ + \gdef\@nx\tag@lengths{\tag@lengths}% + \let\@nx\restorealignstate@\@nx\@empty + }% + \endgroup + \let\restorealignstate@\@gtempa +} + +\let\restorealignstate@\@empty +\def\savecolumn@{% + \edef\restorecolumn@{% + \global\column@\number\column@ + \let\@nx\restorecolumn@\@nx\@empty + }% +} +\let\restorecolumn@\@empty +\newtoks\@envbody +\def\addto@envbody#1{\global\@envbody\@xp{\the\@envbody#1}} +\def\collect@body#1{% + \@envbody{\@xp#1\@xp{\the\@envbody}}% + \edef\process@envbody{\the\@envbody\@nx\end{\@currenvir}}% + \@envbody\@emptytoks \def\begin@stack{b}% + \begingroup + \@xp\let\csname\@currenvir\endcsname\collect@@body + \edef\process@envbody{\@xp\@nx\csname\@currenvir\endcsname}% + \process@envbody +} +\def\push@begins#1\begin#2{% + \ifx\end#2\else b\@xp\push@begins\fi +} +\def\collect@@body#1\end#2{% + \edef\begin@stack{\push@begins#1\begin\end \@xp\@gobble\begin@stack}% + \ifx\@empty\begin@stack + \endgroup + \@checkend{#2}% + \addto@envbody{#1}% + \else + \addto@envbody{#1\end{#2}}% + \fi + \process@envbody % A little tricky! Note the grouping +} +\def\math@cr@@@aligned{% + \ifodd\column@ \let\next@\@empty + \else \def\next@{&\kern-\alignsep@}% + \fi + \next@ \cr +} +\def\ams@start@box#1{% + \edef\reserved@a{\csname ams@pos@\expandafter\detokenize + \expandafter{\romannumeral-`\0#1}\endcsname}% + \expandafter\ifx\reserved@a\relax + \PackageWarning{amsmath}{% + Bracket group \detokenize{[#1]} at formula start!\MessageBreak + It could be a misspelled positional argument.\MessageBreak + If it belongs to the formula add a \relax in\MessageBreak + front to hide it}% + \def\ams@return@opt@arg{[#1]}\vcenter + \else + \let\ams@return@opt@arg\@empty\reserved@a + \fi +} +\def\ams@pos@t{\vtop} +\def\ams@pos@b{\vbox} +\def\ams@pos@c{\vcenter} +\let\ams@pos@\ams@pos@c +\newcommand{\start@aligned}[2]{% + \RIfM@\else + \nonmatherr@{\begin{\@currenvir}}% + \fi + \savecolumn@ % Assumption: called inside a group + \alignedspace@left + \ams@start@box{#1}\bgroup + \maxfields@#2\relax + \ifnum\maxfields@>\m@ne + \multiply\maxfields@\tw@ + \let\math@cr@@@\math@cr@@@alignedat + \alignsep@\z@skip + \else + \let\math@cr@@@\math@cr@@@aligned + \alignsep@\minalignsep + \fi + \Let@ \chardef\dspbrk@context\@ne + \default@tag + \spread@equation % no-op if already called + \global\column@\z@ + \ialign\bgroup + &\column@plus + \hfil + \strut@ + $\m@th\displaystyle{##}$% + \tabskip\z@skip + &\column@plus + $\m@th\displaystyle{{}##}$% + \hfil + \tabskip\alignsep@ + \crcr + \ams@return@opt@arg +} +\def\math@cr@@@alignedat{% + \ifnum\column@>\maxfields@ + \begingroup + \measuring@false + \@amsmath@err{Extra & on this line}% + {\the\andhelp@}% "An extra & here is disastrous" + \endgroup + \fi + \global\column@\z@ + \cr +} +\def\alignsafe@testopt#1#2{% + \relax\iffalse{\fi\ifnum`}=0\fi + \@ifnextchar[% + {\let\@let@token\relax \ifnum`{=\z@\fi\iffalse}\fi#1}% + {\let\@let@token\relax \ifnum`{=\z@\fi\iffalse}\fi#1[#2]}% +} +\newenvironment{aligned}{% + \let\@testopt\alignsafe@testopt + \aligned@a +}{% + \crcr\egroup + \restorecolumn@ + \egroup +} +\newcommand{\aligned@a}[1][c]{\start@aligned{#1}\m@ne} +\newenvironment{alignedat}{% + \let\@testopt\alignsafe@testopt + \alignedat@a +}{% + \endaligned +} +\newcommand{\alignedat@a}[1][c]{\start@aligned{#1}} +\newenvironment{gathered}[1][c]{% + \RIfM@\else + \nonmatherr@{\begin{gathered}}% + \fi + \alignedspace@left + \ams@start@box{#1}\bgroup + \Let@ \chardef\dspbrk@context\@ne \restore@math@cr + \spread@equation + \ialign\bgroup + \hfil\strut@$\m@th\displaystyle##$\hfil + \crcr + \ams@return@opt@arg +}{% + \endaligned +} +\def\start@gather#1{% + \RIfM@ + \nomath@env + \DN@{\@namedef{end\@currenvir}{}\@gobble}% + \else + \dollardollar@begin + #1% + \ifst@rred \else \global\@eqnswtrue \fi + \let\next@\gather@ + \fi + \collect@body\next@ +} +\newenvironment{gather}{% + \start@gather\st@rredfalse +}{% + \math@cr \black@\totwidth@ \egroup + \dollardollar@end\ignorespacesafterend +} + +\newenvironment{gather*}{% + \start@gather\st@rredtrue +}{% + \endgather +} +\def\gather@#1{% + \ingather@true \let\split\insplit@ + \let\tag\tag@in@align \let\label\label@in@display + \chardef\dspbrk@context\z@ + \intertext@ \displ@y@ \Let@ + \let\math@cr@@@\math@cr@@@gather + \gmeasure@{#1}% + \global\shifttag@false + \tabskip\z@skip + \global\row@\@ne + \halign to\displaywidth\bgroup + \strut@ + \setboxz@h{$\m@th\displaystyle{##}$}% + \calc@shift@gather + \set@gather@field + \tabskip\@centering + &\setboxz@h{\strut@{##}}% + \place@tag@gather + \tabskip \iftagsleft@ \gdisplaywidth@ \else \z@skip \span\fi + \crcr + #1% +} +\def\gmeasure@#1{% + \begingroup + \measuring@true + \totwidth@\z@ + \global\let\tag@lengths\@empty + \savecounters@ + \setbox\@ne\vbox{% + \everycr{\noalign{\global\tag@false + \global\let\raise@tag\@empty \global\column@\z@}}% + \let\label\@gobble + \halign{% + \setboxz@h{$\m@th\displaystyle{##}$}% + \ifdim\wdz@>\totwidth@ + \global\totwidth@\wdz@ + \fi + &\setboxz@h{\strut@{##}}% + \savetaglength@ + \crcr + #1% + \math@cr@@@ + }% + }% + \restorecounters@ + \if@fleqn + \global\advance\totwidth@\@mathmargin + \fi + \iftagsleft@ + \ifdim\totwidth@>\displaywidth + \global\let\gdisplaywidth@\totwidth@ + \else + \global\let\gdisplaywidth@\displaywidth + \fi + \fi + \endgroup +} +\def\math@cr@@@gather{% + \ifst@rred\nonumber\fi + &\relax + \make@display@tag + \ifst@rred\else\global\@eqnswtrue\fi + \global\advance\row@\@ne + \cr +} +\def\calc@shift@gather{% + \dimen@\mintagsep\relax + \tagwidth@\tag@width\row@\relax + \if@fleqn + \global\eqnshift@\@mathmargin + \ifdim\tagwidth@>\z@ + \advance\dimen@\tagwidth@ + \iftagsleft@ + \ifdim\dimen@>\@mathmargin + \global\shifttag@true + \fi + \else + \advance\dimen@\@mathmargin + \advance\dimen@\wdz@ + \ifdim\dimen@>\displaywidth + \global\shifttag@true + \fi + \fi + \fi + \else + \global\eqnshift@\displaywidth + \global\advance\eqnshift@-\wdz@ + \ifdim\tagwidth@>\z@ + \multiply\dimen@\tw@ + \advance\dimen@\wdz@ + \advance\dimen@\tagwidth@ + \ifdim\dimen@>\displaywidth + \global\shifttag@true + \else + \ifdim\eqnshift@<4\tagwidth@ + \global\advance\eqnshift@-\tagwidth@ + \fi + \fi + \fi + \global\divide\eqnshift@\tw@ + \iftagsleft@ + \global\eqnshift@-\eqnshift@ + \global\advance\eqnshift@\displaywidth + \global\advance\eqnshift@-\wdz@ + \fi + \ifdim\eqnshift@<\z@ + \global\eqnshift@\z@ + \fi + \fi +} +\def\place@tag@gather{% + \iftagsleft@ + \kern-\gdisplaywidth@ + \ifshifttag@ + \rlap{\vbox{% + \normalbaselines + \boxz@ + \vbox to\lineht@{}% + \raise@tag + }}% + \global\shifttag@false + \else + \rlap{\boxz@}% + \fi + \else + \ifdim\totwidth@>\displaywidth + \dimen@\totwidth@ + \advance\dimen@-\displaywidth + \kern-\dimen@ + \fi + \ifshifttag@ + \llap{\vtop{% + \raise@tag + \normalbaselines + \setbox\@ne\null + \dp\@ne\lineht@ + \box\@ne + \boxz@ + }}% + \global\shifttag@false + \else + \llap{\boxz@}% + \fi + \fi +} +\def\set@gather@field{% + \iftagsleft@ + \global\lineht@\ht\z@ + \else + \global\lineht@\dp\z@ + \fi + \kern\eqnshift@ + \boxz@ + \hfil +} +\newif\ifxxat@ + +\newif\ifcheckat@ + +\let\xatlevel@\@empty +\def\start@align#1#2#3{% + \let\xatlevel@#1% always \z@, \@ne, or \tw@ + \maxfields@#3\relax + \ifnum\maxfields@>\m@ne + \checkat@true + \ifnum\xatlevel@=\tw@ + \xxat@true + \fi + \multiply\maxfields@\tw@ + \else + \checkat@false + \fi + \ifingather@ + \iffalse{\fi\ifnum0=`}\fi + \DN@{\vcenter\bgroup\savealignstate@\align@#2}% + \else + \ifmmode + \if@display + \DN@{\align@recover}% + \else + \nomath@env + \DN@{\@namedef{end\@currenvir}{}\@gobble}% + \fi + \else + \dollardollar@begin + \let\split\insplit@ + \DN@{\align@#2}% + \fi + \fi + \collect@body\next@ +} +\def\align@recover#1#2#3{% + \endgroup + \@amsmath@err{% +Erroneous nesting of equation structures;\MessageBreak +trying to recover with `aligned'% + }\@ehc + \begin{aligned}\relax#1\end{aligned}% +} +\newenvironment{alignat}{% + \start@align\z@\st@rredfalse +}{% + \endalign +} +\newenvironment{alignat*}{% + \start@align\z@\st@rredtrue +}{% + \endalign +} +\newenvironment{xalignat}{% + \start@align\@ne\st@rredfalse +}{% + \endalign +} +\newenvironment{xalignat*}{% + \start@align\@ne\st@rredtrue +}{% + \endalign +} +\newenvironment{xxalignat}{% + \start@align\tw@\st@rredtrue +}{% + \endalign +} +\newenvironment{align}{% + \start@align\@ne\st@rredfalse\m@ne +}{% + \math@cr \black@\totwidth@ + \egroup + \ifingather@ + \restorealignstate@ + \egroup + \nonumber + \ifnum0=`{\fi\iffalse}\fi + \else + \dollardollar@end + \fi + \ignorespacesafterend +} +\newenvironment{align*}{% + \start@align\@ne\st@rredtrue\m@ne +}{% + \endalign +} +\newenvironment{flalign}{% + \start@align\tw@\st@rredfalse\m@ne +}{% + \endalign +} +\newenvironment{flalign*}{% + \start@align\tw@\st@rredtrue\m@ne +}{% + \endalign +} +\def\align@#1#2{% + \inalign@true \intertext@ \Let@ \chardef\dspbrk@context\z@ + \ifingather@\else\displ@y@\fi + \let\math@cr@@@\math@cr@@@align + \ifxxat@\else \let\tag\tag@in@align \fi + \let\label\label@in@display + #1% set st@r + \ifst@rred\else \global\@eqnswtrue \fi + \measure@{#2}% + \global\row@\z@ + \tabskip\eqnshift@ + \halign\bgroup + \span\align@preamble\crcr + #2% +} +\def\math@cr@@@align{% + \ifst@rred\nonumber\fi + \if@eqnsw \global\tag@true \fi + \global\advance\row@\@ne + \add@amps\maxfields@ + \omit + \kern-\alignsep@ + \iftag@ + \setboxz@h{\@lign\strut@{\make@display@tag}}% + \place@tag + \fi + \ifst@rred\else\global\@eqnswtrue\fi + \global\lineht@\z@ + \cr +} +\def\math@cr@@@align@measure{% + &\omit + \global\advance\row@\@ne + \ifst@rred\nonumber\fi + \if@eqnsw \global\tag@true \fi + \ifnum\column@>\maxfields@ + \ifcheckat@ + \begingroup + \measuring@false + \@amsmath@err{Extra & on this line}% + {\the\andhelp@}% "An extra & here is disastrous" + \endgroup + \else + \global\maxfields@\column@ + \fi + \fi + \setboxz@h{\@lign\strut@{% + \if@eqnsw + \stepcounter{equation}% + \tagform@\theequation + \else + \iftag@\df@tag\fi + \fi + }}% + \savetaglength@ + \ifst@rred\else\global\@eqnswtrue\fi + \cr +} +\let\field@lengths\@empty + +\def\savefieldlength@{% + \begingroup + \let\or\relax + \xdef\field@lengths{% + \field@lengths + \ifnum\column@=0 + \or + \else + ,% + \fi + \the\wdz@ + }% + \endgroup +} + +\def\fieldlengths@#1{% + \ifcase\@xp#1\field@lengths\fi +} +\let\maxcolumn@widths\@empty +\def\maxcol@width#1{% + \ifcase\@xp#1\maxcolumn@widths\fi\relax +} +\def\measure@#1{% + \begingroup + \measuring@true + \global\eqnshift@\z@ + \global\alignsep@\z@ + \global\let\tag@lengths\@empty + \global\let\field@lengths\@empty + \savecounters@ + \global\setbox0\vbox{% + \let\math@cr@@@\math@cr@@@align@measure + \everycr{\noalign{\global\tag@false + \global\let\raise@tag\@empty \global\column@\z@}}% + \let\label\@gobble + \global\row@\z@ + \tabskip\z@ + \halign{\span\align@preamble\crcr + #1% + \math@cr@@@ + \global\column@\z@ + \add@amps\maxfields@\cr + }% + }% + \restorecounters@ + \ifodd\maxfields@ + \global\advance\maxfields@\@ne + \fi + \ifnum\xatlevel@=\tw@ + \ifnum\maxfields@<\thr@@ + \let\xatlevel@\z@ + \fi + \fi + \setbox\z@\vbox{% + \unvbox\z@ \unpenalty \global\setbox\@ne\lastbox + }% + \global\totwidth@\wd\@ne + \if@fleqn \global\advance\totwidth@\@mathmargin \fi + \global\let\maxcolumn@widths\@empty + \begingroup + \let\or\relax + \loop + \global\setbox\@ne\hbox{% + \unhbox\@ne \unskip \global\setbox\thr@@\lastbox + }% + \ifhbox\thr@@ + \xdef\maxcolumn@widths{ \or \the\wd\thr@@ \maxcolumn@widths}% + \repeat + \endgroup + \dimen@\displaywidth + \advance\dimen@-\totwidth@ + \ifcase\xatlevel@ + \global\alignsep@\z@ + \let\minalignsep\z@ + \@tempcntb\z@ + \if@fleqn + \@tempcnta\@ne + \global\eqnshift@\@mathmargin + \else + \@tempcnta\tw@ + \global\eqnshift@\dimen@ + \global\divide\eqnshift@\@tempcnta + \fi + \or + \@tempcntb\maxfields@ + \divide\@tempcntb\tw@ + \@tempcnta\@tempcntb + \advance\@tempcntb\m@ne + \if@fleqn + \global\eqnshift@\@mathmargin + \global\alignsep@\dimen@ + \global\divide\alignsep@\@tempcnta + \else + \global\advance\@tempcnta\@ne + \global\eqnshift@\dimen@ + \global\divide\eqnshift@\@tempcnta + \global\alignsep@\eqnshift@ + \fi + \or + \@tempcntb\maxfields@ + \divide\@tempcntb\tw@ + \global\advance\@tempcntb\m@ne + \global\@tempcnta\@tempcntb + \global\eqnshift@\z@ + \global\alignsep@\dimen@ + \if@fleqn + \global\advance\alignsep@\@mathmargin\relax + \fi + \global\divide\alignsep@\@tempcntb + \fi + \ifdim\alignsep@<\minalignsep\relax + \global\alignsep@\minalignsep\relax + \ifdim\eqnshift@>\z@ + \if@fleqn\else + \global\eqnshift@\displaywidth + \global\advance\eqnshift@-\totwidth@ + \global\advance\eqnshift@-\@tempcntb\alignsep@ + \global\divide\eqnshift@\tw@ + \fi + \fi + \fi + \ifdim\eqnshift@<\z@ + \global\eqnshift@\z@ + \fi + \calc@shift@align + \global\tagshift@\totwidth@ + \global\advance\tagshift@\@tempcntb\alignsep@ + \if@fleqn + \ifnum\xatlevel@=\tw@ + \global\advance\tagshift@-\@mathmargin\relax + \fi + \else + \global\advance\tagshift@\eqnshift@ + \fi + \iftagsleft@ \else + \global\advance\tagshift@-\displaywidth + \fi + \dimen@\minalignsep\relax + \global\advance\totwidth@\@tempcntb\dimen@ + \ifdim\totwidth@>\displaywidth + \global\let\displaywidth@\totwidth@ + \else + \global\let\displaywidth@\displaywidth + \fi + \endgroup +} +\iftagsleft@\if@fleqn + \def\calc@shift@align{% + \global\let\tag@shifts\@empty + \begingroup + \@tempdima\@mathmargin\relax + \advance\@tempdima-\mintagsep\relax + \loop + \ifnum\row@>0 + \ifdim\tag@width\row@>\z@ + \x@calc@shift@lf + \else + \saveshift@0% + \fi + \advance\row@\m@ne + \repeat + \endgroup + } + \def\x@calc@shift@lf{% + \ifdim\eqnshift@=\z@ + \global\eqnshift@\@mathmargin\relax + \alignsep@\displaywidth + \advance\alignsep@-\totwidth@ + \global\divide\alignsep@\@tempcntb + \ifdim\alignsep@<\minalignsep\relax + \global\alignsep@\minalignsep\relax + \fi + \fi + \ifdim\tag@width\row@>\@tempdima + \saveshift@1% + \else + \saveshift@0% + \fi + } +\fi\fi +\iftagsleft@\else\if@fleqn + \def\calc@shift@align{% + \global\let\tag@shifts\@empty + \begingroup + \loop + \ifnum\row@>0 + \ifdim\tag@width\row@>\z@ + \x@calc@shift@rf + \else + \saveshift@0% + \fi + \advance\row@\m@ne + \repeat + \endgroup + } + \def\x@calc@shift@rf{% + \column@\z@ + \@tempdimb\z@ + \@tempdimc\z@ + \edef\@tempb{\fieldlengths@\row@}% + \@for\@tempa:=\@tempb\do{% + \advance\column@\@ne + \x@rcalc@width + }% + \begingroup + \advance\column@\m@ne + \divide\column@\tw@ + \ifnum\@tempcntb>\column@ + \advance\@tempcnta-\@tempcntb + \advance\@tempcnta\column@ + \@tempcntb\column@ + \fi + \tagwidth@\tag@width\row@\relax + \@tempdima\eqnshift@ + \advance\@tempdima\@tempdimc\relax + \advance\@tempdima\tagwidth@ + \dimen@\minalignsep\relax + \multiply\dimen@\@tempcntb + \advance\dimen@\mintagsep\relax + \advance\dimen@\@tempdima + \ifdim\dimen@>\displaywidth + \saveshift@1% + \else + \saveshift@0% + \dimen@\alignsep@\relax + \multiply\dimen@\@tempcntb + \advance\dimen@\@tempdima + \advance\dimen@\tagwidth@ + \ifdim\dimen@>\displaywidth + \dimen@\displaywidth + \advance\dimen@-\@tempdima + \ifnum\xatlevel@=\tw@ + \advance\dimen@-\mintagsep\relax + \fi + \divide\dimen@\@tempcnta + \ifdim\dimen@<\minalignsep\relax + \global\alignsep@\minalignsep\relax + \else + \global\alignsep@\dimen@ + \fi + \fi + \fi + \endgroup + } +\fi\fi +\iftagsleft@\else\if@fleqn\else + \def\calc@shift@align{% + \global\let\tag@shifts\@empty + \begingroup + \loop + \ifnum\row@>0 + \ifdim\tag@width\row@>\z@ + \x@calc@shift@rc + \else + \saveshift@0% + \fi + \advance\row@\m@ne + \repeat + \endgroup + } + \def\x@calc@shift@rc{% + \column@\z@ + \@tempdimb\z@ + \@tempdimc\z@ + \edef\@tempb{\fieldlengths@\row@}% + \@for\@tempa:=\@tempb\do{% + \advance\column@\@ne + \x@rcalc@width + }% + \begingroup + \advance\column@\m@ne + \divide\column@\tw@ + \ifnum\@tempcntb>\column@ + \advance\@tempcnta-\@tempcntb + \advance\@tempcnta\column@ + \@tempcntb\column@ + \fi + \tagwidth@\tag@width\row@\relax + \@tempdima\@tempdimc + \advance\@tempdima\tagwidth@ + \dimen@\minalignsep\relax + \multiply\dimen@\@tempcntb + \advance\dimen@\mintagsep\relax + \ifnum\xatlevel@=\tw@ \else + \advance\dimen@\mintagsep\relax + \fi + \advance\dimen@\@tempdima + \ifdim\dimen@>\displaywidth + \saveshift@1% + \else + \saveshift@0% + \dimen@\eqnshift@ + \advance\dimen@\@tempdima + \advance\dimen@\@tempcntb\alignsep@ + \advance\dimen@\tagwidth@ + \ifdim\dimen@>\displaywidth + \dimen@\displaywidth + \advance\dimen@-\@tempdima + \ifnum\xatlevel@=\tw@ + \advance\dimen@-\mintagsep\relax + \fi + \divide\dimen@\@tempcnta + \ifdim\dimen@<\minalignsep\relax + \global\alignsep@\minalignsep\relax + \eqnshift@\displaywidth + \advance\eqnshift@-\@tempdima + \advance\eqnshift@-\@tempcntb\alignsep@ + \global\divide\eqnshift@\tw@ + \else + \ifdim\dimen@<\eqnshift@ + \ifdim\dimen@<\z@ + \global\eqnshift@\z@ + \else + \global\eqnshift@\dimen@ + \fi + \fi + \ifdim\dimen@<\alignsep@ + \global\alignsep@\dimen@ + \fi + \fi + \fi + \fi + \endgroup + } +\fi\fi +\iftagsleft@\else + \def\x@rcalc@width{% + \ifdim\@tempa > \z@ + \advance\@tempdimc\@tempdimb + \ifodd\column@ + \advance\@tempdimc\maxcol@width\column@ + \@tempdimb\z@ + \else + \advance\@tempdimc\@tempa\relax + \@tempdimb\maxcol@width\column@ + \advance\@tempdimb-\@tempa\relax + \fi + \else + \advance\@tempdimb\maxcol@width\column@\relax + \fi + } +\fi +\iftagsleft@\if@fleqn\else + \def\calc@shift@align{% + \global\let\tag@shifts\@empty + \begingroup + \loop + \ifnum\row@>\z@ + \ifdim\tag@width\row@>\z@ + \x@calc@shift@lc + \else + \saveshift@0% + \fi + \advance\row@\m@ne + \repeat + \endgroup + } + \def\x@calc@shift@lc{% + \column@\z@ + \@tempdima\z@ % ``width of equation'' + \@tempdimb\z@ % ``indent of equation'' + \edef\@tempb{\fieldlengths@\row@}% + \@for\@tempa:=\@tempb\do{% + \advance\column@\@ne + \x@lcalc@width + }% + \begingroup + \tagwidth@\tag@width\row@\relax + \@tempdima\totwidth@ + \advance\@tempdima-\@tempdimb + \advance\@tempdima\tagwidth@ + \dimen@\minalignsep\relax + \multiply\dimen@\@tempcntb + \advance\dimen@\mintagsep\relax + \ifnum\xatlevel@=\tw@ \else + \advance\dimen@\mintagsep\relax + \fi + \advance\dimen@\@tempdima + \ifdim\dimen@>\displaywidth + \saveshift@1% + \else + \saveshift@0% + \dimen@\alignsep@ + \multiply\dimen@\count@ + \advance\dimen@\eqnshift@ + \advance\dimen@\@tempdimb + \ifdim\dimen@<2\tagwidth@ + \dimen@\displaywidth + \advance\dimen@-\@tempdima + \ifnum\xatlevel@=\tw@ + \advance\dimen@-\mintagsep\relax + \fi + \ifnum\@tempcnta>\z@ + \divide\dimen@\@tempcnta + \else \dimen@\z@ + \fi + \ifdim\dimen@<\minalignsep\relax + \global\alignsep@\minalignsep\relax + \dimen@\displaywidth + \advance\dimen@-\@tempdima + \advance\dimen@-\@tempcntb\alignsep@ + \global\divide\dimen@\tw@ + \else + \ifdim\dimen@<\alignsep@ + \global\alignsep@\dimen@ + \fi + \fi + \ifnum\xatlevel@=\tw@ + \dimen@\mintagsep\relax + \fi + \advance\dimen@\tagwidth@ + \advance\dimen@-\@tempdimb + \advance\dimen@-\count@\alignsep@ + \ifdim\dimen@>\eqnshift@ + \global\eqnshift@\dimen@ + \fi + \fi + \fi + \endgroup + } + \def\x@lcalc@width{% + \ifdim\@tempdima = \z@ + \ifdim\@tempa > \z@ + \@tempdima\p@ + \ifodd\column@ + \advance\@tempdimb \maxcol@width\column@ + \advance\@tempdimb-\@tempa + \fi + \count@\column@ + \advance\count@\m@ne + \divide\count@\tw@ + \advance\@tempcnta-\count@ + \advance\@tempcntb-\count@ + \else + \advance\@tempdimb \maxcol@width\column@\relax + \fi + \fi + } +\fi\fi +\def\place@tag{% + \iftagsleft@ + \kern-\tagshift@ + \if1\shift@tag\row@\relax + \rlap{\vbox{% + \normalbaselines + \boxz@ + \vbox to\lineht@{}% + \raise@tag + }}% + \else + \rlap{\boxz@}% + \fi + \kern\displaywidth@ + \else + \kern-\tagshift@ + \if1\shift@tag\row@\relax + \llap{\vtop{% + \raise@tag + \normalbaselines + \setbox\@ne\null + \dp\@ne\lineht@ + \box\@ne + \boxz@ + }}% + \else + \llap{\boxz@}% + \fi + \fi +} +\def\align@preamble{% + &\hfil + \strut@ + \setboxz@h{\@lign$\m@th\displaystyle{##}$}% + \ifmeasuring@\savefieldlength@\fi + \set@field + \tabskip\z@skip + &\setboxz@h{\@lign$\m@th\displaystyle{{}##}$}% + \ifmeasuring@\savefieldlength@\fi + \set@field + \hfil + \tabskip\alignsep@ +} +\def\set@field{% + \column@plus + \iftagsleft@ + \ifdim\ht\z@>\lineht@ + \global\lineht@\ht\z@ + \fi + \else + \ifdim\dp\z@>\lineht@ + \global\lineht@\dp\z@ + \fi + \fi + \boxz@ +} +\edef\split@err#1{% + \@nx\@amsmath@err{% + \string\begin{split} won't work here% + }{% + \@xp\@nx\csname + Did you forget a preceding \string\begin{equation}?^^J% + If not, perhaps the `aligned' environment is what + you want.\endcsname}% +} +\newenvironment{split}{% + \if@display + \ifinner + \@xp\@xp\@xp\split@aligned + \else + \ifst@rred \else \global\@eqnswtrue \fi + \fi + \else \let\endsplit\@empty \@xp\collect@body\@xp\split@err + \fi + \collect@body\gather@split +}{% + \crcr + \egroup + \egroup + \iftagsleft@ \@xp\lendsplit@ \else \@xp\rendsplit@ \fi +} +\let\split@tag\relax % init +\def\gather@split#1#2#3{% + \@xp\endgroup \reset@equation % math@cr will handle equation numbering + \iftag@ + \toks@\@xp{\df@tag}% + \edef\split@tag{% + \gdef\@nx\df@tag{\the\toks@}% + \global\@nx\tag@true \@nx\nonumber + }% + \else \let\split@tag\@empty + \fi + \spread@equation + \vcenter\bgroup + \gather@{\split@tag \begin{split}#1\end{split}}% + \def\endmathdisplay@a{% + \math@cr \black@ \totwidth@ \egroup + \egroup + }% +} +\def\insplit@{% + \global\setbox\z@\vbox\bgroup + \Let@ \chardef\dspbrk@context\@ne \restore@math@cr + \default@tag % disallow use of \tag here + \ialign\bgroup + \hfil + \strut@ + $\m@th\displaystyle{##}$% + &$\m@th\displaystyle{{}##}$% + \hfill % Why not \hfil?---dmj, 1994/12/28 + \crcr +} +\def\rendsplit@{% + \ifinalign@ + \global\setbox9 \vtop{% + \unvcopy\z@ + \global\setbox8 \lastbox + \unskip + }% + \setbox\@ne\hbox{% + \unhcopy8 + \unskip + \global\setbox\tw@\lastbox + \unskip + \global\setbox\thr@@\lastbox + }% + \ifctagsplit@ + \gdef\split@{% + \hbox to\wd\thr@@{}% + &\vcenter{\vbox{\moveleft\wd\thr@@\boxz@}}% + }% + \else + \global\setbox7 \hbox{\unhbox\tw@\unskip}% + \gdef\split@{% + \global\@tempcnta\column@ + &\setboxz@h{}% + \savetaglength@ + \global\advance\row@\@ne + \vbox{\moveleft\wd\thr@@\box9}% + \crcr + \noalign{\global\lineht@\z@}% + \add@amps\@tempcnta + \box\thr@@ + &\box7 + }% + \fi + \else + \ifctagsplit@ + \gdef\split@{\vcenter{\boxz@}}% + \else + \gdef\split@{% + \boxz@ + }% + \fi + \fi + \aftergroup\split@ +} +\def\lendsplit@{% + \global\setbox9\vtop{\unvcopy\z@}% + \ifinalign@ + \setbox\@ne\vbox{% + \unvcopy\z@ + \global\setbox8\lastbox + }% + \setbox\@ne\hbox{% + \unhcopy8% + \unskip + \setbox\tw@\lastbox + \unskip + \global\setbox\thr@@\lastbox + }% + \ifctagsplit@ + \gdef\split@{% + \hbox to\wd\thr@@{}% + &\vcenter{\vbox{\moveleft\wd\thr@@\box9}}% + }% + \else + \gdef\split@{% + \hbox to\wd\thr@@{}% + &\vbox{\moveleft\wd\thr@@\box9}% + }% + \fi + \else + \ifctagsplit@ + \gdef\split@{\vcenter{\box9}}% + \else + \gdef\split@{\box9}% + \fi + \fi + \aftergroup\split@ +} +\def\split@aligned#1#2{% + \iffalse{\fi\ifnum0=`}\fi + \collect@body\split@al@a} +\def\split@al@a#1#2#3{% + \split@warning + \endgroup + \toks@{\begin{aligned}}% + \if@fleqn \split@al@tagcheck \fi + \the\toks@\relax#1\end{aligned}% + \ifnum0=`{\fi\iffalse}\fi +} +\def\split@al@tagcheck{% + \ifctagsplit@ + \else + \iftagsleft@ \toks@\@xp{\the\toks@ [t]}% + \else \toks@\@xp{\the\toks@ [b]}% + \fi + \fi +} +\def\split@warning{% + \PackageWarning{amsmath}{% +Cannot use `split' here;\MessageBreak trying to recover with `aligned'}% +} +\newskip\multlinegap +\multlinegap10pt +\newskip\multlinetaggap +\multlinetaggap10pt +\def\start@multline#1{% + \RIfM@ + \nomath@env + \DN@{\@namedef{end\@currenvir}{}\@gobble}% + \else + \dollardollar@begin + #1% + \ifst@rred + \nonumber + \else + \global\@eqnswtrue + \fi + \let\next@\multline@ + \fi + \collect@body\next@ +} +\newenvironment{multline}{% + \start@multline\st@rredfalse +}{% + \iftagsleft@ \@xp\lendmultline@ \else \@xp\rendmultline@ \fi + \ignorespacesafterend +} +\newenvironment{multline*}{\start@multline\st@rredtrue}{\endmultline} +\def\multline@#1{% + \Let@ + \@display@init{\global\advance\row@\@ne \global\dspbrk@lvl\m@ne}% + \chardef\dspbrk@context\z@ + \restore@math@cr + \let\tag\tag@in@align + \global\tag@false \global\let\raise@tag\@empty + \mmeasure@{#1}% + \let\tag\gobble@tag \let\label\@gobble + \tabskip \if@fleqn \@mathmargin \else \z@skip \fi + \totwidth@\displaywidth + \if@fleqn + \advance\totwidth@-\@mathmargin + \fi + \halign\bgroup + \hbox to\totwidth@{% + \if@fleqn + \hskip \@centering \relax + \else + \hfil + \fi + \strut@ + $\m@th\displaystyle{}##\endmultline@math + \hfil + }% + \crcr + \if@fleqn + \hskip-\@mathmargin + \def\multline@indent{\hskip\@mathmargin}% put it back + \else + \hfilneg + \def\multline@indent{\hskip\multlinegap}% + \fi + \iftagsleft@ + \iftag@ + \begingroup + \ifshifttag@ + \rlap{\vbox{% + \normalbaselines + \hbox{% + \strut@ + \make@display@tag + }% + \vbox to\lineht@{}% + \raise@tag + }}% + \multline@indent + \else + \setbox\z@\hbox{\make@display@tag}% + \dimen@\@mathmargin \advance\dimen@-\wd\z@ + \ifdim\dimen@<\multlinetaggap + \dimen@\multlinetaggap + \fi + \box\z@ \hskip\dimen@\relax + \fi + \endgroup + \else + \multline@indent + \fi + \else + \multline@indent + \fi + #1% +} +\def\endmultline@math{$} +\def\lendmultline@{% + \hfilneg + \hskip\multlinegap + \math@cr + \egroup + \dollardollar@end +} +\def\rendmultline@{% + \iftag@ + $\let\endmultline@math\relax + \ifshifttag@ + \hskip\multlinegap + \llap{\vtop{% + \raise@tag + \normalbaselines + \setbox\@ne\null + \dp\@ne\lineht@ + \box\@ne + \hbox{\strut@\make@display@tag}% + }}% + \else + \hskip\multlinetaggap + \make@display@tag + \fi + \else + \hskip\multlinegap + \fi + \hfilneg + \math@cr + \egroup\dollardollar@end +} +\def\mmeasure@#1{% + \begingroup + \measuring@true + \def\label##1{% + \begingroup\measuring@false\label@in@display{##1}\endgroup}% + \def\math@cr@@@{\cr}% + \let\shoveleft\@iden \let\shoveright\@iden + \savecounters@ + \global\row@\z@ + \setbox\@ne\vbox{% + \global\let\df@tag\@empty + \halign{% + \setboxz@h{\@lign$\m@th\displaystyle{}##$}% + \iftagsleft@ + \ifnum\row@=\@ne + \global\totwidth@\wdz@ + \global\lineht@\ht\z@ + \fi + \else + \global\totwidth@\wdz@ + \global\lineht@\dp\z@ + \fi + \crcr + #1% + \crcr + }% + }% + \ifx\df@tag\@empty\else\global\tag@true\fi + \if@eqnsw\global\tag@true\fi + \iftag@ + \setboxz@h{% + \if@eqnsw + \stepcounter{equation}% + \tagform@\theequation + \else + \df@tag + \fi + }% + \global\tagwidth@\wdz@ + \dimen@\totwidth@ + \advance\dimen@\tagwidth@ + \advance\dimen@\multlinetaggap + \iftagsleft@\else + \if@fleqn + \advance\dimen@\@mathmargin + \fi + \fi + \ifdim\dimen@>\displaywidth + \global\shifttag@true + \else + \global\shifttag@false + \fi + \fi + \restorecounters@ + \endgroup +} +\iftagsleft@ + \protected\def\shoveright#1{% + #1% + \hfilneg + \hskip\multlinegap + } +\else + \protected\def\shoveright#1{% + #1% + \hfilneg + \iftag@ + \ifshifttag@ + \hskip\multlinegap + \else + \hskip\tagwidth@ + \hskip\multlinetaggap + \fi + \else + \hskip\multlinegap + \fi + } +\fi +\if@fleqn + \def\shoveleft#1{#1}% +\else + \iftagsleft@ + \protected\def\shoveleft#1{% + \setboxz@h{$\m@th\displaystyle{}#1$}% + \setbox\@ne\hbox{$\m@th\displaystyle#1$}% + \hfilneg + \iftag@ + \ifshifttag@ + \hskip\multlinegap + \else + \hskip\tagwidth@ + \hskip\multlinetaggap + \fi + \else + \hskip\multlinegap + \fi + \hskip.5\wd\@ne + \hskip-.5\wdz@ \relax + #1% + } + \else + \protected\def\shoveleft#1{% + \setboxz@h{$\m@th\displaystyle{}#1$}% + \setbox\@ne\hbox{$\m@th\displaystyle#1$}% + \hfilneg + \hskip\multlinegap + \hskip.5\wd\@ne + \hskip-.5\wdz@ \relax + #1% + } + \fi +\fi +\let\@@eqno\eqno +\let\@@leqno\leqno +\def\eqno{\@@eqno\let\eqno\relax\let\leqno\relax} +\def\leqno{\@@leqno\let\leqno\relax\let\eqno\relax} +\let\veqno=\@@eqno +\iftagsleft@ \let\veqno=\@@leqno \fi +\@ifundefined{SK@@label}{% + \let\SK@@label\relax \let\SK@equationtrue\relax +}{} +\let\reset@equation\@empty +\let\alt@tag\@empty +\def\tag@in@display#1#{\relax\tag@in@display@a{#1}} +\def\tag@in@display@a#1#2{% + \iftag@ + \invalid@tag{Multiple \string\tag}\relax + \else + \global\tag@true \nonumber \reset@equation \st@rredtrue + \if *\string#1% + \gdef\alt@tag{\def\SK@tagform@{#2\@gobble}% + \ifx\SK@@label\relax \let\tagform@\SK@tagform@ \fi + }% + \make@df@tag@@{#2}% + \else + \make@df@tag@@@{#2}% + \fi + \fi +} +\let\restore@hfuzz\@empty +\def\mathdisplay#1{% + \ifmmode \@badmath + \else + \dollardollar@begin\def\@currenvir{#1}% + \let\dspbrk@context\z@ + \let\tag\tag@in@display \let\label\label@in@display \SK@equationtrue + \global\let\df@label\@empty \global\let\df@tag\@empty + \global\tag@false + \let\mathdisplay@push\mathdisplay@@push + \let\mathdisplay@pop\mathdisplay@@pop + \if@fleqn + \edef\restore@hfuzz{\hfuzz\the\hfuzz\relax}% + \hfuzz\maxdimen + \setbox\z@\hbox to\displaywidth\bgroup + \let\split@warning\relax \restore@hfuzz + \everymath\@emptytoks \m@th $\displaystyle + \fi + \fi +} +\def\endmathdisplay#1{% + \ifmmode \else \@badmath \fi + \endmathdisplay@a + \dollardollar@end + \global\let\df@label\@empty \global\let\df@tag\@empty + \global\tag@false \global\let\alt@tag\@empty + \global\@eqnswfalse +} +\def\endmathdisplay@a{% + \if@eqnsw \gdef\df@tag{\tagform@\theequation}\fi + \if@fleqn \@xp\endmathdisplay@fleqn + \else \ifx\df@tag\@empty \else \veqno \alt@tag \df@tag \fi + \ifx\df@label\@empty \else \@xp\ltx@label\@xp{\df@label}\fi + \fi + \ifnum\dspbrk@lvl>\m@ne + \postdisplaypenalty -\@getpen\dspbrk@lvl + \global\dspbrk@lvl\m@ne + \fi +} +\let\too@wide\@ne +\def\endmathdisplay@fleqn{% + $\hfil\hskip\@mathmargin\egroup + \ifnum\badness<\inf@bad \let\too@wide\@ne \else \let\too@wide\z@ \fi + \ifx\@empty\df@tag + \else + \setbox4\hbox{\df@tag + \ifx\df@label\@empty \else \@xp\ltx@label\@xp{\df@label}\fi + }% + \fi + \csname emdf@% + \ifx\df@tag\@empty U\else \iftagsleft@ L\else R\fi\fi + \endcsname +} +\def\emdf@U{% + \restore@hfuzz + \ifodd\too@wide % not too wide: just need to swap the glue around + \hbox to\displaywidth{\hskip\@mathmargin\unhbox\z@\unskip}% + \else % M+B > displaywidth + \emdf@Ua + \fi +} +\def\emdf@Ua{% + \hbox to\columnwidth{% + \ifdim\displayindent>\z@ + \hskip\displayindent minus\displayindent + \fi + \hskip\@mathmargin \unhbox\z@ \unskip + }% + \displayindent\z@ \displaywidth\columnwidth +} +\def\emdf@R{% + \setbox\tw@\hbox to\displaywidth{% + \hskip\@mathmargin \unhcopy\z@\unskip\hfil\hskip\mintagsep\copy4 + }% + \restore@hfuzz + \ifnum\badness<\inf@bad \box\tw@ \else \emdf@Ra \fi +} +\def\emdf@Ra{% + \skip@\displayindent minus\displayindent + \displayindent\z@ \displaywidth\columnwidth + \spread@equation \everycr{}\tabskip\z@skip + \halign{\hbox to\displaywidth{##}\cr + \relax + \ifdim\skip@>\z@ \hskip\skip@ \fi + \hskip\@mathmargin\unhbox\z@\unskip\hfil\cr + \noalign{\raise@tag}% + \hfil\box4 \cr}% +} +\def\emdf@L{% + \@tempdima\@mathmargin + \advance\@tempdima-\wd4 \advance\@tempdima-\mintagsep + \skip@\@tempdima minus\@tempdima + \setbox\tw@\hbox to\displaywidth{% + \copy4\hskip\mintagsep + \ifdim\skip@>\z@ \hskip\skip@\fi + \unhcopy\z@\unskip + }% + \restore@hfuzz + \ifnum\badness<\inf@bad \box\tw@ \else \emdf@La \fi +} +\def\emdf@La{% + \spread@equation \everycr{}\tabskip\z@skip + \halign{\hbox to\displaywidth{##}\cr + \box4 \hfil \cr + \noalign{\raise@tag}% + \hskip\@mathmargin\unhbox\z@\unskip\hfil\cr}% +} +\newtoks\mathdisplay@stack +\let\mathdisplay@push\@empty +\def\mathdisplay@@push{% + \begingroup + \toks@\@xp{\df@label}\@temptokena\@xp{\df@tag}% + \toks8\@xp{\alt@tag}% + \edef\@tempa{% + \global\if@eqnsw\@nx\@eqnswtrue\else\@nx\@eqnswfalse\fi + \global\iftag@\@nx\tag@false\else\@nx\tag@true\fi + \gdef\@nx\df@label{\the\toks@}\gdef\@nx\df@tag{\the\@temptokena}% + \gdef\@nx\alt@tag{\the\toks8}% + \global\mathdisplay@stack{\the\mathdisplay@stack}% + }% + \global\mathdisplay@stack\@xp{\@tempa} + \endgroup +} +\let\mathdisplay@pop\@empty +\def\mathdisplay@@pop{\the\mathdisplay@stack} +\if@fleqn +\renewenvironment{equation}{% + \incr@eqnum + \mathdisplay@push + \st@rredfalse \global\@eqnswtrue + \mathdisplay{equation}% +}{% + \endmathdisplay{equation}% + \mathdisplay@pop + \ignorespacesafterend +} +\else +\renewenvironment{equation}{% + \mathdisplay@push + \st@rredfalse \global\@eqnswtrue + \mathdisplay{equation}% + \incr@eqnum\mathopen{}% +}{% + \endmathdisplay{equation}% + \mathdisplay@pop + \ignorespacesafterend +} +\fi +\newenvironment{equation*}{% + \mathdisplay@push + \st@rredtrue \global\@eqnswfalse + \mathdisplay{equation*}% +}{% + \endmathdisplay{equation*}% + \mathdisplay@pop + \ignorespacesafterend +} +\DeclareRobustCommand{\[}{\begin{equation*}} +\DeclareRobustCommand{\]}{\end{equation*}} +\endinput +%% +%% End of file `amsmath.sty'. diff --git a/text/tex/texmf/amsopn.sty b/text/tex/texmf/amsopn.sty new file mode 100644 index 0000000000..12429b2946 --- /dev/null +++ b/text/tex/texmf/amsopn.sty @@ -0,0 +1,116 @@ +%% +%% This is file `amsopn.sty', +%% generated with the docstrip utility. +%% +%% The original source files were: +%% +%% amsopn.dtx +%% +%% Copyright (C) 1995, 1999 American Mathematical Society. +%% Copyright (C) 2016-2025 LaTeX Project and American Mathematical Society. +%% +%% This work may be distributed and/or modified under the +%% conditions of the LaTeX Project Public License, either version 1.3c +%% of this license or (at your option) any later version. +%% The latest version of this license is in +%% https://www.latex-project.org/lppl.txt +%% and version 1.3c or later is part of all distributions of LaTeX +%% version 2005/12/01 or later. +%% +%% This work has the LPPL maintenance status `maintained'. +%% +%% The Current Maintainer of this work is the LaTeX Project. +%% +\NeedsTeXFormat{LaTeX2e}% LaTeX 2.09 can't be used (nor non-LaTeX) +[1994/12/01]% LaTeX date must December 1994 or later +\ProvidesPackage{amsopn}[2022/04/08 v2.04 operator names] +\def\nolimits@{\@ifnextchar\limits{\nolimits\@gobble}{\nolimits}} +\begingroup \catcode`\"=12 +\ifx\Umathcode\@undefined +\gdef\newmcodes@{\mathcode`\'39\mathcode`\*42\mathcode`\."613A% + \ifnum\mathcode`\-=45 \else + \mathchardef\std@minus\mathcode`\-\relax + \fi + \mathcode`\-45\mathcode`\/47\mathcode`\:"603A\relax} +\else +\gdef\newmcodes@{\mathcode`\'39\mathcode`\*42\mathcode`\."613A% + \ifnum\Umathcodenum`\-=45 \else + \Umathcharnumdef\std@minus\Umathcodenum`\-\relax + \fi + \mathcode`\-45\mathcode`\/47\mathcode`\:"603A\relax} +\fi +\endgroup +\DeclareRobustCommand{\operatorname}{% + \@ifstar{\qopname\newmcodes@ m}% + {\qopname\newmcodes@ o}}% +\DeclareRobustCommand{\qopname}[3]{% + \mathop{#1\kern\z@\operator@font#3}% + \csname n#2limits@\endcsname} +\newcommand{\DeclareMathOperator}{% + \@ifstar{\@declmathop m}{\@declmathop o}} +\long\def\@declmathop#1#2#3{% + \@ifdefinable{#2}{% + \DeclareRobustCommand{#2}{\qopname\newmcodes@#1{#3}}}} +\@onlypreamble\DeclareMathOperator +\@onlypreamble\@declmathop +\protected\def\arccos{\qopname\relax o{arccos}} +\protected\def\arcsin{\qopname\relax o{arcsin}} +\protected\def\arctan{\qopname\relax o{arctan}} +\protected\def\arg{\qopname\relax o{arg}} +\protected\def\cos{\qopname\relax o{cos}} +\protected\def\cosh{\qopname\relax o{cosh}} +\protected\def\cot{\qopname\relax o{cot}} +\protected\def\coth{\qopname\relax o{coth}} +\protected\def\csc{\qopname\relax o{csc}} +\protected\def\deg{\qopname\relax o{deg}} +\protected\def\det{\qopname\relax m{det}} +\protected\def\dim{\qopname\relax o{dim}} +\protected\def\exp{\qopname\relax o{exp}} +\protected\def\gcd{\qopname\relax m{gcd}} +\protected\def\hom{\qopname\relax o{hom}} +\protected\def\inf{\qopname\relax m{inf}} +\protected\def\injlim{\qopname\relax m{inj\,lim}} +\protected\def\ker{\qopname\relax o{ker}} +\protected\def\lg{\qopname\relax o{lg}} +\protected\def\lim{\qopname\relax m{lim}} +\protected\def\liminf{\qopname\relax m{lim\,inf}} +\protected\def\limsup{\qopname\relax m{lim\,sup}} +\protected\def\ln{\qopname\relax o{ln}} +\protected\def\log{\qopname\relax o{log}} +\protected\def\max{\qopname\relax m{max}} +\protected\def\min{\qopname\relax m{min}} +\protected\def\Pr{\qopname\relax m{Pr}} +\protected\def\projlim{\qopname\relax m{proj\,lim}} +\protected\def\sec{\qopname\relax o{sec}} +\protected\def\sin{\qopname\relax o{sin}} +\protected\def\sinh{\qopname\relax o{sinh}} +\protected\def\sup{\qopname\relax m{sup}} +\protected\def\tan{\qopname\relax o{tan}} +\protected\def\tanh{\qopname\relax o{tanh}} +\def\operatorfont{\operator@font} +\def\operatornamewithlimits{\operatorname*} +\protected\def\varlim@#1#2{% + \vtop{\m@th\ialign{##\cr + \hfil$#1\operator@font lim$\hfil\cr + \noalign{\nointerlineskip\kern1.5\ex@}#2\cr + \noalign{\nointerlineskip\kern-\ex@}\cr}}% +} +\protected\def\varinjlim{% + \mathop{\mathpalette\varlim@{\rightarrowfill@\textstyle}}\nmlimits@ +} +\protected\def\varprojlim{% + \mathop{\mathpalette\varlim@{\leftarrowfill@\textstyle}}\nmlimits@ +} +\protected\def\varliminf{\mathop{\mathpalette\varliminf@{}}\nmlimits@} +\def\varliminf@#1{\@@underline{\vrule\@depth.2\ex@\@width\z@ + \hbox{$#1\m@th\operator@font lim$}}} +\protected\def\varlimsup{\mathop{\mathpalette\varlimsup@{}}\nmlimits@} +\def\varlimsup@#1{\@@overline{\hbox{$#1\m@th\operator@font lim$}}} +\let\nmlimits@\displaylimits +\DeclareOption{namelimits}{\let\nmlimits@\displaylimits} +\DeclareOption{nonamelimits}{\let\nmlimits@\nolimits} +\ProcessOptions\relax +\RequirePackage{amsgen}\relax +\endinput +%% +%% End of file `amsopn.sty'. diff --git a/text/tex/texmf/amstext.sty b/text/tex/texmf/amstext.sty new file mode 100644 index 0000000000..b68bcad388 --- /dev/null +++ b/text/tex/texmf/amstext.sty @@ -0,0 +1,76 @@ +%% +%% This is file `amstext.sty', +%% generated with the docstrip utility. +%% +%% The original source files were: +%% +%% amstext.dtx +%% +%% Copyright (C) 1995, 1999 American Mathematical Society. +%% Copyright (C) 2016-2025 LaTeX Project and American Mathematical Society. +%% +%% This work may be distributed and/or modified under the +%% conditions of the LaTeX Project Public License, either version 1.3c +%% of this license or (at your option) any later version. +%% The latest version of this license is in +%% https://www.latex-project.org/lppl.txt +%% and version 1.3c or later is part of all distributions of LaTeX +%% version 2005/12/01 or later. +%% +%% This work has the LPPL maintenance status `maintained'. +%% +%% The Current Maintainer of this work is the LaTeX Project. +%% +\NeedsTeXFormat{LaTeX2e}% LaTeX 2.09 can't be used (nor non-LaTeX) +[1994/12/01]% LaTeX date must be December 1994 or later +\ProvidesPackage{amstext}[2024/11/17 v2.01 AMS text] +\RequirePackage{amsgen} +\DeclareRobustCommand{\text}{% + \ifmmode\expandafter\text@\else\expandafter\mbox\fi} +\let\nfss@text\text +\def\text@#1{{\mathchoice + {\textdef@\displaystyle\f@size{#1}}% + {\textdef@\textstyle\f@size{\firstchoice@false #1}}% + {\textdef@\textstyle\sf@size{\firstchoice@false #1}}% + {\textdef@\textstyle \ssf@size{\firstchoice@false #1}}% + \check@mathfonts + }% +} +\def\textdef@#1#2#3{\hbox{{% + \everymath{#1}% + \let\f@size#2\selectfont + #3}}} +\newif\iffirstchoice@ +\firstchoice@true +\def\stepcounter#1{% + \iffirstchoice@ + \addtocounter{#1}\@ne + \begingroup \let\@elt\@stpelt \csname cl@#1\endcsname \endgroup + \fi +} +\def\addtocounter#1#2{% + \iffirstchoice@ + \@ifundefined {c@#1}{\@nocounterr {#1}}% + {\global \advance \csname c@#1\endcsname #2\relax}% + \fi} +\let\m@gobble\@empty +\@xp\let\csname m@gobble4\endcsname\@gobblefour +\long\@xp\def\csname m@gobble6\endcsname#1#2#3#4#5#6{} +\toks@{% + \csname m@gobble\iffirstchoice@\else 4\fi\endcsname + \protect} +\edef\GenericInfo{\the\toks@ + \@xp\@nx\csname GenericInfo \endcsname} +\edef\GenericWarning{\the\toks@ + \@xp\@nx\csname GenericWarning \endcsname} +\toks@{% + \csname m@gobble\iffirstchoice@\else 6\fi\endcsname + \protect} +\edef\GenericError{\the\toks@ + \@xp\@nx\csname GenericError \endcsname} +\begingroup \catcode`\"=12 +\gdef\mathhexbox#1#2#3{\text{$\m@th\mathchar"#1#2#3$}} +\endgroup +\endinput +%% +%% End of file `amstext.sty'. diff --git a/text/tex/texmf/article.cls b/text/tex/texmf/article.cls new file mode 100644 index 0000000000..5ab6daa7b9 --- /dev/null +++ b/text/tex/texmf/article.cls @@ -0,0 +1,644 @@ +%% +%% This is file `article.cls', +%% generated with the docstrip utility. +%% +%% The original source files were: +%% +%% classes.dtx (with options: `article') +%% +%% This is a generated file. +%% +%% The source is maintained by the LaTeX Project team and bug +%% reports for it can be opened at https://latex-project.org/bugs.html +%% (but please observe conditions on bug reports sent to that address!) +%% +%% +%% Copyright (C) 1993-2025 +%% The LaTeX Project and any individual authors listed elsewhere +%% in this file. +%% +%% This file was generated from file(s) of the LaTeX base system. +%% -------------------------------------------------------------- +%% +%% It may be distributed and/or modified under the +%% conditions of the LaTeX Project Public License, either version 1.3c +%% of this license or (at your option) any later version. +%% The latest version of this license is in +%% https://www.latex-project.org/lppl.txt +%% and version 1.3c or later is part of all distributions of LaTeX +%% version 2008 or later. +%% +%% This file has the LPPL maintenance status "maintained". +%% +%% This file may only be distributed together with a copy of the LaTeX +%% base system. You may however distribute the LaTeX base system without +%% such generated files. +%% +%% The list of all files belonging to the LaTeX base distribution is +%% given in the file `manifest.txt'. See also `legal.txt' for additional +%% information. +%% +%% The list of derived (unpacked) files belonging to the distribution +%% and covered by LPPL is defined by the unpacking scripts (with +%% extension .ins) which are part of the distribution. +\NeedsTeXFormat{LaTeX2e}[1995/12/01] +\ProvidesClass{article} + [2025/01/22 v1.4n + Standard LaTeX document class] +\newcommand\@ptsize{} +\newif\if@restonecol +\newif\if@titlepage +\@titlepagefalse +\if@compatibility\else + \DeclareOption{a4paper} + {\setlength\paperheight {297mm}% + \setlength\paperwidth {210mm}} + \DeclareOption{a5paper} + {\setlength\paperheight {210mm}% + \setlength\paperwidth {148mm}} + \DeclareOption{b5paper} + {\setlength\paperheight {250mm}% + \setlength\paperwidth {176mm}} + \DeclareOption{letterpaper} + {\setlength\paperheight {11in}% + \setlength\paperwidth {8.5in}} + \DeclareOption{legalpaper} + {\setlength\paperheight {14in}% + \setlength\paperwidth {8.5in}} + \DeclareOption{executivepaper} + {\setlength\paperheight {10.5in}% + \setlength\paperwidth {7.25in}} + \DeclareOption{landscape} + {\setlength\@tempdima {\paperheight}% + \setlength\paperheight {\paperwidth}% + \setlength\paperwidth {\@tempdima}} +\fi +\if@compatibility + \renewcommand\@ptsize{0} +\else + \DeclareOption{10pt}{\renewcommand\@ptsize{0}} +\fi +\DeclareOption{11pt}{\renewcommand\@ptsize{1}} +\DeclareOption{12pt}{\renewcommand\@ptsize{2}} +\if@compatibility\else + \DeclareOption{oneside}{\@twosidefalse \@mparswitchfalse} +\fi +\DeclareOption{twoside}{\@twosidetrue \@mparswitchtrue} +\DeclareOption{draft}{\setlength\overfullrule{5pt}} +\if@compatibility\else + \DeclareOption{final}{\setlength\overfullrule{0pt}} +\fi +\DeclareOption{titlepage}{\@titlepagetrue} +\if@compatibility\else + \DeclareOption{notitlepage}{\@titlepagefalse} +\fi +\if@compatibility\else + \DeclareOption{onecolumn}{\@twocolumnfalse} +\fi +\DeclareOption{twocolumn}{\@twocolumntrue} +\DeclareOption{leqno}{\input{leqno.clo}} +\DeclareOption{fleqn}{\input{fleqn.clo}} +\DeclareOption{openbib}{% + \AtEndOfPackage{% + \renewcommand\@openbib@code{% + \advance\leftmargin\bibindent + \itemindent -\bibindent + \listparindent \itemindent + \parsep \z@ + }% + \renewcommand\newblock{\par}}% +} +\ExecuteOptions{letterpaper,10pt,oneside,onecolumn,final} +\ProcessOptions +\input{size1\@ptsize.clo} +\setlength\lineskip{1\p@} +\setlength\normallineskip{1\p@} +\renewcommand\baselinestretch{} +\setlength\parskip{0\p@ \@plus \p@} +\@lowpenalty 51 +\@medpenalty 151 +\@highpenalty 301 +\setcounter{topnumber}{2} +\renewcommand\topfraction{.7} +\setcounter{bottomnumber}{1} +\renewcommand\bottomfraction{.3} +\setcounter{totalnumber}{3} +\renewcommand\textfraction{.2} +\renewcommand\floatpagefraction{.5} +\setcounter{dbltopnumber}{2} +\renewcommand\dbltopfraction{.7} +\renewcommand\dblfloatpagefraction{.5} +\if@twoside + \def\ps@headings{% + \let\@oddfoot\@empty\let\@evenfoot\@empty + \def\@evenhead{\thepage\hfil\slshape\leftmark}% + \def\@oddhead{{\slshape\rightmark}\hfil\thepage}% + \let\@mkboth\markboth + \def\sectionmark##1{% + \markboth {\MakeUppercase{% + \ifnum \c@secnumdepth >\z@ + \thesection\quad + \fi + ##1}}{}}% + \def\subsectionmark##1{% + \markright {% + \ifnum \c@secnumdepth >\@ne + \thesubsection\quad + \fi + ##1}}} +\else + \def\ps@headings{% + \let\@oddfoot\@empty + \def\@oddhead{{\slshape\rightmark}\hfil\thepage}% + \let\@mkboth\markboth + \def\sectionmark##1{% + \markright {\MakeUppercase{% + \ifnum \c@secnumdepth >\m@ne + \thesection\quad + \fi + ##1}}}} +\fi +\def\ps@myheadings{% + \let\@oddfoot\@empty\let\@evenfoot\@empty + \def\@evenhead{\thepage\hfil\slshape\leftmark}% + \def\@oddhead{{\slshape\rightmark}\hfil\thepage}% + \let\@mkboth\@gobbletwo + \let\sectionmark\@gobble + \let\subsectionmark\@gobble + } +\if@titlepage + \newcommand\maketitle{\begin{titlepage}% + \let\footnotesize\small + \let\footnoterule\relax + \let \footnote \thanks + \null\vfil + \vskip 60\p@ + \begin{center}% + {\LARGE \@title \par}% + \vskip 3em% + {\large + \lineskip .75em% + \begin{tabular}[t]{c}% + \@author + \end{tabular}\par}% + \vskip 1.5em% + {\large \@date \par}% % Set date in \large size. + \end{center}\par + \@thanks + \vfil\null + \end{titlepage}% + \setcounter{footnote}{0}% + \global\let\thanks\relax + \global\let\maketitle\relax + \global\let\@thanks\@empty + \global\let\@author\@empty + \global\let\@date\@empty + \global\let\@title\@empty + \global\let\title\relax + \global\let\author\relax + \global\let\date\relax + \global\let\and\relax + } +\else + \newcommand\maketitle{\par + \begingroup + \renewcommand\thefootnote{\@fnsymbol\c@footnote}% + \def\@makefnmark{\rlap{\@textsuperscript{\normalfont\@thefnmark}}}% + \long\def\@makefntext##1{\parindent 1em\noindent + \hb@xt@1.8em{% + \hss\@textsuperscript{\normalfont\@thefnmark}}##1}% + \if@twocolumn + \ifnum \col@number=\@ne + \@maketitle + \else + \twocolumn[\@maketitle]% + \fi + \else + \newpage + \global\@topnum\z@ % Prevents figures from going at top of page. + \@maketitle + \fi + \thispagestyle{plain}\@thanks + \endgroup + \setcounter{footnote}{0}% + \global\let\thanks\relax + \global\let\maketitle\relax + \global\let\@maketitle\relax + \global\let\@thanks\@empty + \global\let\@author\@empty + \global\let\@date\@empty + \global\let\@title\@empty + \global\let\title\relax + \global\let\author\relax + \global\let\date\relax + \global\let\and\relax + } +\def\@maketitle{% + \newpage + \null + \vskip 2em% + \begin{center}% + \let \footnote \thanks + {\LARGE \@title \par}% + \vskip 1.5em% + {\large + \lineskip .5em% + \begin{tabular}[t]{c}% + \@author + \end{tabular}\par}% + \vskip 1em% + {\large \@date}% + \end{center}% + \par + \vskip 1.5em} +\fi +\setcounter{secnumdepth}{3} +\newcounter {part} +\newcounter {section} +\newcounter {subsection}[section] +\newcounter {subsubsection}[subsection] +\newcounter {paragraph}[subsubsection] +\newcounter {subparagraph}[paragraph] +\renewcommand \thepart {\@Roman\c@part} +\renewcommand \thesection {\@arabic\c@section} +\renewcommand\thesubsection {\thesection.\@arabic\c@subsection} +\renewcommand\thesubsubsection{\thesubsection.\@arabic\c@subsubsection} +\renewcommand\theparagraph {\thesubsubsection.\@arabic\c@paragraph} +\renewcommand\thesubparagraph {\theparagraph.\@arabic\c@subparagraph} +\newcommand\part{% + \if@noskipsec \leavevmode \fi + \par + \addvspace{4ex}% + \@afterindentfalse + \secdef\@part\@spart} + +\def\@part[#1]#2{% + \ifnum \c@secnumdepth >\m@ne + \refstepcounter{part}% + \addcontentsline{toc}{part}{\thepart\hspace{1em}#1}% + \else + \addcontentsline{toc}{part}{#1}% + \fi + {\parindent \z@ \raggedright + \interlinepenalty \@M + \normalfont + \ifnum \c@secnumdepth >\m@ne + \Large\bfseries \partname\nobreakspace\thepart + \par\nobreak + \fi + \huge \bfseries #2% + \markboth{}{}\par}% + \nobreak + \vskip 3ex + \@afterheading} +\def\@spart#1{% + {\parindent \z@ \raggedright + \interlinepenalty \@M + \normalfont + \huge \bfseries #1\par}% + \nobreak + \vskip 3ex + \@afterheading} +\newcommand\section{\@startsection {section}{1}{\z@}% + {-3.5ex \@plus -1ex \@minus -.2ex}% + {2.3ex \@plus.2ex}% + {\normalfont\Large\bfseries}} +\newcommand\subsection{\@startsection{subsection}{2}{\z@}% + {-3.25ex\@plus -1ex \@minus -.2ex}% + {1.5ex \@plus .2ex}% + {\normalfont\large\bfseries}} +\newcommand\subsubsection{\@startsection{subsubsection}{3}{\z@}% + {-3.25ex\@plus -1ex \@minus -.2ex}% + {1.5ex \@plus .2ex}% + {\normalfont\normalsize\bfseries}} +\newcommand\paragraph{\@startsection{paragraph}{4}{\z@}% + {3.25ex \@plus1ex \@minus.2ex}% + {-1em}% + {\normalfont\normalsize\bfseries}} +\newcommand\subparagraph{\@startsection{subparagraph}{5}{\parindent}% + {3.25ex \@plus1ex \@minus .2ex}% + {-1em}% + {\normalfont\normalsize\bfseries}} +\if@twocolumn + \setlength\leftmargini {2em} +\else + \setlength\leftmargini {2.5em} +\fi +\leftmargin \leftmargini +\setlength\leftmarginii {2.2em} +\setlength\leftmarginiii {1.87em} +\setlength\leftmarginiv {1.7em} +\if@twocolumn + \setlength\leftmarginv {.5em} + \setlength\leftmarginvi {.5em} +\else + \setlength\leftmarginv {1em} + \setlength\leftmarginvi {1em} +\fi +\setlength \labelsep {.5em} +\setlength \labelwidth{\leftmargini} +\addtolength\labelwidth{-\labelsep} +\@beginparpenalty -\@lowpenalty +\@endparpenalty -\@lowpenalty +\@itempenalty -\@lowpenalty +\renewcommand\theenumi{\@arabic\c@enumi} +\renewcommand\theenumii{\@alph\c@enumii} +\renewcommand\theenumiii{\@roman\c@enumiii} +\renewcommand\theenumiv{\@Alph\c@enumiv} +\newcommand\labelenumi{\theenumi.} +\newcommand\labelenumii{(\theenumii)} +\newcommand\labelenumiii{\theenumiii.} +\newcommand\labelenumiv{\theenumiv.} +\renewcommand\p@enumii{\theenumi} +\renewcommand\p@enumiii{\theenumi(\theenumii)} +\renewcommand\p@enumiv{\p@enumiii\theenumiii} +\newcommand\labelitemi {\labelitemfont \textbullet} +\newcommand\labelitemii {\labelitemfont \bfseries \textendash} +\newcommand\labelitemiii{\labelitemfont \textasteriskcentered} +\newcommand\labelitemiv {\labelitemfont \textperiodcentered} +\newcommand\labelitemfont{\normalfont} +\newenvironment{description} + {\list{}{\labelwidth\z@ \itemindent-\leftmargin + \let\makelabel\descriptionlabel}} + {\endlist} +\newcommand*\descriptionlabel[1]{\hspace\labelsep + \normalfont\bfseries #1} +\if@titlepage + \newenvironment{abstract}{% + \titlepage + \null\vfil + \@beginparpenalty\@lowpenalty + \begin{center}% + \bfseries \abstractname + \@endparpenalty\@M + \end{center}}% + {\par\vfil\null\endtitlepage} +\else + \newenvironment{abstract}{% + \if@twocolumn + \section*{\abstractname}% + \else + \small + \begin{center}% + {\bfseries \abstractname\vspace{-.5em}\vspace{\z@}}% + \end{center}% + \quotation + \fi} + {\if@twocolumn\else\endquotation\fi} +\fi +\newenvironment{verse} + {\let\\\@centercr + \list{}{\itemsep \z@ + \itemindent -1.5em% + \listparindent\itemindent + \rightmargin \leftmargin + \advance\leftmargin 1.5em}% + \item\relax} + {\endlist} +\newenvironment{quotation} + {\list{}{\listparindent 1.5em% + \itemindent \listparindent + \rightmargin \leftmargin + \parsep \z@ \@plus\p@}% + \item\relax} + {\endlist} +\newenvironment{quote} + {\list{}{\rightmargin\leftmargin}% + \item\relax} + {\endlist} +\if@compatibility + \newenvironment{titlepage} + {% + \if@twocolumn + \@restonecoltrue\onecolumn + \else + \@restonecolfalse\newpage + \fi + \thispagestyle{empty}% + \setcounter{page}\z@ + }% + {\if@restonecol\twocolumn \else \newpage \fi + } +\else + \newenvironment{titlepage} + {% + \if@twocolumn + \@restonecoltrue\onecolumn + \else + \@restonecolfalse\newpage + \fi + \thispagestyle{empty}% + \setcounter{page}\@ne + }% + {\if@restonecol\twocolumn \else \newpage \fi + \if@twoside\else + \setcounter{page}\@ne + \fi + } +\fi +\newcommand\appendix{\par + \setcounter{section}{0}% + \setcounter{subsection}{0}% + \gdef\thesection{\@Alph\c@section}} +\setlength\arraycolsep{5\p@} +\setlength\tabcolsep{6\p@} +\setlength\arrayrulewidth{.4\p@} +\setlength\doublerulesep{2\p@} +\setlength\tabbingsep{\labelsep} +\skip\@mpfootins = \skip\footins +\setlength\fboxsep{3\p@} +\setlength\fboxrule{.4\p@} +\renewcommand \theequation {\@arabic\c@equation} +\newcounter{figure} +\renewcommand \thefigure {\@arabic\c@figure} +\def\fps@figure{tbp} +\def\ftype@figure{1} +\def\ext@figure{lof} +\def\fnum@figure{\figurename\nobreakspace\thefigure} +\newenvironment{figure} + {\@float{figure}} + {\end@float} +\newenvironment{figure*} + {\@dblfloat{figure}} + {\end@dblfloat} +\newcounter{table} +\renewcommand\thetable{\@arabic\c@table} +\def\fps@table{tbp} +\def\ftype@table{2} +\def\ext@table{lot} +\def\fnum@table{\tablename\nobreakspace\thetable} +\newenvironment{table} + {\@float{table}} + {\end@float} +\newenvironment{table*} + {\@dblfloat{table}} + {\end@dblfloat} +\newlength\abovecaptionskip +\newlength\belowcaptionskip +\setlength\abovecaptionskip{10\p@} +\setlength\belowcaptionskip{0\p@} +\long\def\@makecaption#1#2{% + \vskip\abovecaptionskip + \sbox\@tempboxa{#1: #2}% + \ifdim \wd\@tempboxa >\hsize + #1: #2\par + \else + \global \@minipagefalse + \hb@xt@\hsize{\hfil\box\@tempboxa\hfil}% + \fi + \vskip\belowcaptionskip} +\DeclareOldFontCommand{\rm}{\normalfont\rmfamily}{\mathrm} +\DeclareOldFontCommand{\sf}{\normalfont\sffamily}{\mathsf} +\DeclareOldFontCommand{\tt}{\normalfont\ttfamily}{\mathtt} +\DeclareOldFontCommand{\bf}{\normalfont\bfseries}{\mathbf} +\DeclareOldFontCommand{\it}{\normalfont\itshape}{\mathit} +\DeclareOldFontCommand{\sl}{\normalfont\slshape}{\@nomath\sl} +\DeclareOldFontCommand{\sc}{\normalfont\scshape}{\@nomath\sc} +\DeclareRobustCommand*\cal{\@fontswitch\relax\mathcal} +\DeclareRobustCommand*\mit{\@fontswitch\relax\mathnormal} +\newcommand\@pnumwidth{1.55em} +\newcommand\@tocrmarg{2.55em} +\newcommand\@dotsep{4.5} +\setcounter{tocdepth}{3} +\newcommand\tableofcontents{% + \section*{\contentsname + \@mkboth{% + \MakeUppercase\contentsname}{\MakeUppercase\contentsname}}% + \@starttoc{toc}% + } +\newcommand*\l@part[2]{% + \ifnum \c@tocdepth >-2\relax + \addpenalty\@secpenalty + \addvspace{2.25em \@plus\p@}% + \setlength\@tempdima{3em}% + \begingroup + \parindent \z@ \rightskip \@pnumwidth + \parfillskip -\@pnumwidth + {\leavevmode + \large \bfseries #1\hfil + \hb@xt@\@pnumwidth{\hss #2% + \kern-\p@\kern\p@}}\par + \nobreak + \if@compatibility + \global\@nobreaktrue + \everypar{\global\@nobreakfalse\everypar{}}% + \fi + \endgroup + \fi} +\newcommand*\l@section[2]{% + \ifnum \c@tocdepth >\z@ + \addpenalty\@secpenalty + \addvspace{1.0em \@plus\p@}% + \setlength\@tempdima{1.5em}% + \begingroup + \parindent \z@ \rightskip \@pnumwidth + \parfillskip -\@pnumwidth + \leavevmode \bfseries + \advance\leftskip\@tempdima + \hskip -\leftskip + #1\nobreak\hfil + \nobreak\hb@xt@\@pnumwidth{\hss #2% + \kern-\p@\kern\p@}\par + \endgroup + \fi} +\newcommand*\l@subsection{\@dottedtocline{2}{1.5em}{2.3em}} +\newcommand*\l@subsubsection{\@dottedtocline{3}{3.8em}{3.2em}} +\newcommand*\l@paragraph{\@dottedtocline{4}{7.0em}{4.1em}} +\newcommand*\l@subparagraph{\@dottedtocline{5}{10em}{5em}} +\newcommand\listoffigures{% + \section*{\listfigurename}% + \@mkboth{\MakeUppercase\listfigurename}% + {\MakeUppercase\listfigurename}% + \@starttoc{lof}% + } +\newcommand*\l@figure{\@dottedtocline{1}{1.5em}{2.3em}} +\newcommand\listoftables{% + \section*{\listtablename}% + \@mkboth{% + \MakeUppercase\listtablename}% + {\MakeUppercase\listtablename}% + \@starttoc{lot}% + } +\let\l@table\l@figure +\newdimen\bibindent +\setlength\bibindent{1.5em} +\newenvironment{thebibliography}[1] + {\section*{\refname}% + \@mkboth{\MakeUppercase\refname}{\MakeUppercase\refname}% + \list{\@biblabel{\@arabic\c@enumiv}}% + {\settowidth\labelwidth{\@biblabel{#1}}% + \leftmargin\labelwidth + \advance\leftmargin\labelsep + \@openbib@code + \usecounter{enumiv}% + \let\p@enumiv\@empty + \renewcommand\theenumiv{\@arabic\c@enumiv}}% + \sloppy + \clubpenalty4000 + \@clubpenalty \clubpenalty + \widowpenalty4000% + \sfcode`\.\@m} + {\def\@noitemerr + {\@latex@warning{Empty `thebibliography' environment}}% + \endlist} +\newcommand\newblock{\hskip .11em\@plus.33em\@minus.07em} +\let\@openbib@code\@empty +\newenvironment{theindex} + {\if@twocolumn + \@restonecolfalse + \else + \@restonecoltrue + \fi + \twocolumn[\section*{\indexname}]% + \@mkboth{\MakeUppercase\indexname}% + {\MakeUppercase\indexname}% + \thispagestyle{plain}\parindent\z@ + \parskip\z@ \@plus .3\p@\relax + \columnseprule \z@ + \columnsep 35\p@ + \let\item\@idxitem} + {\if@restonecol\onecolumn\else\clearpage\fi} +\newcommand\@idxitem{\par\hangindent 40\p@} +\newcommand\subitem{\@idxitem \hspace*{20\p@}} +\newcommand\subsubitem{\@idxitem \hspace*{30\p@}} +\newcommand\indexspace{\par \vskip 10\p@ \@plus5\p@ \@minus3\p@\relax} +\renewcommand\footnoterule{% + \kern-3\p@ + \hrule\@width.4\columnwidth + \kern2.6\p@} +\newcommand\@makefntext[1]{% + \parindent 1em% + \noindent + \hb@xt@1.8em{\hss\@makefnmark}#1} +\newcommand\contentsname{Contents} +\newcommand\listfigurename{List of Figures} +\newcommand\listtablename{List of Tables} +\newcommand\refname{References} +\newcommand\indexname{Index} +\newcommand\figurename{Figure} +\newcommand\tablename{Table} +\newcommand\partname{Part} +\newcommand\appendixname{Appendix} +\newcommand\abstractname{Abstract} +\def\today{\ifcase\month\or + January\or February\or March\or April\or May\or June\or + July\or August\or September\or October\or November\or December\fi + \space\number\day, \number\year} +\setlength\columnsep{10\p@} +\setlength\columnseprule{0\p@} +\pagestyle{plain} +\pagenumbering{arabic} +\if@twoside +\else + \raggedbottom +\fi +\if@twocolumn + \twocolumn + \sloppy + \flushbottom +\else + \onecolumn +\fi +\endinput +%% +%% End of file `article.cls'. diff --git a/text/tex/texmf/cmextra/cmbsy5.tfm b/text/tex/texmf/cmextra/cmbsy5.tfm new file mode 100644 index 0000000000..6e1a451ad3 Binary files /dev/null and b/text/tex/texmf/cmextra/cmbsy5.tfm differ diff --git a/text/tex/texmf/cmextra/cmbsy6.tfm b/text/tex/texmf/cmextra/cmbsy6.tfm new file mode 100644 index 0000000000..09f237d97a Binary files /dev/null and b/text/tex/texmf/cmextra/cmbsy6.tfm differ diff --git a/text/tex/texmf/cmextra/cmbsy7.tfm b/text/tex/texmf/cmextra/cmbsy7.tfm new file mode 100644 index 0000000000..c91f2f6023 Binary files /dev/null and b/text/tex/texmf/cmextra/cmbsy7.tfm differ diff --git a/text/tex/texmf/cmextra/cmbsy8.tfm b/text/tex/texmf/cmextra/cmbsy8.tfm new file mode 100644 index 0000000000..9a57e97faa Binary files /dev/null and b/text/tex/texmf/cmextra/cmbsy8.tfm differ diff --git a/text/tex/texmf/cmextra/cmbsy9.tfm b/text/tex/texmf/cmextra/cmbsy9.tfm new file mode 100644 index 0000000000..97c78c7aa1 Binary files /dev/null and b/text/tex/texmf/cmextra/cmbsy9.tfm differ diff --git a/text/tex/texmf/cmextra/cmbx10.tfm b/text/tex/texmf/cmextra/cmbx10.tfm new file mode 100644 index 0000000000..04f6429540 Binary files /dev/null and b/text/tex/texmf/cmextra/cmbx10.tfm differ diff --git a/text/tex/texmf/cmextra/cmbx12.tfm b/text/tex/texmf/cmextra/cmbx12.tfm new file mode 100644 index 0000000000..d66f70cfe1 Binary files /dev/null and b/text/tex/texmf/cmextra/cmbx12.tfm differ diff --git a/text/tex/texmf/cmextra/cmbx5.tfm b/text/tex/texmf/cmextra/cmbx5.tfm new file mode 100644 index 0000000000..2fa652e8fc Binary files /dev/null and b/text/tex/texmf/cmextra/cmbx5.tfm differ diff --git a/text/tex/texmf/cmextra/cmbx6.tfm b/text/tex/texmf/cmextra/cmbx6.tfm new file mode 100644 index 0000000000..1bbaaffe12 Binary files /dev/null and b/text/tex/texmf/cmextra/cmbx6.tfm differ diff --git a/text/tex/texmf/cmextra/cmbx7.tfm b/text/tex/texmf/cmextra/cmbx7.tfm new file mode 100644 index 0000000000..6685612850 Binary files /dev/null and b/text/tex/texmf/cmextra/cmbx7.tfm differ diff --git a/text/tex/texmf/cmextra/cmbx8.tfm b/text/tex/texmf/cmextra/cmbx8.tfm new file mode 100644 index 0000000000..2c99314464 Binary files /dev/null and b/text/tex/texmf/cmextra/cmbx8.tfm differ diff --git a/text/tex/texmf/cmextra/cmbx9.tfm b/text/tex/texmf/cmextra/cmbx9.tfm new file mode 100644 index 0000000000..ad681fac3c Binary files /dev/null and b/text/tex/texmf/cmextra/cmbx9.tfm differ diff --git a/text/tex/texmf/cmextra/cmbxsl10.tfm b/text/tex/texmf/cmextra/cmbxsl10.tfm new file mode 100644 index 0000000000..d334c0cd4c Binary files /dev/null and b/text/tex/texmf/cmextra/cmbxsl10.tfm differ diff --git a/text/tex/texmf/cmextra/cmbxti10.tfm b/text/tex/texmf/cmextra/cmbxti10.tfm new file mode 100644 index 0000000000..0c7a5fc281 Binary files /dev/null and b/text/tex/texmf/cmextra/cmbxti10.tfm differ diff --git a/text/tex/texmf/cmextra/cmcsc8.tfm b/text/tex/texmf/cmextra/cmcsc8.tfm new file mode 100644 index 0000000000..67453e1bec Binary files /dev/null and b/text/tex/texmf/cmextra/cmcsc8.tfm differ diff --git a/text/tex/texmf/cmextra/cmcsc9.tfm b/text/tex/texmf/cmextra/cmcsc9.tfm new file mode 100644 index 0000000000..5fb95055d4 Binary files /dev/null and b/text/tex/texmf/cmextra/cmcsc9.tfm differ diff --git a/text/tex/texmf/cmextra/cmex7.tfm b/text/tex/texmf/cmextra/cmex7.tfm new file mode 100644 index 0000000000..c60f501630 Binary files /dev/null and b/text/tex/texmf/cmextra/cmex7.tfm differ diff --git a/text/tex/texmf/cmextra/cmex8.tfm b/text/tex/texmf/cmextra/cmex8.tfm new file mode 100644 index 0000000000..2ecf4f0fdd Binary files /dev/null and b/text/tex/texmf/cmextra/cmex8.tfm differ diff --git a/text/tex/texmf/cmextra/cmex9.tfm b/text/tex/texmf/cmextra/cmex9.tfm new file mode 100644 index 0000000000..dd0f85b5b2 Binary files /dev/null and b/text/tex/texmf/cmextra/cmex9.tfm differ diff --git a/text/tex/texmf/cmextra/cmmib5.tfm b/text/tex/texmf/cmextra/cmmib5.tfm new file mode 100644 index 0000000000..dfe472947a Binary files /dev/null and b/text/tex/texmf/cmextra/cmmib5.tfm differ diff --git a/text/tex/texmf/cmextra/cmmib6.tfm b/text/tex/texmf/cmextra/cmmib6.tfm new file mode 100644 index 0000000000..60adc1b234 Binary files /dev/null and b/text/tex/texmf/cmextra/cmmib6.tfm differ diff --git a/text/tex/texmf/cmextra/cmmib7.tfm b/text/tex/texmf/cmextra/cmmib7.tfm new file mode 100644 index 0000000000..2beb64507d Binary files /dev/null and b/text/tex/texmf/cmextra/cmmib7.tfm differ diff --git a/text/tex/texmf/cmextra/cmmib8.tfm b/text/tex/texmf/cmextra/cmmib8.tfm new file mode 100644 index 0000000000..b62d4a40dd Binary files /dev/null and b/text/tex/texmf/cmextra/cmmib8.tfm differ diff --git a/text/tex/texmf/cmextra/cmmib9.tfm b/text/tex/texmf/cmextra/cmmib9.tfm new file mode 100644 index 0000000000..d5b99d02c3 Binary files /dev/null and b/text/tex/texmf/cmextra/cmmib9.tfm differ diff --git a/text/tex/texmf/ifluatex.sty b/text/tex/texmf/ifluatex.sty new file mode 100644 index 0000000000..e762e8281f --- /dev/null +++ b/text/tex/texmf/ifluatex.sty @@ -0,0 +1,17 @@ +% Compatibility stub package for ifluatex + +%% LaTeX3 Project +%% +%% This work may be distributed and/or modified under the +%% conditions of the LaTeX Project Public License, either +%% version 1.3c of this license or (at your option) any later +%% version. + +% The original ifluatex package was written by Heiko Oberdiek + +\ifx\RequirePackage\undefined + \input iftex.sty +\else + \ProvidesPackage{ifluatex}[2019/10/25 v1.5 ifluatex legacy package. Use iftex instead.] + \RequirePackage{iftex} +\fi diff --git a/text/tex/texmf/iftex.sty b/text/tex/texmf/iftex.sty new file mode 100644 index 0000000000..600664bd3b --- /dev/null +++ b/text/tex/texmf/iftex.sty @@ -0,0 +1,299 @@ +%% iftex TeX engine tests + +%% LaTeX3 Project +%% +%% This work may be distributed and/or modified under the +%% conditions of the LaTeX Project Public License, either +%% version 1.3c of this license or (at your option) any later +%% version. +%% +%% Using ideas from: +%% +%% ifetex Martin Scharrer +%% ifxetex Will Robertson +%% iftex 0.2 Persian TeX Group / Vafa Khalighi +%% ifluatex ifvtex Heiko Oberdiek +%% ifptex Takayuki YATO +%% ifpdf Heiko Oberdiek and LaTeX3 Project + +% Only load once (not needed in LaTeX, but does no harm). +\csname IFTEX\string @loaded\endcsname +\expandafter\let\csname IFTEX\string @loaded\endcsname\endinput + +% File loadable in initex +% require { } # with standard catcodes. +\catcode123=1 +\catcode125=2 +\catcode35=6 + + +% ProvidesPackage declaration in LaTeX +\begingroup\expandafter\expandafter\expandafter\endgroup +\expandafter\ifx\csname ProvidesPackage\endcsname\relax\else + \ProvidesPackage{iftex}[2024/12/12 v1.0g TeX engine tests] +\fi + +% Save @ catcode, to restore at end, not needed in LaTeX. +\expandafter\chardef\csname IFTEX\string @atcatcode\endcsname\catcode64 +\catcode 64 11 + +% Message format used in several pre-existing if*tex packages +% Modified here to do a hard stop and not show any error context lines. +\def\IFTEX@Require#1#2#3{% + #1\else + \newlinechar 64\relax + \errorcontextlines -1\relax + \immediate\write20{@ + ********************************************@ + * #2 is required to compile this document.@ + * Sorry!@ + ********************************************}% + \batchmode\read -1 to \@tempa + #3% +} + + +% eTeX \protected if available. +\begingroup\expandafter\expandafter\expandafter\endgroup +\expandafter\ifx\csname protected\endcsname\relax + \let\IFTEX@protected\relax +\else + \let\IFTEX@protected\protected +\fi + +% make sure \detokenize and \protected are available in lualatex, +% but avoid defining them after the package if not already defined. + { + \catcode34 12 % " + \catcode40 12 % ( + \catcode41 12 % ) + \catcode44 12 % , + \catcode46 12 % . + \expandafter\ifx\csname directlua\endcsname\relax\else + \directlua{tex.enableprimitives("IFTEX@", {"detokenize","protected"})} + \fi + } + +% \Require... commands that stop if the wrong engine detected. +\IFTEX@protected\def\RequireeTeX{\IFTEX@Require\ifetex{eTeX}\fi} +\IFTEX@protected\def\RequirePDFTeX{\IFTEX@Require\ifpdftex{pdfTeX}\fi} +\IFTEX@protected\def\RequireXeTeX{\IFTEX@Require\ifxetex{XeTeX}\fi} +\IFTEX@protected\def\RequireLuaTeX{\IFTEX@Require\ifluatex{LuaTeX}\fi} +\IFTEX@protected\def\RequireLuaHBTeX{\IFTEX@Require\ifluahbtex{LuaHBTeX}\fi} +\IFTEX@protected\def\RequireLuaMetaTeX{\IFTEX@Require\ifluahbtex{LuaMetaTeX}\fi} +\IFTEX@protected\def\RequirepTeX{\IFTEX@Require\ifptex{pTeX}\fi} +\IFTEX@protected\def\RequireupTeX{\IFTEX@Require\ifuptex{upTeX}\fi} +\IFTEX@protected\def\RequirepTeXng{\IFTEX@Require\ifptexng{pTeX-ng}\fi} +\IFTEX@protected\def\RequireVTeX{\IFTEX@Require\ifvtex{VTeX}\fi} +% alephtex as aleph name too generic +\IFTEX@protected\def\RequireAlephTeX{\IFTEX@Require\ifalephtex{Aleph}\fi} +% tutex == has \Umathchardef == XeTeX or Lua(HB)TeX currently +\IFTEX@protected\def\RequireTUTeX{\IFTEX@Require\iftutex{LuaTeX or XeTeX}\fi} +% TeXpad TeX +\IFTEX@protected\def\RequireTexpadTeX{\IFTEX@Require\iftexpadtex{TexpadTeX}\fi} +% HiTeX/HINT +\IFTEX@protected\def\RequireHINT{\IFTEX@Require\ifhint{HINT}\fi} +% Prote +\IFTEX@protected\def\RequireProte{\IFTEX@Require\ifprote{Prote}\fi} + +% As a matter of policy over-write any existing \if*tex macro and set +% by the tests here. + +% \csname and \let construct useful for hiding \ifzzz tokens from +% outer level \if tests. +\def\IFTEX@let#1#2{% + \expandafter\let\csname if#1\expandafter\endcsname + \csname if#2\endcsname} + +% etex (should always be true in latex based formats) +\begingroup\expandafter\expandafter\expandafter\endgroup +\expandafter\ifx\csname numexpr\endcsname\relax + \IFTEX@let{etex}{false} +\else + \IFTEX@let{etex}{true} +\fi +\IFTEX@let{eTeX}{etex} + +% pdftex (including in dvi mode) +\begingroup\expandafter\expandafter\expandafter\endgroup +\expandafter\ifx\csname pdftexversion\endcsname\relax + \IFTEX@let{pdftex}{false} +\else + \IFTEX@let{pdftex}{true} +\fi +\IFTEX@let{PDFTeX}{pdftex} + +% xetex +\begingroup\expandafter\expandafter\expandafter\endgroup +\expandafter\ifx\csname XeTeXrevision\endcsname\relax + \IFTEX@let{xetex}{false} +\else + \IFTEX@let{xetex}{true} +\fi +\IFTEX@let{XeTeX}{xetex} + + +% luatex (including luahbtex and luametatex) +\begingroup\expandafter\expandafter\expandafter\endgroup +\expandafter\ifx\csname directlua\endcsname\relax + \IFTEX@let{luatex}{false} +\else + \IFTEX@let{luatex}{true} +\fi +\IFTEX@let{LuaTeX}{luatex} + + +% luahbtex (or luatex + luaharfbuzz) +% Use luaharfbuzz test rather than status.luatex_engine=="luahbtex" +% for issue #2. +\IFTEX@let{luahbtex}{false} +\begingroup\expandafter\expandafter\expandafter\endgroup +\expandafter\ifx\csname directlua\endcsname\relax +\else + \directlua{\IFTEX@detokenize{ + if(pcall(require, 'luaharfbuzz')) then + tex.print("\\let\\ifluahbtex\\iftrue ") + end + }} + +\fi +\IFTEX@let{LuaHBTeX}{luahbtex} + + +% luametatex +\begingroup\expandafter\expandafter\expandafter\endgroup +\expandafter\ifx\csname directlua\endcsname\relax + \IFTEX@let{luametatex}{false} +\else + \ifnum\luatexversion<200 + \IFTEX@let{luametatex}{false} + \else + \IFTEX@let{luametatex}{true} + \fi +\fi +\IFTEX@let{LuaMetaTeX}{luametatex} + + +% ptex (including all variants) (note that the ptex command uses uptex in current releases) +\begingroup\expandafter\expandafter\expandafter\endgroup +\expandafter\ifx\csname kanjiskip\endcsname\relax + \IFTEX@let{ptex}{false} +\else + \IFTEX@let{ptex}{true} +\fi +\IFTEX@let{pTeX}{ptex} + +% uptex (including euptex) +\ifx\enablecjktoken \@undefined + \IFTEX@let{uptex}{false} +\else + \IFTEX@let{uptex}{true} +\fi +\IFTEX@let{upTeX}{uptex} + +% ptex-ng +\begingroup\expandafter\expandafter\expandafter\endgroup +\expandafter\ifx\csname ngbanner\endcsname\relax + \IFTEX@let{ptexng}{false} +\else + \IFTEX@let{ptexng}{true} +\fi +\IFTEX@let{pTeXng}{ptexng} + +% vtex +\begingroup\expandafter\expandafter\expandafter\endgroup +\expandafter\ifx\csname VTeXversion\endcsname\relax + \IFTEX@let{vtex}{false} +\else + \IFTEX@let{vtex}{true} +\fi +\IFTEX@let{VTeX}{vtex} + +% aleph +\IFTEX@let{alephtex}{false} +\ifptex\else +\begingroup\expandafter\expandafter\expandafter\endgroup +\expandafter\ifx\csname omathchardef\endcsname\relax +\else + \IFTEX@let{alephtex}{true} +\fi +\fi +\IFTEX@let{AlephTeX}{alephtex} + + +% tutex (LuaTeX or XeTeX) +\begingroup\expandafter\expandafter\expandafter\endgroup +\expandafter\ifx\csname Umathchardef\endcsname\relax + \IFTEX@let{tutex}{false} +\else + \IFTEX@let{tutex}{true} +\fi +\IFTEX@let{TUTeX}{tutex} + + +% texpadtex +\begingroup\expandafter\expandafter\expandafter\endgroup +\expandafter\ifx\csname TexpadTeXMode\endcsname\relax + \IFTEX@let{texpadtex}{false} +\else + \IFTEX@let{texpadtex}{true} + \ifcase\TexpadTeXMode\relax + % This is 8 bit mode + \or + \IFTEX@let{tutex}{true} + \fi +\fi +\IFTEX@let{TexpadTeX}{texpadtex} + +% HiTeX +\begingroup\expandafter\expandafter\expandafter\endgroup +\expandafter\ifx\csname HINTversion\endcsname\relax + \IFTEX@let{hint}{false} +\else + \IFTEX@let{hint}{true} +\fi +\IFTEX@let{HINT}{hint} + +% Prote +\begingroup\expandafter\expandafter\expandafter\endgroup +\expandafter\ifx\csname Proteversion\endcsname\relax + \IFTEX@let{prote}{false} +\else + \IFTEX@let{prote}{true} +\fi +\IFTEX@let{Prote}{prote} + + +% Output mode +% declare as if with \newif +\def\pdftrue{\let\ifpdf\iftrue} +\def\pdffalse{\let\ifpdf\iffalse} +\pdffalse +\ifluatex +\directlua{\IFTEX@detokenize{ +if (tex.outputmode or tex.pdfoutput or 0) > 0 then + tex.print('\\pdftrue') +end +}} +\else +\begingroup\expandafter\expandafter\expandafter\endgroup +\expandafter\ifx\csname pdfoutput\endcsname\relax +\ifvtex + \ifnum\OpMode=3 % + \pdftrue + \fi +\else + \iftexpadtex + \pdftrue + \fi +\fi +\else + \ifnum\pdfoutput>0 % + \pdftrue + \fi +\fi +\fi + + +% restore things +\catcode64 \IFTEX@atcatcode diff --git a/text/tex/texmf/keyval.tex b/text/tex/texmf/keyval.tex new file mode 100644 index 0000000000..fbbdf2e60c --- /dev/null +++ b/text/tex/texmf/keyval.tex @@ -0,0 +1,87 @@ +%% +%% This is file `keyval.tex', +%% generated with the docstrip utility. +%% +%% The original source files were: +%% +%% xkeyval.dtx (with options: `xkvkeyval') +%% +%% --------------------------------------- +%% Copyright (C) 2004-2022 Hendri Adriaens +%% 2025 David Carlisle for latex-package-repositories +%% --------------------------------------- +%% +%% This work may be distributed and/or modified under the +%% conditions of the LaTeX Project Public License, either version 1.3 +%% of this license or (at your option) any later version. +%% The latest version of this license is in +%% http://www.latex-project.org/lppl.txt +%% and version 1.3 or later is part of all distributions of LaTeX +%% version 2003/12/01 or later. +%% +%% This work has the LPPL maintenance status "maintained". +%% +%% This Current Maintainer of this work is Hendri Adriaens. +%% +%% This work consists of the file xkeyval.dtx and derived files +%% keyval.tex, xkvtxhdr.tex, xkeyval.sty, xkeyval.tex, xkvview.sty, +%% xkvltxp.sty, xkvutils.tex, pst-xkey.tex, pst-xkey.sty, xkveca.cls, +%% xkvecb.cls, xkvesa.sty, xkvesb.sty, xkvesc.sty, xkvex1.tex, +%% xkvex2.tex, xkvex3.tex and xkvex4.tex. +%% +%% The following files constitute the xkeyval bundle and must be +%% distributed as a whole: readme, xkeyval.pdf, keyval.tex, +%% pst-xkey.sty, pst-xkey.tex, xkeyval.sty, xkeyval.tex, xkvview.sty, +%% xkvltxp.sty, xkvtxhdr.tex, xkvutils.tex, pst-xkey.dtx and xkeyval.dtx. +%% +%% +%% Based on keyval.sty. +%% +\def\XKV@tempa#1{% +\long\def\KV@@sp@def##1##2{% + \futurelet\XKV@resa\KV@@sp@d##2\@nil\@nil#1\@nil\relax##1}% +\long\def\KV@@sp@d{% + \ifx\XKV@resa\@sptoken + \expandafter\KV@@sp@b + \else + \expandafter\KV@@sp@b\expandafter#1% + \fi}% +\long\def\KV@@sp@b#1##1 \@nil{\KV@@sp@c##1}% + } +\XKV@tempa{ } +\long\def\KV@@sp@c#1\@nil#2\relax#3{\XKV@toks{#1}\edef#3{\the\XKV@toks}} +\long\def\KV@do#1,{% + \ifx\relax#1\@empty\else + \KV@split#1==\relax + \expandafter\KV@do\fi} +\long\def\KV@split#1=#2=#3\relax{% + \KV@@sp@def\XKV@tempa{#1}% + \ifx\XKV@tempa\@empty\else + \expandafter\let\expandafter\XKV@tempc + \csname\KV@prefix\XKV@tempa\endcsname + \ifx\XKV@tempc\relax + \XKV@err{`\XKV@tempa' undefined}% + \else + \ifx\@empty#3\@empty + \KV@default + \else + \KV@@sp@def\XKV@tempb{#2}% + \expandafter\XKV@tempc\expandafter{\XKV@tempb}\relax + \fi + \fi + \fi} +\def\KV@default{% + \expandafter\let\expandafter\XKV@tempb + \csname\KV@prefix\XKV@tempa @default\endcsname + \ifx\XKV@tempb\relax + \XKV@err{No value specified for key `\XKV@tempa'}% + \else + \XKV@tempb\relax + \fi} +\def\KV@def#1#2[#3]{% + \long\@namedef{KV@#1@#2@default\expandafter}\expandafter + {\csname KV@#1@#2\endcsname{#3}}% + \long\@namedef{KV@#1@#2}##1} +\endinput +%% +%% End of file `keyval.tex'. diff --git a/text/tex/texmf/l3backend-dvips.def b/text/tex/texmf/l3backend-dvips.def new file mode 100644 index 0000000000..ac9d82d9df --- /dev/null +++ b/text/tex/texmf/l3backend-dvips.def @@ -0,0 +1,1086 @@ +%% +%% This is file `l3backend-dvips.def', +%% generated with the docstrip utility. +%% +%% The original source files were: +%% +%% l3backend-basics.dtx (with options: `package,dvips') +%% l3backend-color.dtx (with options: `package,dvips') +%% l3backend-box.dtx (with options: `package,dvips') +%% l3backend-draw.dtx (with options: `package,dvips') +%% l3backend-graphics.dtx (with options: `package,dvips') +%% l3backend-pdf.dtx (with options: `package,dvips') +%% l3backend-pdfannot.dtx (with options: `package,dvips') +%% l3backend-opacity.dtx (with options: `package,dvips') +%% +%% Copyright (C) 2019-2025 The LaTeX Project +%% +%% It may be distributed and/or modified under the conditions of +%% the LaTeX Project Public License (LPPL), either version 1.3c of +%% this license or (at your option) any later version. The latest +%% version of this license is in the file: +%% +%% https://www.latex-project.org/lppl.txt +%% +%% This file is part of the "l3backend bundle" (The Work in LPPL) +%% and all files in that bundle must be distributed together. +%% +%% File: l3backend-basics.dtx +\ProvidesExplFile + {l3backend-dvips.def}{2025-10-09}{} + {L3 backend support: dvips} +\cs_if_exist:NTF \__kernel_dependency_version_check:nn + { + \__kernel_dependency_version_check:nn {2023-10-10} + {l3backend-dvips.def} + } + { + \cs_if_exist_use:cF { @latex@error } { \errmessage } + { + Mismatched~LaTeX~support~files~detected. \MessageBreak + Loading~aborted! + } + { \use:c { @ehd } } + \tex_endinput:D + } +\cs_new_eq:NN \__kernel_backend_literal:e \tex_special:D +\cs_new_protected:Npn \__kernel_backend_literal:n #1 + { \__kernel_backend_literal:e { \exp_not:n {#1} } } +\cs_if_exist:NTF \@ifl@t@r + { + \@ifl@t@r \fmtversion { 2020-10-01 } + { + \cs_new_protected:Npn \__kernel_backend_first_shipout:n #1 + { \hook_gput_code:nnn { shipout / firstpage } { l3backend } {#1} } + } + { \cs_new_eq:NN \__kernel_backend_first_shipout:n \AtBeginDvi } + } + { \cs_new_eq:NN \__kernel_backend_first_shipout:n \use:n } +\cs_new_protected:Npn \__kernel_backend_literal_postscript:n #1 + { \__kernel_backend_literal:n { ps:: #1 } } +\cs_generate_variant:Nn \__kernel_backend_literal_postscript:n { e } +\cs_new_protected:Npn \__kernel_backend_postscript:n #1 + { \__kernel_backend_literal:n { ps: SDict ~ begin ~ #1 ~ end } } +\cs_generate_variant:Nn \__kernel_backend_postscript:n { e } +\bool_if:NT \g__kernel_backend_header_bool + { + \__kernel_backend_first_shipout:n + { \__kernel_backend_literal:n { header = l3backend-dvips.pro } } + } +\cs_new_protected:Npn \__kernel_backend_align_begin: + { + \__kernel_backend_literal:n { ps::[begin] } + \__kernel_backend_literal_postscript:n { currentpoint } + \__kernel_backend_literal_postscript:n { currentpoint~translate } + } +\cs_new_protected:Npn \__kernel_backend_align_end: + { + \__kernel_backend_literal_postscript:n { neg~exch~neg~exch~translate } + \__kernel_backend_literal:n { ps::[end] } + } +\cs_new_protected:Npn \__kernel_backend_scope_begin: + { \__kernel_backend_literal:n { ps:gsave } } +\cs_new_protected:Npn \__kernel_backend_scope_end: + { \__kernel_backend_literal:n { ps:grestore } } +%% File: l3backend-color.dtx +\cs_new_protected:Npn \__color_backend_select_cmyk:n #1 + { \__color_backend_select:n { cmyk ~ #1 } } +\cs_new_protected:Npn \__color_backend_select_gray:n #1 + { \__color_backend_select:n { gray ~ #1 } } +\cs_new_protected:Npn \__color_backend_select_named:n #1 + { \__color_backend_select:n { ~ #1 } } +\cs_new_protected:Npn \__color_backend_select_rgb:n #1 + { \__color_backend_select:n { rgb ~ #1 } } +\cs_new_protected:Npn \__color_backend_select:n #1 + { + \__kernel_backend_literal:n { color~push~ #1 } + \__kernel_backend_postscript:n { /color.sc ~ { } ~ def } + } +\cs_new_protected:Npn \__color_backend_reset: + { \__kernel_backend_literal:n { color~pop } } +\prop_new:N \g__color_backend_colorant_prop +\cs_new:Npe \__color_backend_devicen_colorants:n #1 + { + \exp_not:N \tl_if_blank:nF {#1} + { + \c_space_tl + << ~ + /Colorants ~ + << ~ + \exp_not:N \__color_backend_devicen_colorants:w #1 ~ + \exp_not:N \q_recursion_tail \c_space_tl + \exp_not:N \q_recursion_stop + >> ~ + >> + } + } +\cs_new:Npn \__color_backend_devicen_colorants:w #1 ~ + { + \quark_if_recursion_tail_stop:n {#1} + \prop_if_in:NnT \g__color_backend_colorant_prop {#1} + { + #1 ~ + \prop_item:Nn \g__color_backend_colorant_prop {#1} ~ + } + \__color_backend_devicen_colorants:w + } +\cs_new_protected:Npn \__color_backend_select_separation:nn #1#2 + { \__color_backend_select:n { separation ~ #1 ~ #2 } } +\cs_new_eq:NN \__color_backend_select_devicen:nn \__color_backend_select_separation:nn +\cs_new_protected:Npn \__color_backend_select_iccbased:nn #1#2 { } +\cs_new_protected:Npe \__color_backend_separation_init:nnnnn #1#2#3#4#5 + { + \bool_if:NT \g__kernel_backend_header_bool + { + \exp_not:N \exp_args:Ne \__kernel_backend_first_shipout:n + { + \exp_not:N \__color_backend_separation_init_aux:nnnnnn + { \exp_not:N \int_use:N \g__color_model_int } + {#1} {#2} {#3} {#4} {#5} + } + \prop_gput:Nee \exp_not:N \g__color_backend_colorant_prop + { / \exp_not:N \str_convert_pdfname:n {#1} } + { + << ~ + /setcolorspace ~ {} ~ + >> ~ begin ~ + color \exp_not:N \int_use:N \g__color_model_int \c_space_tl + end + } + } + } +\cs_generate_variant:Nn \__color_backend_separation_init:nnnnn { nee } +\cs_new_protected:Npn \__color_backend_separation_init_aux:nnnnnn #1#2#3#4#5#6 + { + \__kernel_backend_literal:e + { + ! + TeXDict ~ begin ~ + /color #1 + { + [ ~ + /Separation ~ ( \str_convert_pdfname:n {#2} ) ~ + [ ~ #3 ~ ] ~ + { + \cs_if_exist_use:cF { __color_backend_separation_init_ #3 :nnn } + { \__color_backend_separation_init:nnn } + {#4} {#5} {#6} + } + ] ~ setcolorspace + } ~ def ~ + end + } + } +\cs_new:cpn { __color_backend_separation_init_ /DeviceCMYK :nnn } #1#2#3 + { \__color_backend_separation_init_Device:Nn 4 {#3} } +\cs_new:cpn { __color_backend_separation_init_ /DeviceGray :nnn } #1#2#3 + { \__color_backend_separation_init_Device:Nn 1 {#3} } +\cs_new:cpn { __color_backend_separation_init_ /DeviceRGB :nnn } #1#2#3 + { \__color_backend_separation_init_Device:Nn 2 {#3} } +\cs_new:Npn \__color_backend_separation_init_Device:Nn #1#2 + { + #2 ~ + \prg_replicate:nn {#1} + { #1 ~ index ~ mul ~ #1 ~ 1 ~ roll ~ } + \int_eval:n { #1 + 1 } ~ -1 ~ roll ~ pop + } +\cs_new:Npn \__color_backend_separation_init:nnn #1#2#3 + { + \exp_args:Ne \__color_backend_separation_init:nnnn + { \__color_backend_separation_init_count:n {#2} } + {#1} {#2} {#3} + } +\cs_new:Npn \__color_backend_separation_init_count:n #1 + { \int_eval:n { 0 \__color_backend_separation_init_count:w #1 ~ \s__color_stop } } +\cs_new:Npn \__color_backend_separation_init_count:w #1 ~ #2 \s__color_stop + { + +1 + \tl_if_blank:nF {#2} + { \__color_backend_separation_init_count:w #2 \s__color_stop } + } +\cs_new:Npn \__color_backend_separation_init:nnnn #1#2#3#4 + { + \__color_backend_separation_init:w #3 ~ \s__color_stop #4 ~ \s__color_stop + \prg_replicate:nn {#1} + { + pop ~ 1 ~ index ~ neg ~ 1 ~ index ~ add ~ + \int_eval:n { 3 * #1 } ~ index ~ mul ~ + 2 ~ index ~ add ~ + \int_eval:n { 3 * #1 } ~ #1 ~ roll ~ + } + \int_step_function:nnnN {#1} { -1 } { 1 } + \__color_backend_separation_init:n + \int_eval:n { 4 * #1 + 1 } ~ #1 ~ roll ~ + \prg_replicate:nn { 3 * #1 + 1 } { pop ~ } + \tl_if_blank:nF {#2} + { \__color_backend_separation_init:nw {#1} #2 ~ \s__color_stop } + } +\cs_new:Npn \__color_backend_separation_init:w + #1 ~ #2 \s__color_stop #3 ~ #4 \s__color_stop + { + #1 ~ #3 ~ 0 ~ + \tl_if_blank:nF {#2} + { \__color_backend_separation_init:w #2 \s__color_stop #4 \s__color_stop } + } +\cs_new:Npn \__color_backend_separation_init:n #1 + { \int_eval:n { #1 * 2 } ~ index ~ } +\cs_new:Npn \__color_backend_separation_init:nw #1#2 ~ #3 ~ #4 \s__color_stop + { + #2 ~ #3 ~ + 2 ~ index ~ 2 ~ index ~ lt ~ + { ~ pop ~ exch ~ pop ~ } ~ + { ~ + 2 ~ index ~ 1 ~ index ~ gt ~ + { ~ exch ~ pop ~ exch ~ pop ~ } ~ + { ~ pop ~ pop ~ } ~ + ifelse ~ + } + ifelse ~ + #1 ~ 1 ~ roll ~ + \tl_if_blank:nF {#4} + { \__color_backend_separation_init:nw {#1} #4 \s__color_stop } + } +\cs_new_protected:Npn \__color_backend_separation_init_CIELAB:nnn #1#2#3 + { + \__color_backend_separation_init:neenn + {#2} + { + /CIEBasedABC ~ + << ~ + /RangeABC ~ [ ~ \c__color_model_range_CIELAB_tl \c_space_tl ] ~ + /DecodeABC ~ + [ ~ + { ~ 16 ~ add ~ 116 ~ div ~ } ~ bind ~ + { ~ 500 ~ div ~ } ~ bind ~ + { ~ 200 ~ div ~ } ~ bind ~ + ] ~ + /MatrixABC ~ [ ~ 1 ~ 1 ~ 1 ~ 1 ~ 0 ~ 0 ~ 0 ~ 0 ~ -1 ~ ] ~ + /DecodeLMN ~ + [ ~ + { ~ + dup ~ 6 ~ 29 ~ div ~ ge ~ + { ~ dup ~ dup ~ mul ~ mul ~ ~ } ~ + { ~ 4 ~ 29 ~ div ~ sub ~ 108 ~ 841 ~ div ~ mul ~ } ~ + ifelse ~ + 0.9505 ~ mul ~ + } ~ bind ~ + { ~ + dup ~ 6 ~ 29 ~ div ~ ge ~ + { ~ dup ~ dup ~ mul ~ mul ~ } ~ + { ~ 4 ~ 29 ~ div ~ sub ~ 108 ~ 841 ~ div ~ mul ~ } ~ + ifelse ~ + } ~ bind ~ + { ~ + dup ~ 6 ~ 29 ~ div ~ ge ~ + { ~ dup ~ dup ~ mul ~ mul ~ } ~ + { ~ 4 ~ 29 ~ div ~ sub ~ 108 ~ 841 ~ div ~ mul ~ } ~ + ifelse ~ + 1.0890 ~ mul ~ + } ~ bind + ] ~ + /WhitePoint ~ + [ ~ \tl_use:c { c__color_model_whitepoint_CIELAB_ #1 _tl } ~ ] ~ + >> + } + { \c__color_model_range_CIELAB_tl } + { 100 ~ 0 ~ 0 } + {#3} + } +\cs_new_protected:Npn \__color_backend_devicen_init:nnn #1#2#3 + { + \__kernel_backend_literal:e + { + ! + TeXDict ~ begin ~ + /color \int_use:N \g__color_model_int + { + [ ~ + /DeviceN ~ + [ ~ #1 ~ ] ~ + #2 ~ + { ~ #3 ~ } ~ + \__color_backend_devicen_colorants:n {#1} + ] ~ setcolorspace + } ~ def ~ + end + } + } +\cs_new_protected:Npn \__color_backend_iccbased_init:nnn #1#2#3 { } +\cs_new_protected:Npn \__color_backend_fill_cmyk:n #1 + { \__color_backend_fill:n { cmyk ~ #1 } } +\cs_new_protected:Npn \__color_backend_fill_gray:n #1 + { \__color_backend_fill:n { gray ~ #1 } } +\cs_new_protected:Npn \__color_backend_fill_rgb:n #1 + { \__color_backend_fill:n { rgb ~ #1 } } +\cs_new_protected:Npn \__color_backend_fill:n #1 + { + \__kernel_backend_literal:n { color~push~ #1 } + } +\cs_new_protected:Npn \__color_backend_stroke_cmyk:n #1 + { \__kernel_backend_postscript:n { /color.sc { #1 ~ setcmykcolor } def } } +\cs_new_protected:Npn \__color_backend_stroke_gray:n #1 + { \__kernel_backend_postscript:n { /color.sc { #1 ~ setgray } def } } +\cs_new_protected:Npn \__color_backend_stroke_rgb:n #1 + { \__kernel_backend_postscript:n { /color.sc { #1 ~ setrgbcolor } def } } +\cs_new_protected:Npn \__color_backend_fill_separation:nn #1#2 + { \__color_backend_fill:n { separation ~ #1 ~ #2 } } +\cs_new_protected:Npn \__color_backend_stroke_separation:nn #1#2 + { \__kernel_backend_postscript:n { /color.sc { separation ~ #1 ~ #2 } def } } +\cs_new_eq:NN \__color_backend_fill_devicen:nn \__color_backend_fill_separation:nn +\cs_new_eq:NN \__color_backend_stroke_devicen:nn \__color_backend_stroke_separation:nn +\cs_new_eq:NN \__color_backend_fill_reset: \__color_backend_reset: +\cs_new_protected:Npn \__color_backend_stroke_reset: { } +%% File: l3backend-box.dtx +\cs_new_protected:Npn \__box_backend_clip:N #1 + { + \__kernel_backend_scope_begin: + \__kernel_backend_align_begin: + \__kernel_backend_literal_postscript:n { matrix~currentmatrix } + \__kernel_backend_literal_postscript:n + { Resolution~72~div~VResolution~72~div~scale } + \__kernel_backend_literal_postscript:n { DVImag~dup~scale } + \__kernel_backend_literal_postscript:e + { + 0 ~ + \dim_to_decimal_in_bp:n { \box_dp:N #1 } ~ + \dim_to_decimal_in_bp:n { \box_wd:N #1 } ~ + \dim_to_decimal_in_bp:n { -\box_ht:N #1 - \box_dp:N #1 } ~ + rectclip + } + \__kernel_backend_literal_postscript:n { setmatrix } + \__kernel_backend_align_end: + \hbox_overlap_right:n { \box_use:N #1 } + \__kernel_backend_scope_end: + \skip_horizontal:n { \box_wd:N #1 } + } +\cs_new_protected:Npn \__box_backend_rotate:Nn #1#2 + { \exp_args:NNf \__box_backend_rotate_aux:Nn #1 { \fp_eval:n {#2} } } +\cs_new_protected:Npn \__box_backend_rotate_aux:Nn #1#2 + { + \__kernel_backend_scope_begin: + \__kernel_backend_align_begin: + \__kernel_backend_literal_postscript:e + { + \fp_compare:nNnTF {#2} = \c_zero_fp + { 0 } + { \fp_eval:n { round ( -(#2) , 5 ) } } ~ + rotate + } + \__kernel_backend_align_end: + \box_use:N #1 + \__kernel_backend_scope_end: + } +\cs_new_protected:Npn \__box_backend_scale:Nnn #1#2#3 + { + \__kernel_backend_scope_begin: + \__kernel_backend_align_begin: + \__kernel_backend_literal_postscript:e + { + \fp_eval:n { round ( #2 , 5 ) } ~ + \fp_eval:n { round ( #3 , 5 ) } ~ + scale + } + \__kernel_backend_align_end: + \hbox_overlap_right:n { \box_use:N #1 } + \__kernel_backend_scope_end: + } +%% File: l3backend-draw.dtx +\cs_new_eq:NN \__draw_backend_literal:n \__kernel_backend_literal_postscript:n +\cs_generate_variant:Nn \__draw_backend_literal:n { e } +\cs_new_protected:Npn \__draw_backend_begin: + { + \__draw_backend_literal:n { [begin] } + \__draw_backend_literal:n { /draw.x~currentpoint~/draw.y~exch~def~def } + \__draw_backend_literal:n { @beginspecial } + } +\cs_new_protected:Npn \__draw_backend_end: + { + \__draw_backend_literal:n { @endspecial } + \__draw_backend_literal:n { [end] } + } +\cs_new_protected:Npn \__draw_backend_scope_begin: + { \__draw_backend_literal:n { save } } +\cs_new_protected:Npn \__draw_backend_scope_end: + { \__draw_backend_literal:n { restore } } +\cs_new_protected:Npn \__draw_backend_moveto:nn #1#2 + { + \__draw_backend_literal:e + { + \dim_to_decimal_in_bp:n {#1} ~ + \dim_to_decimal_in_bp:n {#2} ~ moveto + } + } +\cs_new_protected:Npn \__draw_backend_lineto:nn #1#2 + { + \__draw_backend_literal:e + { + \dim_to_decimal_in_bp:n {#1} ~ + \dim_to_decimal_in_bp:n {#2} ~ lineto + } + } +\cs_new_protected:Npn \__draw_backend_rectangle:nnnn #1#2#3#4 + { + \__draw_backend_literal:e + { + \dim_to_decimal_in_bp:n {#4} ~ \dim_to_decimal_in_bp:n {#3} ~ + \dim_to_decimal_in_bp:n {#1} ~ \dim_to_decimal_in_bp:n {#2} ~ + moveto~dup~0~rlineto~exch~0~exch~rlineto~neg~0~rlineto~closepath + } + } +\cs_new_protected:Npn \__draw_backend_curveto:nnnnnn #1#2#3#4#5#6 + { + \__draw_backend_literal:e + { + \dim_to_decimal_in_bp:n {#1} ~ \dim_to_decimal_in_bp:n {#2} ~ + \dim_to_decimal_in_bp:n {#3} ~ \dim_to_decimal_in_bp:n {#4} ~ + \dim_to_decimal_in_bp:n {#5} ~ \dim_to_decimal_in_bp:n {#6} ~ + curveto + } + } +\cs_new_protected:Npn \__draw_backend_evenodd_rule: + { \bool_gset_true:N \g__draw_draw_eor_bool } +\cs_new_protected:Npn \__draw_backend_nonzero_rule: + { \bool_gset_false:N \g__draw_draw_eor_bool } +\bool_new:N \g__draw_draw_eor_bool +\cs_new_protected:Npn \__draw_backend_closepath: + { \__draw_backend_literal:n { closepath } } +\cs_new_protected:Npn \__draw_backend_stroke: + { + \__draw_backend_literal:n { gsave } + \__draw_backend_literal:n { color.sc } + \__draw_backend_literal:n { stroke } + \__draw_backend_literal:n { grestore } + \bool_if:NT \g__draw_draw_clip_bool + { + \__draw_backend_literal:e + { + \bool_if:NT \g__draw_draw_eor_bool { eo } + clip + } + } + \__draw_backend_literal:n { newpath } + \bool_gset_false:N \g__draw_draw_clip_bool + } +\cs_new_protected:Npn \__draw_backend_closestroke: + { + \__draw_backend_closepath: + \__draw_backend_stroke: + } +\cs_new_protected:Npn \__draw_backend_fill: + { + \__draw_backend_literal:e + { + \bool_if:NT \g__draw_draw_eor_bool { eo } + fill + } + \bool_if:NT \g__draw_draw_clip_bool + { + \__draw_backend_literal:e + { + \bool_if:NT \g__draw_draw_eor_bool { eo } + clip + } + } + \__draw_backend_literal:n { newpath } + \bool_gset_false:N \g__draw_draw_clip_bool + } +\cs_new_protected:Npn \__draw_backend_fillstroke: + { + \__draw_backend_literal:e + { + \bool_if:NT \g__draw_draw_eor_bool { eo } + fill + } + \__draw_backend_literal:n { gsave } + \__draw_backend_literal:n { color.sc } + \__draw_backend_literal:n { stroke } + \__draw_backend_literal:n { grestore } + \bool_if:NT \g__draw_draw_clip_bool + { + \__draw_backend_literal:e + { + \bool_if:NT \g__draw_draw_eor_bool { eo } + clip + } + } + \__draw_backend_literal:n { newpath } + \bool_gset_false:N \g__draw_draw_clip_bool + } +\cs_new_protected:Npn \__draw_backend_clip: + { \bool_gset_true:N \g__draw_draw_clip_bool } +\bool_new:N \g__draw_draw_clip_bool +\cs_new_protected:Npn \__draw_backend_discardpath: + { + \bool_if:NT \g__draw_draw_clip_bool + { + \__draw_backend_literal:e + { + \bool_if:NT \g__draw_draw_eor_bool { eo } + clip + } + } + \__draw_backend_literal:n { newpath } + \bool_gset_false:N \g__draw_draw_clip_bool + } +\cs_new_protected:Npn \__draw_backend_dash_pattern:nn #1#2 + { + \__draw_backend_literal:e + { + [ + \exp_args:Nf \use:n + { \clist_map_function:nN {#1} \__draw_backend_dash:n } + ] ~ + \dim_to_decimal_in_bp:n {#2} ~ setdash + } + } +\cs_new:Npn \__draw_backend_dash:n #1 + { ~ \dim_to_decimal_in_bp:n {#1} } +\cs_new_protected:Npn \__draw_backend_linewidth:n #1 + { + \__draw_backend_literal:e + { \dim_to_decimal_in_bp:n {#1} ~ setlinewidth } + } +\cs_new_protected:Npn \__draw_backend_miterlimit:n #1 + { \__draw_backend_literal:n { #1 ~ setmiterlimit } } +\cs_new_protected:Npn \__draw_backend_cap_butt: + { \__draw_backend_literal:n { 0 ~ setlinecap } } +\cs_new_protected:Npn \__draw_backend_cap_round: + { \__draw_backend_literal:n { 1 ~ setlinecap } } +\cs_new_protected:Npn \__draw_backend_cap_rectangle: + { \__draw_backend_literal:n { 2 ~ setlinecap } } +\cs_new_protected:Npn \__draw_backend_join_miter: + { \__draw_backend_literal:n { 0 ~ setlinejoin } } +\cs_new_protected:Npn \__draw_backend_join_round: + { \__draw_backend_literal:n { 1 ~ setlinejoin } } +\cs_new_protected:Npn \__draw_backend_join_bevel: + { \__draw_backend_literal:n { 2 ~ setlinejoin } } +\cs_new_protected:Npn \__draw_backend_transform:nnnn #1#2#3#4 + { + \__draw_backend_literal:n + { [ #1 ~ #2 ~ #3 ~ #4 ~ 0 ~ 0 ] ~ concat } + } +\cs_new_protected:Npn \__draw_backend_shift:nn #1#2 + { + \__draw_backend_literal:n + { [ 1 ~ 0 ~ 0 ~ 1 ~ #1 ~ #2 ] ~ concat } + } +\cs_new_protected:Npn \__draw_backend_box_use:Nnnnn #1#2#3#4#5 + { + \__draw_backend_literal:n { save } + \__draw_backend_literal:n { 72~Resolution~div~72~VResolution~div~neg~scale } + \__draw_backend_literal:n { magscale { 1~DVImag~div~dup~scale } if } + \__draw_backend_literal:n { draw.x~neg~draw.y~neg~translate } + \__draw_backend_literal:n { [end] } + \__draw_backend_literal:n { [begin] } + \__draw_backend_literal:n { save } + \__draw_backend_literal:n { currentpoint } + \__draw_backend_literal:n { currentpoint~translate } + \__draw_backend_transform:nnnn { 1 } { 0 } { 0 } { -1 } + \__draw_backend_transform:nnnn {#2} {#3} {#4} {#5} + \__draw_backend_transform:nnnn { 1 } { 0 } { 0 } { -1 } + \__draw_backend_literal:n { neg~exch~neg~exch~translate } + \__draw_backend_literal:n { [end] } + \hbox_overlap_right:n { \box_use:N #1 } + \__draw_backend_literal:n { [begin] } + \__draw_backend_literal:n { restore } + \__draw_backend_literal:n { [end] } + \__draw_backend_literal:n { [begin] } + \__draw_backend_literal:n { restore } + } +%% File: l3backend-graphics.dtx +\seq_set_from_clist:Nn \l_graphics_search_ext_seq { .eps , .ps } +\cs_new_eq:NN \__graphics_backend_getbb_eps:n \__graphics_read_bb:n +\cs_new_eq:NN \__graphics_backend_getbb_ps:n \__graphics_read_bb:n +\cs_new_protected:Npn \__graphics_backend_include_eps:n #1 + { + \__kernel_backend_literal:e + { + PSfile = #1 \c_space_tl + llx = \dim_to_decimal_in_bp:n \l__graphics_llx_dim \c_space_tl + lly = \dim_to_decimal_in_bp:n \l__graphics_lly_dim \c_space_tl + urx = \dim_to_decimal_in_bp:n \l__graphics_urx_dim \c_space_tl + ury = \dim_to_decimal_in_bp:n \l__graphics_ury_dim + } + } +\cs_new_eq:NN \__graphics_backend_include_ps:n \__graphics_backend_include_eps:n +\cs_new_eq:NN \__graphics_backend_get_pagecount:n \__graphics_get_pagecount:n +%% File: l3backend-pdf.dtx +\cs_new_protected:Npn \__pdf_backend_pdfmark:n #1 + { \__kernel_backend_postscript:n { mark #1 ~ pdfmark } } +\cs_generate_variant:Nn \__pdf_backend_pdfmark:n { e } +\cs_new_protected:Npn \__pdf_backend_catalog_gput:nn #1#2 + { \__pdf_backend_pdfmark:n { { Catalog } << /#1 ~ #2 >> /PUT } } +\cs_new_protected:Npn \__pdf_backend_info_gput:nn #1#2 + { \__pdf_backend_pdfmark:n { /#1 ~ #2 /DOCINFO } } +\cs_new_protected:Npn \__pdf_backend_object_new: + { \int_gincr:N \g__pdf_backend_object_int } +\cs_new:Npn \__pdf_backend_object_ref:n #1 { { pdf.obj #1 } } +\cs_new_eq:NN \__pdf_backend_object_id:n \__pdf_backend_object_ref:n +\cs_new_protected:Npn \__pdf_backend_object_write:nnn #1#2#3 + { + \__pdf_backend_object_write_aux:nnn + { \__pdf_backend_object_ref:n {#1} } + {#2} {#3} + } +\cs_generate_variant:Nn \__pdf_backend_object_write:nnn { nne } +\cs_new_protected:Npn \__pdf_backend_object_write_aux:nnn #1#2#3 + { + \__pdf_backend_pdfmark:e + { + /_objdef ~ #1 + /type + \str_case:nn {#2} + { + { array } { /array } + { dict } { /dict } + { fstream } { /stream } + { stream } { /stream } + } + /OBJ + } + \use:c { __pdf_backend_object_write_ #2 :nn } {#1} {#3} + } +\cs_new_protected:Npn \__pdf_backend_object_write_array:nn #1#2 + { + \__pdf_backend_pdfmark:e + { #1 ~0~ [ ~ \exp_not:n {#2} ~ ] ~ /PUTINTERVAL } + } +\cs_new_protected:Npn \__pdf_backend_object_write_dict:nn #1#2 + { + \__pdf_backend_pdfmark:e + { #1 << \exp_not:n {#2} >> /PUT } + } +\cs_new_protected:Npn \__pdf_backend_object_write_fstream:nn #1#2 + { + \exp_args:Ne + \__pdf_backend_object_write_fstream:nnn {#1} #2 + } +\cs_new_protected:Npn \__pdf_backend_object_write_fstream:nnn #1#2#3 + { + \__kernel_backend_postscript:n + { + SDict ~ begin ~ + mark ~ #1 ~ << #2 >> /PUT ~ pdfmark ~ + mark ~ #1 ~ ( #3 )~ ( r )~ file ~ /PUT ~ pdfmark ~ + end + } + } +\cs_new_protected:Npn \__pdf_backend_object_write_stream:nn #1#2 + { + \exp_args:Ne + \__pdf_backend_object_write_stream:nnn {#1} #2 + } +\cs_new_protected:Npn \__pdf_backend_object_write_stream:nnn #1#2#3 + { + \__kernel_backend_postscript:n + { + mark ~ #1 ~ ( #3 ) /PUT ~ pdfmark ~ + mark ~ #1 ~ << #2 >> /PUT ~ pdfmark + } + } +\cs_new_protected:Npn \__pdf_backend_object_now:nn #1#2 + { + \int_gincr:N \g__pdf_backend_object_int + \__pdf_backend_object_write_aux:nnn + { { pdf.obj \int_use:N \g__pdf_backend_object_int } } + {#1} {#2} + } +\cs_generate_variant:Nn \__pdf_backend_object_now:nn { ne } +\cs_new:Npn \__pdf_backend_object_last: + { { pdf.obj \int_use:N \g__pdf_backend_object_int } } +\cs_new:Npn \__pdf_backend_pageobject_ref:n #1 + { { Page #1 } } +\cs_new_protected:Npn \__pdf_backend_destination:nn #1#2 + { + \__kernel_backend_postscript:n { pdf.dest.anchor } + \__pdf_backend_pdfmark:e + { + /View + [ + \str_case:nnF {#2} + { + { xyz } { /XYZ ~ pdf.dest.point ~ null } + { fit } { /Fit } + { fitb } { /FitB } + { fitbh } { /FitBH ~ pdf.dest.y } + { fitbv } { /FitBV ~ pdf.dest.x } + { fith } { /FitH ~ pdf.dest.y } + { fitv } { /FitV ~ pdf.dest.x } + { fitr } { /Fit } + } + { + /XYZ ~ pdf.dest.point ~ \fp_eval:n { (#2) / 100 } + } + ] + /Dest ( \exp_not:n {#1} ) cvn + /DEST + } + } +\cs_new_protected:Npn \__pdf_backend_destination:nnnn #1#2#3#4 + { + \exp_args:Ne \__pdf_backend_destination_aux:nnnn + { \dim_eval:n {#2} } {#1} {#3} {#4} + } +\cs_new_protected:Npn \__pdf_backend_destination_aux:nnnn #1#2#3#4 + { + \vbox_to_zero:n + { + \__kernel_kern:n {#4} + \hbox:n { \__kernel_backend_postscript:n { pdf.save.ll } } + \tex_vss:D + } + \__kernel_kern:n {#1} + \vbox_to_zero:n + { + \__kernel_kern:n { -#3 } + \hbox:n { \__kernel_backend_postscript:n { pdf.save.ur } } + \tex_vss:D + } + \__kernel_kern:n { -#1 } + \__pdf_backend_pdfmark:n + { + /View + [ + /FitR ~ + pdf.llx ~ pdf.lly ~ pdf.dest2device ~ + pdf.urx ~ pdf.ury ~ pdf.dest2device + ] + /Dest ( #2 ) cvn + /DEST + } + } +\cs_new_protected:Npn \__pdf_backend_compresslevel:n #1 + { + \int_compare:nNnT {#1} = 0 + { + \__kernel_backend_literal_postscript:n + { + /setdistillerparams ~ where + { pop << /CompressPages ~ false >> setdistillerparams } + if + } + } + } +\cs_new_protected:Npn \__pdf_backend_compress_objects:n #1 + { + \bool_if:nF {#1} + { + \__kernel_backend_literal_postscript:n + { + /setdistillerparams ~ where + { pop << /CompressStreams ~ false >> setdistillerparams } + if + } + } + } +\cs_new_protected:Npn \__pdf_backend_version_major_gset:n #1 + { + \cs_gset:Npe \__pdf_backend_version_major: { \int_eval:n {#1} } + } +\cs_new_protected:Npn \__pdf_backend_version_minor_gset:n #1 + { + \cs_gset:Npe \__pdf_backend_version_minor: { \int_eval:n {#1} } + } +\cs_new:Npn \__pdf_backend_version_major: { -1 } +\cs_new:Npn \__pdf_backend_version_minor: { -1 } +\cs_new_protected:Npn \__pdf_backend_bdc:nn #1#2 + { \__pdf_backend_pdfmark:n { /#1 ~ #2 /BDC } } +\cs_new_protected:Npn \__pdf_backend_emc: + { \__pdf_backend_pdfmark:n { /EMC } } +\cs_new_protected:Npn \__pdf_backend_pagesize_gset:nn #1#2 + { + \__kernel_backend_first_shipout:n + { + \__kernel_backend_literal:e + { + papersize = \dim_eval:n {#1} , \dim_eval:n {#2} + } + } + } +%% File: l3backend-pdfannot.dtx +\box_new:N \l__pdfannot_backend_content_box +\box_new:N \l__pdfannot_backend_model_box +\int_new:N \g__pdfannot_backend_int +\cs_new_protected:Npn \__pdfannot_backend_generic:nnnn #1#2#3#4 + { + \exp_args:Nf \__pdfannot_backend_generic_aux:nnnn + { \dim_eval:n {#1} } {#2} {#3} {#4} + } +\cs_new_protected:Npn \__pdfannot_backend_generic_aux:nnnn #1#2#3#4 + { + \box_move_down:nn {#3} + { \hbox:n { \__kernel_backend_postscript:n { pdf.save.ll } } } + \box_move_up:nn {#2} + { + \hbox:n + { + \__kernel_kern:n {#1} + \__kernel_backend_postscript:n { pdf.save.ur } + \__kernel_kern:n { -#1 } + } + } + \int_gincr:N \g__pdfannot_backend_int + \__kernel_backend_postscript:e + { + mark + /_objdef { pdf.annot \int_use:N \g__pdfannot_backend_int } + pdf.rect + #4 ~ + /ANN ~ + pdfmark + } + } +\cs_new:Npn \__pdfannot_backend_last: + { { pdf.annot \int_use:N \g__pdfannot_backend_int } } +\int_new:N \g__pdfannot_backend_link_int +\tl_new:N \g__pdfannot_backend_link_dict_tl +\int_new:N \g__pdfannot_backend_link_sf_int +\bool_new:N \g__pdfannot_backend_link_math_bool +\bool_new:N \g__pdfannot_backend_link_bool +\tl_new:N \l__pdfannot_backend_breaklink_pdfmark_tl +\tl_set:Nn \l__pdfannot_backend_breaklink_pdfmark_tl { pdfmark } +\cs_new_protected:Npn \__pdfannot_backend_breaklink_postscript:n #1 { } +\cs_new_eq:NN \__pdfannot_backend_breaklink_usebox:N \box_use:N +\cs_new_protected:Npn \__pdfannot_backend_link_begin_goto:nnw #1#2 + { + \__pdfannot_backend_link_begin:nw + { #1 /Subtype /Link /Action << /S /GoTo /D ( #2 ) >> } + } +\cs_new_protected:Npn \__pdfannot_backend_link_begin_user:nnw #1#2 + { \__pdfannot_backend_link_begin:nw {#1#2} } +\cs_new_protected:Npn \__pdfannot_backend_link_begin:nw #1 + { + \bool_if:NF \g__pdfannot_backend_link_bool + { \__pdfannot_backend_link_begin_aux:nw {#1} } + } +\cs_new_protected:Npn \__pdfannot_backend_link_begin_aux:nw #1 + { + \bool_gset_true:N \g__pdfannot_backend_link_bool + \__kernel_backend_postscript:n + { /pdf.link.dict ( #1 ) def } + \tl_gset:Nn \g__pdfannot_backend_link_dict_tl {#1} + \__pdfannot_backend_link_sf_save: + \mode_if_math:TF + { \bool_gset_true:N \g__pdfannot_backend_link_math_bool } + { \bool_gset_false:N \g__pdfannot_backend_link_math_bool } + \hbox_set:Nw \l__pdfannot_backend_content_box + \__pdfannot_backend_link_sf_restore: + \bool_if:NT \g__pdfannot_backend_link_math_bool + { \c_math_toggle_token } + } +\cs_new_protected:Npn \__pdfannot_backend_link_end: + { + \bool_if:NT \g__pdfannot_backend_link_bool + { \__pdfannot_backend_link_end_aux: } + } +\cs_new_protected:Npn \__pdfannot_backend_link_end_aux: + { + \bool_if:NT \g__pdfannot_backend_link_math_bool + { \c_math_toggle_token } + \__pdfannot_backend_link_sf_save: + \hbox_set_end: + \__pdfannot_backend_link_minima: + \hbox_set:Nn \l__pdfannot_backend_model_box { Gg } + \exp_args:Ne \__pdfannot_backend_link_outerbox:n + { + \int_if_odd:nTF { \value { page } } + { \oddsidemargin } + { \evensidemargin } + } + \box_move_down:nn { \box_dp:N \l__pdfannot_backend_content_box } + { \hbox:n { \__kernel_backend_postscript:n { pdf.save.linkll } } } + \__pdfannot_backend_breaklink_postscript:n { pdf.bordertracking.begin } + \__pdfannot_backend_breaklink_usebox:N \l__pdfannot_backend_content_box + \__pdfannot_backend_breaklink_postscript:n { pdf.bordertracking.end } + \box_move_up:nn { \box_ht:N \l__pdfannot_backend_content_box } + { + \hbox:n + { \__kernel_backend_postscript:n { pdf.save.linkur } } + } + \int_gincr:N \g__pdfannot_backend_int + \int_gset_eq:NN \g__pdfannot_backend_link_int \g__pdfannot_backend_int + \__kernel_backend_postscript:e + { + mark + /_objdef { pdf.annot \int_use:N \g__pdfannot_backend_link_int } + \g__pdfannot_backend_link_dict_tl \c_space_tl + pdf.rect + /ANN ~ \l__pdfannot_backend_breaklink_pdfmark_tl + } + \__pdfannot_backend_link_sf_restore: + \bool_gset_false:N \g__pdfannot_backend_link_bool + } +\cs_new_protected:Npn \__pdfannot_backend_link_minima: + { + \hbox_set:Nn \l__pdfannot_backend_model_box { Gg } + \__kernel_backend_postscript:e + { + /pdf.linkdp.pad ~ + \dim_to_decimal:n + { + \dim_max:nn + { + \box_dp:N \l__pdfannot_backend_model_box + - \box_dp:N \l__pdfannot_backend_content_box + } + { 0pt } + } ~ + pdf.pt.dvi ~ def + /pdf.linkht.pad ~ + \dim_to_decimal:n + { + \dim_max:nn + { + \box_ht:N \l__pdfannot_backend_model_box + - \box_ht:N \l__pdfannot_backend_content_box + } + { 0pt } + } ~ + pdf.pt.dvi ~ def + } + } +\cs_new_protected:Npn \__pdfannot_backend_link_outerbox:n #1 + { + \__kernel_backend_postscript:e + { + /pdf.outerbox + [ + \dim_to_decimal:n {#1} ~ + \dim_to_decimal:n { -\box_dp:N \l__pdfannot_backend_model_box } ~ + \dim_to_decimal:n { #1 + \textwidth } ~ + \dim_to_decimal:n { \box_ht:N \l__pdfannot_backend_model_box } + ] + [ exch { pdf.pt.dvi } forall ] def + /pdf.baselineskip ~ + \dim_to_decimal:n { \tex_baselineskip:D } ~ dup ~ 0 ~ gt + { pdf.pt.dvi ~ def } + { pop ~ pop } + ifelse + } + } +\cs_new_protected:Npn \__pdfannot_backend_link_sf_save: + { + \int_gset:Nn \g__pdfannot_backend_link_sf_int + { + \mode_if_horizontal:TF + { \tex_spacefactor:D } + { 0 } + } + } +\cs_new_protected:Npn \__pdfannot_backend_link_sf_restore: + { + \mode_if_horizontal:T + { + \int_compare:nNnT \g__pdfannot_backend_link_sf_int > { 0 } + { \int_set:Nn \tex_spacefactor:D \g__pdfannot_backend_link_sf_int } + } + } +\use_none:nnn +\cs_if_exist:NT \hook_gput_code:nnn + { + \hook_gput_code:nnn { build/column/after } { backend } + { + \box_if_empty:NF \l_shipout_box + { + \vbox_set:Nn \l_shipout_box + { + \__kernel_backend_postscript:n + { + pdf.globaldict /pdf.brokenlink.rect ~ known + { pdf.bordertracking.continue } + if + } + \vbox_unpack_drop:N \l_shipout_box + \__kernel_backend_postscript:n + { pdf.bordertracking.endpage } + } + } + } + \tl_set:Nn \l__pdfannot_backend_breaklink_pdfmark_tl { pdf.pdfmark } + \cs_set_eq:NN \__pdfannot_backend_breaklink_postscript:n + \__kernel_backend_postscript:n + \cs_set_eq:NN \__pdfannot_backend_breaklink_usebox:N \hbox_unpack:N + } +\cs_new:Npn \__pdfannot_backend_link_last: + { { pdf.annot \int_use:N \g__pdfannot_backend_link_int } } +\cs_new_protected:Npn \__pdfannot_backend_link_margin:n #1 + { + \__kernel_backend_postscript:e + { + /pdf.linkmargin { \dim_to_decimal:n {#1} ~ pdf.pt.dvi } def + } + } +\cs_new_protected:Npn \__pdfannot_backend_link_on: { } +\cs_new_protected:Npn \__pdfannot_backend_link_off: { } +\cs_new_eq:NN \__pdf_backend_annotation:nnnn \__pdfannot_backend_generic:nnnn +\cs_new_eq:NN \__pdf_backend_annotation_last: \__pdfannot_backend_last: +\clist_map_inline:nn + { + begin_goto:nnw , + begin_user:nnw , + begin:nnnw , + end: , + last: , + margin:n + } + { \cs_new_eq:cc { __pdf_backend_link_ #1 } { __pdfannot_backend_link_ #1 } } +%% File: l3backend-opacity.dtx +\cs_new_protected:Npn \__opacity_backend_select:n #1 + { + \__opacity_backend:nnn {#1} { fill } { ca } + \__opacity_backend:nnn {#1} { stroke } { CA } + \group_insert_after:N \__opacity_backend_reset_fill: + \group_insert_after:N \__opacity_backend_reset_stroke: + } +\cs_new_protected:Npn \__opacity_backend_fill:n #1 + { + \__opacity_backend:nnn + { #1 } + { fill } + { ca } + \group_insert_after:N \__opacity_backend_reset_fill: + } +\cs_new_protected:Npn \__opacity_backend_stroke:n #1 + { + \__opacity_backend:nnn + { #1 } + { stroke } + { CA } + \group_insert_after:N \__opacity_backend_reset_stroke: + } +\cs_new_protected:Npn \__opacity_backend:nnn #1#2#3 + { + \__kernel_backend_postscript:n + { + product ~ (Ghostscript) ~ search + { + pop ~ pop ~ pop ~ + #1 ~ .set #2 constantalpha + } + { + pop ~ + mark ~ + /#3 ~ #1 + /SetTransparency ~ + pdfmark + } + ifelse + } + } +\cs_new_protected:Npn \__opacity_backend_reset_fill: + { + \__opacity_backend:nnn + { 1 } + { fill } + { ca } + } +\cs_new_protected:Npn \__opacity_backend_reset_stroke: + { + \__opacity_backend:nnn + { 1 } + { stroke } + { CA } + } +%% +%% +%% End of file `l3backend-dvips.def'. diff --git a/text/tex/texmf/ls-R b/text/tex/texmf/ls-R new file mode 100644 index 0000000000..b9119fb5a7 --- /dev/null +++ b/text/tex/texmf/ls-R @@ -0,0 +1,52 @@ +% ls-R -- filename database for kpathsea; do not change this line. +./: +amsbsy.sty +amsgen.sty +amsmath.sty +amsopn.sty +amstext.sty +article.cls +cmextra +ifluatex.sty +iftex.sty +keyval.tex +l3backend-dvips.def +ls-R +pst-xkey.tex +shellesc.sty +size10.clo +standalone.cfg +standalone.cls +standalone.sty +standalone.tex +xkeyval.sty +xkeyval.tex +xkvtxhdr.tex +xkvutils.tex + +./cmextra: +cmbsy5.tfm +cmbsy6.tfm +cmbsy7.tfm +cmbsy8.tfm +cmbsy9.tfm +cmbx10.tfm +cmbx12.tfm +cmbx5.tfm +cmbx6.tfm +cmbx7.tfm +cmbx8.tfm +cmbx9.tfm +cmbxsl10.tfm +cmbxti10.tfm +cmcsc8.tfm +cmcsc9.tfm +cmex7.tfm +cmex8.tfm +cmex9.tfm +cmmib5.tfm +cmmib6.tfm +cmmib7.tfm +cmmib8.tfm +cmmib9.tfm + diff --git a/text/tex/texmf/pst-xkey.tex b/text/tex/texmf/pst-xkey.tex new file mode 100644 index 0000000000..1647dc8367 --- /dev/null +++ b/text/tex/texmf/pst-xkey.tex @@ -0,0 +1,71 @@ +%% +%% This is file `pst-xkey.tex', +%% generated with the docstrip utility. +%% +%% The original source files were: +%% +%% xkeyval.dtx (with options: `pxktex') +%% +%% --------------------------------------- +%% Copyright (C) 2004-2022 Hendri Adriaens +%% 2025 David Carlisle for latex-package-repositories +%% --------------------------------------- +%% +%% This work may be distributed and/or modified under the +%% conditions of the LaTeX Project Public License, either version 1.3 +%% of this license or (at your option) any later version. +%% The latest version of this license is in +%% http://www.latex-project.org/lppl.txt +%% and version 1.3 or later is part of all distributions of LaTeX +%% version 2003/12/01 or later. +%% +%% This work has the LPPL maintenance status "maintained". +%% +%% This Current Maintainer of this work is Hendri Adriaens. +%% +%% This work consists of the file xkeyval.dtx and derived files +%% keyval.tex, xkvtxhdr.tex, xkeyval.sty, xkeyval.tex, xkvview.sty, +%% xkvltxp.sty, xkvutils.tex, pst-xkey.tex, pst-xkey.sty, xkveca.cls, +%% xkvecb.cls, xkvesa.sty, xkvesb.sty, xkvesc.sty, xkvex1.tex, +%% xkvex2.tex, xkvex3.tex and xkvex4.tex. +%% +%% The following files constitute the xkeyval bundle and must be +%% distributed as a whole: readme, xkeyval.pdf, keyval.tex, +%% pst-xkey.sty, pst-xkey.tex, xkeyval.sty, xkeyval.tex, xkvview.sty, +%% xkvltxp.sty, xkvtxhdr.tex, xkvutils.tex, pst-xkey.dtx and xkeyval.dtx. +%% +\csname PSTXKeyLoaded\endcsname +\let\PSTXKeyLoaded\endinput +\edef\PSTXKeyCatcodes{% + \catcode`\noexpand\@\the\catcode`\@\relax + \let\noexpand\PSTXKeyCatcodes\relax +} +\catcode`\@=11\relax +\ifx\ProvidesFile\@undefined + \message{2005/11/25 v1.6 PSTricks specialization of xkeyval (HA)} + \ifx\XKeyValLoaded\endinput\else\input xkeyval \fi +\else + \ProvidesFile{pst-xkey.tex} + [2005/11/25 v1.6 PSTricks specialization of xkeyval (HA)] + \@addtofilelist{pst-xkey.tex} + \RequirePackage{xkeyval} +\fi +\def\pst@famlist{} +\def\pst@addfams#1{% + \XKV@for@n{#1}\XKV@tempa{% + \@expandtwoargs\in@{,\XKV@tempa,}{,\pst@famlist,}% + \ifin@\else\edef\pst@famlist{\pst@famlist,\XKV@tempa}\fi + }% +} +\def\psset{% + \expandafter\@testopt\expandafter\pss@t\expandafter{\pst@famlist}% +} +\def\pss@t[#1]#2{\setkeys+[psset]{#1}{#2}\ignorespaces} +\def\@psset#1,\@nil{% + \edef\XKV@tempa{\noexpand\setkeys+[psset]{\pst@famlist}}% + \XKV@tempa{#1}% +} +\PSTXKeyCatcodes +\endinput +%% +%% End of file `pst-xkey.tex'. diff --git a/text/tex/texmf/shellesc.sty b/text/tex/texmf/shellesc.sty new file mode 100644 index 0000000000..07cf35881e --- /dev/null +++ b/text/tex/texmf/shellesc.sty @@ -0,0 +1,132 @@ +%% +%% This is file `shellesc.sty', +%% generated with the docstrip utility. +%% +%% The original source files were: +%% +%% shellesc.dtx (with options: `package') +%% +%% This is a generated file. +%% +%% The source is maintained by the LaTeX Project team and bug +%% reports for it can be opened at https://latex-project.org/bugs/ +%% (but please observe conditions on bug reports sent to that address!) +%% +%% +%% Copyright (C) 1993-2025 +%% The LaTeX Project and any individual authors listed elsewhere +%% in this file. +%% +%% This file was generated from file(s) of the Standard LaTeX `Tools Bundle'. +%% -------------------------------------------------------------------------- +%% +%% It may be distributed and/or modified under the +%% conditions of the LaTeX Project Public License, either version 1.3c +%% of this license or (at your option) any later version. +%% The latest version of this license is in +%% https://www.latex-project.org/lppl.txt +%% and version 1.3c or later is part of all distributions of LaTeX +%% version 2005/12/01 or later. +%% +%% This file may only be distributed together with a copy of the LaTeX +%% `Tools Bundle'. You may however distribute the LaTeX `Tools Bundle' +%% without such generated files. +%% +%% The list of all files belonging to the LaTeX `Tools Bundle' is +%% given in the file `manifest.txt'. +%% +%% Source File: shellesc.dtx +%% Copyright (C) 2015-2025 +%% +%% The LaTeX Project and any individual authors listed elsewhere +%% in this file. +%% +%% This file may be distributed under the terms of the LPPL. +%% See README for details. +\ifx\ProvidesPackage\undefined +\def\next#1#2[#3]{\wlog{#2 #3}} +\ifx\PackageInfo\undefined\def\PackageInfo#1#2{\wlog{#1: #2}}\fi +\ifx\PackageWarning\undefined\def\PackageWarning#1#2{\wlog{#1: #2}}\fi +\expandafter\next\fi +\ProvidesPackage{shellesc} + [2023/07/08 v1.0d unified shell escape interface for LaTeX] +\chardef\shellesc@quotecat\catcode`\" +\chardef\shellesc@underscorecat\catcode`\_ +\@makeother\" +\@makeother\_ +\chardef\ShellEscapeStatus + \ifx\pdfshellescape\@undefined + \ifx\shellescape\@undefined + \ifx\directlua\@undefined + \z@ + \else + \directlua{% + tex.sprint((status.shell_escape or os.execute()) .. " ")} + \fi + \else + \shellescape + \fi + \else + \pdfshellescape + \fi +\ifcase\ShellEscapeStatus + \PackageWarning{shellesc}{Shell escape disabled} +\or + \PackageInfo {shellesc}{Unrestricted shell escape enabled} +\else + \PackageInfo {shellesc}{Restricted shell escape enabled} +\fi +\ifx\lastsavedimageresourcepages\@undefined + \protected\def\ShellEscape{\immediate\write18 } +\else + \protected\def\ShellEscape{\directlua\ShellEscape@Lua} +\fi +\ifx\lastsavedimageresourcepages\@undefined + \protected\def\DelayedShellEscape{\relax\write18 } +\else + \protected\def\DelayedShellEscape{\latelua\ShellEscape@Lua} +\fi +\ifx\directlua\@undefined\else +\protected\def\ShellEscape@Lua#1{{% +local status, msg = os.execute("\luaescapestring{#1}")% +if status == nil then + texio.write_nl("log",% + "runsystem(" .. "\luaescapestring{#1}"% + .. ")...(" .. msg .. ").\string\n") + elseif status == 0 then + texio.write_nl("log",% + "runsystem(" .. "\luaescapestring{#1}"% + .. ")...executed.\string\n") + else + texio.write_nl("log",% + "runsystem(" .. "\luaescapestring{#1}"% + .. ")...failed. " .. (msg or "") .. "\string\n") + end +}} +\fi +\ifx\lastsavedimageresourcepages\@undefined + \catcode`\"\shellesc@quotecat + \catcode`\_\shellesc@underscorecat + \expandafter\endinput +\fi +\directlua{% +shellesc = shellesc or {} +local function write_or_execute() + local s = token.scan_int() + if (s==18) then + tex.sprint(\the\numexpr\catcodetable@atletter\relax, + "\string\\ShellEscape ") + else + tex.sprint(\the\numexpr\catcodetable@atletter\relax, + "\string\\shellesc@write " .. s) + end +end +shellesc.write_or_execute=write_or_execute +} +\let\shellesc@write\write +\protected\def\write{\directlua{shellesc.write_or_execute()}} +\catcode`\"\shellesc@quotecat +\catcode`\_\shellesc@underscorecat +\endinput +%% +%% End of file `shellesc.sty'. diff --git a/text/tex/texmf/size10.clo b/text/tex/texmf/size10.clo new file mode 100644 index 0000000000..2835447c09 --- /dev/null +++ b/text/tex/texmf/size10.clo @@ -0,0 +1,246 @@ +%% +%% This is file `size10.clo', +%% generated with the docstrip utility. +%% +%% The original source files were: +%% +%% classes.dtx (with options: `10pt') +%% +%% This is a generated file. +%% +%% The source is maintained by the LaTeX Project team and bug +%% reports for it can be opened at https://latex-project.org/bugs.html +%% (but please observe conditions on bug reports sent to that address!) +%% +%% +%% Copyright (C) 1993-2025 +%% The LaTeX Project and any individual authors listed elsewhere +%% in this file. +%% +%% This file was generated from file(s) of the LaTeX base system. +%% -------------------------------------------------------------- +%% +%% It may be distributed and/or modified under the +%% conditions of the LaTeX Project Public License, either version 1.3c +%% of this license or (at your option) any later version. +%% The latest version of this license is in +%% https://www.latex-project.org/lppl.txt +%% and version 1.3c or later is part of all distributions of LaTeX +%% version 2008 or later. +%% +%% This file has the LPPL maintenance status "maintained". +%% +%% This file may only be distributed together with a copy of the LaTeX +%% base system. You may however distribute the LaTeX base system without +%% such generated files. +%% +%% The list of all files belonging to the LaTeX base distribution is +%% given in the file `manifest.txt'. See also `legal.txt' for additional +%% information. +%% +%% The list of derived (unpacked) files belonging to the distribution +%% and covered by LPPL is defined by the unpacking scripts (with +%% extension .ins) which are part of the distribution. +\ProvidesFile{size10.clo} + [2025/01/22 v1.4n + Standard LaTeX file (size option)] +\renewcommand\normalsize{% + \@setfontsize\normalsize\@xpt\@xiipt + \abovedisplayskip 10\p@ \@plus2\p@ \@minus5\p@ + \abovedisplayshortskip \z@ \@plus3\p@ + \belowdisplayshortskip 6\p@ \@plus3\p@ \@minus3\p@ + \belowdisplayskip \abovedisplayskip + \let\@listi\@listI} +\normalsize +\ifx\MakeRobust\@undefined \else + \MakeRobust\normalsize +\fi +\DeclareRobustCommand\small{% + \@setfontsize\small\@ixpt{11}% + \abovedisplayskip 8.5\p@ \@plus3\p@ \@minus4\p@ + \abovedisplayshortskip \z@ \@plus2\p@ + \belowdisplayshortskip 4\p@ \@plus2\p@ \@minus2\p@ + \def\@listi{\leftmargin\leftmargini + \topsep 4\p@ \@plus2\p@ \@minus2\p@ + \parsep 2\p@ \@plus\p@ \@minus\p@ + \itemsep \parsep}% + \belowdisplayskip \abovedisplayskip +} +\DeclareRobustCommand\footnotesize{% + \@setfontsize\footnotesize\@viiipt{9.5}% + \abovedisplayskip 6\p@ \@plus2\p@ \@minus4\p@ + \abovedisplayshortskip \z@ \@plus\p@ + \belowdisplayshortskip 3\p@ \@plus\p@ \@minus2\p@ + \def\@listi{\leftmargin\leftmargini + \topsep 3\p@ \@plus\p@ \@minus\p@ + \parsep 2\p@ \@plus\p@ \@minus\p@ + \itemsep \parsep}% + \belowdisplayskip \abovedisplayskip +} +\DeclareRobustCommand\scriptsize{\@setfontsize\scriptsize\@viipt\@viiipt} +\DeclareRobustCommand\tiny{\@setfontsize\tiny\@vpt\@vipt} +\DeclareRobustCommand\large{\@setfontsize\large\@xiipt{14}} +\DeclareRobustCommand\Large{\@setfontsize\Large\@xivpt{18}} +\DeclareRobustCommand\LARGE{\@setfontsize\LARGE\@xviipt{22}} +\DeclareRobustCommand\huge{\@setfontsize\huge\@xxpt{25}} +\DeclareRobustCommand\Huge{\@setfontsize\Huge\@xxvpt{30}} +\if@twocolumn + \setlength\parindent{1em} +\else + \setlength\parindent{15\p@} +\fi +\setlength\smallskipamount{3\p@ \@plus 1\p@ \@minus 1\p@} +\setlength\medskipamount{6\p@ \@plus 2\p@ \@minus 2\p@} +\setlength\bigskipamount{12\p@ \@plus 4\p@ \@minus 4\p@} +\setlength\headheight{12\p@} +\setlength\headsep {25\p@} +\setlength\topskip {10\p@} +\setlength\footskip{30\p@} +\if@compatibility \setlength\maxdepth{4\p@} \else + \setlength\maxdepth{.5\topskip} \fi +\if@compatibility + \if@twocolumn + \setlength\textwidth{410\p@} + \else + \setlength\textwidth{345\p@} + \fi +\else + \setlength\@tempdima{\paperwidth} + \addtolength\@tempdima{-2in} + \setlength\@tempdimb{345\p@} + \if@twocolumn + \ifdim\@tempdima>2\@tempdimb\relax + \setlength\textwidth{2\@tempdimb} + \else + \setlength\textwidth{\@tempdima} + \fi + \else + \ifdim\@tempdima>\@tempdimb\relax + \setlength\textwidth{\@tempdimb} + \else + \setlength\textwidth{\@tempdima} + \fi + \fi +\fi +\if@compatibility\else + \@settopoint\textwidth +\fi +\if@compatibility + \setlength\textheight{43\baselineskip} +\else + \setlength\@tempdima{\paperheight} + \addtolength\@tempdima{-2in} + \addtolength\@tempdima{-1.5in} + \divide\@tempdima\baselineskip + \@tempcnta=\@tempdima + \setlength\textheight{\@tempcnta\baselineskip} +\fi +\addtolength\textheight{\topskip} +\if@twocolumn + \setlength\marginparsep {10\p@} +\else + \setlength\marginparsep{11\p@} +\fi +\setlength\marginparpush{5\p@} +\if@compatibility + \if@twoside + \setlength\oddsidemargin {44\p@} + \setlength\evensidemargin {82\p@} + \setlength\marginparwidth {107\p@} + \else + \setlength\oddsidemargin {63\p@} + \setlength\evensidemargin {63\p@} + \setlength\marginparwidth {90\p@} + \fi + \if@twocolumn + \setlength\oddsidemargin {30\p@} + \setlength\evensidemargin {30\p@} + \setlength\marginparwidth {48\p@} + \fi +\else + \if@twoside + \setlength\@tempdima {\paperwidth} + \addtolength\@tempdima {-\textwidth} + \setlength\oddsidemargin {.4\@tempdima} + \addtolength\oddsidemargin {-1in} + \setlength\marginparwidth {.6\@tempdima} + \addtolength\marginparwidth {-\marginparsep} + \addtolength\marginparwidth {-0.4in} + \else + \setlength\@tempdima {\paperwidth} + \addtolength\@tempdima {-\textwidth} + \setlength\oddsidemargin {.5\@tempdima} + \addtolength\oddsidemargin {-1in} + \setlength\marginparwidth {.5\@tempdima} + \addtolength\marginparwidth {-\marginparsep} + \addtolength\marginparwidth {-0.4in} + \addtolength\marginparwidth {-.4in} + \fi + \ifdim \marginparwidth >2in + \setlength\marginparwidth{2in} + \fi + \@settopoint\oddsidemargin + \@settopoint\marginparwidth + \setlength\evensidemargin {\paperwidth} + \addtolength\evensidemargin{-2in} + \addtolength\evensidemargin{-\textwidth} + \addtolength\evensidemargin{-\oddsidemargin} + \@settopoint\evensidemargin +\fi +\if@compatibility + \setlength\topmargin{27pt} +\else + \setlength\topmargin{\paperheight} + \addtolength\topmargin{-2in} + \addtolength\topmargin{-\headheight} + \addtolength\topmargin{-\headsep} + \addtolength\topmargin{-\textheight} + \addtolength\topmargin{-\footskip} % this might be wrong! + \addtolength\topmargin{-.5\topmargin} + \@settopoint\topmargin +\fi +\setlength\footnotesep{6.65\p@} +\setlength{\skip\footins}{9\p@ \@plus 4\p@ \@minus 2\p@} +\setlength\floatsep {12\p@ \@plus 2\p@ \@minus 2\p@} +\setlength\textfloatsep{20\p@ \@plus 2\p@ \@minus 4\p@} +\setlength\intextsep {12\p@ \@plus 2\p@ \@minus 2\p@} +\setlength\dblfloatsep {12\p@ \@plus 2\p@ \@minus 2\p@} +\setlength\dbltextfloatsep{20\p@ \@plus 2\p@ \@minus 4\p@} +\setlength\@fptop{0\p@ \@plus 1fil} +\setlength\@fpsep{8\p@ \@plus 2fil} +\setlength\@fpbot{0\p@ \@plus 1fil} +\setlength\@dblfptop{0\p@ \@plus 1fil} +\setlength\@dblfpsep{8\p@ \@plus 2fil} +\setlength\@dblfpbot{0\p@ \@plus 1fil} +\setlength\partopsep{2\p@ \@plus 1\p@ \@minus 1\p@} +\def\@listi{\leftmargin\leftmargini + \parsep 4\p@ \@plus2\p@ \@minus\p@ + \topsep 8\p@ \@plus2\p@ \@minus4\p@ + \itemsep4\p@ \@plus2\p@ \@minus\p@} +\let\@listI\@listi +\@listi +\def\@listii {\leftmargin\leftmarginii + \labelwidth\leftmarginii + \advance\labelwidth-\labelsep + \topsep 4\p@ \@plus2\p@ \@minus\p@ + \parsep 2\p@ \@plus\p@ \@minus\p@ + \itemsep \parsep} +\def\@listiii{\leftmargin\leftmarginiii + \labelwidth\leftmarginiii + \advance\labelwidth-\labelsep + \topsep 2\p@ \@plus\p@\@minus\p@ + \parsep \z@ + \partopsep \p@ \@plus\z@ \@minus\p@ + \itemsep \topsep} +\def\@listiv {\leftmargin\leftmarginiv + \labelwidth\leftmarginiv + \advance\labelwidth-\labelsep} +\def\@listv {\leftmargin\leftmarginv + \labelwidth\leftmarginv + \advance\labelwidth-\labelsep} +\def\@listvi {\leftmargin\leftmarginvi + \labelwidth\leftmarginvi + \advance\labelwidth-\labelsep} +\endinput +%% +%% End of file `size10.clo'. diff --git a/text/tex/texmf/standalone.cfg b/text/tex/texmf/standalone.cfg new file mode 100644 index 0000000000..03598f79f9 --- /dev/null +++ b/text/tex/texmf/standalone.cfg @@ -0,0 +1,37 @@ +\NeedsTeXFormat{LaTeX2e} +\ProvidesFile{standalone.cfg}[% + 2025/02/22 + v1.5a + Default configuration file for 'standalone' class]% +%% Enabled the "varwidth" option if the "varwidth" package is available: +%%\IfFileExists{varwidth.sty}{% +%% \standaloneconfig{varwidth}% +%%}{}% + +%% Default options: +\standaloneconfig{crop} + +%% Option which 'preview' should be loaded with +%% (will be ignored outside preamble) +\expandafter\ifx\csname @notprerr\endcsname\PassOptionsToPackage\else +\PassOptionsToPackage{active,tightpage}{preview}% +\fi + +%% Enable 'preview' option by default: +%%\standaloneconfig{preview} + +%% Remove the border: +\standaloneconfig{border=0pt} + +%% Default preview border (used by standalone v0.x): +%%\standaloneconfig{border=0.50001bp} + +%% Disable navigation symbols in beamer. +%% This must be done AtEndOfClass because the options are not processed yet, +%% so "beamer" mode is not enabled yet. +\AtEndOfClass{% +\ifstandalonebeamer + \setbeamertemplate{navigation symbols}{}% +\fi +} +%% vim: ft=tex diff --git a/text/tex/texmf/standalone.cls b/text/tex/texmf/standalone.cls new file mode 100644 index 0000000000..7243c6b420 --- /dev/null +++ b/text/tex/texmf/standalone.cls @@ -0,0 +1,1089 @@ +%% Copyright (C) 2010-2025 by Martin Scharrer +%% --------------------------------------------------------------------------- +%% This work may be distributed and/or modified under the +%% conditions of the LaTeX Project Public License, either version 1.3 +%% of this license or (at your option) any later version. +%% The latest version of this license is in +%% http://www.latex-project.org/lppl.txt +%% and version 1.3 or later is part of all distributions of LaTeX +%% version 2005/12/01 or later. +%% +%% This work has the LPPL maintenance status `maintained'. +%% +%% The Current Maintainer of this work is Martin Scharrer. +%% +%% This work consists of the files standalone.dtx and standalone.ins +%% and the derived filebase standalone.sty, standalone.cls and +%% standalone.cfg. +%% +\NeedsTeXFormat{LaTeX2e} +\ProvidesClass{standalone}[% + 2025/02/22 + v1.5a + Class to compile TeX sub-files standalone] +\newif\ifstandalone +\standalonetrue +\newif\ifstandalonebeamer +\standalonebeamerfalse +\let\onlyifstandalone\@firstofone +\let\IfStandalone\@firstoftwo +\def\sa@border@left{0.50001bp} +\let\sa@border@right\sa@border@left +\let\sa@border@top\sa@border@left +\let\sa@border@bottom\sa@border@left +\def\rem@bp#1bp\relax#2\@nnil{#1}% +\def\default@bp#1#2{% + \begingroup + \afterassignment\remove@to@nnil + \dimen@ #2bp\relax\@nnil + \expandafter + \endgroup + \expandafter + \def\expandafter#1\expandafter{\the\dimen@}% +} +\def\sa@readborder#1 #2 #3 #4 #5\@nnil{% + \ifx\\#2#3#4\\% + \default@bp\sa@border@left{#1}% + \let\sa@border@right\sa@border@left + \let\sa@border@top\sa@border@left + \let\sa@border@bottom\sa@border@left + \else + \ifx\\#4\\% + \default@bp\sa@border@left{#1}% + \let\sa@border@right\sa@border@left + \default@bp\sa@border@top{#2}% + \let\sa@border@bottom\sa@border@top + \else + \default@bp\sa@border@left{#1}% + \default@bp\sa@border@bottom{#2}% + \default@bp\sa@border@right{#3}% + \default@bp\sa@border@top{#4}% + \fi\fi +}% +\expandafter\ifx\csname ShellEscape\endcsname\relax + \IfFileExists{shellesc.sty}{ + \RequirePackage{shellesc} + \@ifpackagelater{shellesc}{2016/04/29}{ + }{ + \protected\def\ShellEscape{\immediate\write18 } + } + }{ + \protected\def\ShellEscape{\immediate\write18 } + } +\fi +\expandafter\ifx\csname ifluatex\endcsname\relax + \IfFileExists{ifluatex.sty}{\@firstoftwo}{\@secondoftwo}{% + \RequirePackage{ifluatex} + }{ + \begingroup + \expandafter\ifx\csname directlua\endcsname\relax + \endgroup + \expandafter\let\csname ifluatex\expandafter\endcsname\csname iffalse\endcsname + \else + \endgroup + \expandafter\let\csname ifluatex\expandafter\endcsname\csname iftrue\endcsname + \fi + } +\fi +\expandafter\ifx\csname ifpdf\endcsname\relax + \IfFileExists{ifpdf.sty}{\@firstoftwo}{\@secondoftwo}{% + \RequirePackage{ifpdf} + }{ + \begingroup + \expandafter\ifx\csname pdfoutput\endcsname\relax + \endgroup + \expandafter\let\csname ifpdf\expandafter\endcsname\csname iffalse\endcsname + \else + \endgroup + \ifnum\pdfoutput<1 + \expandafter\let\csname ifpdf\expandafter\endcsname\csname iffalse\endcsname + \else + \expandafter\let\csname ifpdf\expandafter\endcsname\csname iftrue\endcsname + \fi + \fi + } +\fi +\expandafter\ifx\csname ifxetex\endcsname\relax + \IfFileExists{ifxetex.sty}{\@firstoftwo}{\@secondoftwo}{% + \RequirePackage{ifxetex} + }{ + \begingroup + \expandafter\ifx\csname XeTeXrevision\endcsname\relax + \endgroup + \expandafter\let\csname ifxetex\expandafter\endcsname\csname iffalse\endcsname + \else + \endgroup + \expandafter\let\csname ifxetex\expandafter\endcsname\csname iftrue\endcsname + \fi + } +\fi +\let\sa@classoptionslist\@classoptionslist +\RequirePackage{xkeyval} +\newif\ifsa@preview +\newif\ifsa@crop +\newif\ifsa@multi +\newif\ifsa@multido +\newif\ifsa@varwidth +\newif\ifsa@ignorerest +\newif\ifsa@ignoreempty +\newif\ifsa@tikz +\newif\ifsa@pstricks +\newif\ifsa@convert +\newif\ifsa@float +\newif\ifsa@math +\newif\ifsa@convert@perpage +\let\sa@beamertrue\standalonebeamertrue +\let\sa@beamerfalse\standalonebeamerfalse +\def\sa@clsoption{% + \define@key{standalone.cls}% +} +\sa@clsoption{border}{% + \sa@readborder#1 {} {} {} {} \@nnil +} +\sa@clsoption{margin}{% + \sa@readborder#1 {} {} {} {} \@nnil +} +\def\sa@boolean#1#2{% + \sa@boolorvalue{#1}{#2}% + {\ClassError{standalone}{Invalid value '#2' for boolean key '#1'}{}}% +} +\def\sa@boolorvalue#1#2{% + \begingroup + \edef\@tempa{#2}% + \def\@tempb{true}% + \ifx\@tempa\@tempb + \endgroup + \csname sa@#1true\endcsname + \expandafter\@gobble + \else + \def\@tempb{false}% + \ifx\@tempa\@tempb + \endgroup + \csname sa@#1false\endcsname + \expandafter\expandafter + \expandafter\@gobble + \else + \endgroup + \expandafter\expandafter + \expandafter\@firstofone + \fi\fi +} +\sa@clsoption{preview}[true]{% + \sa@boolean{preview}{#1}% + \ifsa@preview + \setkeys{standalone.cls}{crop=false,float=false}% + \fi +} +\sa@previewtrue +\sa@clsoption{crop}[true]{% + \sa@boolean{crop}{#1}% + \ifsa@crop + \setkeys{standalone.cls}{preview=false,float=false}% + \fi +} +\sa@clsoption{ignorerest}[true]{% + \sa@boolean{ignorerest}{#1}% +} +\sa@clsoption{ignoreempty}[true]{% + \sa@boolean{ignoreempty}{#1}% +} +\sa@clsoption{multi}[true]{% + \sa@boolorvalue{multi}{#1}{\sa@multitrue\AtBeginDocument{\standaloneenv{#1}}}% +} +\sa@clsoption{multido}[true]{% + \sa@boolean{multido}{#1}% + \ifsa@multido + \setkeys{standalone.cls}{multi=samultido}% + \fi +} +\sa@clsoption{math}[true]{% + \sa@boolean{math}{#1}% + \ifsa@math + \setkeys{standalone.cls}{multi=true,ignoreempty=true,border=0.50001bp}% + \fi +} +\AtBeginDocument{\ifsa@math\sa@math\fi} +\def\sa@math{% + \standaloneenv{math}% + \def\({\begingroup\math}% + \def\){\endmath\endgroup}% + \def\[{\(\displaystyle}% + \def\]{\)}% + \def\displaymath{\math\displaystyle}% + \def\enddisplaymath{\endmath}% + \newcommand*\multimathsep{% + \endmath + \math + \let\\\multimathsep + }% + \newenvironment{multimath}{% + \math + \let\\\multimathsep + }{% + \endmath + }% + \newcommand*\multidisplaymathsep{% + \endmath + \math\displaystyle + \let\\\multidisplaymathsep + }% + \newenvironment{multidisplaymath}{% + \math\displaystyle + \let\\\multidisplaymathsep + }{% + \endmath + }% +} +\sa@clsoption{varwidth}[true]{% + \sa@boolorvalue{varwidth}{#1}{\sa@varwidthtrue\def\sa@width{#1}}% + \ifsa@varwidth + \def\sa@varwidth{\varwidth{\sa@width}}% + \def\sa@endvarwidth{\endvarwidth}% + \else + \let\sa@varwidth\@empty + \let\sa@endvarwidth\@empty + \fi +} +\let\sa@varwidth\@empty +\let\sa@endvarwidth\@empty +\sa@clsoption{tikz}[true]{% + \sa@boolean{tikz}{#1}% + \ifsa@tikz + \setkeys{standalone.cls}{multi=tikzpicture,varwidth=false}% + \fi +} +\sa@clsoption{pstricks}[true]{% + \sa@boolean{pstricks}{#1}% + \ifsa@pstricks + \setkeys{standalone.cls}{multi=pspicture,varwidth=false}% + \fi +} +\sa@clsoption{beamer}[true]{% + \sa@boolean{beamer}{#1}% + \ifstandalonebeamer + \def\sa@class{beamer}% + \setkeys{standalone.cls}{preview=false,crop=false,varwidth=false}% + \else + \begingroup + \def\@tempa{beamer}% + \ifx\@tempa\sa@class + \endgroup + \def\sa@class{article}% + \else + \endgroup + \fi + \fi +} +\sa@clsoption{class}{% + \def\sa@class{#1}% +} +\def\sa@class{article} +\sa@clsoption{float}[true]{% + \sa@boolean{float}{#1}% + \ifsa@float + \let\@float\sa@origfloat + \let\end@float\sa@origendfloat + \else + \ifx\@float\sa@nofloat\else + \let\sa@origfloat\@float + \fi + \ifx\end@float\sa@endnofloat\else + \let\sa@origendfloat\end@float + \fi + \let\@float\sa@nofloat + \let\end@float\sa@endnofloat + \fi +} +\def\sa@nofloat#1{% + \def\@captype{#1}% + \trivlist\item[]% + \@ifnextchar[{% + \begingroup + \def\@tempa[####1]{% + \endgroup + }\@tempa + }{}% +} +\def\sa@endnofloat{% + \endtrivlist +} +\sa@clsoption{convert}[]{% + \setkeys{standalone.cls/convert}{true,#1}% +} +\sa@clsoption{disable@convert}[]{% + \typeout{Disable conversion} + \sa@convertfalse + \let\sa@converttrue\relax +} +\def\sa@convertoption{% + \define@key{standalone.cls/convert}% +} +\def\sa@convertvar#1#2{% + \define@key{standalone.cls/convert}{#1}{% + \@namedef{sa@convert@#1}{##1}% + }% + \@namedef{sa@convert@#1}{#2}% +} +\sa@convertoption{true}[]{% + \sa@converttrue +} +\sa@convertoption{false}[]{% + \sa@convertfalse +} +\sa@convertoption{realmainfile}[]{% + \RequirePackage{currfile-abspath}% + \getmainfile + \let\sa@convert@mainfile\themainfile +} +\sa@convertoption{png}[]{% + \setkeys{standalone.cls/convert}{true,outext={.png}}% +} +\sa@clsoption{png}[]{% + \setkeys{standalone.cls/convert}{png,#1}% +} +\sa@convertoption{jpg}[]{% + \setkeys{standalone.cls/convert}{true,outext={.jpg}}% +} +\sa@clsoption{jpg}[]{% + \setkeys{standalone.cls/convert}{jpg,#1}% +} +\sa@convertoption{gif}[]{% + \setkeys{standalone.cls/convert}{true,imagemagick,outext={.gif}}% +} +\sa@clsoption{gif}[]{% + \setkeys{standalone.cls/convert}{gif,#1}% +} +\sa@convertoption{svg}[]{% + \setkeys{standalone.cls/convert}{true,inkscape,outext={.svg}}% +} +\sa@clsoption{svg}[]{% + \setkeys{standalone.cls/convert}{svg,#1}% +} +\sa@convertoption{emf}[]{% + \setkeys{standalone.cls/convert}{true,inkscape,outext={.emf}}% +} +\sa@clsoption{emf}[]{% + \setkeys{standalone.cls/convert}{emf,#1}% +} +\sa@convertoption{onfailure}{% + \begingroup + \edef\@tempa{#1}% + \def\@tempb{error}% + \ifx\@tempa\@tempb + \endgroup + \let\sa@convert@failuremsg\ClassError + \else + \def\@tempb{warning}% + \ifx\@tempa\@tempb + \endgroup + \let\sa@convert@failuremsg\ClassWarning + \else + \def\@tempb{info}% + \ifx\@tempa\@tempb + \endgroup + \let\sa@convert@failuremsg\ClassInfo + \else + \def\@tempb{ignore}% + \ifx\@tempa\@tempb + \endgroup + \def\sa@convert@failuremsg##1##2##3{}% + \let\sa@convert@notfoundmsg\@gobbletwo + \else + \let\on@line\@empty + \ClassError{standalone}{Invalid value '\@tempa' for the 'onfailure' option.\MessageBreak + Valid values: 'error', 'warning', 'info', 'ignore'}{}% + \endgroup + \fi\fi\fi\fi +} +\let\sa@convert@failuremsg\ClassWarning +\let\sa@convert@notfoundmsg\ClassWarning +\sa@convertoption{perpage}[true]{% + \sa@boolean{convert@perpage}{#1}% +} +\sa@convertoption{defgsdevice}{% + \sa@defgsdevice#1\relax\relax +} +\def\sa@defgsdevice#1#2{% + \@namedef{sa@gsdevice@#1}{#2}% +} +\@namedef{sa@gsdevice@.jpg}{jpeg}% +\@namedef{sa@gsdevice@.png}{png16m}% +\sa@convertoption{command}{% + \def\sa@convert@command{#1}% +} +\sa@convertoption{pdf2svg}[]{% + \def\sa@convert@command{pdf2svg \infile\space\outfile}% + \sa@convertvar{outext}{.svg} +} +\sa@convertoption{imagemagick}[]{% + \def\sa@convert@command{\convertexe\space + -density \density\space + -units PixelsPerInch + \infile\ifsa@convert@perpage[\prevpagenum]\fi\space + -scene 1 + \ifx\size\empty\else -resize \size\fi\space + -quality 90 \outfile}% +} +\sa@convertoption{ghostscript}[]{% + \def\sa@convert@command{\gsexe\space -dSAFER -dBATCH -dNOPAUSE + \ifsa@convert@perpage-sPageList=\pagenum\fi\space + -sDEVICE=\gsdevice\space + -r\density\space + -sOutputFile=\outfile\space \infile + }% +} +\sa@convertoption{ghostscript32}[]{% + \setkeys{standalone.cls/convert}{ghostscript,gsexe=\@nameuse{sa@convert@gsexe32}}% +} +\sa@convertoption{ghostscript64}[]{% + \setkeys{standalone.cls/convert}{ghostscript,gsexe=\@nameuse{sa@convert@gsexe64}}% +} +\sa@convertoption{inkscape}[]{% + \def\sa@convert@command{\inkscapeexe\space + --pdf-poppler \sa@inkscape@bgcolor\space + --export-type="\expandafter\@gobble\outext" + --pdf-page=\pagenum\space + -o \outfile\space \infile} + \sa@convert@perpagetrue + \def\sa@multi@pagemark{\pagenum}% +} +\def\sa@inkscape@bgcolor{\ifx\sa@convert@bgcolor\@empty\else--actions="export-background:\sa@convert@bgcolor"\fi} +\sa@convertvar{latexoptions}{ -shell-escape \ifx\outputdir\empty\else-output-directory \sa@convert@quote\outputdir\sa@convert@quote\fi\space} +\sa@convertvar{subjobname}{\jobname} +\sa@convertvar{mainfile}{\jobname} +\sa@convertvar{quote}{} +\let\sa@convert@quote\relax +\sa@convertvar{size}{} +\sa@convertvar{inname}{\subjobname} +\sa@convertvar{infile}{\indir\inname\inext} +\sa@convertvar{outputdir}{} +\sa@convertvar{indir}{\outputdir} +\sa@convertvar{outdir}{\outputdir} +\sa@convertvar{outext}{.png} +\sa@convertvar{outname}{\inname} +\sa@convertvar{outfile}{\outdir\outname\ifsa@multi\sa@multi@pagemark\fi\outext} +\def\sa@multi@pagemark{-\percent0d} +\def\sa@convert@pagenum{1} +\sa@convertvar{density}{300} +\sa@convertvar{bgcolor}{} +\sa@convertvar{gsdevice}{% + \expandafter\ifx\csname sa@gsdevice@\outext\endcsname\relax + \expandafter\@gobble\outext + \else + \csname sa@gsdevice@\outext\endcsname + \fi +} +\ifluatex + \sa@convertvar{latex}{lualatex} + \sa@convertvar{inext}{.pdf} + \sa@convertvar{precommand}{} + \setkeys{standalone.cls/convert}{ghostscript} +\else +\ifpdf + \sa@convertvar{latex}{pdflatex} + \sa@convertvar{inext}{.pdf} + \sa@convertvar{precommand}{} + \setkeys{standalone.cls/convert}{ghostscript} +\else +\ifxetex + \sa@convertvar{latex}{xelatex} + \sa@convertvar{inext}{.pdf} + \sa@convertvar{precommand}{} + \setkeys{standalone.cls/convert}{ghostscript} +\else + \sa@convertvar{latex}{latex} + \sa@convertvar{inext}{.ps} + \sa@convertvar{precommand}{dvips \subjobname.dvi} + \setkeys{standalone.cls/convert}{ghostscript} +\fi\fi\fi +\begingroup +\ifluatex + \csname @tempswa\directlua{ + if os.type == "windows" then + tex.sprint("true") + else + tex.sprint("false") + end + }\endcsname +\else + \IfFileExists{/dev/null}{\@tempswafalse}{\@tempswatrue}% +\fi +\if@tempswa + \endgroup + \@namedef{sa@convert@gsexe32}{gswin32c} + \@namedef{sa@convert@gsexe64}{gswin64c} +\else + \endgroup + \@namedef{sa@convert@gsexe32}{gs} + \@namedef{sa@convert@gsexe64}{gs} +\fi +\sa@convertvar{gsexe}{\@nameuse{sa@convert@gsexe64}} +\sa@convertvar{convertexe}{magick convert} +\sa@convertvar{inkscapeexe}{inkscape} +\newcommand*\standaloneenv[1]{% + \begingroup + \edef\@tempa{\endgroup\noexpand\@for\noexpand\@tempa:=\zap@space#1 \@empty}% + \@tempa\do{\expandafter\@standaloneenv\expandafter{\@tempa}}% + \setkeys{standalone.cls}{multi}% +} +\@onlypreamble\standaloneenv +\newcommand*{\standaloneconfig}{\setkeys{standalone.cls}} +\let\@standaloneenv\@gobble +\newcount\sa@internal +\newcounter{sapage} +\let\standalone\empty +\let\endstandalone\relax +\def\sa@width{\linewidth} +\InputIfFileExists{standalone.cfg}{}{} +\begingroup +\def\@tempa{\endgroup\setkeys*{standalone.cls}} +\expandafter\expandafter\expandafter\@tempa +\expandafter\expandafter\expandafter{\csname opt@standalone.cls\endcsname} +\let\@classoptionslist\XKV@rm +\disable@keys{standalone.cls}{crop,preview,class,beamer,ignorerest} +\AtBeginDocument{% + \disable@keys{standalone.cls}{multi}% +} +\expandafter\expandafter\expandafter\LoadClass +\expandafter\expandafter\expandafter[% +\expandafter\@classoptionslist +\expandafter]\expandafter{\sa@class} +\ifsa@ignorerest + \def\sa@startignore{\sa@boxit} +\else + \let\sa@startignore\relax +\fi +\ifsa@ignorerest + \def\sa@stopignore{\endsa@boxit} +\else + \let\sa@stopignore\relax +\fi +\ifsa@multido +\RequirePackage{multido} +\let\sa@orig@multido@\multido@ +\renewcommand{\multido@}[6]{% + \sa@stopignore + \sa@orig@multido@{#1}{#2}{#3}{#4}{#5}{% + \sa@startignore + \begin{samultido}% + \let\multido@\sa@orig@multido@ + #6% + \end{samultido}% + \sa@stopignore + }% + \sa@startignore +} +\fi +\ifluatex +\RequirePackage{luatex85} +\RequirePackage{pdftexcmds} +\fi +\ifsa@convert +\ifx\sa@convert@quote\relax +\begingroup +\@tempswafalse +\expandafter\ifx\csname pdftexbanner\endcsname\relax + \@tempswatrue +\else +\def\MiKTeX{MiKTeX} +\@onelevel@sanitize\MiKTeX +\expandafter\def\expandafter\testmiktex\expandafter#\expandafter1\MiKTeX#2\relax{% + \ifx\empty#2\empty + \@tempswafalse + \else + \@tempswatrue + \fi +} +\expandafter\expandafter +\expandafter\testmiktex\expandafter\pdftexbanner\MiKTeX\relax\relax + +\fi +\expandafter +\endgroup +\if@tempswa +\def\sa@convert@quote{"} +\else +\def\sa@convert@quote{'} +\fi +\fi +\fi +\ifsa@varwidth + \RequirePackage{varwidth} +\fi +\ifsa@tikz + \RequirePackage{tikz} +\fi +\ifsa@pstricks + \RequirePackage{pstricks} +\fi +\ifsa@preview +\RequirePackage{preview} +\ifsa@multi\else + \@ifundefined{endstandalone}{% + \renewenvironment{standalone} + {\preview\sa@varwidth} + {\sa@endvarwidth\endpreview} + }{}% TODO: Add info message? +\fi +\def\PreviewBbAdjust{-\sa@border@left\space -\sa@border@bottom\space \sa@border@right\space \sa@border@top}% +\def\@standaloneenv#1{% + \expandafter\ifx\csname sa@orig@#1\endcsname\relax + \expandafter\let\csname sa@orig@#1\expandafter\endcsname\csname #1\endcsname + \expandafter\let\csname sa@orig@end#1\expandafter\endcsname\csname end#1\endcsname + \fi + \expandafter\def\csname #1\endcsname{% + \ifnum\sa@internal=0 + \addtocounter{sapage}\@ne + \preview + \sa@varwidth + \fi + \advance\sa@internal\@ne + \csname sa@orig@#1\endcsname + }% + \expandafter\def\csname end#1\endcsname{% + \csname sa@orig@end#1\endcsname + \advance\sa@internal\m@ne + \ifnum\sa@internal=0 + \sa@endvarwidth + \endpreview + \fi + }% +}% +\fi +\ifsa@crop +\newbox\sa@box +\pagestyle{empty} +\hoffset=-72.27pt +\voffset=-72.27pt +\topmargin=0pt +\headheight=0pt +\headsep=0pt +\marginparsep=0pt +\marginparwidth=0pt +\footskip=0pt +\marginparpush=0pt +\oddsidemargin=0pt +\evensidemargin=0pt +\topskip=0pt +\textheight=\maxdimen +\def\sa@boxit{% + \setbox\sa@box\hbox\bgroup\color@setgroup\sa@varwidth +}% +\def\endsa@boxit{% + \sa@endvarwidth\color@endgroup\egroup +}% +\renewenvironment{standalone}{% + \ifsa@multi + \sa@startignore + \else + \sa@boxit + \fi +}{% + \ifsa@multi + \sa@stopignore + \else + \endsa@boxit + \sa@handlebox + \fi +} +\ifsa@multi\else + \sa@ignorerestfalse +\fi +\ifsa@ignorerest + \def\@standaloneenv#1{% + \expandafter\ifx\csname sa@orig@#1\endcsname\relax + \expandafter\let\csname sa@orig@#1\expandafter\endcsname\csname #1\endcsname + \expandafter\let\csname sa@orig@end#1\expandafter\endcsname\csname end#1\endcsname + \fi + \expandafter\def\csname #1\endcsname{% + \ifnum\sa@internal=0 + \addtocounter{sapage}\@ne + \edef\@tempa{\endgroup + \noexpand\endsa@boxit + \begingroup + \def\noexpand\@currenvir{\@currenvir}% + \def\noexpand\@currenvline{\@currenvline}% + }% + \@tempa + \sa@boxit + \fi + \advance\sa@internal\@ne + \csname sa@orig@#1\endcsname + }% + \expandafter\def\csname end#1\endcsname{% + \csname sa@orig@end#1\endcsname + \advance\sa@internal\m@ne + \ifnum\sa@internal=0 + \endsa@boxit + \sa@handlebox + \aftergroup\sa@boxit + \fi + }% + }% +\else + \def\@standaloneenv#1{% + \expandafter\ifx\csname sa@orig@#1\endcsname\relax + \expandafter\let\csname sa@orig@#1\expandafter\endcsname\csname #1\endcsname + \expandafter\let\csname sa@orig@end#1\expandafter\endcsname\csname end#1\endcsname + \fi + \expandafter\def\csname #1\endcsname{% + \ifnum\sa@internal=0 + \addtocounter{sapage}\@ne + \sa@boxit + \fi + \advance\sa@internal\@ne + \csname sa@orig@#1\endcsname + }% + \expandafter\def\csname end#1\endcsname{% + \csname sa@orig@end#1\endcsname + \advance\sa@internal\m@ne + \ifnum\sa@internal=0 + \endsa@boxit + \sa@handlebox + \fi + }% + }% +\fi +\def\sa@handlebox{% + \ifcase + 0% + \ifsa@ignoreempty + \ifdim\wd\sa@box=\z@ + \ifdim\ht\sa@box=\z@ + \ifdim\dp\sa@box=\z@ + 1% + \fi\fi\fi + \fi + \relax + \sbox\sa@box{% + \hskip\sa@border@left + \@tempdima=\ht\sa@box + \advance\@tempdima\sa@border@top\relax + \ht\sa@box=\@tempdima + \@tempdima=\dp\sa@box + \advance\@tempdima\sa@border@bottom\relax + \dp\sa@box=\@tempdima + \raise\dp\sa@box + \box\sa@box + \hskip\sa@border@right + }% + \sa@placebox + \fi +} +\ifcase0% + \ifpdf\else\ifluatex\else\ifxetex\else 1\fi\fi\fi + \relax + \def\sa@placebox{% + \newpage + \ifluatex + \ifnum\luatexversion<85 + % LuaLaTeX < 0.85 does define the PDF-specific globals. + \global\pdfpagewidth=\wd\sa@box + \global\pdfpageheight=\ht\sa@box + \else + % LuaLaTeX >= 0.85 doesn't define the PDF-specific globals. + \global\pagewidth=\wd\sa@box + \global\pageheight=\ht\sa@box + \fi + \else + % Not LuaLaTeX at all, so still need this. + \global\pdfpagewidth=\wd\sa@box + \global\pdfpageheight=\ht\sa@box + \fi + \global\paperwidth=\wd\sa@box + \global\paperheight=\ht\sa@box + \special{papersize=\the\paperwidth,\the\paperheight} + \global\hsize=\wd\sa@box + \global\vsize=\ht\sa@box + \global\@colht=\ht\sa@box + \global\@colroom=\ht\sa@box + \noindent\usebox\sa@box + \newpage + } + \else + \def\sa@placebox{% + \global\paperwidth=\wd\sa@box + \global\paperheight=\ht\sa@box + \special{papersize=\the\paperwidth,\the\paperheight} + \global\@colht=\maxdimen + \global\@colroom=\maxdimen + \global\hsize=\maxdimen + \global\vsize=\maxdimen + \sa@papersize + \ifsa@multi + \begingroup + \@tempdima0.99626\paperwidth + \@tempdimb0.99626\paperheight + \edef\@tempc{\strip@pt\@tempdima}% + \edef\@tempd{\strip@pt\@tempdimb}% + \advance\@tempdima by .998pt + \advance\@tempdimb by .998pt + \def\strip@float##1.##2\relax{##1}% + \edef\@tempa{\expandafter\strip@float\the\@tempdima\relax}% + \edef\@tempb{\expandafter\strip@float\the\@tempdimb\relax}% + \special{ps::% + \@percentchar\@percentchar PageBoundingBox: 0 0 \@tempa\space\@tempb^^J% + \@percentchar\@percentchar HiResPageBoundingBox: 0 0 \@tempc\space\@tempd^^J% + \@percentchar\@percentchar BeginPageSetup^^J% + << /PageSize [\@tempc\space\@tempd] + >> setpagedevice^^J%<< + 0 0 bop^^J% + \@percentchar\@percentchar EndPageSetup}% + \endgroup + \fi + \topskip=0pt + \noindent\sa@ps@content + \newpage + } +\def\sa@ps@content{% + \noindent\usebox\sa@box + \global\def\sa@ps@content{% + \@tempdima\sa@yoffset + \advance\@tempdima-\topskip + \dp\sa@box\z@ + \ht\sa@box\z@ + \noindent\lower\@tempdima\copy\sa@box + }% +} +\def\sa@papersize{% + \global\let\sa@papersize\relax + \global\sa@yoffset=\paperheight + \global\setbox\@begindvibox\vbox{% + \special{papersize=\the\paperwidth,\the\paperheight}% + \special{ps::% + \@percentchar\@percentchar HiResBoundingBox: 0 0 \the\paperwidth\space\the\paperheight^^J% + }% + \unvbox\@begindvibox + \special{papersize=\the\paperwidth,\the\paperheight}% + }% +} +\newlength\sa@yoffset +\fi +\fi +\ifstandalonebeamer +\newenvironment{standaloneframe}{% + \@ifnextchar<% + {\@standaloneframe}% + {\@@standaloneframe{}}% +}{\end{frame}}% +\def\@standaloneframe<#1>{% + \@@standaloneframe{<#1>}% +} +\def\@@standaloneframe#1{% + \@ifnextchar[%] + {\@@@standaloneframe{#1}}% + {\@@@standaloneframe{#1}[]}% +}% +\def\@@@standaloneframe#1[{% + \@ifnextchar<% + {\@@@@standaloneframe{#1}[}% + {\@@@@@@standaloneframe{#1}[}% +}% +\def\@@@@standaloneframe#1[#2]{% + \@ifnextchar[%] + {\@@@@@standaloneframe{#1}{#2}}% + {\begin{frame}#1[#2][environment=standaloneframe]}% +}% +\def\@@@@@standaloneframe#1#2[#3]{% + \begin{frame}#1[#2][environment=standaloneframe,#3]% +}% +\def\@@@@@@standaloneframe#1[#2]{% + \begin{frame}#1[environment=standaloneframe,#2]% +}% +\fi +\expandafter\ifx\csname sa@internal@run\endcsname\relax\else + \AtEndDocument{% + \immediate\write\@mainaux{\noexpand\@gobbletwo\noexpand\sa@multi@setnumpages{\arabic{sapage}}}% + } + \sa@convertfalse +\fi +\ifsa@convert +\ifsa@multi\else +\sa@convert@perpagefalse +\fi +\def\sa@convert@stop{\csname fi\endcsname\stop}% +\begingroup +\let\on@line\@gobble +\def\sa@convert#1{% + \IfFileExists{\outfile}{% + \edef\filemodbefore{\csname pdf\ifluatex @\fi filemoddate\endcsname{\outfile}}% + }{% + \IfFileExists{\outname\outext}{% + \edef\filemodbefore{\csname pdf\ifluatex @\fi filemoddate\endcsname{\outname\outext}}% + }{% + \IfFileExists{\outname-0\outext}{% + \edef\filemodbefore{\csname pdf\ifluatex @\fi filemoddate\endcsname{\outname-0\outext}}% + }{% + \IfFileExists{\outname-1\outext}{% + \edef\filemodbefore{\csname pdf\ifluatex @\fi filemoddate\endcsname{\outname-1\outext}}% + }{% + \def\filemodbefore{}% + }}}}% + \edef\@tempa{\jobname}% + \edef\@tempb{\sa@convert@subjobname}% + \@onelevel@sanitize\@tempa + \@onelevel@sanitize\@tempb + \@tempswafalse + \ifx\@tempa\@tempb + \@tempswatrue + \edef\infile@filemodbefore{\csname pdf\ifluatex @\fi filemoddate\endcsname{\infile}}% + \else + \global\let\sa@convert@stop\relax + \fi + \ShellEscape{\sa@convert@latex\space\sa@convert@latexoptions\space + -jobname \sa@convert@quote\sa@convert@subjobname\sa@convert@quote\space + \sa@convert@quote\string\expandafter\string\def\string\csname\space + sa@internal@run\string\endcsname{1}\string\input{\sa@convert@mainfile}\sa@convert@quote}% + \def\sa@multi@numpages{0}% + \begingroup + \IfFileExists{\sa@convert@subjobname.aux}{\@tempswatrue}{\@tempswafalse}% + \if@tempswa + \newread\sa@read + \def\@tempa##1\sa@multi@setnumpages##2##3\@nnil{% + \def\@tempc{##2}% + \ifx\@tempc\@nnil\else + \gdef\sa@multi@numpages{##2}% + \fi + }% + \endlinechar=\m@ne + \immediate\openin\sa@read=\sa@convert@subjobname.aux\relax + \loop\unless\ifeof\sa@read + \read\sa@read to\@tempb + \expandafter\@tempa\@tempb\sa@multi@setnumpages\@nil\@empty\@nnil + \repeat + \immediate\closein\sa@read + \fi + \endgroup + \@tempcnta\sa@multi@numpages\relax + \ifsa@convert@perpage + \def\sa@multi@pagemark{-\pagenum}% + \else + \ifnum\@tempcnta=\z@ + \def\sa@multi@pagemark{}% + \edef\sa@lastoutfile{\outfile}% + \else + \begingroup + \def\sa@multi@pagemark{-\the\@tempcnta}% + \xdef\sa@lastoutfile{\outfile}% + \endgroup + \@tempcntb\z@ + \loop\ifnum\@tempcnta>0 + \advance\@tempcntb\@ne + \divide\@tempcnta by 10\relax + \repeat + \edef\sa@multi@pagemark{-\percent0\the\@tempcntb d}% + \fi + \fi + \if@tempswa + \edef\infile@filemodafter{\csname pdf\ifluatex @\fi filemoddate\endcsname{\infile}}% + \ifx\infile@filemodbefore\infile@filemodafter + \global\let\sa@convert@stop\relax + \fi + \fi + \edef\sa@convert@precommand{\sa@convert@precommand}% + \ifx\sa@convert@precommand\@empty\else +\message{Executing precommand:^^J\sa@convert@precommand^^J^^J}% + \ShellEscape{\sa@convert@precommand}% + \fi + \ifsa@convert@perpage + \begingroup + \@tempcnta\sa@multi@numpages\relax + \@tempcntb\z@ + \def\pagenum{\the\@tempcntb}% + \loop\ifnum\@tempcntb<\@tempcnta + \edef\prevpagenum{\pagenum}% + \advance\@tempcntb\@ne + \sa@execute@convert@command + \sa@checkoutfile{\outfile}{#1}% + \repeat + \endgroup + \else + \sa@execute@convert@command + \sa@checkoutfile{\sa@lastoutfile}{#1}% + \fi + \@tempswafalse +} +\def\sa@execute@convert@command{% +\message{Executing command:^^J\sa@convert@command^^J^^J}% + \ShellEscape{\sa@convert@command}% +} +\def\sa@checkoutfile#1#2{% + \IfFileExists{#1}{% + \edef\filemodafter{\csname pdf\ifluatex @\fi filemoddate\endcsname{#1}}% + \ifx\filemodbefore\filemodafter + \expandafter\ifx\csname pdf\ifluatex @\fi filemoddate\endcsname\relax\else + \sa@convert@failuremsg{standalone}{#2}{}% + \fi + \else + \typeout{Class standalone:^^JOutput written on #1.}% + \fi + }{% + \sa@convert@failuremsg{standalone}{#2}{}% + }% +} +\let\subjobname\sa@convert@subjobname +\let\mainfile\sa@convert@mainfile +\let\infile\sa@convert@infile +\let\inext\sa@convert@inext +\let\inname\sa@convert@inname +\let\indir\sa@convert@indir +\let\outdir\sa@convert@outdir +\let\outputdir\sa@convert@outputdir +\let\gsdevice\sa@convert@gsdevice +\let\convertexe\sa@convert@convertexe +\let\gsexe\sa@convert@gsexe +\let\inkscapeexe\sa@convert@inkscapeexe +\let\gsexe\sa@convert@gsexe +\let\density\sa@convert@density +\let\size\sa@convert@size +\let\outext\sa@convert@outext +\let\outname\sa@convert@outname +\let\outfile\sa@convert@outfile +\let\pagenum\sa@convert@pagenum +\let\percent\@percentchar +\let\quote\sa@convert@quote +\edef\sa@shellescape{% + \ifluatex + \directlua{tex.write(status.shell_escape or 2)}% + \else\ifxetex + \the\shellescape + \else + \expandafter\ifx\csname pdfshellescape\endcsname\relax + 0% + \else + \the\pdfshellescape + \fi\fi\fi +}% +\ifcase\sa@shellescape\relax% 0 + \sa@convert@failuremsg + {standalone}{Shell escape disabled! Cannot convert file '\infile'.}{}% + \global\let\sa@convert@stop\relax +\or% 1 + \sa@convert{Conversion unsuccessful!\MessageBreak + There might be something wrong with your\MessageBreak + conversation software or the file permissions!}% +\else% 2 or 3 + \sa@convert{Conversion failed! Please ensure that shell escape\MessageBreak + is enabled (e.g. use '-shell-escape').}% +\fi +\endgroup +\expandafter\sa@convert@stop +\fi +\begingroup +\toks@\expandafter{% + \document + \sa@cls@afterbegindocument +} +\xdef\document{\the\toks@}% +\toks@\expandafter{% + \expandafter + \sa@cls@beforeenddocument + \enddocument +} +\xdef\enddocument{\the\toks@}% +\endgroup +\def\sa@cls@afterbegindocument{\standalone\ignorespaces} +\def\sa@cls@beforeenddocument{\ifhmode\unskip\fi\endstandalone} +\endinput +%% +%% End of file `standalone.cls'. diff --git a/text/tex/texmf/standalone.sty b/text/tex/texmf/standalone.sty new file mode 100644 index 0000000000..e40e7fdf2a --- /dev/null +++ b/text/tex/texmf/standalone.sty @@ -0,0 +1,1145 @@ +%% Copyright (C) 2010-2025 by Martin Scharrer +%% --------------------------------------------------------------------------- +%% This work may be distributed and/or modified under the +%% conditions of the LaTeX Project Public License, either version 1.3 +%% of this license or (at your option) any later version. +%% The latest version of this license is in +%% http://www.latex-project.org/lppl.txt +%% and version 1.3 or later is part of all distributions of LaTeX +%% version 2005/12/01 or later. +%% +%% This work has the LPPL maintenance status `maintained'. +%% +%% The Current Maintainer of this work is Martin Scharrer. +%% +%% This work consists of the files standalone.dtx and standalone.ins +%% and the derived filebase standalone.sty, standalone.cls and +%% standalone.cfg. +%% +%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% +\NeedsTeXFormat{LaTeX2e} +\ProvidesPackage{standalone}[% + 2025/02/22 + v1.5a + Package to include TeX sub-files with preambles] +%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% +\@ifundefined{ifstandalone}{% + \expandafter\newif\csname ifstandalone\endcsname + \standalonefalse +}{} +\@ifundefined{ifstandalonebeamer}{% + \expandafter\newif\csname ifstandalonebeamer\endcsname + \standalonebeamerfalse +}{} +\@ifundefined{onlyifstandalone}{% + \let\onlyifstandalone\@gobble +}{} +\@ifundefined{IfStandalone}{% + \let\IfStandalone\@secondoftwo +}{} +\expandafter\ifx\csname ShellEscape\endcsname\relax + \IfFileExists{shellesc.sty}{ + \RequirePackage{shellesc} + \@ifpackagelater{shellesc}{2016/04/29}{ + }{ + \protected\def\ShellEscape{\immediate\write18 } + } + }{ + \protected\def\ShellEscape{\immediate\write18 } + } +\fi +\expandafter\ifx\csname ifluatex\endcsname\relax + \IfFileExists{ifluatex.sty}{ + \RequirePackage{ifluatex} + }{ + \begingroup + \expandafter\ifx\csname directlua\endcsname\relax + \endgroup + \global\expandafter\let\csname ifluatex\expandafter\endcsname\csname iffalse\endcsname + \else + \endgroup + \global\expandafter\let\csname ifluatex\expandafter\endcsname\csname iftrue\endcsname + \fi + } +\fi +\expandafter\ifx\csname ifpdf\endcsname\relax + \IfFileExists{ifpdf.sty}{ + \RequirePackage{ifpdf} + }{ + \begingroup + \expandafter\ifx\csname pdfoutput\endcsname\relax + \endgroup + \global\expandafter\let\csname ifpdf\expandafter\endcsname\csname iffalse\endcsname + \else + \endgroup + \ifnum\pdfoutput<1 + \global\expandafter\let\csname ifpdf\expandafter\endcsname\csname iffalse\endcsname + \else + \global\expandafter\let\csname ifpdf\expandafter\endcsname\csname iftrue\endcsname + \fi + \fi + } +\fi +\expandafter\ifx\csname ifxetex\endcsname\relax + \IfFileExists{ifxetex.sty}{ + \RequirePackage{ifxetex} + }{ + \begingroup + \expandafter\ifx\csname XeTeXrevision\endcsname\relax + \endgroup + \global\expandafter\let\csname ifxetex\expandafter\endcsname\csname iffalse\endcsname + \else + \endgroup + \global\expandafter\let\csname ifxetex\expandafter\endcsname\csname iftrue\endcsname + \fi + } +\fi +\newif\ifsa@subpreambles +\newif\ifsa@sortsubpreambles +\newif\ifsa@printsubpreambles +\newif\ifsa@group +\newif\ifsa@obeyclassoptions +\newif\ifsa@multi +\newif\ifsa@tikz +\newif\ifsa@varwidth +\newif\ifsa@comments +%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% +\RequirePackage{xkeyval} +\def\sa@pkgoption{% + \define@key{standalone.sty}% +} +\def\sa@boolean#1#2{% + \sa@boolorvalue{#1}{#2}% + {\ClassError{standalone}{Invalid value '#2' for boolean key '#1'}{}}% +} +\def\sa@boolorvalue#1#2{% + \begingroup + \edef\@tempa{#2}% + \def\@tempb{true}% + \ifx\@tempa\@tempb + \endgroup + \csname sa@#1true\endcsname + \expandafter\@gobble + \else + \def\@tempb{false}% + \ifx\@tempa\@tempb + \endgroup + \csname sa@#1false\endcsname + \expandafter\expandafter + \expandafter\@gobble + \else + \endgroup + \expandafter\expandafter + \expandafter\@firstofone + \fi\fi +} +\sa@pkgoption{sort}[true]{% + \sa@boolean{sortsubpreambles}{#1}% + \ifsa@sortsubpreambles + \sa@subpreamblestrue + \fi +} +\sa@pkgoption{print}[true]{% + \sa@boolean{printsubpreambles}{#1}% + \ifsa@printsubpreambles + \sa@subpreamblestrue + \fi +} +\sa@pkgoption{subpreambles}[true]{% + \sa@boolean{subpreambles}{#1}% +} +\sa@pkgoption{group}[true]{% + \sa@boolean{group}{#1}% +} +\sa@grouptrue +\sa@pkgoption{comments}[true]{% + \sa@boolean{comments}{#1}% + \ifsa@comments + \def\sa@percent{\@makeother\%}% + \else + \def\sa@percent{\catcode`\%=14\relax}% + \fi +} +\sa@pkgoption{nocomments}[]{% + \begingroup + \def\@tempa{#1}% + \ifx\@tempa\@empty\else + \PackageWarning{standalone}{Unwanted value of 'nocomments' was ignored}{}A + \fi + \endgroup + \setkeys{standalone.sty}{comments=false}% +} +\sa@pkgoption{mode}{% + \begingroup + \expandafter\let\expandafter\@tempa\csname sa@mode@#1\endcsname + \ifx\@tempa\relax + \endgroup + \PackageError{standalone}{Wrong value for option 'mode'}{}% + \else + \expandafter + \endgroup + \@tempa + \fi +} +\def\sa@mode@none{% + \let\sa@mode\relax% +} +\def\sa@mode@tex{% + \def\sa@mode{1}% +} +\def\sa@mode@image{% + \def\sa@mode{2}% +} +\@namedef{sa@mode@image|tex}{% + \def\sa@mode{0}% +} +\def\sa@mode@build{% + \def\sa@mode{3}% +} +\def\sa@mode@buildmissing{% + \def\sa@mode{4}% +} +\def\sa@mode@buildnew{% + \ifxetex + \PackageWarning{standalone}{The 'mode=buildnew' option is not available for XeTeX.\MessageBreak + Therefore 'mode=build' will be used instead}% + \def\sa@mode{3}% + \else + \def\sa@mode{5}% + \fi +} +\sa@mode@tex +\sa@pkgoption{obeyclassoptions}[true]{% + \sa@boolean{obeyclassoptions}{#1}% +} +\sa@pkgoption{extension}{% + \def\sa@graphicext{#1}% +} +\sa@pkgoption{build}[]{% + \setkeys{standalone.sty/build}{#1}% +} +\def\sa@buildvar#1#2{% + \define@key{standalone.sty/build}{#1}{% + \@namedef{sa@build@#1}{##1}% + }% + \@namedef{sa@build@#1}{#2}% +} +\sa@buildvar{jobname}{\file} +\sa@buildvar{latex}{} +\sa@buildvar{quote}{} +\let\sa@build@quote\relax +\sa@buildvar{latexoptions}{% + -interaction=batchmode -shell-escape -jobname \quote\buildjobname\quote +} +\sa@buildvar{command}{% + \latex\space\latexoptions\space\file +} +%% '\string\PassOptionsToClass{border=0pt}{standalone}\string\input{\image}' +\def\sa@build@postcommand{} +\ifpdf + \def\sa@graphicext{.pdf} + \ifluatex + \def\sa@build@latex{lualatex} + \else + \def\sa@build@latex{pdflatex} + \fi +\else +\ifxetex + \def\sa@graphicext{.pdf} + \def\sa@build@latex{xelatex} +\else + \def\sa@graphicext{.eps} + \def\sa@build@latex{latex} + \def\sa@build@postcommand{dvips -o \quote\file.eps\quote\space \quote\file.dvi\quote} +\fi\fi +\ProcessOptionsX*\relax +\disable@keys{standalone.sty}{subpreambles,print,sort} +\def\sa@setquote{% + \ifx\sa@build@quote\relax + \expandafter\ifx\csname sa@convert@quote\endcsname\relax + \begingroup + \@tempswafalse + \expandafter\ifx\csname pdftexbanner\endcsname\relax + \@tempswatrue + \else + \def\MiKTeX{MiKTeX} + \@onelevel@sanitize\MiKTeX + \expandafter\def\expandafter\testmiktex\expandafter##\expandafter1\MiKTeX##2\relax{% + \ifx\empty##2\empty + \@tempswafalse + \else + \@tempswatrue + \fi + } + \expandafter\expandafter + \expandafter\testmiktex\expandafter\pdftexbanner\MiKTeX\relax\relax + \fi + \expandafter + \endgroup + \if@tempswa + \def\sa@build@quote{"} + \else + \def\sa@build@quote{'} + \fi + \else + \let\sa@build@quote\sa@convert@quote + \fi + \fi +} +\ifsa@printsubpreambles + \ifsa@sortsubpreambles\else + \@ifundefined{sa@percent}{% + \setkeys{standalone.sty}{comments=true}% + }{}% + \fi +\fi +\@ifclassloaded{standalone}{% + \def\standaloneconfig{% + \setkeys{standalone.sty,standalone.cls}% + }% +}{% + \newcommand*{\standaloneconfig}{% + \setkeys{standalone.sty}% + }% +} +\RequirePackage{currfile} +%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% +\ifsa@subpreambles +\newwrite\sa@out +\def\sa@write{\immediate\write\sa@out}% +\ifsa@printsubpreambles +\long\def\sa@removeonlyifstandalone#1\onlyifstandalone{% + \g@addto@macro\sa@preamble{#1}% + \@ifnextchar\sa@endmarker + {\@gobble}% + {\expandafter\sa@gobbleeol\expandafter\sa@removeonlyifstandalone\expandafter^^J\@gobble}% +} +\fi +%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% +\ifsa@sortsubpreambles +\newcommand{\sa@usepackagewithoutoptions}[2][]{% + \sa@orig@usepackage{#2}% +} +\def\sa@endmarker{% + \@gobble{sa@endmarker}% +} +\ifsa@printsubpreambles +\AtEndDocument{% + \sa@write{\@percentchar\space Packages required by sub-files:}% + \expandafter\@for\expandafter\pkg\expandafter:\expandafter=\sa@collpkgs\do{% + \ifx\pkg\empty\else + \sa@write{% + \string\usepackage% + \expandafter\ifx\csname sa@pkgopts@\pkg\endcsname\empty\else% + [\csname sa@pkgopts@\pkg\endcsname]% + \fi + {\pkg}% + \expandafter\ifx\csname sa@pkgdate@\pkg\endcsname\relax\else% + [\csname sa@pkgdate@\pkg\endcsname]% + \fi + }% + \fi + }% + \ifx\sa@collpgflibs\empty\else + \sa@write{^^J\@percentchar\space PGF libraries required by sub-files:}% + \expandafter\@for\expandafter\lib\expandafter:\expandafter=\sa@collpgflibs\do{% + \ifx\lib\empty\else + \sa@write{\string\usepgflibrary{\lib}}% + \fi + }% + \fi + \ifx\sa@colltikzlibs\empty\else + \sa@write{^^J\@percentchar\space TikZ libraries required by sub-files:}% + \expandafter\@for\expandafter\lib\expandafter:\expandafter=\sa@colltikzlibs\do{% + \ifx\lib\empty\else + \sa@write{\string\usetikzlibrary{\lib}}% + \fi + }% + \fi + \ifx\sa@colltikztiminglibs\empty\else + \sa@write{^^J\@percentchar\space TikZ-Timing libraries required by sub-files:}% + \expandafter\@for\expandafter\lib\expandafter:\expandafter=\sa@colltikztiminglibs\do{% + \ifx\lib\empty\else + \sa@write{% + \string\usetikztiminglibrary% + \expandafter\ifx\csname sa@tikztimingopts@\lib\endcsname\empty\else% + [\csname sa@tikztimingopts@\lib\endcsname]% + \fi + {\lib}% + \expandafter\ifx\csname sa@tikztimingdate@\lib\endcsname\relax\else% + [\csname sa@tikztimingdate@\lib\endcsname]% + \fi + }% + \fi + }% + \fi + \sa@write{\expandafter\unexpanded\expandafter{\sa@preamble}}% + \message{^^JPackage 'standalone' INFO: See file '\jobname.stp' for list of sub-preambles.^^J}% + \immediate\closeout\sa@out +} +\long\def\sa@removepackages#1\usepackage{% + \sa@removepgflibs#1\usepgflibrary\sa@endmarker + \@ifnextchar\sa@endmarker + {\@gobble}% + {\sa@sortpackages}% +} +\long\def\sa@removepgflibs#1\usepgflibrary{% + \sa@removetikzlibs#1\usetikzlibrary\sa@endmarker + \@ifnextchar\sa@endmarker + {\@gobble}% + {\sa@sortpgflibs}% +} +\long\def\sa@removetikzlibs#1\usetikzlibrary{% + \sa@removetikztiminglibs#1\usetikztiminglibrary\sa@endmarker + \@ifnextchar\sa@endmarker + {\@gobble}% + {\sa@sorttikzlibs}% +} +\long\def\sa@removetikztiminglibs#1\usetikztiminglibrary{% + \sa@removeonlyifstandalone#1\onlyifstandalone\sa@endmarker + \@ifnextchar\sa@endmarker + {\@gobble}% + {\sa@sorttikztiminglibs}% +} +\def\sa@collpkgs{}% +\newcommand\sa@sortpackages[2][]{% + \@ifnextchar[%] + {\sa@@sortpackages{#1}{#2}}% + {\sa@@sortpackages{#1}{#2}[]}% +} +\def\sa@@sortpackages#1#2[#3]{% + \@for\pkg:=#2\do {% + \@ifundefined{sa@pkgopts@\pkg}% + {% + \expandafter\g@addto@macro\expandafter\sa@collpkgs\expandafter{\expandafter,\pkg}% + \global\@namedef{sa@pkgopts@\pkg}{#1}% + \global\@namedef{sa@pkgopt@\pkg @}{}% + \ifx\relax#1\relax\else + \@for\opt:=#1\do{\global\@namedef{sa@pkgopt@\pkg @\opt}{}}% + \fi + }% + {% + \ifx\relax#1\relax\else + \@for\opt:=#1\do{% + \@ifundefined{sa@pkgopt@\pkg @\opt}% + {% + \expandafter\g@addto@macro\csname sa@pkgopts@\pkg\expandafter\endcsname\expandafter{\expandafter,\opt}% + \global\@namedef{sa@pkgopt@\pkg @\opt}{}% + }{}% + }% + \fi + }% + \ifx\relax#3\relax\else + \@ifundefined{sa@pkgdate@\pkg}% + {\global\@namedef{sa@pkgdate@\pkg}{#3}}% + {% + \ifnum\expandafter\expandafter + \expandafter\sa@@getdate\csname sa@pkgdate@\pkg\endcsname//00\relax<\sa@@getdate#3//00\relax + \global\@namedef{sa@pkgdate@\pkg}{#3}% + \fi + }% + \fi + }% + \sa@gobbleeol\sa@removepackages^^J% +} +\def\sa@@getdate#1/#2/#3#4#5\relax{#1#2#3#4} +\def\sa@collpgflibs{}% +\def\sa@sortpgflibs#1{% + \@for\lib:=#1\do {% + \@ifundefined{sa@pgflib@\lib}% + {% + \expandafter\g@addto@macro\expandafter\sa@collpgflibs\expandafter{\expandafter,\lib}% + \global\@namedef{sa@pgflib@\lib}{}% + }% + {}% + }% + \sa@gobbleeol\sa@removepgflibs^^J% +} +\def\sa@colltikzlibs{}% +\def\sa@sorttikzlibs#1{% + \@for\lib:=#1\do {% + \@ifundefined{sa@tikzlib@\lib}% + {% + \expandafter\g@addto@macro\expandafter\sa@colltikzlibs\expandafter{\expandafter,\lib}% + \global\@namedef{sa@tikzlib@\lib}{}% + }% + {}% + }% + \sa@gobbleeol\sa@removetikzlibs^^J% +} +\def\sa@colltikztiminglibs{}% +\newcommand\sa@sorttikztiminglibs[2][]{% + \@ifnextchar[%] + {\sa@@sorttikztiminglibs{#1}{#2}}% + {\sa@@sorttikztiminglibs{#1}{#2}[]}% +} +\def\sa@@sorttikztiminglibs#1#2[#3]{% + \@for\lib:=#2\do {% + \@ifundefined{sa@tikztimingopts@\lib}% + {% + \expandafter\g@addto@macro\expandafter\sa@colltikztiminglibs\expandafter{\expandafter,\lib}% + \global\@namedef{sa@tikztimingopts@\lib}{#1}% + \global\@namedef{sa@tikztimingopt@\lib @}{}% + \ifx\relax#1\relax\else + \@for\opt:=#1\do{\global\@namedef{sa@tikztimingopt@\lib @\opt}{}}% + \fi + }% + {% + \ifx\relax#1\relax\else + \@for\opt:=#1\do{% + \@ifundefined{sa@tikztimingopt@\lib @\opt}% + {% + \expandafter\g@addto@macro\csname sa@tikztimingopts@\lib\expandafter\endcsname\expandafter{\expandafter,\opt}% + \global\@namedef{sa@tikztimingopt@\lib @\opt}{}% + }{}% + }% + \fi + }% + \ifx\relax#3\relax\else + \@ifundefined{sa@tikztimingdate@\lib}% + {\global\@namedef{sa@tikztimingdate@\lib}{#3}}% + {% + \begingroup + \edef\@tempa{{\csname sa@tikztimingdate@\lib\endcsname}{#3}}% + \expandafter\sa@getlargerdate\@tempa + \expandafter\xdef\csname sa@tikztimingdate@\lib\endcsname{\sa@thedate}% + \endgroup + }% + \fi + }% + \sa@gobbleeol\sa@removetikztiminglibs^^J% +} +\def\sa@gobbleopt#1[#2]{% + \@ifnextchar^^J% + {\sa@gobbleeol{#1}}{#1}% +} +\else +\def\sa@scanpackages#1\usepackage{% + \@ifnextchar\sa@endmarker + {\@gobble}% + {\sa@collectpackage} +} +\newcommand\sa@collectpackage[2][]{% + \ifx\relax#1\relax\else + \g@addto@macro\sa@collopts{\PassOptionsToPackage{#1}{#2}}% + \fi + \sa@scanpackages +} +\fi +\def\sa@collopts{} +\AtEndOfPackage{\sa@collopts\let\sa@collopts\relax} +\fi +\def\standalonepreambles{% + \begingroup + \endlinechar=\m@ne + \@makeother\#% +} +\def\endstandalonepreambles{% + \endgroup + \endinput +} +\long\gdef\subpreamble#1#2\endsubpreamble{% + \expandafter\gdef\csname prevsubpreamble@#1\endcsname{#2}% + \ifsa@sortsubpreambles + \sa@scanpackages#2\usepackage\sa@endmarker + \fi +} +\def\endsubpreamble{}% +\ifsa@printsubpreambles + \immediate\openout\sa@out=\jobname.stp\relax +\else +\begingroup + \setbox\@tempboxa\hbox{% + \makeatother + \InputIfFileExists{\jobname.sta}{}{\PackageInfo{standalone}{STA file not found!}{}{}}% + }% +\endgroup + +\AtBeginDocument{% + \let\subpreamble\@gobble + \let\endsubpreamble\relax + \let\standalonepreambles\relax + \let\endstandalonepreambles\relax + \ifsa@sortsubpreambles + \let\sa@orig@usepackage\usepackage + \let\usepackage\sa@usepackagewithoutoptions + \fi + \InputIfFileExists{\jobname.sta}{}{}% + \ifsa@sortsubpreambles + \let\usepackage\sa@orig@usepackage + \fi + \immediate\openout\sa@out=\jobname.sta\relax + \immediate\write\sa@out{\string\standalonepreambles}% +} +\AtEndDocument{% + \sa@write{\string\endstandalonepreambles}% + \immediate\closeout\sa@out +} +\fi +\fi +%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% +\def\sa@gobbleeol#1^^J{% + \@ifnextchar^^J% + {\sa@gobbleeol{#1}}{#1}% +} +\def\sa@endinput{% + \endlinechar`^^J\relax + \let\do\@makeother + \dospecials + \sa@@endinput +}% +\def\sa@@endinput#1^^J{% + \endgroup + \endinput +} +\def\sa@substbox{% + \leavevmode\hbox to 1pt{\vbox to 1pt{}}% +}% +\long\def\standaloneignore#1\documentclass{% + \sa@documentclass +} +\@namedef{standaloneignore\space}{\standaloneignore} +\newcommand{\sa@documentclass}[2][]{% + \let\document\sa@document + \let\sa@subfile@options\@empty + \ifsa@obeyclassoptions + \begingroup + \edef\@tempa{#2}% + \edef\@tempb{standalone}% + \ifx\@tempa\@tempb + \endgroup + \def\sa@subfile@options{#1}% + \else + \endgroup + \fi + \fi + \begingroup + \ifsa@subpreambles + \@ifundefined{sa@written@\currfilepath}% + {% + \ifsa@printsubpreambles + \ifsa@sortsubpreambles + \begingroup + \edef\@tempa{^^J\@percentchar\space Preamble from file '\currfilepath'^^J}% + \expandafter\g@addto@macro\expandafter\sa@preamble\expandafter{\@tempa}% + \endgroup + \else + \sa@write{^^J\@percentchar\space Preamble from file '\currfilepath'}% + \fi + \else + \sa@write{\string\subpreamble{\currfilepath}}% + \fi + }{}% + \global\@namedef{subpreamble@\currfilepath}{}% + \ifsa@printsubpreambles + \endlinechar=`\^^J\relax + \else + \endlinechar=\m@ne + \fi + \@makeother\#% + \@nameuse{sa@percent}% + \fi + \def\sa@gobbleto{document}% + \sa@gobbleeol\sa@gobble^^J% +} +\def\sa@preamble{}% +\long\def\sa@gobble#1\begin#2{% + \def\@tempa{#2}% + \ifx\@tempa\sa@gobbleto + \ifsa@subpreambles + \expandafter\g@addto@macro\csname subpreamble@\currfilepath\endcsname{#1}% + \@ifundefined{sa@written@\currfilepath}% + {% + \ifsa@printsubpreambles + \ifsa@sortsubpreambles + \sa@removepackages#1\usepackage\sa@endmarker + \else + \begingroup + \let\sa@preamble\empty + \sa@removeonlyifstandalone#1\onlyifstandalone\sa@endmarker + \expandafter\sa@write\expandafter{\expandafter\unexpanded\expandafter{\sa@preamble}}% + \endgroup + \fi + \else + \sa@write{\unexpanded{#1}}% + \sa@write{\string\endsubpreamble}% + \fi + }{}% + \global\@namedef{sa@written@\currfilepath}{}% + \ifsa@printsubpreambles + \def\next{% + \PackageWarning{standalone}{Running 'standalone' package in sub-preamble print mode. All body content of file `\currfilepath' is ignored!}{}{}% + \sa@substbox + \sa@endinput + }% + \else + \expandafter + \ifx + \csname prevsubpreamble@\currfilepath\expandafter\endcsname + \csname subpreamble@\currfilepath\endcsname + \def\next{\expandafter\endgroup\expandafter\begin\expandafter{\sa@gobbleto}}% + \else + %\expandafter\show\csname prevsubpreamble@\currfilepath\endcsname + %\expandafter\show\csname subpreamble@\currfilepath\endcsname + \def\next{% + \PackageWarning{standalone}{Sub-preamble of file '\currfilepath' has changed. Content will be ignored. Please rerun LaTeX!}{}{}% + \immediate\write\@mainaux{% + \@percentchar\space standalone package info: Rerun LaTeX! + }% + \sa@substbox + \sa@endinput + }% + \fi + \fi + \else + \def\next{\expandafter\endgroup\expandafter\begin\expandafter{\sa@gobbleto}}% + \fi + \else + \ifsa@subpreambles + \expandafter\g@addto@macro\csname subpreamble@\currfilepath\endcsname{#1\begin{#2}}% + \@ifundefined{sa@written@\currfilepath}% + {\sa@write{\unexpanded{#1\begin{#2}}}}{}% + \fi + \def\next{\sa@gobble}% + \fi + \next +} +\@ifundefined{standalone} + {\newenvironment{standalone}[1][]{}{}} + {} +\@ifundefined{standaloneframe} + {\@ifundefined{beamer@newenv} + {\newenvironment{standaloneframe}[1][]{% + \@ifnextchar[%] + {\sa@framegobbleopt}{\sa@framegobbleargs}}{}% + } + {\newenvironment<>{standaloneframe}[1][]{% + \@ifnextchar[%] + {\sa@framegobbleopt}{\sa@framegobbleargs}}{}% + } + \def\sa@framegobbleopt[#1]{\sa@framegobbleargs} + \def\sa@framegobbleargs{% + \@ifnextchar\bgroup + {\sa@framegobbleargs@}% + {}% + } + \def\sa@framegobbleargs@#1{% + \@ifnextchar\bgroup + {\@gobble}% + {}% + } + } + {} +\let\sa@orig@document\document +\let\sa@orig@enddocument\enddocument +\begingroup +\toks@\expandafter{% + \document + \let\documentclass\sa@documentclass + \ignorespaces +} +\xdef\document{\the\toks@}% +\endgroup +\ifsa@obeyclassoptions +\IfFileExists{varwidth.sty}{% + \RequirePackage{varwidth}% +}{} +\define@key{standalone.sty/class}{12pt}[]{% + \def\sa@subfile@size{12}% +} +\define@key{standalone.sty/class}{11pt}[]{% + \def\sa@subfile@size{11}% +} +\define@key{standalone.sty/class}{10pt}[]{% + \def\sa@subfile@size{10}% +} +\define@key{standalone.sty/class}{class}{% + \def\sa@subfile@class{#1}% +} +\define@key{standalone.sty/class}{multi}[true]{% + \sa@boolorvalue{multi}{#1}{% + \sa@multitrue\AtEndOfClass{\standaloneenv{#1}}% + }% + \ifsa@multi + \def\sa@requestedpage{1}% + \def\standaloneenv##1{% + \begingroup + \edef\@tempa{\endgroup\noexpand\@for\noexpand\@tempa:=\zap@space##1 \@empty}% + \@tempa\do{\expandafter\@standaloneenv\expandafter{\@tempa}}% + }% + \def\@standaloneenv##1{% + \expandafter\ifx\csname sa@orig@##1\endcsname\relax + \expandafter\let\csname sa@orig@##1\expandafter\endcsname\csname ##1\endcsname + \expandafter\let\csname sa@orig@end##1\expandafter\endcsname\csname end##1\endcsname + \fi + \expandafter\def\csname ##1\endcsname{% + \ifnum\sa@internal=0 + \global\advance\sa@pagenum\@ne + \sa@boxit + \fi + \advance\sa@internal\@ne + \csname sa@orig@##1\endcsname + }% + \expandafter\def\csname end##1\endcsname{% + \csname sa@orig@end##1\endcsname + \advance\sa@internal\m@ne + \ifnum\sa@internal=0 + \endsa@boxit + \ifx\sa@requestedpage\@empty +\let\sa@requestedpage\sa@allpages + \fi + \ifx\sa@requestedpage\sa@allpages + \usebox\sa@box + \else + \ifnum\sa@requestedpage=\sa@pagenum + \usebox\sa@box + \fi\fi + \fi + \@ignoretrue + }% + }% + \else + \let\standaloneenv\@gobble + \fi +} +\newcount\sa@internal +\newcount\sa@pagenum +\def\sa@allpages{-1}% +\let\sa@box\@tempboxa +\def\sa@boxit{% + \setbox\sa@box\hbox\bgroup\color@setgroup\sa@varwidth +}% +\def\endsa@boxit{% + \sa@endvarwidth\color@endgroup\egroup +}% +\define@key{standalone.sty/class}{tikz}[true]{% + \sa@boolean{tikz}{#1}% + \ifsa@tikz + \setkeys*{standalone.sty/class}{multi=tikzpicture,varwidth=false}% + \fi +} +\define@key{standalone.sty/class}{varwidth}[true]{% + \sa@boolorvalue{varwidth}{#1}{\sa@varwidthtrue\def\sa@width{#1}}% + \ifsa@varwidth + \expandafter\ifx\csname ver@varwidth.sty\endcsname\relax + \PackageWarning{standalone}{A standalone file which uses the varwidth package\MessageBreak + has been encountered while obeyclassoptions=true.\MessageBreak + Please load this package in the preamble.\MessageBreak + The file in question is loaded}% + \sa@varwidthfalse + \fi + \fi + \ifsa@varwidth + \def\sa@varwidth{\varwidth{\sa@width}}% + \def\sa@endvarwidth{\endvarwidth}% + \else + \let\sa@varwidth\@empty + \let\sa@endvarwidth\@empty + \fi +} +\let\sa@varwidth\@empty +\let\sa@endvarwidth\@empty +\def\sa@width{\linewidth} +\define@key{standalone.sty/class}{beamer}[true]{% + \sa@boolean{beamer}{#1}% + \ifstandalonebeamer + \setkeys*{standalone.sty/class}{class=beamer,preview=false,crop=false,varwidth=false}% + \fi + \standalonebeamerfalse +} +\let\sa@beamertrue\standalonebeamertrue +\let\sa@beamerfalse\standalonebeamerfalse +\define@key{standalone.sty/class}{border}{% + \sa@readborder#1 {} {} {} {} \@nnil +} +\def\sa@border@left{0.50001bp} +\let\sa@border@right\sa@border@left +\let\sa@border@top\sa@border@left +\let\sa@border@bottom\sa@border@left +\def\rem@bp#1bp\relax#2\@nnil{#1}% +\def\default@bp#1#2{% + \begingroup + \afterassignment\remove@to@nnil + \dimen@ #2bp\relax\@nnil + \expandafter + \endgroup + \expandafter + \def\expandafter#1\expandafter{\the\dimen@}% +} +\def\sa@readborder#1 #2 #3 #4 #5\@nnil{% + \ifx\\#2#3#4\\% + \default@bp\sa@border@left{#1}% + \let\sa@border@right\sa@border@left + \let\sa@border@top\sa@border@left + \let\sa@border@bottom\sa@border@left + \else + \ifx\\#4\\% + \default@bp\sa@border@left{#1}% + \let\sa@border@right\sa@border@left + \default@bp\sa@border@top{#2}% + \let\sa@border@bottom\sa@border@top + \else + \default@bp\sa@border@left{#1}% + \default@bp\sa@border@bottom{#2}% + \default@bp\sa@border@right{#3}% + \default@bp\sa@border@top{#4}% + \fi\fi +}% +\IfFileExists{adjustbox.sty}{% + \IfFileExists{trimclip.sty}{% + \RequirePackage{trimclip}% + }{% + \RequirePackage{adjustbox}% + }% + \def\sa@beginbox{% + \ifcase0% + \ifdim\sa@border@left<\z@ 1\fi + \ifdim\sa@border@right<\z@ 1\fi + \ifdim\sa@border@top<\z@ 1\fi + \ifdim\sa@border@bottom<\z@ 1\fi + \relax + \marginbox{{\sa@border@left} {\sa@border@bottom} {\sa@border@right} {\sa@border@top}}\bgroup + \else + \clipbox{{-\sa@border@left} {-\sa@border@bottom} {-\sa@border@right} {-\sa@border@top}}\bgroup + \fi + }% + \let\sa@endbox\egroup +}{% + \PackageInfo{standalone}{The 'adjustbox' bundle was not found. Negative borders will not be clipped.}% + \def\sa@beginbox{% + \setbox\@tempboxa\color@hbox + }% + \def\sa@endbox{% + \color@endbox + \sbox\@tempboxa{% + \setlength\@tempdima{\sa@border@left}% + \hskip\@tempdima + \setlength\@tempdima{\sa@border@right}% + \setlength\@tempdimb{\sa@border@bottom}% + \setlength\@tempdimc{\sa@border@top}% + \advance\@tempdima\wd\@tempboxa + \wd\@tempboxa\@tempdima + \advance\@tempdimb\dp\@tempboxa + \dp\@tempboxa\@tempdimb + \advance\@tempdimc\ht\@tempboxa + \ht\@tempboxa\@tempdimc + \raise\dp\@tempboxa\box\@tempboxa + }% + \usebox\@tempboxa + }% +} +\fi +\def\sa@document{% + \ifsa@group + \let\enddocument\sa@enddocument + \ifx\sa@subfile@options\@empty\else + \def\sa@subfile@size{10}% + \def\sa@subfile@class{article}% + \let\NeedsTeXFormat\@gobble + \let\sa@atendofclass\@empty + \def\AtEndOfClass{\g@addto@macro\sa@atendofclass}% + \def\standaloneconfig{\setkeys*{standalone.sty/class}}% + \let\sa@@latex@error\@latex@error + \let\@latex@error\@gobbletwo + \let\sa@selectfont\selectfont + \let\selectfont\relax + \makeatletter + \nullfont + \InputIfFileExists{standalone.cfg}{}{}% + \begingroup + \def\@tempa{\setkeys*{standalone.sty/class}}% + \expandafter\expandafter + \expandafter\endgroup + \expandafter\@tempa\expandafter{\sa@subfile@options}% + \sa@atendofclass + \let\sa@requestedpage\Gin@page + \sa@pagenum\z@ + \sa@beginbox + \@ifundefined{KOMAClassName}{% + \def\@tempa{size}% + }{% + \def\@tempa##1##2##3##4\relax{\def\@tempa{##1##2##3}}% + \expandafter\@tempa\sa@subfile@class{}{}{}\relax + \def\@tempb{scr}% + \ifx\@tempa\@tempb + \def\@tempa##1{scrsize##1pt}% + \else + \def\@tempa{size}% + \fi + }% + \let\sa@newcommand\newcommand + \let\sa@@ifundefined\@ifundefined + \let\newcommand\renewcommand + \let\@ifundefined\@thirdofthree + \edef\@tempa{% + \noexpand\input{\@tempa\sa@subfile@size.clo}% + \catcode`\noexpand\@=\the\catcode`\@ + }\@tempa + \let\newcommand\sa@newcommand + \let\@latex@error\sa@@latex@error + \let\@ifundefined\sa@@ifundefined + \let\selectfont\sa@selectfont + \normalsize + \fi + \else + \endgroup + \global\let\enddocument\sa@enddocument + \fi + \sa@atbegindocument +} +\def\sa@enddocument{% + \sa@atenddocument + \ifsa@group + \ifx\sa@subfile@options\@empty\else + \sa@endbox + \fi + \else + \global\let\document\sa@orig@document + \global\let\enddocument\sa@orig@enddocument + \begingroup + \def\@currenvir{document}% + \fi + \@ignoretrue + \aftergroup\endinput +} +\def\sa@atbegindocument{% + \ignorespaces +}% +\def\sa@atenddocument{% + \ifhmode\unskip\fi +}% +%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% +\IfFileExists{gincltex.sty}{% + \RequirePackage{gincltex} + \newcommand*\includestandalone[2][]{% + \begingroup + \setkeys*{standalone.sty}{##1}% + \edef\@tempa{{##2\sa@graphicext}}% + \expandafter\expandafter\expandafter\includestandalone@ + \expandafter\expandafter\expandafter{\expandafter\XKV@rm\expandafter}\@tempa{##2}% + \endgroup + } +}{% + \begingroup + \let\on@line\@gobble + \PackageWarning{standalone}{Required package 'gincltex' not found.\MessageBreak + The \string\includestandalone\space feature is disabled.} + \endgroup + \newcommand*\includestandalone[2][]{% + \begingroup + \input{##2}% + \endgroup + } +} +\ifxetex\else + \RequirePackage{filemod-expmin} +\fi +\newif\ifsa@buildsuccess +%% 0 = PDF if exists, TEX otherwise +%% 1 = force TEX +%% 2 = force PDF +%% 3 = build PDF if not exists +%% 4 = build PDF if older than TEX +\def\includestandalone@#1#2#3{% + \ifcase\sa@mode + \relax% 0 + \IfFileExists{#2}% + {\includegraphics[#1]{#2}}% + {\includegraphics[#1]{#3.tex}}% + \or% 1 + \includegraphics[#1]{#3.tex}% + \or% 2 + \includegraphics[#1]{#2}% + \or% 3 + \sa@buildgraphic{#3}% + \ifsa@buildsuccess + \includegraphics[#1]{#2}% + \else + \PackageWarning{standalone}% + {Graphic '#2' could not be build.^^J% + Shell escape activated?}% + \includegraphics[#1]{#3.tex}% + \fi + \or% 4 + \IfFileExists{#2}% + {\includegraphics[#1]{#2}}% + {\sa@buildgraphic{#3}% + \ifsa@buildsuccess + \includegraphics[#1]{#2}% + \else + \PackageWarning{standalone}% + {Graphic '#2' could not be build.^^J% + Shell escape activated?}% + \includegraphics[#1]{#3.tex}% + \fi + }% + \or% 5 + \filemodCmp{#3.tex}{#2}% + {\sa@buildgraphic{#3}% + \ifsa@buildsuccess + \includegraphics[#1]{#2}% + \else + \PackageWarning{standalone}% + {Graphic '#2' could not be build.^^J% + Shell escape activated?}% + \includegraphics[#1]{#3.tex}% + \fi + }% + {% + \PackageInfo{standalone}% + {generated file #2 newer then source file #3.tex}% + \includegraphics[#1]{#2}% + }% + \fi +} +\def\sa@buildgraphic#1{% + \ifcase + \ifx\pdfshellescape\@undefined + \ifx\shellescape\@undefined + \ifx\directlua\@undefined + \z@ + \else + \directlua{% + tex.sprint((status.shell_escape or os.execute()) .. " ")} + \fi + \else + \shellescape + \fi + \else + \pdfshellescape + \fi + \PackageError{standalone}{Shell escape needed to create graphic! Use the '-shell-escape' option.}{}% + \else + \begingroup + \edef\file{#1}% + \edef\outfile{\file\sa@graphicext}% + \edef\filemodbefore{\csname pdffilemoddate\endcsname{\outfile}}% + \let\latex\sa@build@latex + \let\latexoptions\sa@build@latexoptions + \let\buildjobname\sa@build@jobname + \sa@setquote + \let\quote\sa@build@quote + \ShellEscape{\sa@build@command}% + \ifx\sa@build@postcommand\@empty\else + \ShellEscape{\sa@build@postcommand}% + \fi + \IfFileExists{\outfile}{% + \edef\filemodafter{\csname pdffilemoddate\endcsname{\outfile}}% + \ifx\filemodbefore\filemodafter + \expandafter\ifx\csname pdffilemoddate\endcsname\relax + \global\sa@buildsuccesstrue + \else + \global\sa@buildsuccessfalse + \fi + \else + \global\sa@buildsuccesstrue + \fi + }{% + \global\sa@buildsuccessfalse + }% + \endgroup + \fi +} +\endinput +%% +%% End of file `standalone.sty'. diff --git a/text/tex/texmf/standalone.tex b/text/tex/texmf/standalone.tex new file mode 100644 index 0000000000..416f626423 --- /dev/null +++ b/text/tex/texmf/standalone.tex @@ -0,0 +1,8 @@ +%%\ProvidesFile{standalone.tex}[2010/02/28 v0.4 Provides if-switch to show if file is compiled standalone]% +\expandafter\ifx\csname ifstandalone\endcsname\relax +\expandafter\newif\csname ifstandalone\endcsname +\expandafter\ifx\csname @twoclasseserror\endcsname\documentclass +\else + \standalonetrue +\fi +\fi diff --git a/text/tex/texmf/xkeyval.sty b/text/tex/texmf/xkeyval.sty new file mode 100644 index 0000000000..be7d3bd2ce --- /dev/null +++ b/text/tex/texmf/xkeyval.sty @@ -0,0 +1,149 @@ +%% +%% This is file `xkeyval.sty', +%% generated with the docstrip utility. +%% +%% The original source files were: +%% +%% xkeyval.dtx (with options: `xkvlatex') +%% +%% --------------------------------------- +%% Copyright (C) 2004-2022 Hendri Adriaens +%% 2025 David Carlisle for latex-package-repositories +%% --------------------------------------- +%% +%% This work may be distributed and/or modified under the +%% conditions of the LaTeX Project Public License, either version 1.3 +%% of this license or (at your option) any later version. +%% The latest version of this license is in +%% http://www.latex-project.org/lppl.txt +%% and version 1.3 or later is part of all distributions of LaTeX +%% version 2003/12/01 or later. +%% +%% This work has the LPPL maintenance status "maintained". +%% +%% This Current Maintainer of this work is Hendri Adriaens. +%% +%% This work consists of the file xkeyval.dtx and derived files +%% keyval.tex, xkvtxhdr.tex, xkeyval.sty, xkeyval.tex, xkvview.sty, +%% xkvltxp.sty, xkvutils.tex, pst-xkey.tex, pst-xkey.sty, xkveca.cls, +%% xkvecb.cls, xkvesa.sty, xkvesb.sty, xkvesc.sty, xkvex1.tex, +%% xkvex2.tex, xkvex3.tex and xkvex4.tex. +%% +%% The following files constitute the xkeyval bundle and must be +%% distributed as a whole: readme, xkeyval.pdf, keyval.tex, +%% pst-xkey.sty, pst-xkey.tex, xkeyval.sty, xkeyval.tex, xkvview.sty, +%% xkvltxp.sty, xkvtxhdr.tex, xkvutils.tex, pst-xkey.dtx and xkeyval.dtx. +%% +\NeedsTeXFormat{LaTeX2e}[1995/12/01] +\ProvidesPackage{xkeyval} + [2025/11/04 v2.10 package option processing (HA)] +\ifx\XKeyValLoaded\endinput\else\input xkeyval \fi +\edef\XKVcatcodes{% + \catcode`\noexpand\=\the\catcode`\=\relax + \catcode`\noexpand\,\the\catcode`\,\relax + \let\noexpand\XKVcatcodes\relax +} +\catcode`\=12\relax +\catcode`\,12\relax +\let\XKV@doxs\relax +\def\XKV@warn#1{\PackageWarning{xkeyval}{#1}} +\def\XKV@err#1{\PackageError{xkeyval}{#1}\@ehc} +\XKV@whilist\@filelist\XKV@tempa\ifx\XKV@documentclass\@undefined\fi{% + \filename@parse\XKV@tempa + \ifx\filename@ext\@clsextension + \XKV@ifundefined{opt@\filename@base.\filename@ext + }{}{\edef\XKV@documentclass{\filename@base.\filename@ext}}% + \fi +} +\ifx\XKV@documentclass\@undefined + \XKV@err{xkeyval loaded before \protect\documentclass}% + \let\XKV@documentclass\@empty + \let\XKV@classoptionslist\@empty +\else + \let\XKV@classoptionslist\@classoptionslist + \def\XKV@tempa#1{% + \let\@classoptionslist\@empty + \XKV@for@n{#1}\XKV@tempa{% + \expandafter\in@\expandafter=\expandafter{\XKV@tempa}% + \ifin@\else\XKV@addtolist@o\@classoptionslist\XKV@tempa\fi + }% + } + \expandafter\XKV@tempa\expandafter{\@classoptionslist} +\fi +\def\XKV@testopte#1{% + \XKV@ifstar{\XKV@sttrue\XKV@t@stopte#1}{\XKV@stfalse\XKV@t@stopte#1}% +} +\def\XKV@t@stopte#1{\@testopt{\XKV@t@st@pte#1}{KV}} +\def\XKV@t@st@pte#1[#2]{% + \XKV@makepf{#2}% + \@ifnextchar<{\XKV@@t@st@pte#1}% + {\XKV@@t@st@pte#1<\@currname.\@currext>}% +} +\def\XKV@@t@st@pte#1<#2>{% + \XKV@sp@deflist\XKV@fams{#2}% + \@testopt#1{}% +} +\def\DeclareOptionX{% + \let\@fileswith@pti@ns\@badrequireerror + \XKV@ifstar\XKV@dox\XKV@d@x +} +\long\def\XKV@dox#1{\XKV@toks{#1}\edef\XKV@doxs{\the\XKV@toks}} +\def\XKV@d@x{\@testopt\XKV@@d@x{KV}} +\def\XKV@@d@x[#1]{% + \@ifnextchar<{\XKV@@@d@x[#1]}{\XKV@@@d@x[#1]<\@currname.\@currext>}% +} +\def\XKV@@@d@x[#1]<#2>#3{\@testopt{\define@key[#1]{#2}{#3}}{}} +\def\ExecuteOptionsX{\XKV@stfalse\XKV@plfalse\XKV@t@stopte\XKV@setkeys} +\def\ProcessOptionsX{\XKV@plfalse\XKV@testopte\XKV@pox} +\def\XKV@pox[#1]{% + \let\XKV@tempa\@empty + \XKV@inpoxtrue + \let\@fileswith@pti@ns\@badrequireerror + \edef\XKV@testclass{\@currname.\@currext}% + \ifx\XKV@testclass\XKV@documentclass + \let\@unusedoptionlist\XKV@classoptionslist + \XKV@ifundefined{ver@xkvltxp.sty}{}{% + \@onelevel@sanitize\@unusedoptionlist + }% + \else + \ifXKV@st + \def\XKV@tempb##1,{% + \def\CurrentOption{##1}% + \ifx\CurrentOption\@nnil\else + \XKV@g@tkeyname##1=\@nil\CurrentOption + \XKV@key@if@ndefined{\CurrentOption}{}{% + \XKV@useoption{##1}% + \XKV@addtolist@n\XKV@tempa{##1}% + }% + \expandafter\XKV@tempb + \fi + }% + \expandafter\XKV@tempb\XKV@classoptionslist,\@nil,% + \fi + \fi + \expandafter\XKV@addtolist@o\expandafter + \XKV@tempa\csname opt@\@currname.\@currext\endcsname + \def\XKV@tempb{\XKV@setkeys[#1]}% + \expandafter\XKV@tempb\expandafter{\XKV@tempa}% + \let\XKV@doxs\relax + \let\XKV@rm\@empty + \XKV@inpoxfalse + \let\@fileswith@pti@ns\@@fileswith@pti@ns + \AtEndOfPackage{\let\@unprocessedoptions\relax}% +} +\def\XKV@useoption#1{% + \def\XKV@resa{#1}% + \XKV@ifundefined{ver@xkvltxp.sty}{}{% + \@onelevel@sanitize\XKV@resa + }% + \@expandtwoargs\@removeelement{\expandafter\@remove@eq@value\XKV@resa=\@nil}% + {\@unusedoptionlist}\@unusedoptionlist +} +\DeclareOptionX*{% + \PackageWarning{xkeyval}{Unknown option `\CurrentOption'}% +} +\ProcessOptionsX +\XKVcatcodes +\endinput +%% +%% End of file `xkeyval.sty'. diff --git a/text/tex/texmf/xkeyval.tex b/text/tex/texmf/xkeyval.tex new file mode 100644 index 0000000000..1389f1ae2f --- /dev/null +++ b/text/tex/texmf/xkeyval.tex @@ -0,0 +1,623 @@ +%% +%% This is file `xkeyval.tex', +%% generated with the docstrip utility. +%% +%% The original source files were: +%% +%% xkeyval.dtx (with options: `xkvtex') +%% +%% --------------------------------------- +%% Copyright (C) 2004-2022 Hendri Adriaens +%% 2025 David Carlisle for latex-package-repositories +%% --------------------------------------- +%% +%% This work may be distributed and/or modified under the +%% conditions of the LaTeX Project Public License, either version 1.3 +%% of this license or (at your option) any later version. +%% The latest version of this license is in +%% http://www.latex-project.org/lppl.txt +%% and version 1.3 or later is part of all distributions of LaTeX +%% version 2003/12/01 or later. +%% +%% This work has the LPPL maintenance status "maintained". +%% +%% This Current Maintainer of this work is Hendri Adriaens. +%% +%% This work consists of the file xkeyval.dtx and derived files +%% keyval.tex, xkvtxhdr.tex, xkeyval.sty, xkeyval.tex, xkvview.sty, +%% xkvltxp.sty, xkvutils.tex, pst-xkey.tex, pst-xkey.sty, xkveca.cls, +%% xkvecb.cls, xkvesa.sty, xkvesb.sty, xkvesc.sty, xkvex1.tex, +%% xkvex2.tex, xkvex3.tex and xkvex4.tex. +%% +%% The following files constitute the xkeyval bundle and must be +%% distributed as a whole: readme, xkeyval.pdf, keyval.tex, +%% pst-xkey.sty, pst-xkey.tex, xkeyval.sty, xkeyval.tex, xkvview.sty, +%% xkvltxp.sty, xkvtxhdr.tex, xkvutils.tex, pst-xkey.dtx and xkeyval.dtx. +%% +\csname XKeyValLoaded\endcsname +\let\XKeyValLoaded\endinput +\edef\XKVcatcodes{% + \catcode`\noexpand\@\the\catcode`\@\relax + \catcode`\noexpand\=\the\catcode`\=\relax + \catcode`\noexpand\,\the\catcode`\,\relax + \catcode`\noexpand\:\the\catcode`\:\relax + \let\noexpand\XKVcatcodes\relax +} +\catcode`\@11\relax +\catcode`\=12\relax +\catcode`\,12\relax +\catcode`\:12\relax +\input xkvutils +\newcount\XKV@depth +\newif\ifXKV@st +\newif\ifXKV@sg +\newif\ifXKV@pl +\newif\ifXKV@knf +\newif\ifXKV@rkv +\newif\ifXKV@inpox +\newif\ifXKV@preset +\let\XKV@rm\@empty +\ifx\ProvidesFile\@undefined + \message{2014/12/03 v2.7a key=value parser (HA)} + \input xkvtxhdr +\else + \ProvidesFile{xkeyval.tex}[2014/12/03 v2.7a key=value parser (HA)] + \@addtofilelist{xkeyval.tex} +\fi +\def\XKV@warn#1{\message{xkeyval warning: #1}} +\def\XKV@err#1{\errmessage{xkeyval error: #1}} +\def\KV@errx{\XKV@err} +\let\KV@err\KV@errx +\def\XKV@ifstar#1{\@ifnextcharacter*{\@firstoftwo{#1}}} +\def\XKV@ifplus#1{\@ifnextcharacter+{\@firstoftwo{#1}}} +\def\XKV@makepf#1{% + \KV@@sp@def\XKV@prefix{#1}% + \def\XKV@resa{XKV}% + \ifx\XKV@prefix\XKV@resa + \XKV@err{`XKV' prefix is not allowed}% + \let\XKV@prefix\@empty + \else + \edef\XKV@prefix{\ifx\XKV@prefix\@empty\else\XKV@prefix @\fi}% + \fi +} +\def\XKV@makehd#1{% + \expandafter\KV@@sp@def\expandafter\XKV@header\expandafter{#1}% + \edef\XKV@header{% + \XKV@prefix\ifx\XKV@header\@empty\else\XKV@header @\fi + }% +} +\def\XKV@srstate#1#2{% + \ifx\@empty#2\@empty\advance\XKV@depth\@ne\fi + \XKV@for@n{XKV@prefix,XKV@fams,XKV@tkey,XKV@na,% + ifXKV@st,ifXKV@pl,ifXKV@knf,CurrentOption}\XKV@resa{% + \expandafter\let\csname\XKV@resa#1\expandafter + \endcsname\csname\XKV@resa#2\endcsname + }% + \ifx\@empty#1\@empty\advance\XKV@depth\m@ne\fi +} +\def\XKV@testopta#1{% + \XKV@ifstar{\XKV@sttrue\XKV@t@stopta{#1}}% + {\XKV@stfalse\XKV@t@stopta{#1}}% +} +\def\XKV@t@stopta#1{\XKV@ifplus{\XKV@pltrue#1}{\XKV@plfalse#1}} +\def\XKV@testoptb#1{\@testopt{\XKV@t@stoptb#1}{KV}} +\def\XKV@t@stoptb#1[#2]#3{% + \XKV@makepf{#2}% + \XKV@makehd{#3}% + \KV@@sp@def\XKV@tfam{#3}% + #1% +} +\def\XKV@testoptc#1{\@testopt{\XKV@t@stoptc#1}{KV}} +\def\XKV@t@stoptc#1[#2]#3{% + \XKV@makepf{#2}% + \XKV@checksanitizeb{#3}\XKV@fams + \expandafter\XKV@sp@deflist\expandafter + \XKV@fams\expandafter{\XKV@fams}% + \@testopt#1{}% +} +\def\XKV@testoptd#1#2{% + \XKV@testoptb{% + \edef\XKV@tempa{#2\XKV@header}% + \def\XKV@tempb{\@testopt{\XKV@t@stoptd#1}}% + \expandafter\XKV@tempb\expandafter{\XKV@tempa}% + }% +} +\def\XKV@t@stoptd#1[#2]#3{% + \@ifnextchar[{\XKV@sttrue#1{#2}{#3}}{\XKV@stfalse#1{#2}{#3}[]}% +} +\def\XKV@ifcmd#1#2#3{% + \def\XKV@@ifcmd##1#2##2##3\@nil##4{% + \def##4{##2}\ifx##4\@nnil + \def##4{##1}\expandafter\@secondoftwo + \else + \expandafter\@firstoftwo + \fi + }% + \XKV@@ifcmd#1#2{\@nil}\@nil#3% +} +\def\XKV@getkeyname#1#2{\expandafter\XKV@g@tkeyname#1=\@nil#2} +\long\def\XKV@g@tkeyname#1=#2\@nil#3{% + \XKV@ifcmd{#1}\savevalue#3{\XKV@rkvtrue\XKV@sgfalse}{% + \XKV@ifcmd{#1}\gsavevalue#3% + {\XKV@rkvtrue\XKV@sgtrue}{\XKV@rkvfalse\XKV@sgfalse}% + }% +} +\def\XKV@getsg#1#2{% + \expandafter\XKV@ifcmd\expandafter{#1}\global#2\XKV@sgtrue\XKV@sgfalse +} +\def\XKV@define@default#1#2{% + \expandafter\def\csname\XKV@header#1@default\expandafter + \endcsname\expandafter{\csname\XKV@header#1\endcsname{#2}}% +} +\def\define@key{\XKV@testoptb\XKV@define@key} +\def\XKV@define@key#1{% + \@ifnextchar[{\XKV@d@fine@k@y{#1}}{% + \long\expandafter\def\csname\XKV@header#1\endcsname####1% + }% +} +\def\XKV@d@fine@k@y#1[#2]{% + \XKV@define@default{#1}{#2}% + \expandafter\def\csname\XKV@header#1\endcsname##1% +} +\def\define@cmdkey{\XKV@testoptd\XKV@define@cmdkey{cmd}} +\def\XKV@define@cmdkey#1#2[#3]#4{% + \ifXKV@st\XKV@define@default{#2}{#3}\fi + \def\XKV@tempa{\expandafter\def\csname\XKV@header#2\endcsname####1}% + \begingroup\expandafter\endgroup\expandafter\XKV@tempa\expandafter + {\expandafter\def\csname#1#2\endcsname{##1}#4}% +} +\def\define@cmdkeys{\XKV@testoptd\XKV@define@cmdkeys{cmd}} +\def\XKV@define@cmdkeys#1#2[#3]{% + \XKV@sp@deflist\XKV@tempa{#2}% + \XKV@for@o\XKV@tempa\XKV@tempa{% + \edef\XKV@tempa{\noexpand\XKV@define@cmdkey{#1}{\XKV@tempa}}% + \XKV@tempa[#3]{}% + }% +} +\def\define@choicekey{\XKV@testopta{\XKV@testoptb\XKV@define@choicekey}} +\def\XKV@define@choicekey#1{\@testopt{\XKV@d@fine@choicekey{#1}}{}} +\def\XKV@d@fine@choicekey#1[#2]#3{% + \toks@{#2}% + \XKV@sp@deflist\XKV@tempa{#3}\XKV@toks\expandafter{\XKV@tempa}% + \@ifnextchar[{\XKV@d@fine@ch@icekey{#1}}{\XKV@d@fine@ch@ic@key{#1}}% +} +\def\XKV@d@fine@ch@icekey#1[#2]{% + \XKV@define@default{#1}{#2}% + \XKV@d@fine@ch@ic@key{#1}% +} +\def\XKV@d@fine@ch@ic@key#1{% + \ifXKV@pl\XKV@afterelsefi + \expandafter\XKV@d@f@ne@ch@ic@k@y + \else\XKV@afterfi + \expandafter\XKV@d@f@ne@ch@ic@key + \fi + \csname\XKV@header#1\endcsname +} +\def\XKV@d@f@ne@ch@ic@key#1#2{\XKV@d@f@n@@ch@ic@k@y#1{{#2}}} +\def\XKV@d@f@ne@ch@ic@k@y#1#2#3{\XKV@d@f@n@@ch@ic@k@y#1{{#2}{#3}}} +\def\XKV@d@f@n@@ch@ic@k@y#1#2{% + \edef#1##1{% + \ifXKV@st\noexpand\XKV@sttrue\else\noexpand\XKV@stfalse\fi + \ifXKV@pl\noexpand\XKV@pltrue\else\noexpand\XKV@plfalse\fi + \noexpand\XKV@checkchoice[\the\toks@]{##1}{\the\XKV@toks}% + }% + \def\XKV@tempa{\def#1####1}% + \expandafter\XKV@tempa\expandafter{#1{##1}#2}% +} +\def\define@boolkey{\XKV@t@stopta{\XKV@testoptd\XKV@define@boolkey{}}} +\def\XKV@define@boolkey#1#2[#3]{% + \ifXKV@pl\XKV@afterelsefi + \expandafter\XKV@d@f@ne@boolkey + \else\XKV@afterfi + \expandafter\XKV@d@fine@boolkey + \fi + \csname\XKV@header#2\endcsname{#2}{#1#2}{#3}% +} +\def\XKV@d@fine@boolkey#1#2#3#4#5{% + \XKV@d@f@ne@b@olkey#1{#2}{#3}{#4}% + {{\csname#3\XKV@resa\endcsname#5}}% +} +\def\XKV@d@f@ne@boolkey#1#2#3#4#5#6{% + \XKV@d@f@ne@b@olkey#1{#2}{#3}{#4}% + {{\csname#3\XKV@resa\endcsname#5}{#6}}% +} +\def\XKV@d@f@ne@b@olkey#1#2#3#4#5{% + \expandafter\newif\csname if#3\endcsname + \ifXKV@st\XKV@define@default{#2}{#4}\fi + \ifXKV@pl + \def#1##1{\XKV@pltrue\XKV@sttrue + \XKV@checkchoice[\XKV@resa]{##1}{true,false}#5% + }% + \else + \def#1##1{\XKV@plfalse\XKV@sttrue + \XKV@checkchoice[\XKV@resa]{##1}{true,false}#5% + }% + \fi +} +\def\define@boolkeys{\XKV@plfalse\XKV@testoptd\XKV@define@boolkeys{}} +\def\XKV@define@boolkeys#1#2[#3]{% + \XKV@sp@deflist\XKV@tempa{#2}% + \XKV@for@o\XKV@tempa\XKV@tempa{% + \expandafter\XKV@d@fine@boolkeys\expandafter{\XKV@tempa}{#1}{#3}% + }% +} +\def\XKV@d@fine@boolkeys#1#2#3{% + \expandafter\XKV@d@f@ne@b@olkey\csname\XKV@header#1\endcsname + {#1}{#2#1}{#3}{{\csname#2#1\XKV@resa\endcsname}}% +} +\def\XKV@cc{\XKV@testopta{\@testopt\XKV@checkchoice{}}} +\def\XKV@checkchoice[#1]#2#3{% + \def\XKV@tempa{#1}% + \ifXKV@st\lowercase{\fi + \ifx\XKV@tempa\@empty + \def\XKV@tempa{\XKV@ch@ckch@ice\@nil{#2}{#3}}% + \else + \def\XKV@tempa{\XKV@ch@ckchoice#1\@nil{#2}{#3}}% + \fi + \ifXKV@st}\fi\XKV@tempa +} +\def\XKV@ch@ckchoice#1#2\@nil#3#4{% + \def\XKV@tempa{#2}% + \ifx\XKV@tempa\@empty\XKV@afterelsefi + \XKV@ch@ckch@ice#1{#3}{#4}% + \else\XKV@afterfi + \XKV@@ch@ckchoice#1#2{#3}{#4}% + \fi +} +\def\XKV@ch@ckch@ice#1#2#3{% + \def\XKV@tempa{#1}% + \ifx\XKV@tempa\@nnil\let\XKV@tempa\@empty\else + \def\XKV@tempa{\def#1{#2}}% + \fi + \in@{,#2,}{,#3,}% + \ifin@ + \ifXKV@pl + \XKV@addtomacro@n\XKV@tempa\@firstoftwo + \else + \XKV@addtomacro@n\XKV@tempa\@firstofone + \fi + \else + \ifXKV@pl + \XKV@addtomacro@n\XKV@tempa\@secondoftwo + \else + \XKV@toks{#2}% + \XKV@err{value `\the\XKV@toks' is not allowed}% + \XKV@addtomacro@n\XKV@tempa\@gobble + \fi + \fi + \XKV@tempa +} +\def\XKV@@ch@ckchoice#1#2#3#4{% + \edef\XKV@tempa{\the\count@}\count@\z@ + \def\XKV@tempb{#3}% + \def\XKV@tempc##1,{% + \def#1{##1}% + \ifx#1\@nnil + \def#1{#3}\def#2{-1}\count@\XKV@tempa + \ifXKV@pl + \let\XKV@tempd\@secondoftwo + \else + \XKV@toks{#3}% + \XKV@err{value `\the\XKV@toks' is not allowed}% + \let\XKV@tempd\@gobble + \fi + \else + \ifx#1\XKV@tempb + \edef#2{\the\count@}\count@\XKV@tempa + \ifXKV@pl + \let\XKV@tempd\XKV@@ch@ckch@ice + \else + \let\XKV@tempd\XKV@@ch@ckch@ic@ + \fi + \else + \advance\count@\@ne + \let\XKV@tempd\XKV@tempc + \fi + \fi + \XKV@tempd + }% + \XKV@tempc#4,\@nil,% +} +\def\XKV@@ch@ckch@ice#1\@nil,{\@firstoftwo} +\def\XKV@@ch@ckch@ic@#1\@nil,{\@firstofone} +\def\key@ifundefined{\@testopt\XKV@key@ifundefined{KV}} +\def\XKV@key@ifundefined[#1]#2{% + \XKV@makepf{#1}% + \XKV@checksanitizeb{#2}\XKV@fams + \expandafter\XKV@sp@deflist\expandafter + \XKV@fams\expandafter{\XKV@fams}% + \XKV@key@if@ndefined +} +\def\XKV@key@if@ndefined#1{% + \XKV@knftrue + \KV@@sp@def\XKV@tkey{#1}% + \XKV@whilist\XKV@fams\XKV@tfam\ifXKV@knf\fi{% + \XKV@makehd\XKV@tfam + \XKV@ifundefined{\XKV@header\XKV@tkey}{}{\XKV@knffalse}% + }% + \ifXKV@knf + \expandafter\@firstoftwo + \else + \expandafter\@secondoftwo + \fi +} +\def\disable@keys{\XKV@testoptb\XKV@disable@keys} +\def\XKV@disable@keys#1{% + \XKV@checksanitizeb{#1}\XKV@tempa + \XKV@for@o\XKV@tempa\XKV@tempa{% + \XKV@ifundefined{\XKV@header\XKV@tempa}{% + \XKV@err{key `\XKV@tempa' undefined}% + }{% + \edef\XKV@tempb{% + \noexpand\XKV@warn{key `\XKV@tempa' has been disabled}% + }% + \XKV@ifundefined{\XKV@header\XKV@tempa @default}{% + \edef\XKV@tempc{\noexpand\XKV@define@key{\XKV@tempa}}% + }{% + \edef\XKV@tempc{\noexpand\XKV@define@key{\XKV@tempa}[]}% + }% + \expandafter\XKV@tempc\expandafter{\XKV@tempb}% + }% + }% +} +\def\presetkeys{\XKV@stfalse\XKV@testoptb\XKV@presetkeys} +\def\gpresetkeys{\XKV@sttrue\XKV@testoptb\XKV@presetkeys} +\def\XKV@presetkeys#1#2{% + \XKV@pr@setkeys{#1}{preseth}% + \XKV@pr@setkeys{#2}{presett}% +} +\def\XKV@pr@setkeys#1#2{% + \XKV@ifundefined{XKV@\XKV@header#2}{% + \XKV@checksanitizea{#1}\XKV@tempa + \ifXKV@st\expandafter\global\fi\expandafter\def\csname + XKV@\XKV@header#2\expandafter\endcsname\expandafter{\XKV@tempa}% + }{% + \expandafter\XKV@merge\csname XKV@\XKV@header + #2\endcsname{#1}\XKV@getkeyname + }% +} +\def\delpresetkeys{\XKV@stfalse\XKV@testoptb\XKV@delpresetkeys} +\def\gdelpresetkeys{\XKV@sttrue\XKV@testoptb\XKV@delpresetkeys} +\def\XKV@delpresetkeys#1#2{% + \XKV@d@lpresetkeys{#1}{preseth}% + \XKV@d@lpresetkeys{#2}{presett}% +} +\def\XKV@d@lpresetkeys#1#2{% + \XKV@ifundefined{XKV@\XKV@header#2}{% + \XKV@err{no presets defined for `\XKV@header'}% + }{% + \expandafter\XKV@delete\csname XKV@\XKV@header + #2\endcsname{#1}\XKV@getkeyname + }% +} +\def\unpresetkeys{\XKV@stfalse\XKV@testoptb\XKV@unpresetkeys} +\def\gunpresetkeys{\XKV@sttrue\XKV@testoptb\XKV@unpresetkeys} +\def\XKV@unpresetkeys{% + \XKV@ifundefined{XKV@\XKV@header preseth}{% + \XKV@err{no presets defined for `\XKV@header'}% + }{% + \ifXKV@st\expandafter\global\fi\expandafter\let + \csname XKV@\XKV@header preseth\endcsname\@undefined + \ifXKV@st\expandafter\global\fi\expandafter\let + \csname XKV@\XKV@header presett\endcsname\@undefined + }% +} +\def\savekeys{\XKV@stfalse\XKV@testoptb\XKV@savekeys} +\def\gsavekeys{\XKV@sttrue\XKV@testoptb\XKV@savekeys} +\def\XKV@savekeys#1{% + \XKV@ifundefined{XKV@\XKV@header save}{% + \XKV@checksanitizeb{#1}\XKV@tempa + \ifXKV@st\expandafter\global\fi\expandafter\def\csname XKV@% + \XKV@header save\expandafter\endcsname\expandafter{\XKV@tempa}% + }{% + \expandafter\XKV@merge\csname XKV@\XKV@header + save\endcsname{#1}\XKV@getsg + }% +} +\def\delsavekeys{\XKV@stfalse\XKV@testoptb\XKV@delsavekeys} +\def\gdelsavekeys{\XKV@sttrue\XKV@testoptb\XKV@delsavekeys} +\def\XKV@delsavekeys#1{% + \XKV@ifundefined{XKV@\XKV@header save}{% + \XKV@err{no save keys defined for `\XKV@header'}% + }{% + \expandafter\XKV@delete\csname XKV@\XKV@header + save\endcsname{#1}\XKV@getsg + }% +} +\def\unsavekeys{\XKV@stfalse\XKV@testoptb\XKV@unsavekeys} +\def\gunsavekeys{\XKV@sttrue\XKV@testoptb\XKV@unsavekeys} +\def\XKV@unsavekeys{% + \XKV@ifundefined{XKV@\XKV@header save}{% + \XKV@err{no save keys defined for `\XKV@header'}% + }{% + \ifXKV@st\expandafter\global\fi\expandafter\let + \csname XKV@\XKV@header save\endcsname\@undefined + }% +} +\def\setkeys{\XKV@testopta{\XKV@testoptc\XKV@setkeys}} +\long\def\XKV@setkeys[#1]#2{% + \XKV@checksanitizea{#2}\XKV@resb + \let\XKV@naa\@empty + \XKV@for@o\XKV@resb\XKV@tempa{% + \expandafter\XKV@g@tkeyname\XKV@tempa=\@nil\XKV@tempa + \XKV@addtolist@x\XKV@naa\XKV@tempa + }% + \ifnum\XKV@depth=\z@\let\XKV@rm\@empty\fi + \XKV@usepresetkeys{#1}{preseth}% + \expandafter\XKV@s@tkeys\expandafter{\XKV@resb}{#1}% + \XKV@usepresetkeys{#1}{presett}% + \let\CurrentOption\@empty +} +\def\XKV@usepresetkeys#1#2{% + \XKV@presettrue + \XKV@for@eo\XKV@fams\XKV@tfam{% + \XKV@makehd\XKV@tfam + \XKV@ifundefined{XKV@\XKV@header#2}{}{% + \XKV@toks\expandafter\expandafter\expandafter + {\csname XKV@\XKV@header#2\endcsname}% + \@expandtwoargs\XKV@s@tkeys{\the\XKV@toks}% + {\XKV@naa\ifx\XKV@naa\@empty\else,\fi#1}% + }% + }% + \XKV@presetfalse +} +\long\def\XKV@s@tkeys#1#2{% + \XKV@sp@deflist\XKV@na{#2}% + \XKV@for@n{#1}\CurrentOption{% + \expandafter\XKV@s@tk@ys\CurrentOption==\@nil + }% +} +\long\def\XKV@s@tk@ys#1=#2=#3\@nil{% + \XKV@g@tkeyname#1=\@nil\XKV@tkey + \expandafter\KV@@sp@def\expandafter\XKV@tkey\expandafter{\XKV@tkey}% + \ifx\XKV@tkey\@empty + \XKV@toks{#2}% + \ifcat$\the\XKV@toks$\else + \XKV@err{no key specified for value `\the\XKV@toks'}% + \fi + \else + \@expandtwoargs\in@{,\XKV@tkey,}{,\XKV@na,}% + \ifin@\else + \XKV@knftrue + \KV@@sp@def\XKV@tempa{#2}% + \ifXKV@preset\XKV@s@tk@ys@{#3}\else + \ifXKV@pl + \XKV@for@eo\XKV@fams\XKV@tfam{% + \XKV@makehd\XKV@tfam + \XKV@s@tk@ys@{#3}% + }% + \else + \XKV@whilist\XKV@fams\XKV@tfam\ifXKV@knf\fi{% + \XKV@makehd\XKV@tfam + \XKV@s@tk@ys@{#3}% + }% + \fi + \fi + \ifXKV@knf + \ifXKV@inpox + \ifx\XKV@doxs\relax + \ifx\@currext\@clsextension\else + \let\CurrentOption\XKV@tkey\@unknownoptionerror + \fi + \else\XKV@doxs\fi + \else + \ifXKV@st + \XKV@addtolist@o\XKV@rm\CurrentOption + \else + \XKV@err{`\XKV@tkey' undefined in families `\XKV@fams'}% + \fi + \fi + \else + \ifXKV@inpox\ifx\XKV@testclass\XKV@documentclass + \expandafter\XKV@useoption\expandafter{\CurrentOption}% + \fi\fi + \fi + \fi + \fi +} +\def\XKV@s@tk@ys@#1{% + \XKV@ifundefined{\XKV@header\XKV@tkey}{}{% + \XKV@knffalse + \XKV@ifundefined{XKV@\XKV@header save}{}{% + \expandafter\XKV@testsavekey\csname XKV@\XKV@header + save\endcsname\XKV@tkey + }% + \ifXKV@rkv + \ifXKV@sg\expandafter\global\fi\expandafter\let + \csname XKV@\XKV@header\XKV@tkey @value\endcsname\XKV@tempa + \fi + \expandafter\XKV@replacepointers\expandafter{\XKV@tempa}% + \ifx\@empty#1\@empty\XKV@afterelsefi + \XKV@ifundefined{\XKV@header\XKV@tkey @default}{% + \XKV@err{no value specified for key `\XKV@tkey'}% + }{% + \expandafter\expandafter\expandafter\XKV@default + \csname\XKV@header\XKV@tkey @default\endcsname\@nil + }% + \else\XKV@afterfi + \XKV@srstate{@\romannumeral\XKV@depth}{}% + \csname\XKV@header\XKV@tkey\expandafter + \endcsname\expandafter{\XKV@tempa}\relax + \XKV@srstate{}{@\romannumeral\XKV@depth}% + \fi + }% +} +\def\XKV@testsavekey#1#2{% + \ifXKV@rkv\else + \XKV@for@o#1\XKV@resa{% + \expandafter\XKV@ifcmd\expandafter{\XKV@resa}\global\XKV@resa{% + \ifx#2\XKV@resa + \XKV@rkvtrue\XKV@sgtrue + \fi + }{% + \ifx#2\XKV@resa + \XKV@rkvtrue\XKV@sgfalse + \fi + }% + }% + \fi +} +\long\def\XKV@replacepointers#1{% + \let\XKV@tempa\@empty + \let\XKV@resa\@empty + \XKV@r@placepointers#1\usevalue\@nil +} +\long\def\XKV@r@placepointers#1\usevalue#2{% + \XKV@addtomacro@n\XKV@tempa{#1}% + \def\XKV@tempb{#2}% + \ifx\XKV@tempb\@nnil\else\XKV@afterfi + \XKV@ifundefined{XKV@\XKV@header#2@value}{% + \XKV@err{no value recorded for key `#2'; ignored}% + \XKV@r@placepointers + }{% + \@expandtwoargs\in@{,#2,}{,\XKV@resa,}% + \ifin@\XKV@afterelsefi + \XKV@err{back linking pointers; pointer replacement canceled}% + \else\XKV@afterfi + \XKV@addtolist@x\XKV@resa{#2}% + \expandafter\expandafter\expandafter\XKV@r@placepointers + \csname XKV@\XKV@header#2@value\endcsname + \fi + }% + \fi +} +\def\XKV@default#1#2\@nil{% + \expandafter\edef\expandafter\XKV@tempa + \expandafter{\expandafter\@gobble\string#1}% + \edef\XKV@tempb{\XKV@header\XKV@tkey}% + \@onelevel@sanitize\XKV@tempb + \ifx\XKV@tempa\XKV@tempb + \begingroup + \expandafter\def\csname\XKV@header\XKV@tkey\endcsname##1{% + \gdef\XKV@tempa{##1}% + }% + \csname\XKV@header\XKV@tkey @default\endcsname + \endgroup + \XKV@ifundefined{XKV@\XKV@header save}{}{% + \expandafter\XKV@testsavekey\csname XKV@\XKV@header + save\endcsname\XKV@tkey + }% + \ifXKV@rkv + \ifXKV@sg\expandafter\global\fi\expandafter\let + \csname XKV@\XKV@header\XKV@tkey @value\endcsname\XKV@tempa + \fi + \expandafter\XKV@replacepointers\expandafter + {\XKV@tempa}\XKV@afterelsefi + \XKV@srstate{@\romannumeral\XKV@depth}{}% + \expandafter#1\expandafter{\XKV@tempa}\relax + \XKV@srstate{}{@\romannumeral\XKV@depth}% + \else\XKV@afterfi + \XKV@srstate{@\romannumeral\XKV@depth}{}% + \csname\XKV@header\XKV@tkey @default\endcsname\relax + \XKV@srstate{}{@\romannumeral\XKV@depth}% + \fi +} +\def\setrmkeys{\XKV@testopta{\XKV@testoptc\XKV@setrmkeys}} +\def\XKV@setrmkeys[#1]{% + \def\XKV@tempa{\XKV@setkeys[#1]}% + \expandafter\XKV@tempa\expandafter{\XKV@rm}% +} +\XKVcatcodes +\endinput +%% +%% End of file `xkeyval.tex'. diff --git a/text/tex/texmf/xkvtxhdr.tex b/text/tex/texmf/xkvtxhdr.tex new file mode 100644 index 0000000000..be65ac88a6 --- /dev/null +++ b/text/tex/texmf/xkvtxhdr.tex @@ -0,0 +1,92 @@ +%% +%% This is file `xkvtxhdr.tex', +%% generated with the docstrip utility. +%% +%% The original source files were: +%% +%% xkeyval.dtx (with options: `xkvheader') +%% +%% --------------------------------------- +%% Copyright (C) 2004-2022 Hendri Adriaens +%% 2025 David Carlisle for latex-package-repositories +%% --------------------------------------- +%% +%% This work may be distributed and/or modified under the +%% conditions of the LaTeX Project Public License, either version 1.3 +%% of this license or (at your option) any later version. +%% The latest version of this license is in +%% http://www.latex-project.org/lppl.txt +%% and version 1.3 or later is part of all distributions of LaTeX +%% version 2003/12/01 or later. +%% +%% This work has the LPPL maintenance status "maintained". +%% +%% This Current Maintainer of this work is Hendri Adriaens. +%% +%% This work consists of the file xkeyval.dtx and derived files +%% keyval.tex, xkvtxhdr.tex, xkeyval.sty, xkeyval.tex, xkvview.sty, +%% xkvltxp.sty, xkvutils.tex, pst-xkey.tex, pst-xkey.sty, xkveca.cls, +%% xkvecb.cls, xkvesa.sty, xkvesb.sty, xkvesc.sty, xkvex1.tex, +%% xkvex2.tex, xkvex3.tex and xkvex4.tex. +%% +%% The following files constitute the xkeyval bundle and must be +%% distributed as a whole: readme, xkeyval.pdf, keyval.tex, +%% pst-xkey.sty, pst-xkey.tex, xkeyval.sty, xkeyval.tex, xkvview.sty, +%% xkvltxp.sty, xkvtxhdr.tex, xkvutils.tex, pst-xkey.dtx and xkeyval.dtx. +%% +%% +%% Taken from latex.ltx. +%% +\message{2005/02/22 v1.1 xkeyval TeX header (HA)} +\def\@nnil{\@nil} +\def\@empty{} +\def\newif#1{% + \count@\escapechar \escapechar\m@ne + \let#1\iffalse + \@if#1\iftrue + \@if#1\iffalse + \escapechar\count@} +\def\@if#1#2{% + \expandafter\def\csname\expandafter\@gobbletwo\string#1% + \expandafter\@gobbletwo\string#2\endcsname + {\let#1#2}} +\long\def\@ifnextchar#1#2#3{% + \let\reserved@d=#1% + \def\reserved@a{#2}% + \def\reserved@b{#3}% + \futurelet\@let@token\@ifnch} +\def\@ifnch{% + \ifx\@let@token\@sptoken + \let\reserved@c\@xifnch + \else + \ifx\@let@token\reserved@d + \let\reserved@c\reserved@a + \else + \let\reserved@c\reserved@b + \fi + \fi + \reserved@c} +\def\:{\let\@sptoken= } \: % this makes \@sptoken a space token +\def\:{\@xifnch} \expandafter\def\: {\futurelet\@let@token\@ifnch} +\let\kernel@ifnextchar\@ifnextchar +\long\def\@testopt#1#2{% + \kernel@ifnextchar[{#1}{#1[{#2}]}} +\long\def\@firstofone#1{#1} +\long\def \@gobble #1{} +\long\def \@gobbletwo #1#2{} +\def\@expandtwoargs#1#2#3{% +\edef\reserved@a{\noexpand#1{#2}{#3}}\reserved@a} +\edef\@backslashchar{\expandafter\@gobble\string\\} +\newif\ifin@ +\def\in@#1#2{% + \def\in@@##1#1##2##3\in@@{% + \ifx\in@##2\in@false\else\in@true\fi}% + \in@@#2#1\in@\in@@} +\def\strip@prefix#1>{} +\def \@onelevel@sanitize #1{% + \edef #1{\expandafter\strip@prefix + \meaning #1}% +} +\endinput +%% +%% End of file `xkvtxhdr.tex'. diff --git a/text/tex/texmf/xkvutils.tex b/text/tex/texmf/xkvutils.tex new file mode 100644 index 0000000000..0314d54753 --- /dev/null +++ b/text/tex/texmf/xkvutils.tex @@ -0,0 +1,273 @@ +%% +%% This is file `xkvutils.tex', +%% generated with the docstrip utility. +%% +%% The original source files were: +%% +%% xkeyval.dtx (with options: `xkvutils') +%% +%% --------------------------------------- +%% Copyright (C) 2004-2022 Hendri Adriaens +%% 2025 David Carlisle for latex-package-repositories +%% --------------------------------------- +%% +%% This work may be distributed and/or modified under the +%% conditions of the LaTeX Project Public License, either version 1.3 +%% of this license or (at your option) any later version. +%% The latest version of this license is in +%% http://www.latex-project.org/lppl.txt +%% and version 1.3 or later is part of all distributions of LaTeX +%% version 2003/12/01 or later. +%% +%% This work has the LPPL maintenance status "maintained". +%% +%% This Current Maintainer of this work is Hendri Adriaens. +%% +%% This work consists of the file xkeyval.dtx and derived files +%% keyval.tex, xkvtxhdr.tex, xkeyval.sty, xkeyval.tex, xkvview.sty, +%% xkvltxp.sty, xkvutils.tex, pst-xkey.tex, pst-xkey.sty, xkveca.cls, +%% xkvecb.cls, xkvesa.sty, xkvesb.sty, xkvesc.sty, xkvex1.tex, +%% xkvex2.tex, xkvex3.tex and xkvex4.tex. +%% +%% The following files constitute the xkeyval bundle and must be +%% distributed as a whole: readme, xkeyval.pdf, keyval.tex, +%% pst-xkey.sty, pst-xkey.tex, xkeyval.sty, xkeyval.tex, xkvview.sty, +%% xkvltxp.sty, xkvtxhdr.tex, xkvutils.tex, pst-xkey.dtx and xkeyval.dtx. +%% +\csname XKeyValUtilsLoaded\endcsname +\let\XKeyValUtilsLoaded\endinput +\edef\XKeyValUtilsCatcodes{% + \catcode`\noexpand\@\the\catcode`\@\relax + \let\noexpand\XKeyValUtilsCatcodes\relax +} +\catcode`\@=11\relax +\newtoks\XKV@toks +\newtoks\XKV@tempa@toks +\newtoks\XKV@tempb@toks +\long\def\@firstoftwo#1#2{#1} +\long\def\@secondoftwo#1#2{#2} +\long\def\XKV@afterfi#1\fi{\fi#1} +\long\def\XKV@afterelsefi#1\else#2\fi{\fi#1} +\ifx\ifcsname\@undefined\XKV@afterelsefi + \def\XKV@ifundefined#1{% + \begingroup\expandafter\expandafter\expandafter\endgroup + \expandafter\ifx\csname#1\endcsname\relax + \expandafter\@firstoftwo + \else + \expandafter\@secondoftwo + \fi + } +\else + \def\XKV@ifundefined#1{% + \ifcsname#1\endcsname + \expandafter\@secondoftwo + \else + \expandafter\@firstoftwo + \fi + } +\fi +\XKV@ifundefined{ver@keyval.sty}{ + \input keyval + \expandafter\def\csname ver@keyval.sty\endcsname{1999/03/16} +}{} +\long\def\@ifnextcharacter#1#2#3{% + \@ifnextchar\bgroup + {\@ifnextchar{#1}{#2}{#3}}% + {\@ifncharacter{#1}{#2}{#3}}% +} +\long\def\@ifncharacter#1#2#3#4{% + \if\string#1\string#4% + \expandafter\@firstoftwo + \else + \expandafter\@secondoftwo + \fi + {#2}{#3}#4% +} +\long\def\XKV@for@n#1#2#3{% + \XKV@tempa@toks{#1}\edef#2{\the\XKV@tempa@toks}% + \ifx#2\@empty + \XKV@for@break + \else + \expandafter\XKV@f@r + \fi + #2{#3}#1,\@nil,% +} +\long\def\XKV@f@r#1#2#3,{% + \XKV@tempa@toks{#3}\edef#1{\the\XKV@tempa@toks}% + \ifx#1\@nnil + \expandafter\@gobbletwo + \else + #2\expandafter\XKV@f@r + \fi + #1{#2}% +} +\long\def\XKV@for@break #1\@nil,{\fi} +\long\def\XKV@for@o#1{\expandafter\XKV@for@n\expandafter{#1}} +\long\def\XKV@for@en#1#2#3{\XKV@f@r#2{#3}#1,\@nil,} +\long\def\XKV@for@eo#1#2#3{% + \def#2{\XKV@f@r#2{#3}}\expandafter#2#1,\@nil,% +} +\long\def\XKV@whilist#1#2#3\fi#4{% + #3\expandafter\XKV@wh@list#1,\@nil,\@nil\@@#2#3\fi{#4}{}\fi +} +\long\def\XKV@wh@list#1,#2\@@#3#4\fi#5#6{% + \def#3{#1}% + \ifx#3\@nnil + \def#3{#6}\expandafter\XKV@wh@l@st + \else + #4% + #5\expandafter\expandafter\expandafter\XKV@wh@list + \else + \def#3{#6}\expandafter\expandafter\expandafter\XKV@wh@l@st + \fi + \fi + #2\@@#3#4\fi{#5}{#1}% +} +\long\def\XKV@wh@l@st#1\@@#2#3\fi#4#5{} +\long\def\XKV@addtomacro@n#1#2{% + \XKV@tempa@toks\expandafter{#1#2}% + \edef#1{\the\XKV@tempa@toks}% +} +\def\XKV@addtomacro@o#1#2{% + \expandafter\XKV@addtomacro@n\expandafter#1\expandafter{#2}% +} +\def\XKV@addtolist@n#1#2{% + \ifx#1\@empty + \XKV@addtomacro@n#1{#2}% + \else + \XKV@addtomacro@n#1{,#2}% + \fi +} +\def\XKV@addtolist@o#1#2{% + \ifx#1\@empty + \XKV@addtomacro@o#1#2% + \else + \XKV@addtomacro@o#1{\expandafter,#2}% + \fi +} +\def\XKV@addtolist@x#1#2{\edef#1{#1\ifx#1\@empty\else,\fi#2}} +\def\@selective@sanitize{\@testopt\@s@lective@sanitize\@M} +\def\@s@lective@sanitize[#1]#2#3{% + \begingroup + \count@#1\relax\advance\count@\@ne + \XKV@toks\expandafter{#3}% + \def#3{#2}\@onelevel@sanitize#3% + \edef#3{{#3}{\the\XKV@toks}}% + \expandafter\@s@l@ctive@sanitize\expandafter#3#3% + \expandafter\XKV@tempa@toks\expandafter{#3}% + \expandafter\endgroup\expandafter\XKV@tempb@toks\expandafter{\the\XKV@tempa@toks}% + \edef#3{\the\XKV@tempb@toks}% +} +\def\@s@l@ctive@sanitize#1#2#3{% + \def\@i{\futurelet\@@tok\@ii}% + \def\@ii{% + \expandafter\@iii\meaning\@@tok\relax + \ifx\@@tok\@s@l@ctive@sanitize + \let\@@cmd\@gobble + \else + \ifx\@@tok\@sptoken + \XKV@toks\expandafter{#1}\edef#1{\the\XKV@toks\space}% + \def\@@cmd{\afterassignment\@i\let\@@tok= }% + \else + \let\@@cmd\@iv + \fi + \fi + \@@cmd + }% + \def\@iii##1##2\relax{\if##1\@backslashchar\let\@@tok\relax\fi}% + \def\@iv##1{% + \toks@\expandafter{#1}\XKV@toks{##1}% + \ifx\@@tok\bgroup + \advance\count@\m@ne + \ifnum\count@>\z@ + \begingroup + \def#1{\expandafter\@s@l@ctive@sanitize + \csname\string#1\endcsname{#2}}% + \expandafter#1\expandafter{\the\XKV@toks}% + \XKV@toks\expandafter\expandafter\expandafter + {\csname\string#1\endcsname}% + \edef#1{\noexpand\XKV@toks{\the\XKV@toks}}% + \expandafter\endgroup#1% + \fi + \edef#1{\the\toks@{\the\XKV@toks}}% + \advance\count@\@ne + \let\@@cmd\@i + \else + \edef#1{\expandafter\string\the\XKV@toks}% + \expandafter\in@\expandafter{#1}{#2}% + \edef#1{\the\toks@\ifin@#1\else + \ifx\@@tok\@sptoken\space\else\the\XKV@toks\fi\fi}% + \edef\@@cmd{\noexpand\@i\ifx\@@tok\@sptoken\the\XKV@toks\fi}% + \fi + \@@cmd + }% + \let#1\@empty\@i#3\@s@l@ctive@sanitize +} +\long\def\XKV@checksanitizea#1#2{% + \XKV@ch@cksanitize{#1}#2=% + \ifin@\else\XKV@ch@cksanitize{#1}#2,\fi + \ifin@\@selective@sanitize[0]{,=}#2\fi +} +\def\XKV@checksanitizeb#1#2{% + \XKV@ch@cksanitize{#1}#2,% + \ifin@\@selective@sanitize[0],#2\fi +} +\long\def\XKV@ch@cksanitize#1#2#3{% + \XKV@tempa@toks{#1}\edef#2{\the\XKV@tempa@toks}% + \@onelevel@sanitize#2% + \@expandtwoargs\in@#3{#2}% + \ifin@ + \long\def#2##1#3##2\@nil{% + \XKV@tempa@toks{##2}\edef#2{\the\XKV@tempa@toks}% + \ifx#2\@empty\else\in@false\fi + }% + #2#1#3\@nil + \fi + \XKV@tempa@toks{#1}\edef#2{\the\XKV@tempa@toks}% +} +\def\XKV@sp@deflist#1#2{% + \let#1\@empty + \XKV@for@n{#2}\XKV@resa{% + \expandafter\KV@@sp@def\expandafter\XKV@resa\expandafter{\XKV@resa}% + \XKV@addtomacro@o#1{\expandafter,\XKV@resa}% + }% + \ifx#1\@empty\else + \def\XKV@resa,##1\@nil{\def#1{##1}}% + \expandafter\XKV@resa#1\@nil + \fi +} +\def\XKV@merge#1#2#3{% + \XKV@checksanitizea{#2}\XKV@tempa + \XKV@for@o\XKV@tempa\XKV@tempa{% + \XKV@pltrue + #3\XKV@tempa\XKV@tempb + \let\XKV@tempc#1% + \let#1\@empty + \XKV@for@o\XKV@tempc\XKV@tempc{% + #3\XKV@tempc\XKV@tempd + \ifx\XKV@tempb\XKV@tempd + \XKV@plfalse + \XKV@addtolist@o#1\XKV@tempa + \else + \XKV@addtolist@o#1\XKV@tempc + \fi + }% + \ifXKV@pl\XKV@addtolist@o#1\XKV@tempa\fi + }% + \ifXKV@st\global\let#1#1\fi +} +\def\XKV@delete#1#2#3{% + \XKV@checksanitizeb{#2}\XKV@tempa + \let\XKV@tempb#1% + \let#1\@empty + \XKV@for@o\XKV@tempb\XKV@tempb{% + #3\XKV@tempb\XKV@tempc + \@expandtwoargs\in@{,\XKV@tempc,}{,\XKV@tempa,}% + \ifin@\else\XKV@addtolist@o#1\XKV@tempb\fi + }% + \ifXKV@st\global\let#1#1\fi +} +\XKeyValUtilsCatcodes +\endinput +%% +%% End of file `xkvutils.tex'.