Hot
- How to create decorative page numbers using MetaPost in ConTeXt?by nasim ahmed on June 3, 2026 at 4:54 pm
I am developing a document in ConTeXt and I would like to create custom, decorative page numbers using MetaPost. My goal is to design intricate graphics (e.g., shapes or frames) that incorporate the current page number, and to apply this design automatically as the page number in the footer or header of my document. Could you please guide me on: How to define a MetaPost graphic that acts as a page number in ConTeXt? How to pass the current \currentpage value to a MetaPost buffer or a standalone MetaPost module within the header/footer setup? What is the recommended approach in ConTeXt to handle this synchronization between the page counter and the MetaPost rendering? I am working with LMTX/MkIV. Any advice or a minimal working example would be highly appreciated. Thanks in advance!
- Conditionals not returning correct outputby AnyAD on June 3, 2026 at 4:32 pm
Can this code be fixed so I can choose between answers and solutions? It also produces blank pages (that don't go away when I remove newpage command after Qs and As). \newcounter{sheetnumber} \newenvironment{problemsheet}{ \stepcounter{sheetnumber} \bigskip \centerline{\bf \Large \ifQ {Sheet} \else \ifA {Answers for sheet} \fi \fi \arabic{sheetnumber}: \ \sheetname} \addcontentsline{toc}{section}{ \ifQ {Sheet} \else \ifA {Answers for sheet} \fi \fi \arabic{sheetnumber}: \ \sheetname} %% Number questions as sheetnumber.questionnumber eg 1.1, 1.2, ... \begin{enumerate}[label=\arabic{sheetnumber}.\arabic*.] %% Uncomment lines below to continue question numbering across sheets % \ifnum\value{sheetnumber}=1 % % First sheet - start numbering questions from 1 % \begin{enumerate}[series=questions] % \else % % Subsequent sheet - continue numbering questions from previous sheet % \begin{enumerate}[resume=questions] % \fi }{\end{enumerate}\ifQ \newpage \else \ifA \newpage \fi \fi} \long\def\ignore#1\endignore{} \long\def\ignoreQ#1\endquestion{\fi} \long\def\ignoreS#1\endsolution{\fi} \long\def\ignoreA#1\endanswer{\fi} \long\def\ignoreT#1\par{\fi} \def\beginquestion#1{\ifQ\item {\sl #1.}\else\ignoreQ\fi} \def\endquestion{\par\goodbreak} \def\beginsolution{\ifS\ifQ\addtocounter{enumi}{-1}\else\fi\item {\sl Solution.\/\ }\else\ignoreS\fi} \def\endsolution{\goodbreak} \def\beginanswer{\ifA{{ \ifQ \addtocounter{enumi}{-1} %\else \ifS \addtocounter{enumi}{-1} \fi\fi} \item {\sl Answer:\/\ } \else \ifS \addtocounter{enumi}{-1} \fi\fi} \item {\noindent } } \else \ignoreA \fi} \def\endanswer{} \newcommand{\textfixed}[1]{\ifT \item[#1] \else\ignoreT\fi} \newcommand{\arrowvec}[1]{\ensuremath{\overrightarrow{\mathrm{#1}}}} %%%%%% ************
- Value for option of anchor not iterable in TikZby youthdoo on June 3, 2026 at 3:15 pm
The following code raises an error \documentclass[tikz,border=2mm]{standalone} \usetikzlibrary{arrows.meta} \begin{document} \begin{tikzpicture} \def\radius{3} \def\smallr{0.3} \def\angleof#1{#1*360/18+3*360/18} \foreach \i in {0,...,17} { \draw ( \angleof{\i}:\radius ) circle (\smallr); } \foreach \i/\labl/\pos in { 1/$1$/center, 2/$2$/center, 3/$3=d$/east, 4/$4$/center, 6/$6=2d$/east, 9/$9=3d$/east, 12/$12=4d$/west, 15/$15=5d$/west, 18/$18=6d$/west } { \node[anchor=\pos] at ({\angleof{\i}}:\radius+\smallr+.25) {\labl}; } \end{tikzpicture} \end{document} The problem is with the second \foreach loop. But the error message is confusing, Package PGF Math Error: Unknown function `west' (in 'west '). I don't see why west would be used as a "function" in any way. What is the correct way of assigning different anchor points in the iteration?
- LaTeX working half only in unicode-math `\bm`by mathrm alpha on June 3, 2026 at 1:57 pm
Because I discovered that NewCMMath has a bold version, I set the \bm command in unicode-math. However, whenever I try to use \bm{\symsf{A}} or similar to other \bm{\symxx} fonts, it fails; However, it works for pure letters. \documentclass{article} \usepackage{unicode-math} \setmathfont{NewCMMath-Regular.otf} \setmathfontface{\bm}{NewCMMath-Bold.otf} \begin{document} $\symsf{ABCabc}, \symscr{ABCabc}$\\ with bm command: $\bm{\symsf{ABCabc}, \symscr{ABCabc}}$\\ ideal glyphs: $\symbfsf{ABCabc}, \symbfscr{ABCabc}$ \end{document} \documentclass{article} \usepackage{unicode-math} \setmathfont{NewCMMath-Regular.otf} \setmathfontface{\bm}{NewCMMath-Bold.otf} \begin{document} $\bm{ABCabc123\alpha\beta\gamma}$ \end{document}
- Some kinds of Multiplication tablesby Vanellope on June 3, 2026 at 5:43 am
Recently, I came across a multiplication table in Visual Group Theory (Fig. 4.6). I tried to reproduce it, including asking AI assistants (ChatGPT, Claude), but without success. It seems that AI struggles to handle the subtle blanks in this table. I believe TikZ could produce something similar, but the result would feel unnatural. Is it possible to construct this in the form of a table? The closest result I've achieved so far is as follows. It uses the package nicematrix . \documentclass{article} \usepackage{nicematrix} \usepackage{tikz} \usepackage{amsmath} \begin{document} \begin{NiceTabular}{c*{4}{c}}[ hvlines, corners = NW, ] & $N$ & $R$ & $B$ & $RB$ \\ $N$ & $N$ & $R$ & $B$ & $RB$ \\ $R$ & $R$ & $N$ & $RB$ & $B$ \\ $B$ & $B$ & $RB$ & $N$ & $R$ \\ $RB$ & $RB$ & $B$ & $R$ & $N$ \\ \end{NiceTabular} \end{document} The book also contains more intricate tables of this kind(same elements have a same color), and I'm curious how those might be reproduced as well.
- Using forest package, how do I code the following two trees?by Nix on June 2, 2026 at 6:59 pm
I need to create a flowchart of my dissertation and it seems the forest package suits well. Though, I manage to go down the first fork, I cannot create in the same loop the inverted v. There is no math in this tree, only text. Can someone please help? Thank you. \ex. \begin{forest} [\footnotesize{Systemic Input Variable:}\\ \footnotesize{International Anarchy \& Geopolitical Rivalry}\\ \footnotesize{(Waltz, 2001; Mearsheimer, 2001)} [\footnotesize{Independent Technological Shock:}\\ \footnotesize{Hypersonic Proliferation (Mach 5+) \& Cross-Domain Swarms $(\lambda_{swarm})$}\\ \footnotesize{(Acton, 2013; Speier et al., 2017; Wong et al., 2020)} [ \footnotesize{Kinematic / Spatial Boundary:}\\ \footnotesize{Warning Compression (<180s)}\\ \footnotesize{Sensor Horizon Depletion $(d_LR)$}\\ \footnotesize{Plasma Sheath Ionization Blackouts}\\ \footnotesize{(Skolnik, 2001; Yue et al., 2024)} ] [\footnotesize{Economic / Resource Boundary:}\\ \footnotesize{Asymmetric Cost Deficit $(C_ex)$}\\ \footnotesize{Imported Platform Procurement Trap}\\ \footnotesize{Fiscal \& Strategic Exhaustion Over Time}\\ \footnotesize{(Sandler \& Hartley, 1995; Papasotiriou, 2001)}] ]] \end{forest}
- How to create new date time styles in datetime2by AlanQ on June 2, 2026 at 6:47 pm
TLDR: I would like to output dates thus: 2026 Jun 02 Tue I am aware that there are inbuilt date and time formats in datetime2. There is also very comprehensive documentation — but I don't have time to read it, let alone digest it. From looking at answers to other similar questions, it's very complicated. I modified the answer here to: \number##1 \DTMenglishshortmonthname{##2} \DTMenglishordinal{##3} but now there's no space after the year. In datetime2 v1.5.7: date and time formats, there is \DTMdisplaydate{〈year 〉}{〈month 〉}{〈day 〉}{〈dow 〉}, showing how to input a day of week (dow), but I can't find how to output a calculated day of week. In the example above there are formats like \DTMenglishordinal. But how can I know what various options there are for these? How would I guess that there even was an option called 'English short ordinal'? Has anyone written an article with many examples?
- "How to place item numbers inside colored circles in ConTeXt LMTX?"by nasim ahmed on June 2, 2026 at 5:54 pm
I am working with ConTeXt LMTX 2026 and trying to customize an itemgroup (or itemize) to display the numbers inside colored circles. I have tried several approaches, including \framed, MetaPost graphics, and \defineconversion with Unicode symbols. However, I am facing consistent issues where either the numbers don't render inside the shapes, or the itemize environment overrides the custom formatting. Here is the basic structure I am currently using that works for standard underlining:
- Using multiple fonts and also using old-style numbersby Nex on June 2, 2026 at 5:43 pm
I am currently working on a document that uses both Greek and English. For these two languages, I would like to use two different fonts, namely EB Garamond and GFS Neohellenic. I would also like to use old style numbers. For some reason, I am not able to get both options working. Here's an example of what I mean: \documentclass{article} \usepackage{fontspec} \setmainfont[Numbers=OldStyle,Language=English]{EBGaramond-Regular} \setmainfont[Script=Greek]{GFSNeohellenic-Regular} \usepackage{lipsum} \begin{document} \lipsum[1] \begin{quote} Ἥκω Διὸϲ παῖϲ τήνδε Θηβαίαν χθόνα\\ Διόνυϲοϲ, ὃν τίκτει ποθ' ἡ Κάδμου κόρη\\ Ϲεμέλη λοχευθεῖϲ' ἀϲτραπηφόρωι πυρί·\\ μορφὴν δ' ἀμείψαϲ ἐκ θεοῦ βροτηϲίαν\\ πάρειμι Δίρκηϲ νάμαθ' Ἱϲμηνοῦ θ' ὕδωρ.\\ (Eur. \textit{Bacch.} 1-5)\end{quote} \end{document} This gives the following output: Then, when I flip the two font options around, this happens: \documentclass{article} \usepackage{fontspec} \setmainfont[Script=Greek]{GFSNeohellenic-Regular} \setmainfont[Numbers=OldStyle,Language=English]{EBGaramond-Regular} \usepackage{lipsum} \begin{document} \lipsum[1] \begin{quote} Ἥκω Διὸϲ παῖϲ τήνδε Θηβαίαν χθόνα\\ Διόνυϲοϲ, ὃν τίκτει ποθ' ἡ Κάδμου κόρη\\ Ϲεμέλη λοχευθεῖϲ' ἀϲτραπηφόρωι πυρί·\\ μορφὴν δ' ἀμείψαϲ ἐκ θεοῦ βροτηϲίαν\\ πάρειμι Δίρκηϲ νάμαθ' Ἱϲμηνοῦ θ' ὕδωρ.\\ (Eur. \textit{Bacch.} 1-5)\end{quote} \end{document} When I try to use a different font, however, a different problem occurs: \documentclass{article} \usepackage{fontspec} \setmainfont[Numbers=OldStyle,Language=English]{EBGaramond-Regular} \setmainfont[Script=Greek]{New Athena Unicode} \usepackage{lipsum} \begin{document} \lipsum[1] \begin{quote} Ἥκω Διὸϲ παῖϲ τήνδε Θηβαίαν χθόνα\\ Διόνυϲοϲ, ὃν τίκτει ποθ' ἡ Κάδμου κόρη\\ Ϲεμέλη λοχευθεῖϲ' ἀϲτραπηφόρωι πυρί·\\ μορφὴν δ' ἀμείψαϲ ἐκ θεοῦ βροτηϲίαν\\ πάρειμι Δίρκηϲ νάμαθ' Ἱϲμηνοῦ θ' ὕδωρ.\\ (Eur. \textit{Bacch.} 1-5)\end{quote} \end{document} What happens in the last picture is almost what I would like to happen, except for the fact that the numbers are not in old style and that the Latin font is not EB Garamond... Does anyone know how to fix this?
- Texstudio takes too long compiling large complex document [duplicate]by David Cuthbertson on June 2, 2026 at 4:44 pm
I'm creating a large complex scrbook document, ~65,000 words and over 90 images and chapters - single page chapters with title, image and short text, plus extensive endnotes (postnote), references and index. The Latex code, packages, etc is split between several files and folders, each chapter in a separate file and images in a single folder. All the text has been imported and half the images. Even in draft mode - \usepackage[draft]{scrbook} - it takes about 35 seconds to render. Unchecking 'automatically load included files' makes almost no difference. I have ADHD so make lots of typos only spotted by running 'build & view'. At this stage I only want to check for errors as I go. Any suggestions to speed things up?
- Precisely Positioning a GS1 ISBN and EANBarcodeby DDS on June 2, 2026 at 2:37 pm
This is an extension of the question asked here: Wrapping Text Around a Barcode within Minipage and Tikzpicture Environments ; and in particular, relates to the second part of egreg's excellent answer. Consider the code: \documentclass[12pt,onecolumn,openany,final]{book} \usepackage[hmargin=0in,vmargin=0in,paperwidth=12.7525in,paperheight=9.25in]{geometry} \usepackage{GS1} \usepackage{pstricks,psvectorian,cabin} \usepackage{wrapstuff} \usepackage{pst-barcode} \psset{unit=1in} \usepackage{tikz,xcolor} \usetikzlibrary{decorations.text} \usetikzlibrary{decorations.pathmorphing} \usetikzlibrary{positioning} \newcommand{\longemdash}{{\fontfamily{lmss}\selectfont---}} %\newcommand{\emdash}{\nobreak---\nobreak\hskip0pt} \definecolor{cranberry}{RGB}{149, 7, 20} \definecolor{pylight}{RGB}{247, 235, 205} \definecolor{py}{RGB}{243, 224, 181} \definecolor{pydark}{RGB}{221, 182, 110} \definecolor{pyhighlight}{RGB}{254, 235, 204} \pgfdeclareverticalshading{parchment}{100bp}{% color(0bp)=(pydark); color(25bp)=(pydark); color(30bp)=(py); color(50bp)=(pylight); color(70bp)=(py); color(75bp)=(pydark); color(100bp)=(pydark)% } \pgfdeclareradialshading{rparchment}{\pgfpoint{0cm}{0cm}}{% color(0bp)=(pylight); color(13bp)=(pylight); color(20bp)=(py); color(40bp)=(pydark); color(60bp)=(pydark!50!black); color(100bp)=(black)% } \tikzset{ pencildraw/.style={% decorate, %decoration={% % random steps, segment length=1.1ex, amplitude=.5ex% % } }, drop shadow/.style={ blur shadow={% shadow xshift=.5pt, shadow yshift=-.5pt, shadow blur steps=9, shadow blur extra rounding=1.5pt% }, }, parchment fill/.style={ pencildraw, fill=pyhighlight, postaction={shading=parchment, opacity=1}, postaction={shading=rparchment, opacity=.7} } } \pagecolor{cranberry} \begin{document} \thispagestyle{empty} \setmainfont{Cabin} \noindent\begin{pspicture}(-6.37625,0)(6.37625,9.25) \psframe[fillcolor=cranberry,fillstyle=solid](-6.37625,0)(6.37625,9.25)% \psframe[linecolor=cranberry](-6.37625,0)(6.37625,9.25) % draws frame. \rput(-3.15,1.35){\begin{tikzpicture} \shade node[parchment fill, text width=14.15cm, text height=5.15cm, inner sep=.4, align=justify] {\hspace{12pt}\begin{minipage}{5.25in}\vspace*{-155pt} \fontsize{8.5}{9}\selectfont \begin{wrapstuff}[width=4.75cm,r,top=4] \centering {\texttt{\footnotesize ISBN 978-1-574889-72-9}\par\smallskip {\,\EANBarcode[module_height=15mm,module_width=0.4mm]{978-1-574889-72-9}}} \end{wrapstuff} \bfseries This is a sentence to be repeated many times.This is a sentence to be repeated many times. This is a sentence to be repeated many times. This is a sentence to be repeated many times. This is a sentence to be repeated many times. This is a sentence to be repeated many times. This is a sentence to be repeated many times. This is a sentence to be repeated many times. This is a sentence to be repeated many times. This is a sentence to be repeated many times.This is a sentence to be repeated many times. This is a sentence to be repeated many times. This is a sentence to be repeated many times. This is a sentence to be repeated many times. This is a sentence to be repeated many times. This is a sentence to be repeated many times. This is a sentence to be repeated many times. This is a sentence to be repeated many times. This is a sentence to be repeated many times. This is a sentence to be repeated many times. \par \end{minipage}}; \end{tikzpicture}} \end{pspicture} \end{document} Output: I would like to position the ISBN and barcode in the lower right-hander corner of the parchment box. I have tried to manually do this without complete success. I am using here the GS1 package and am using \EANBarcode. (I did not have so much trouble doing this with the pst-barcode package, though I did have other difficulties to contend with.) QUESTION: How may I, if possible, automatically specify that the ISBN and barcode be placed in the lower right-hand corner location from the onset? If this is not possible, perhaps someone could advise an efficient way to do it manually. Before posting this question, I was able to make vertical shifts; however, I was no able to do so horizontally where the entire ISBN and barcode picture moved in unison. I compile with xelatex. Thank you.
- How fix Sans serif bold italic in KaTeX failed? [closed]by mathrm alpha on June 2, 2026 at 12:54 pm
I've noticed that when I say "this is code," in KaTeX it fails to display correctly. Is there a way to make it display in a lower-level format? I'm using the KaTeX of official online version. If the Sans serif Bold italic is usable, I hope it can be applied to NewCMSans10-BoldOblique.otf.
- latex 3 toggle a boolean variable and print its valueby user1850133 on June 2, 2026 at 11:43 am
First of all, how do we name a boolean variable? I tried \l_myvar_bool by similarity with what i found in an online tutorial. Why do we need \l_? For toggling the variable value i used \bool_set_inverse:N. I think here it's fine. I might have done it right. For printing I used \cs_meaning:N. It prints \char", don't know why. I don't want it. I need a better command. So I'd like to improve this piece of code. \documentclass[a4paper]{article} \setlength{\parindent}{0pt} \ExplSyntaxOn \bool_new:N \l_myvar_bool \NewDocumentCommand{\togglebool}{ }{ \bool_set_inverse:N \l_myvar_bool \cs_meaning:N \l_myvar_bool } \ExplSyntaxOff \begin{document} \togglebool \togglebool \togglebool \end{document}
- How to get the meta information of a tex file into the pdf meta information?by quarague on June 2, 2026 at 11:34 am
I use xetex to create pdf documents out of LaTeX files. In the interest of general accessibility I would like the pdf file to contain some meta information about the file like the title or the language of the document. This is fairly similar to this question but this is from 2011. Additionally I don't want to manually set the title or the language for the pdf metadata, the LaTeX document already knows what the title is (specified by \title) and what language the document is written in (specified by \setdefaultlanguage) so the pdf meta information should just take this information from the LaTeX directly. The linked question has a way to do this for the title but that was written in 2016 and the comments below show that this feature was already being discontinued back then. So how can I tell xetex to fill as much meta information of the pdf document with the meta information the LaTeX document already has?
- unicode-math font character new mapping in \symsfby mathrm alpha on June 1, 2026 at 10:10 pm
Why do I want to create a new mapping for unicode-math? I noticed that Unicode has sans-serif arrow keys in U+1F850 - U+1F859 range, but unicode-math and \symsf seem to only superficially include them. Also, I noticed that the NewCMMath font has additional sans-serif non-bold Greek characters, but it's not being recognized. Is it possible to create a new mapping in \symsf? \documentclass{article} \usepackage{unicode-math} \setmathfont{NewCMMath-Book.otf} \begin{document} Expected glyphs: $\symbol{"E002}\symbol{"E003}\symbol{"E007}\symbol{"E018}\symbol{"E019}\symbol{"E01A}\symbol{"1F850}\symbol{"1F851}\symbol{"1F852}\symbol{"1F853}\symbol{"E043}\symbol{"E044}\symbol{"E048}\symbol{"E059}\symbol{"E05A}\symbol{"E05B}$\\ Actual glyphs: $\symsf{\Gamma\Delta\Theta\alpha\beta\gamma\leftarrow\uparrow\rightarrow\downarrow}\symsfit{\Gamma\Delta\Theta\alpha\beta\gamma}$ \end{document}
- Really long but narrow table inside multicolsby Daniela Ramírez Montoya on June 1, 2026 at 6:29 pm
I´ve tried this: % Source - https://tex.stackexchange.com/a/105736 % Posted by egreg % Retrieved 2026-06-01, License - CC BY-SA 3.0 \documentclass{article} \usepackage{supertabular,multicol} \newcount\n \n=0 \def\tablebody{} \makeatletter \loop\ifnum\n<100 \advance\n by1 \protected@edef\tablebody{\tablebody \textbf{\number\n.}& shortText \tabularnewline } \repeat \makeatletter \let\mcnewpage=\newpage \newcommand{\TrickSupertabularIntoMulticols}{% \renewcommand\newpage{% \if@firstcolumn \hrule width\linewidth height0pt \columnbreak \else \mcnewpage \fi }% } \makeatother \begin{document} \begin{multicols*}{2} \TrickSupertabularIntoMulticols \begin{supertabular}{|l|l|} \tablebody \end{supertabular} \end{multicols*} \end{document} And it´s working, but it does not use the total lenght of the page, what could I change in oder to use the total lenght of the page?
- How to abstract mutual lua functionality from two classes to a third moduleby Jasper on June 1, 2026 at 4:16 pm
I want to adopt this design philosophy, but don't know how: https://stackoverflow.com/a/13969886/32395400. Mwe: NOTE: This code is untested due to the dependency problem. local Vector = require "vector" local Matrix = require "matrix" local v = Vector:new{1,2,3,1} print(v) local m = Matrix:new{ Vector:new{1,0,0,0}, Vector:new{0,1,0,0}, Vector:new{0,0,1,0}, Vector:new{0,0,0,1}, } print(m) local t = Matrix:new{ Vector:new{1,0,0,0}, Vector:new{0,2,0,0}, Vector:new{0,0,1,0}, Vector:new{0,0,0,1}, } print(t) local vp = v:multiply(t) print(vp) local mp = m:multiply(t) print(mp) local Matrix = require "matrix" --- Vector class --- @class Vector --- @field vector table<number> The 1xn vector data local Vector = {} Vector.__index = Vector --- Create a new 1xn Vector object, without validation --- @param vector table<number> The 1xn vector data --- @return Vector a 1xn vector function Vector:_new(vector) return setmetatable(vector, Vector) end --- Create a new 1xn Vector object, without validation --- @param vector table<number> The 1xn vector data --- @return Vector a 1xn vector function Vector:_new(vector) return setmetatable(vector, Vector) end --- Create a new 1xn Vector object, with validation --- @param vector table<number> The 1xn vector data --- @return Vector a 1xn vector function Vector:new(vector) assert( getmetatable(vector) == table, "Vector input must be a table." ) local length = #vector assert( length > 0, "Vector must have greater than zero length." ) for index = 1, length do assert( getmetatable(vector[index]) == number, "Vector entries must be numbers." ) end return Vector:_new(vector) end --- Pretty print for Vector object --- @return string function Vector:__tostring() return ( "Vector{%.12f" .. string.rep(",%.12f", #self - 1) .. "}" ):format(table.unpack(self)) end --- Multiply Vector by Matrix (applies projective divide) --- @param matrix table The matrix --- @return Vector The product of self and matrix function Vector:multiply(matrix) return Matrix:_new{self}:multiply(matrix)[1] end return Vector local Vector = require "vector" --- Matrix class --- @class Matrix --- @field matrix table<table<number>> local Matrix = {} Matrix.__index = Matrix --- Matrix constructor, unverified --- @param matrix table<table<number>> --- @return Matrix function Matrix:_new(matrix) return setmetatable(matrix, Matrix) end --- Matrix constructor, verified --- @param matrix table<table<number>> --- @return Matrix function Matrix:new(matrix) assert( getmetatable(matrix) == table, "Matrices are encapsulated by tables." ) local num_rows = #matrix local num_cols = #matrix[1] for i = 1, num_rows do assert( getmetatable(matrix[i]) == Vector, "Matrix rows must be vectors." ) local num_col = #matrix[i] assert( num_col == num_cols, "Every row must have the same number of columns." ) for j = 1, num_col do assert( getmetatable(matrix[i][j]) == number, "Matrix entries must be numbers." ) end end return Matrix:_new(matrix) end --- Print a Matrix object --- @return string function Matrix:__tostring() local s = "Matrix{\n" local l = #self for i = 1, l do s = s .. "\t{" local m = #self[i] for j = 1, m do s = s .. string.format("%.12f", self[i][j]) if j < m then s = s .. "," end end s = s .. "}" if i < l then s = s .. ",\n" end end s = s .. "\n}" return s end --- Multiply two Matrix objects --- @param other Matrix|Vector The RHS --- @return Matrix|Vector The product of self and other function Matrix:multiply(other) local Arows = #self local Acols = #self[1] local Bcols = #other[1] local product = Matrix:_new{} for i = 1, Arows do table.insert(product, 0) end for row = 1, Arows do product[row] = Vector:_new{} for i = 1, Arows do table.insert(product, 0) end for col = 1, Bcols do product[row][col] = 0 for k = 1, Acols do product[row][col] = product[row][col] + self[row][k] * other[k][col] end end end return Matrix:_new(product) end return Matrix
- Fonts installed with MacTeX in the Font Book?by Denis Bitouzé on June 1, 2026 at 1:44 pm
(For a LaTeX beginner, colleague of mine, since I don't have a Mac.) Is there a way to view in the Font Book the fonts included with a fresh installation of MacTeX?
- How can I correctly make a biblatex apa reference to swedish law?by Simpe69 on June 1, 2026 at 1:42 pm
I want to have my reference show (Skollag, 2010:800) when I do \parencite{...} and I want the reference to show in my \printbibliography as: Skollag (SFS 2010:800). Utbildningsdepartementet. https://www.riksdagen.se/sv/dokument-och-lagar/dokument/svensk-forfattningssamling/skollag-2010800_sfs-2010-800/#top I dont know what type of @type to make it and the ones I have tried dont fit the formating required.
- How to increase the radius/bend of the voltage label arrow in CircuiTikZ?by ankit kumar on June 1, 2026 at 11:17 am
I am a beginner at using LATEX. I have a question about increasing/decreasing the radius/curve/bulge of the voltage arrow. I am creating a very simple RLC series circuit along with a DC voltage source. I have attached my code below: \begin{circuitikz} \draw (0,0) to [american voltage source, invert, l=$V_s$] (0,6) to [R, l=$R_1$] ++(2.5,0) to [L, l_=$L$] ++(2.5,0) to [C, l=$C$, i=$i_C$, v^<=$v_C$] ++ (0,-6) to [short] ++(-5,0); \draw (2.5,6) to [R, l=$R_2$, *-*] ++(0,-6); \draw (0,0) node[ground, label=west:G] (GND) {}; \end{circuitikz} The output of this code is: As you can see, the text C and the arrow of v_c are sort of overlapping each other. I can easily overcome this issue by bringing the label C to the left or by bringing the voltage arrow to the left. However, I would like to know how I can manipulate the curvature of the arrow itself. I went through the CircuiTikZ User Manual, and questions such as this, this, this, and this but I was unable to solve the issue. I look forward to the opinion of the advanced LATEX users.
- garamondx not working in MacTeX 2026 [duplicate]by Student on June 1, 2026 at 11:16 am
In MacTeX 2026, using the package garamondx doesn't seem to work for me. I have: Installed all non-free fonts using the getnonfreefonts script Run sudo updmap-sys to update the font map files Made sure my updmap.cfg (at /usr/local/texlive/2026/texmf-config/web2c/) contains the line "Map zgm.map" My MWE (with mathdesign commented out because I have read it could cause issues) \documentclass{scrartcl} \usepackage[full]{textcomp} %\usepackage[garamond]{mathdesign} \usepackage{garamondx} \begin{document} Hello World \end{document} This does not compile with the following error: [Loading MPS to PDF converter (version 2006.09.02).] ) (/usr/local/texlive/2026/texmf-dist/tex/latex/epstopdf-pkg/epstopdf-base.sty (/usr/local/texlive/2026/texmf-dist/tex/latex/latexconfig/epstopdf-sys.cfg)) [1{/usr/local/texlive/2026/texmf-var/fonts/map/pdftex/updmap/pdftex.map}] (/Users/friedrich/Documents/LaTeX/Projekte/Garamond Test/.texpadtmp/Test.aux) ) !pdfTeX error: /Library/TeX/texbin/pdflatex (file T1-zgm-r-lf): Font T1-zgm-r-lf at 657 not found ==> Fatal error occurred, no output PDF file produced!
- fbox/parbox works well for text, but refuses to print code listingsby Reinhard Neuwirth on June 1, 2026 at 4:46 am
\documentclass{article} % RN. 1 June 2026 % BRIEF DESCRIPTION: % fbox/parbox works well for text but refuses to print code listings. %====================================================================== \usepackage{listings} \usepackage{color} \definecolor{macroscolor}{rgb}{0.8,0.85,1} \begin{document} \noindent\fbox{% \parbox{\textwidth}{% fbox/parbox works well for text, but refuses to print listings. Is there a work-around? %\lstset{language=Python} %\begin{lstlisting}[basicstyle=\small,backgroundcolor=\color{macroscolor},commentstyle=\color{red}, %caption={}, %label= ] %>>>matrix = [[1, 2, 3,], [4, 5, 6,], [7, 8, 9,], ] %>>>matrix %[[1, 2, 3], [4, 5, 6], [7, 8, 9]] %>>>flat = [item for sublist in matrix for item in sublist] %>>>flat %[1, 2, 3, 4, 5, 6, 7, 8, 9] %\end{lstlisting} }% } \lstset{language=Python} \begin{lstlisting}[basicstyle=\small,backgroundcolor=\color{macroscolor},commentstyle=\color{red}, caption={}, label= ] >>>matrix = [[1, 2, 3,], [4, 5, 6,], [7, 8, 9,], ] >>>matrix [[1, 2, 3], [4, 5, 6], [7, 8, 9]] >>>flat = [item for sublist in matrix for item in sublist] >>>flat [1, 2, 3, 4, 5, 6, 7, 8, 9] \end{lstlisting} \end{document}
- Wrapping Text Around a Barcode within Minipage and Tikzpicture Environmentsby DDS on May 31, 2026 at 11:43 pm
Consider the code: \documentclass[12pt,onecolumn,openany,final]{book} \usepackage[hmargin=0in,vmargin=0in,paperwidth=12.7525in,paperheight=9.25in]{geometry} \usepackage{pstricks,psvectorian,cabin} \usepackage{wrapfig} \usepackage{pst-barcode} \psset{unit=1in} \usepackage{tikz,xcolor} \usetikzlibrary{decorations.text} \usetikzlibrary{decorations.pathmorphing} \usetikzlibrary{positioning} \definecolor{myred}{RGB}{149, 7, 20} \definecolor{pylight}{RGB}{247, 235, 205} \definecolor{py}{RGB}{243, 224, 181} \definecolor{pydark}{RGB}{221, 182, 110} \definecolor{pyhighlight}{RGB}{254, 235, 204} \pgfdeclareverticalshading{parchment}{100bp}{% color(0bp)=(pydark); color(25bp)=(pydark); color(30bp)=(py); color(50bp)=(pylight); color(70bp)=(py); color(75bp)=(pydark); color(100bp)=(pydark)% } \pgfdeclareradialshading{rparchment}{\pgfpoint{0cm}{0cm}}{% color(0bp)=(pylight); color(13bp)=(pylight); color(20bp)=(py); color(40bp)=(pydark); color(60bp)=(pydark!50!black); color(100bp)=(black)% } \tikzset{ pencildraw/.style={% decorate, %decoration={% % random steps, segment length=1.1ex, amplitude=.5ex% % } }, drop shadow/.style={ blur shadow={% shadow xshift=.5pt, shadow yshift=-.5pt, shadow blur steps=9, shadow blur extra rounding=1.5pt% }, }, parchment fill/.style={ pencildraw, fill=pyhighlight, postaction={shading=parchment, opacity=1}, postaction={shading=rparchment, opacity=.7} } } \pagecolor{myred} \begin{document} \thispagestyle{empty} \setmainfont{Cabin} \noindent\begin{pspicture}(-6.37625,0)(6.37625,9.25) \psframe[fillcolor=myred,fillstyle=solid](-6.37625,0)(6.37625,9.25)% \psframe[linecolor=myred](-6.37625,0)(6.37625,9.25) % draws frame. \rput(-3.15,1.35){\begin{tikzpicture} \shade node[parchment fill, text width=14.15cm, text height=5.15cm, inner sep=.4, align=justify] {\hskip 12pt \begin{minipage}{5.25in}\vspace*{-155pt} {\fontsize{8.75}{8.25}\selectfont{This is a sentence to be repeated many times. This is a sentence to be repeated many times. This is a sentence to be repeated many times. This is a sentence to be repeated many times. This is a sentence to be repeated many times. This is a sentence to be repeated many times. This is a sentence to be repeated many times. This is a sentence to be repeated many times. This is a sentence to be repeated many times. This is a sentence to be repeated many times. This is a sentence to be repeated many times. This is a sentence to be repeated many times. This is a sentence to be repeated many times. This is a sentence to be repeated many times. This is a sentence to be repeated many times. This is a sentence to be repeated many times. \begin{wrapfigure}{r}{4.75cm} \psbarcode{0-89555-821-1}{backgroundcolor=FFFFFF borderleft=15 borderright=15 bordertop=14 borderbottom=10 textsize=8 includetext height=0.7 width=1.3125}{isbn}% \end{wrapfigure} This is a sentence to be repeated many times. This is a sentence to be repeated many times.}\par} \end{minipage}}; \end{tikzpicture}} \end{pspicture} \end{document} which produces Within the tikzpicture, I have a minipage wherein I am trying to wrap the text around the barcode which I would like to place in the bottom right-hand corner of the minipage. QUESTION: How may I modify the code which will allow me to place the barcode in the lower right-hand corner of the minipage surrounded by text above it and to the left of it? I must compile with xelatex. Thank you.
- In my list of references, why would there be no line break within certain links but right before them leaving most of the line blank?by Simon on May 31, 2026 at 10:21 pm
I am required to break the links within url{} to my references only after / or //, not after any other symbol that also might occur in a link. As can be seen in this post, this was achieved by adding \def\UrlBigBreaks{\do\/} to my code. Fixing this issue made another problem apparent though, as there would be no line break within certain links but right before them, leaving most of the line blank. How can this problem be resolved? By given guidelines, the list of references is to be formatted left-aligned without hyphenation, yet, links can include a line break after said symbols, thus replacing \raggedright globally by \RaggedRight of \usepackage{ragged2e} unfortunately isn't an option. Setting it locally by wrapping \url{} with \RaggedRight like {\RaggedRight\url{}} seems to make no difference. Potential alternative phrasing for title question: How can I locally allow hyphenation for certain passages in a text that globally doesn't allow hyphenation? Please see the following MWE and its output: \documentclass{article} \usepackage[hidelinks]{hyperref} \def\UrlBigBreaks{\do\/} %\usepackage{ragged2e} \begin{document} { \raggedright %\RaggedRight \begin{thebibliography}{} \bibitem[Smith 2026]{reference} \textsc{Smith}, John (2026) \textit{HMP} : \textit{Hippopotomonstrosesquippedaliophobia} [online]. London : The Publisher. [Retrieved on 2 June 2026] -- Available at \url{https://tex.stackexchange.com/one/two-three/four_five_six} \end{thebibliography} } \end{document} Context: This is a follow-up question to a question that I posted some time ago. I already asked this follow-up question back then in a comment to an answer to my original question, however, I have neither received a response to it nor have I found a solution to it myself in the meantime.
- Getting rid of extra horizontal space after proofsby X3nius on May 31, 2026 at 8:53 pm
How do I get rid of an extra horizontal space after proofs? \documentclass{article} \usepackage[english]{babel} \usepackage{amsthm} \begin{document} \begin{proof} This is the proof. \end{proof} The next line starts here. \end{document} leads to this
- TeX Gyre Pagella font: italic parentheses are missingby Denis Bitouzé on May 31, 2026 at 6:23 pm
It looks like the TeX Gyre Pagella font is missing italic parentheses: \documentclass{article} \usepackage{fontspec} \begin{document} \emph{(foo)} \setmainfont{texgyrepagella} \emph{(foo)} (\emph{foo}) \end{document} Am I missing something?
- How to include a white background photo (jpg) in a 10% gray background?by Learner on May 31, 2026 at 11:20 am
I am using \includegraphics{photo.jpg} to upload a photo in a 10% gray background. For 10% gray background INSIDE border \fill[gray!10] ($(current page.north west) + (1cm,-1cm)$) rectangle ($(current page.south east) + (-1cm,1cm)$); To upload the photo (with white background, I used \node at ($(current page.south)+( 6cm,5.2cm)$) { \includegraphics{sig_digital.jpg} }; This produced the following photo: We can see the background is not matching, the photo has white background. I have one option, I can make the background to be white. But I want to keep the background gray while adjust the photo background. Edit: I am adding the full latex code: \documentclass[12pt,reqno]{amsart} %\documentclass [border = .2cm] {standalone} \usepackage{pgfplots} \usepackage{tikz} \pgfplotsset{compat=newest} \topmargin=0.02cm \textwidth = 17cm \textheight = 23cm \baselineskip=11pt \usepackage{color} \makeatletter \renewcommand*{\@cite}[2]{\fcolorbox{black}{white}{#1\if@tempswa, #2\fi}} %\renewcommand*{\@cite}[2]{\fcolorbox{green}{white}{#1, #2}} \renewcommand*{\@biblabel}[1]{{\fcolorbox{green}{white}{#1}}\hfill} \makeatother \setlength{\oddsidemargin}{0.01 pt} \setlength{\evensidemargin}{0.01 pt} \renewcommand{\baselinestretch}{1.4} \usepackage{amsmath,amsfonts,amssymb,amsthm} \usepackage{graphicx} \graphicspath{ } \usetikzlibrary{intersections} \usetikzlibrary{patterns} \usepackage{dsfont} \usepackage{amssymb} \usepackage{relsize} \usepackage{soul} \usepackage{exercise} \usepackage{lipsum} \usepackage{epstopdf} \usepackage{pdflscape} \usepackage{csquotes} \usepackage{wrapfig} \usepackage{accents} \usepackage{adjustbox} \usepackage{tikz-3dplot} \usepackage{caption} \usepackage{subcaption} \usepackage{calligra} \usepackage[colorlinks]{hyperref} \hypersetup{citecolor=black} \newtheorem{fig}{figure}[section] \numberwithin{figure}{section} \newcommand\norm[1]{\left\lVert#1\right\rVert} \theoremstyle{plain} \newtheorem{thm}{Theorem}[section] \newtheorem*{thm*}{Theorem} \newtheorem{lem}[thm]{Lemma} \newtheorem{prop}[thm]{Proposition} \newtheorem{cor}{Corollary}[thm] \theoremstyle{definition} \newtheorem{defn}{Definition}[section] \newtheorem{conj}{Conjecture}[section] \newtheorem{exmp}{Example}[section] \theoremstyle{remark} \newtheorem{rem}{Remark} \newtheorem*{note}{Note} \usepackage{mathtools} \makeatletter \@namedef{subjclassname@2020}{% \textup{2020} Mathematics Subject Classification} \makeatother \renewcommand\ExerciseName{Question~} \renewcommand\ExerciseHeader{% \noindent\parbox[t]{.18\textwidth}{% \bfseries\large\ExerciseName\ExerciseHeaderNB\hfill}% \parbox[t]{.72\textwidth}{% \centering\bfseries\large% \ExerciseHeaderTitle\ExerciseHeaderOrigin}% \par\medskip } \newcommand{\md}[1]{\hfill\makebox[0pt][r]{[#1]}} %md=mark distribution \begin{document} \thispagestyle{empty} \begin{tikzpicture}[remember picture,overlay] % Light gray background INSIDE border \fill[gray!10] ($(current page.north west) + (1cm,-1cm)$) rectangle ($(current page.south east) + (-1cm,1cm)$); % Border \draw[line width=3pt] ($(current page.north west) + (1cm,-1cm)$) rectangle ($(current page.south east) + (-1cm,1cm)$); \draw[line width=1pt] ($(current page.north west) + (1.2cm,-1.2cm)$) rectangle ($(current page.south east) + (-1.2cm,1.2cm)$); % Title % Title (no node name needed) \node at ($(current page.north)+(0,-2.5cm)$) { {\Huge \bfseries Certificate of Presentation} }; % Main underline \draw[line width=1.3pt, color=blue] ($(current page.north)+(-4.7cm,-3.35cm)$) -- ($(current page.north)+(4.7cm,-3.35cm)$); % End dots \fill[color=blue] ($(current page.north)+(-4.9cm,-3.35cm)$) circle (2.2pt); \fill[color=blue] ($(current page.north)+(4.9cm,-3.35cm)$) circle (2.2pt); % Left stem \draw[line width=0.7pt, color=blue] ($(current page.north)+(-5.05cm,-3.35cm)$) -- ($(current page.north)+(-5.22cm,-3.35cm)$); % Left upper leaf \draw[line width=0.7pt, color=blue] ($(current page.north)+(-5.22cm,-3.35cm)$) .. controls +(-0.14,0.14) and +(0.14,0.11) .. ($(current page.north)+(-5.72cm,-3.16cm)$) .. controls +(-0.14,-0.11) and +(-0.10,0.00) .. ($(current page.north)+(-5.22cm,-3.35cm)$); % Left lower leaf \draw[line width=0.7pt, color=green] ($(current page.north)+(-5.22cm,-3.35cm)$) .. controls +(-0.14,-0.14) and +(0.14,-0.11) .. ($(current page.north)+(-5.72cm,-3.54cm)$) .. controls +(-0.14,0.11) and +(-0.10,0.00) .. ($(current page.north)+(-5.22cm,-3.35cm)$); % Right stem \draw[line width=0.7pt, color=blue] ($(current page.north)+(5.05cm,-3.35cm)$) -- ($(current page.north)+(5.22cm,-3.35cm)$); % Right upper leaf \draw[line width=0.7pt, color=blue] ($(current page.north)+(5.22cm,-3.35cm)$) .. controls +(0.14,0.14) and +(-0.14,0.11) .. ($(current page.north)+(5.72cm,-3.16cm)$) .. controls +(0.14,-0.11) and +(0.10,0.00) .. ($(current page.north)+(5.22cm,-3.35cm)$); % Right lower leaf \draw[line width=0.7pt, color=green] ($(current page.north)+(5.22cm,-3.35cm)$) .. controls +(0.14,-0.14) and +(-0.14,-0.11) .. ($(current page.north)+(5.72cm,-3.54cm)$) .. controls +(0.14,0.11) and +(0.10,0.00) .. ($(current page.north)+(5.22cm,-3.35cm)$); \node at ($(current page.north west)+(10.7cm,-5.6cm)$) { \includegraphics[width=4cm]{DHU_logo.png} }; % Body Text (for presenters) \node[align=center, text width=21cm] at ($(current page.center)+(0,0.1cm)$) { \large This is to certify that \\[0.5cm] {\LARGE \textbf{Participant Name}} \\[0.3cm] {\large (Affiliated to XYZ University)} \\[0.3cm] has presented a research paper titled \\[0.3cm] {\large \bfseries ``Title of the Research Paper''} \\[0.3cm] at the \\[0.1cm] { \color{blue!60!black}{{ $\mathbb{T}\mathbb{W}\mathbb{O}-$$\mathbb{DAY}$ $\mathbb{WORKSHOP}$ $\mathbb{AND}$ $\mathbb{CONFERENCE}$ $\mathbb{IN}$ $\mathbb{MATHEMATICS}$}\\[0.25cm] $\mathbb{HONORING}$ $\mathbb{SRINIVASA}$ $\mathbb{RAMANUJAN}$}}\\[0.6cm] held at Darjeeling Hills University from 2--3 July 2026.\\[0.4cm] We appreciate his/her valuable contribution to the conference. }; % Signature Lines \node at ($(current page.south)+( 6cm,3.5cm)$) { \begin{tabular}{c} \rule{5cm}{0.4pt}\\ (Organizer Name) \\ Affiliation \end{tabular} }; %add digital signature \node[scale=0.9] at ($(current page.south)+( 6cm,5.2cm)$) { \includegraphics{sig_digital.jpg} }; \end{tikzpicture} \end{document} The output is as follows: Here is the photo link
- Why making integral sign upright works for some fonts but not others?by Nasser on May 31, 2026 at 1:03 am
I found this code (bottom of page) which makes the integral sign upright, which I like more than slanted integral sign \usepackage{scalerel} \let\oldint\int \DeclareMathOperator*{\uint}{\scalerel*{\rotatebox{8}{$\textstyle\oldint$}}{\oldint}} \renewcommand{\int}{\uint} I noticed it works on some fonts but not others. Why is that? Is there a way to make either the above code works on all fonts, or a better way to make the integral sign upright for all fonts? Below I give examples where it works and examples where it does not, depending on which font is used. I use only lualatex Here is without adding the code \documentclass[12pt]{article} \usepackage{amsmath} \begin{document} \[ \int \sin x \, dx \] \end{document} When adding the above code to the preamble, here is the output Here is an example when using different font than default it no longer works \documentclass[12pt]{article} \usepackage{amsmath} \usepackage{scalerel} \let\oldint\int \DeclareMathOperator*{\uint}{\scalerel*{\rotatebox{8}{$\textstyle\oldint$}}{\oldint}} \renewcommand{\int}{\uint} \usepackage{unicode-math} \setmainfont{STIX Two Text} \setmathfont{STIX Two Math} \begin{document} \[ \int \sin x \, dx \] \end{document} Here is an example where it worked when trying another font. First without the code \documentclass[12pt]{article} \usepackage{amsmath} \usepackage[T1]{fontenc} \usepackage[math]{anttor} \begin{document} \[ \int \sin x \, dx \] \end{document} When adding the code, it changes OK Is there a better method than the above trick which works for all fonts?
- Automatically shift arrow heads in TikZ for piecewise defined functions or gapsby CampanIgnis on May 30, 2026 at 7:40 pm
The tip of arrow heads in TikZ usually extends on exactly the specified coordinate, for example in \draw[->] (0,0) -- (1,1);. Is it possible to align the center of the end mark automatically at the specified coordinate? This is useful for plotting piecewise defined functions using * or o as arrow heads such as in https://commons.wikimedia.org/wiki/File:Discontinuity_jump.eps.png. Another way to achieve a similar result is by calculating the coordinates of the points and adding the points manually by \filldraw[fill=white] (1,0.5) circle (0.75pt);. To illustrate what I would like to have: The center of the two circles should be in the middle of the two blue lines of the MWE. It would also be great if we could define certain x-values to set marks at exactly desired points. MWE \documentclass{article} \usepackage{tikz} \usetikzlibrary{arrows} \begin{document} \begin{tikzpicture}[scale=3] \draw[blue!25,line width=4.80pt] (0,-0.25) -- ++(0,1.25) (1,-0.25) -- ++(0,1.25) ; \draw[domain=0:1, smooth, variable=\x, samples=4, *-o] plot ({\x}, {0.55}); \draw[->] (0,0) -- (1,0); \end{tikzpicture} \end{document}
- Stylizing the mathematical fraction (afrc)by Lars Malmsteen on May 29, 2026 at 3:49 pm
I'm trying to stylize the mathematical fraction in such a way that both the numerator and the denominator will automatically shrink to roughly fit the line height and preferably the digits will be expanded horizontally to occupy more horizontal space. Being away from the TeX for the last 2-3 years I've consulted an AI-assistent first and it suggested using the afrc (Alternative Fractions) and the font Adobe Caslon Pro which it said supported the afrc but that didn't work out and I gave up asking the AI. "Almost" MWE \documentclass{article} \usepackage{fontspec} \defaultfontfeatures{Ligatures={TeX,Common}} \setmainfont{Adobe Caslon Pro}[] % it's installed on my system \begin{document} gimme {\addfontfeatures{RawFeature=+afrc}1/10} of your money % afrc -> Alternative Fractions \end{document}