• LuaLaTeX Accessible PDF not validated by Yuja Panorama
    by layman on August 28, 2025 at 5:10 pm

    I am having serious problems generating a PDF in TeX that passes my accessibility checker. Below is a minimal working example that should produce an accessible PDF, but the checker highlights that the resulting PDF is missing a title, that the image does not have alt text, and that there is an issue with the reading order. Minimal working example: \DocumentMetadata{ lang = en-US, pdfversion=1.7, pdfstandard = ua-2, pdfstandard = a-4f, tagging = on, tagging-setup = {table/header-rows=1} } \documentclass{article} \usepackage{unicode-math} % Ensure unicode math for MathML conversion \usepackage{graphicx} % Standard graphics package (now supports alt key) \usepackage[hidelinks]{hyperref} % Hyperref for metadata and links (optional, but recommended) \setmathfont{Latin Modern Math} % or any Unicode math font you prefer \title{Accessible LaTeX Document Example} \author{Your Name} \begin{document} \maketitle \section{Introduction} This document is a sample to demonstrate \textbf{accessible PDF} features in LaTeX. We include an image, a table, and a formula as examples. \begin{figure}[h] \centering \includegraphics[width=0.8\textwidth, alt={Enter alt text here}] {sampleimage.png} \caption{Example image with descriptive alt text.} \end{figure} As shown in Figure~1, images can be understood by screen readers if we provide alternative text. Next, we present an example table: \begin{table}[h] \centering \caption{Sample data table demonstrating header row tagging.} \begin{tabular}{l r} \hline Item & Value (\$)\\ % This header row will be tagged as TH cells \hline Alpha & 15 \\ Beta & 20 \\ \hline \end{tabular} \end{table} Finally, we include a mathematical formula. With LuaLaTeX and unicode-math, the equation below will carry a MathML version internally, improving its accessibility: \[ E = m c^2. \] \end{document}

  • Conflict between cleveref, aliascnt, and amsmath
    by seldon on August 27, 2025 at 7:50 am

    This is a follow up to this question. cleveref got broken after LaTeX got updated, apparently this also happened with an amsmath update (see here). Hence the fix proposed in my question above does not work when amsmath is loaded: \documentclass{article} % uncomment to break the second \cref below % \usepackage{amsmath} \usepackage{aliascnt} \usepackage{hyperref} \usepackage{cleveref} \newaliascnt{rule}{equation} \aliascntresetthe{rule} \crefname{rule}{Rule}{Rules} \begin{document} \begin{equation} \label{rule:first} 1 \end{equation} \begin{equation} \label[rule]{rule:second} 2 \end{equation} \cref{rule:first} and \cref{rule:second} \end{document} With amsmath, this is what I get: Any ideas on how to patch it? EDIT: maybe it's obvious, maybe not really helpful to other people, but reinstalling TeXLive 2024 solves the problem.

  • Memorizing inconsistent key names in pgfplots
    by Paul Paulsen on August 25, 2025 at 6:13 pm

    I absolutely love tikz and pgfplots, and I am really thankful for what their authors have built. I regularly am surprised and in awe by what people can accomplish in them. Also, both of them have among the best documentation I have ever come across, and the online versions (tikz and pgfplots) are so smooth to use that I even find myself wanting to learn new functionalities for fun. However, I have one big frustration with pgfplots: I am seemingly unable to ever memorize any of the keys I can use. I always need to look up how to fine tune my plots, no matter how recently I did the same thing - either in the documentation or a file I made earlier. That most code editors can't come up with suggestions for tikz and pgfplots commands doesn't make things easier (I currently mostly use overleaf). And I think the inconsistent naming for keys plays a big role in my difficulties. For example: xtick distance but extra x ticks - why not extra xticks? extra x ticks but extra x tick labels - why not extra x ticks labels? Does anyone have any tips and tricks how to work around this and how to remember the most important of the many, many, many possible options? And out of curiosity, are there any technical reasons for these inconsistencies?

  • Chapter title formatting with TikZ graphic
    by ncant on August 22, 2025 at 4:15 pm

    I am trying to recreate the chapter titles from the 2010 print edition of Ogata's book, 'Modern Control Engineering'. Here's a sample of the pages in question: As you can see, the chapter number is enclosed between two squares, one of which is rotated 45 degrees relative to the other, while the actual chapter title is aligned to the right. Having a PDF file with some of these pages and opening it with Inkscape, I noticed that the chapter title is 18pt, while the chapter number is 58pt. With this information, I used the titlesec package with the following code in the preamble of my document: \usepackage{titlesec, titletoc} \titleformat{\chapter}[display]% {\headerfont\bfseries\Huge\raggedleft} % \Huge is not quite 18pt, but it'll do. {\thechapter} {20pt} % Space between chapter number and chapter title. To be adjusted accordingly. {\Huge} % FIXME: should be 58pt. I tried using the \fontsize command, but probably wrong. Now let's move on to the "fun part". I'm still pretty new to TikZ (until now I didn't have to use it much, relying instead on importing existing .svg files into my documents). However, I think it might be useful to draw the two squares that enclose the chapter number: As a proof of concept, I wrote the following MWE, which uses TikZ: \documentclass{standalone} \usepackage{tikz} \usepackage{anyfontsize} \begin{document} \begin{tikzpicture}[scale=2] \def\outer{1.25} \def\inner{1.05} \def\diamond{1} \def\thick{14pt} % Outer square \draw[thin] (-\outer,-\outer) rectangle (\outer,\outer); % Inner square \filldraw[fill=white, draw=black, thin] (-\inner,-\inner) rectangle (\inner,\inner); % Rotated square \draw[line width=\thick, rotate=45] (-\diamond,-\diamond) rectangle (\diamond,\diamond); % Central number \node at (0,0) {\fontsize{50}{60}\selectfont 3}; \end{tikzpicture} \end{document} which produces the following: As you can see, it's not an exact replica of what I want to achieve, and I kinda know this code it's not up to the task. Opening the PDF again, I approximately measured the bases of the squares: If you find these numbers weird, so do I: I tried switching measurement units in Inkscape, and yet I couldn't find a "perfectly sane" number. I am therefore asking for your help in combining (and, if possible, improving) these two code snippets, and perhaps getting a little closer to the reference images.

  • Why adding `\usepackage{mathtools}` gives latex error in this example?
    by Nasser on August 21, 2025 at 11:21 pm

    I am trying the solution given in How to get paragraph spacing within table to be same as outside when using parskip package? Which works fine except when I added \usepackage{mathtools} it gives error. I thought it will better to make new question on this. But if I should have made this comment instead, will delete this. Here is MWE. This is same exact code in the above link. All what I did is just add one line \usepackage{mathtools} and now lualatex gives error \documentclass[12pt]{book} \usepackage{mathtools} %uncomment this, error goes way \usepackage{longtable,array} \usepackage[skip=10pt plus1pt]{parskip} %see https://tex.stackexchange.com/questions/750023/how-to-get-paragraph-spacing-within-table-to-be-same-as-outside-when-using-parsk \newlength{\defaultparskip} \AtBeginDocument{\setlength{\defaultparskip}{\parskip}} \AddToHook{cmd/@arrayparboxrestore/after}{\setlength{\parskip}{\defaultparskip}} \begin{document} \begin{longtable}{|p{4in}|}\hline line 1 line 2 line 3 \\ \hline \end{longtable} line1 line2 line 3 \end{document} Now >lualatex index.tex This is LuaHBTeX, Version 1.23.3 (TeX Live 2026/dev) restricted system commands enabled. (./index.tex LaTeX2e <2025-06-01> patch level 1 L3 programming layer <2025-08-13> (/usr/local/texlive/2025/texmf-dist/tex/latex/base/book.cls Document Class: book 2025/01/22 v1.4n Standard LaTeX document class (/usr/local/texlive/2025/texmf-dist/tex/latex/base/bk12.clo)) (/usr/local/texlive/2025/texmf-dist/tex/latex/mathtools/mathtools.sty (/usr/local/texlive/2025/texmf-dist/tex/latex/graphics/keyval.sty) (/usr/local/texlive/2025/texmf-dist/tex/latex/tools/calc.sty) (/usr/local/texlive/2025/texmf-dist/tex/latex/mathtools/mhsetup.sty) (/usr/local/texlive/2025/texmf-dist/tex/latex/amsmath/amsmath.sty For additional information on amsmath, use the `?' option. (/usr/local/texlive/2025/texmf-dist/tex/latex/amsmath/amstext.sty (/usr/local/texlive/2025/texmf-dist/tex/latex/amsmath/amsgen.sty)) (/usr/local/texlive/2025/texmf-dist/tex/latex/amsmath/amsbsy.sty) (/usr/local/texlive/2025/texmf-dist/tex/latex/amsmath/amsopn.sty))) (/usr/local/texlive/2025/texmf-dist/tex/latex/tools/longtable.sty) (/usr/local/texlive/2025/texmf-dist/tex/latex/tools/array.sty) (/usr/local/texlive/2025/texmf-dist/tex/latex/parskip/parskip.sty (/usr/local/texlive/2025/texmf-dist/tex/latex/kvoptions/kvoptions.sty (/usr/local/texlive/2025/texmf-dist/tex/generic/ltxcmds/ltxcmds.sty) (/usr/local/texlive/2025/texmf-dist/tex/latex/kvsetkeys/kvsetkeys.sty)) (/usr/local/texlive/2025/texmf-dist/tex/latex/etoolbox/etoolbox.sty)) (/usr/local/texlive/2025/texmf-dist/tex/latex/l3backend/l3backend-luatex.def) (./index.aux) (/usr/local/texlive/2025/texmf-dist/tex/latex/graphics/graphicx.sty (/usr/local/texlive/2025/texmf-dist/tex/latex/graphics/graphics.sty (/usr/local/texlive/2025/texmf-dist/tex/latex/graphics/trig.sty) (/usr/local/texlive/2025/texmf-dist/tex/latex/graphics-cfg/graphics.cfg) (/usr/local/texlive/2025/texmf-dist/tex/latex/graphics-def/luatex.def (/usr/local/texlive/2025/texmf-dist/tex/context/base/mkii/supp-pdf.mkii [Loading MPS to PDF converter (version 2006.09.02).] ))) (/usr/local/texlive/2025/texmf-dist/tex/latex/epstopdf-pkg/epstopdf-base.sty (/usr/local/texlive/2025/texmf-dist/tex/latex/latexconfig/epstopdf-sys.cfg))) ! Missing number, treated as zero. <to be read again> } l.32 \end{document} ? Note, I am using lualatex Version 1.23.3 on TL 2025 on Linux Is there a reason why adding \usepackage{mathtools} gives error on the above solution?

  • Make a square tikzcd diagram
    by Liu Zhiyu on August 21, 2025 at 10:49 am

    The following code gives a rectangle diagram. \documentclass{article} \usepackage{tikz} \usetikzlibrary{cd} \begin{document} \begin{center} \begin{tikzcd}[sep=large] \bullet \ar[r] \ar[d] \ar[rd] & \bullet \ar[d] \\ \bullet \ar[r] & \bullet \end{tikzcd} \end{center} \end{document} How to make it square shaped, like this:

  • Spacing issues with big parenthesis in LuaTeX
    by PHL on August 21, 2025 at 6:29 am

    When using New Computer Modern via fontsetup the spacing in T \bigl( is too small. MWE (to be compiled with LuaLaTeX): % !TEX TS-program = lualatex \documentclass{article} \usepackage{fontsetup}% no options = new computer modern \begin{document} $T( T \bigl( T \Bigl( T \biggl( T \Biggl($ $A( A \bigl( A \Bigl( A \biggl( A \Biggl($ \end{document} As the above example show, the problem does not arise with standard parenthesizes nor does it if we replace Tby A. The \Bigl(, \biggl( and \Biggl( command are also problematic, but less. The problem is specific to New Computer Modern (the default option) and not to fontsetup which works well with other options. Edit As pointed out, the problem is not with New Computer Modern, but with LuaTeX. See mickep's answer and the link within it.

  • Issue with \integral command from intexgral package in math mode
    by Sebastiano on August 20, 2025 at 8:07 pm

    I am using the intexgral package to format integrals with the upright "d" as the differential operator in my document. However, I am encountering an issue when I attempt to use many integrals in one equation. Specifically, in the following code: \documentclass[12pt]{article} \usepackage{amsmath,intexgral} \begin{document} \begin{align*} \integral{\sin^2x} &= \integral{\sin x \sin x}\\ &= -\sin x\cos x +\integral{\cos x\cos x} \\ &= -\sin x\cos x +\integral{(1-\sin^2x)} \\ &= -\sin x\cos x +\integral{1}+\integral{-\sin^2x} \end{align*} \end{document} The expression \integral{1}+\integral{-\sin^2x} is supposed to display two separate integrals: One for 1 and one for -\sin^2x. However, instead of rendering \integral{1}+\integral{-\sin^2x}, I get the following: The first integral displays correctly, but for \integral{-\sin^2x}, I get \integral{1} again (as though it is mistakenly taking -\sin^2x as 1).

  • Is that possible to extend the \pic method to achieve tiling from my first thoughts?
    by Explorer on August 19, 2025 at 6:27 pm

    Description I want to use tikz to achieve the following two images' tiling. This link maybe related, but seemedly not the same. For the First simpler one , I have the following code: \documentclass[border=5pt]{standalone} \usepackage{tkz-euclide} \begin{document} \begin{tikzpicture}[ myunit/.pic={ \tkzDefPoints{0/0/O,1/\tkzSqrTwo-1/x}% \tkzDefRegPolygon[center,sides=8,name=P](O,x) \tkzDrawPolygon[#1](P1,P...,P8) \tkzDefSquare(P3,P2)\tkzGetPoints{Q2}{Q3} \tkzDrawPolygon[#1](P2,P3,Q3,Q2) \tkzDefSquare(P1,P8)\tkzGetPoints{Q1}{Q8} \tkzDrawPolygon[#1](P1,P8,Q1,Q8) \tkzDefSquare(P7,P6)\tkzGetPoints{Q7}{Q6} \tkzDrawPolygon[#1](P6,P7,Q6,Q7) \tkzDefSquare(P5,P4)\tkzGetPoints{Q4}{Q5} \tkzDrawPolygon[#1](P4,P5,Q5,Q4) } ] \foreach \x in {0,...,4}{ \foreach \y in {0,...,4}{ \pic at (\fpeval{2*\x*\tkzSqrTwo},\fpeval{2*\y*\tkzSqrTwo}) {myunit={magenta,semithick}}; } } \end{tikzpicture} \end{document} which gives that: My very basic thought is to use pic act as the unit image, then use nested \foreach to tile all the image-units. Now taking into the Second Image , the for-loop angle and length is more difficult to calculate. And I have no idea from my current state. Question Starting from my current thoughts(and code), is there some solutions to extend to some more other-like tiltings patterns drawing. Appendix Here below are four another tilting patterns. Noted that they are no need to be plot in the answer, just to show what I want my pic thoughts to extend to a wider tilting patterns' example result. Edited: Thanks to MS-SPO's comment and I get inspired by that: Right, meeting a 1x1 size was my objective 😉 I have corrected my calculation error, and normalise the replicated unit symbol as "1×1" square as below: \documentclass[border=5pt]{standalone} \usepackage{tkz-euclide} \begin{document} \begin{tikzpicture}[ myunit/.pic={ \def\xx{0.25*sqrt(2)} \def\yy{\fpeval{0.5-0.25*sqrt(2)}} \tkzDefPoints{0/0/O,\xx/\yy/x}% \tkzDefRegPolygon[center,sides=8,name=P](O,x) \tkzDrawPolygon[#1](P1,P...,P8) \tkzDefSquare(P3,P2)\tkzGetPoints{Q2}{Q3} \tkzDrawPolygon[#1](P2,P3,Q3,Q2) \tkzDefSquare(P1,P8)\tkzGetPoints{Q1}{Q8} \tkzDrawPolygon[#1](P1,P8,Q1,Q8) \tkzDefSquare(P7,P6)\tkzGetPoints{Q7}{Q6} \tkzDrawPolygon[#1](P6,P7,Q6,Q7) \tkzDefSquare(P5,P4)\tkzGetPoints{Q4}{Q5} \tkzDrawPolygon[#1](P4,P5,Q5,Q4) } ] \draw[gray] (-1,-1) grid (6,6); \foreach \x in {0,...,5}{ \foreach \y in {0,...,5}{ \pic at (\x,\y) {myunit={magenta,semithick}}; } } \end{tikzpicture} \end{document} which gives:

  • Why is there no expansion of a local let despite using xdef here?
    by INEEDANSWERS on August 19, 2025 at 1:32 pm

    In this example: { \let\oldpar=\par \xdef\par{NEXT UP!\oldpar} } Par 1 Par 2 Par 3 \bye TeX complains that oldpar is not defined. I do not understand why it tries to look for a definition of oldpar in the first place. To my understanding, let assigns the meaning of par to oldpar in the first line; and, in the second line, TeX expands the xdef's replacement text so that it becomes "NEXT UP!" followed by whatever oldpar does (in this case, what par initially does), after which this new definition is linked to par. What causes the error? Is there a way to achieve what I want while keeping oldpar local?

  • What are the exact rules about spaces surrounding macro parameters/arguments?
    by INEEDANSWERS on August 18, 2025 at 7:32 pm

    To my surprise, the TeXbook (page 203) mentions that the first argument in \cs AB {\Look}C${And\$ }{look}\$ 5. where \cs is defined as \def\cs AB#1#2C$#3\$ {#3{ab#1}#1 c##\x #2} is \Look, and not [space], because in this case TeX ignores the blank space after B, and strips the braces off of {\Look} But it doesn't explain why, or in which other cases it would do so, or what the exact rules are. It is mentioned in an earlier paragraph that TeX doesn’t use single spaces as undelimited arguments. but I don't understand what Knuth means by that. What even are undelimited arguments (arguments, not parameters)? What does he mean with "single spaces".

  • tagged pdf math book: best practices
    by Jasper on August 17, 2025 at 9:41 pm

    I want to learn the correct way of writing a tagged math book. Is my current structure sufficient? If not, how can I improve this skeleton? What packages must I sacrifice in the name of tagging? In my actual practise, I have a source file like this: \DocumentMetadata{ pdfstandard = UA-2 ,tagging = on ,lang = en } \documentclass[letterpaper]{book} \usepackage{preamble} \title{Jasper's Book} \author{Jasper} \date{\today} % \includeonly{chapter_4} \begin{document} \frontmatter \input{half-title} \maketitle \input{copyright} \input{dedication} \input{epigraph} \include{preface} \include{notation} \include{acknowledgements} \tableofcontents \listoftables \listoffigures \mainmatter \part{Blah} \include{chapter_1} \include{chapter_2} \include{chapter_4} \part{Blah blah} \include{chapter_5} \include{chapter_6} \include{chapter_7} \part{Blah blah, blah} \include{chapter_8} \include{chapter_9} \include{chapter_10} \include{chapter_11} \part{Blah blah, blah. Blah.} \include{chapter_12} \appendix \include{appendix_1} \include{appendix_2} \include{appendix_3} \backmatter \printbibliography \printindex \end{document} It expands to something like this: \DocumentMetadata{ pdfstandard = UA-2 ,tagging = on ,lang = en } \documentclass[letterpaper]{book} \makeatletter \PassOptionsToPackage{ backend=biber ,style=alphabetic ,sorting=nyt }{biblatex} \PassOptionsToPackage{colorlinks = true}{hyperref} \RequirePackage{ mathtools ,amsthm ,unicode-math ,siunitx ,microtype ,tikz ,booktabs ,tabularx ,enumext ,extarrows ,unicode-math ,subcaption ,nicematrix ,extarrows ,biblatex ,makeidx ,old-arrows ,xpatch ,hyperref } \defaultfontfeatures{Ligatures=TeX,Scale=MatchLowercase} \setmainfont{Libertinus Serif} \setsansfont{Libertinus Sans} \setmonofont{Libertinus Mono} \setmathfont{Libertinus Math} \addbibresource{bibliography.bib} \makeindex \makeatother \title{Jasper's Book} \author{Jasper} \date{\today} % \includeonly{chapter_4} \begin{document} \frontmatter % half-title \clearpage \thispagestyle{empty} \par\vspace*{.35\textheight}{% \centering Jasper's Book \par } \clearpage \thispagestyle{empty} \maketitle % copyright \clearpage \thispagestyle{empty} \par\vspace*{.35\textheight}{% \copyright~2025 Jasper. This work may not be reproduced, distributed, or transmitted in any form or by any means without the prior written permission of the author. } % dedication \clearpage \thispagestyle{empty} \par\vspace*{.35\textheight}{% This book is deticated to the existence of peanut butter. } % epigraph \clearpage \thispagestyle{empty} \par\vspace*{.35\textheight}{% ``I hate Mondays'' ---Garfield } \chapter*{Preface} This book is meant for people who are interested in reading it. \chapter*{Notation} This book is full of notation, which we will not explain. \chapter*{Acknowledgements} \addcontentsline{toc}{chapter}{Acknowledgements} This work was typeset using \TeX{}, the typesetting system created by Donald~E.~Knuth, along with various extensions and packages developed by the \TeX{} community. I am grateful to the vibrant \TeX{} Stack Exchange community for their ongoing support and resources. \par \vspace{2em} \hfill\textit{Jasper} \tableofcontents \listoftables \listoffigures \mainmatter \part{Part 1} \chapter{Chapter 1} \chapter{Chapter 2} \chapter{Chapter 3} \part{Part 2} \chapter{Chapter 4} \chapter{Chapter 5} \chapter{Chapter 6} \appendix \chapter{Appendix 1} \chapter{Appendix 2} \chapter{Appendix 3} \backmatter \printbibliography \printindex \end{document}

  • WARNING: mathml missing for hash 44BC9D542A92714CAC84E01CBBB7FD61 ====>grabbed math=macro:->a
    by Jasper on August 17, 2025 at 8:29 am

    Credit to @Max C for simplifying the mwe: Compiled with latexmk -lualatex \DocumentMetadata{pdfstandard=ua-2, tagging=on, lang=en} \documentclass{book} \usepackage{mathtools, unicode-math} \begin{document} \begin{tabular}{l} \(a\) \end{tabular} \end{document} Package unicode-math Warning: Using \overbracket and \underbracket from (unicode-math) `mathtools' package. (unicode-math) (unicode-math) Use \Uoverbracket and \Uunderbracket for (unicode-math) original `unicode-math' definition. Package unicode-math Warning: I'm going to overwrite the following commands (unicode-math) from the `mathtools' package: (unicode-math) (unicode-math) \dblcolon, \coloneqq, \Coloneqq, \eqqcolon. (unicode-math) (unicode-math) (unicode-math) Note that since I won't overwrite the other (unicode-math) colon-like commands, using them will lead to (unicode-math) inconsistencies. \g__math_luamml_iow=\write3 \openout3 = mwe-luamml-mathml.html Package tagpdf Info: luamml has been enabled and will create an MathML file. WARNING: mathml missing for hash 44BC9D542A92714CAC84E01CBBB7FD61 ====>grabbed math=macro:->a

  • \use:e and \expanded
    by User23456234 on August 17, 2025 at 6:55 am

    Questions: What is the difference between \use:e and \expanded? I don't understand why \use:e has to absorb an argument first before passing it to \expanded. Why isn't \use:e defined to be a copy of \expanded? Wouldn't this be faster and simpler? For reference, source3.pdf defines \use:e as: \cs_gset:Npn \use:e #1 { \tex_expanded:D {#1} }

  • Non-linear transformation of text
    by David Purton on August 16, 2025 at 2:20 pm

    My end goal is to apply a specific wave warp to a short block of text in line with a style guide. Below is my attempt. I've applied the transform to a 4 by 4 grid and it behaves as I want with the sine wave having maximum height in the middle of the grid and reducing until the top and bottom of the grid remain horizontal. The second transform uses the text converted to a path in Inkscape and exported as TikZ code (sorry it's long). This also does what I want. The third example shows what I wish I could do in just putting the text in a node. I know that this is not possible to do this way as the TikZ documentation states: When /tikz/transform shape nonlinear is set to true, TikZ will try to apply any current nonlinear transformation also to nodes. Typically, for the text in nodes this is not possible in general, in such cases a linear approximation of the nonlinear transformation is used. But converting to curves in Inkscape and then applying the transform is a little too manual. I would like a more automated option, so that I can easily change the text and have a new wave output. Question: Is there a way I can do this? It does not have to be using TikZ (but I do want LaTeX). It can use l3draw or lua code. \documentclass{article} \usepackage{tikz} \usepgfmodule{nonlineartransformations} \pagestyle{empty} \makeatletter \def\wavewarp{% \pgf@ya=\pgf@y% \pgfmathsetmacro{\warped@y}{% \pgf@ya+% 0.01*\pgfkeysvalueof{/tikz/wave warp/bend}*% \pgfkeysvalueof{/tikz/wave warp/height}*% sin(\pgf@x/\pgfkeysvalueof{/tikz/wave warp/width}*360)*% sin(\pgf@ya/\pgfkeysvalueof{/tikz/wave warp/height}*180)% }% \pgf@y=\warped@y pt% } \makeatother \newsavebox{\warpbox} \newlength{\warpboxwd} \newlength{\warpboxht} \begin{document} \tikzset{ wave warp/width/.initial=\warpboxwd, wave warp/height/.initial=\warpboxht, wave warp/bend/.initial=10 } \newcommand*{\grid}{\draw (0,0) grid (4,4);} \sbox\warpbox{\tikz{\grid}} \setlength{\warpboxwd}{\wd\warpbox} \setlength{\warpboxht}{\ht\warpbox} \begin{tikzpicture} \begin{scope} \pgftransformnonlinear{\wavewarp} \grid \end{scope} \end{tikzpicture} \vspace{1cm} \tikzset{x=1pt,y=1pt} \newcommand*{\textaspath}{% \fill[shift={(6.6, 8.6)}] (11.8, -8.6) -- (6.0, -8.6) -- (6.0, 8.1) -- (0.8, 8.1) -- (0.8, 12.8) -- (17.0, 12.8) -- (17.0, 8.1) -- (11.8, 8.1) -- cycle(32.8, -8.6) -- (20.1, -8.6) -- (20.1, 12.8) -- (32.8, 12.8) -- (32.8, 8.2) -- (25.9, 8.2) -- (25.9, 4.8) -- (32.3, 4.8) -- (32.3, 0.2) -- (25.9, 0.2) -- (25.9, -3.9) -- (32.8, -3.9) -- cycle(55.9, -8.6) -- (49.2, -8.6) -- (45.0, -1.9) -- (40.9, -8.6) -- (34.3, -8.6) -- (41.4, 2.4) -- (34.7, 12.8) -- (41.2, 12.8) -- (45.0, 6.2) -- (48.7, 12.8) -- (55.3, 12.8) -- (48.6, 1.9) -- cycle(67.7, -8.6) -- (61.9, -8.6) -- (61.9, 8.1) -- (56.7, 8.1) -- (56.7, 12.8) -- (72.9, 12.8) -- (72.9, 8.1) -- (67.7, 8.1) -- cycle(23.7, 44.3) -- (18.4, 22.9) -- (11.5, 22.9) -- (9.5, 32.2) .. controls (9.5, 32.4) and (9.4, 32.7) .. (9.3, 33.1) .. controls (9.2, 33.5) and (9.1, 34.0) .. (9.0, 34.6) .. controls (8.9, 35.1) and (8.8, 35.6) .. (8.8, 36.1) .. controls (8.7, 36.7) and (8.6, 37.1) .. (8.6, 37.5) .. controls (8.5, 37.1) and (8.5, 36.7) .. (8.4, 36.1) .. controls (8.3, 35.6) and (8.2, 35.1) .. (8.1, 34.6) .. controls (8.0, 34.0) and (7.9, 33.5) .. (7.8, 33.1) .. controls (7.7, 32.7) and (7.7, 32.4) .. (7.6, 32.2) -- (5.5, 22.9) -- (-1.3, 22.9) -- (-6.6, 44.3) -- (-1.0, 44.3) -- (1.3, 33.6) .. controls (1.4, 33.3) and (1.5, 32.9) .. (1.6, 32.4) .. controls (1.7, 31.9) and (1.8, 31.4) .. (1.9, 30.9) .. controls (2.0, 30.3) and (2.1, 29.8) .. (2.2, 29.2) .. controls (2.3, 28.7) and (2.4, 28.3) .. (2.4, 27.9) .. controls (2.5, 28.5) and (2.6, 29.2) .. (2.7, 30.0) .. controls (2.8, 30.7) and (3.0, 31.5) .. (3.1, 32.3) .. controls (3.3, 33.1) and (3.5, 33.8) .. (3.6, 34.5) .. controls (3.8, 35.2) and (3.9, 35.8) .. (4.0, 36.2) -- (5.9, 44.3) -- (11.2, 44.3) -- (13.1, 36.2) .. controls (13.2, 35.8) and (13.3, 35.2) .. (13.4, 34.5) .. controls (13.6, 33.8) and (13.8, 33.1) .. (13.9, 32.3) .. controls (14.1, 31.5) and (14.2, 30.7) .. (14.4, 29.9) .. controls (14.5, 29.2) and (14.6, 28.5) .. (14.7, 27.9) .. controls (14.7, 28.4) and (14.8, 29.0) .. (15.0, 29.8) .. controls (15.1, 30.5) and (15.2, 31.2) .. (15.4, 31.9) .. controls (15.5, 32.6) and (15.6, 33.2) .. (15.7, 33.5) -- (18.1, 44.3) -- cycle(38.4, 22.9) -- (37.3, 26.9) -- (30.4, 26.9) -- (29.3, 22.9) -- (22.9, 22.9) -- (29.9, 44.4) -- (37.6, 44.4) -- (44.7, 22.9) -- cycle(35.2, 35.2) .. controls (35.1, 35.5) and (34.9, 36.1) .. (34.8, 36.8) .. controls (34.6, 37.5) and (34.4, 38.2) .. (34.2, 39.0) .. controls (34.0, 39.8) and (33.9, 40.4) .. (33.8, 40.9) .. controls (33.7, 40.4) and (33.6, 39.8) .. (33.4, 39.1) .. controls (33.3, 38.3) and (33.1, 37.6) .. (32.9, 36.9) .. controls (32.7, 36.2) and (32.6, 35.6) .. (32.5, 35.2) -- (31.6, 31.6) -- (36.1, 31.6) -- cycle(64.3, 44.3) -- (57.3, 22.9) -- (50.5, 22.9) -- (43.5, 44.3) -- (50.0, 44.3) -- (52.9, 33.4) .. controls (53.0, 33.0) and (53.1, 32.5) .. (53.3, 31.9) .. controls (53.4, 31.2) and (53.5, 30.6) .. (53.7, 30.0) .. controls (53.8, 29.3) and (53.9, 28.8) .. (53.9, 28.4) .. controls (53.9, 28.8) and (54.0, 29.3) .. (54.1, 29.9) .. controls (54.2, 30.6) and (54.4, 31.2) .. (54.5, 31.8) .. controls (54.6, 32.5) and (54.7, 33.0) .. (54.9, 33.4) -- (57.8, 44.3) -- cycle(79.3, 22.9) -- (66.6, 22.9) -- (66.6, 44.3) -- (79.3, 44.3) -- (79.3, 39.7) -- (72.4, 39.7) -- (72.4, 36.3) -- (78.8, 36.3) -- (78.8, 31.6) -- (72.4, 31.6) -- (72.4, 27.6) -- (79.3, 27.6) -- cycle(9.8, 60.8) .. controls (9.8, 59.7) and (9.5, 58.6) .. (8.9, 57.5) .. controls (8.4, 56.5) and (7.4, 55.7) .. (6.2, 55.0) .. controls (5.0, 54.4) and (3.4, 54.0) .. (1.4, 54.0) .. controls (0.5, 54.0) and (-0.4, 54.1) .. (-1.1, 54.2) .. controls (-1.9, 54.3) and (-2.5, 54.4) .. (-3.2, 54.6) .. controls (-3.8, 54.8) and (-4.5, 55.1) .. (-5.2, 55.4) -- (-5.2, 60.5) .. controls (-4.0, 60.0) and (-2.8, 59.5) .. (-1.7, 59.2) .. controls (-0.5, 58.9) and (0.6, 58.7) .. (1.6, 58.7) .. controls (2.4, 58.7) and (3.0, 58.9) .. (3.4, 59.2) .. controls (3.8, 59.5) and (4.0, 59.9) .. (4.0, 60.3) .. controls (4.0, 60.9) and (3.7, 61.3) .. (3.1, 61.7) .. controls (2.6, 62.0) and (1.6, 62.5) .. (0.2, 63.2) .. controls (-0.9, 63.7) and (-1.8, 64.2) .. (-2.6, 64.7) .. controls (-3.4, 65.3) and (-4.0, 66.0) .. (-4.4, 66.8) .. controls (-4.8, 67.6) and (-5.0, 68.6) .. (-5.0, 69.8) .. controls (-5.0, 71.2) and (-4.7, 72.3) .. (-4.0, 73.2) .. controls (-3.3, 74.2) and (-2.4, 74.9) .. (-1.2, 75.3) .. controls (0.0, 75.8) and (1.5, 76.1) .. (3.1, 76.1) .. controls (4.5, 76.1) and (5.7, 75.9) .. (6.8, 75.6) .. controls (8.0, 75.3) and (9.0, 74.9) .. (9.8, 74.5) -- (8.1, 70.1) .. controls (7.1, 70.5) and (6.2, 70.8) .. (5.3, 71.0) .. controls (4.5, 71.3) and (3.6, 71.4) .. (2.9, 71.4) .. controls (2.1, 71.4) and (1.6, 71.3) .. (1.2, 71.0) .. controls (0.9, 70.8) and (0.7, 70.5) .. (0.7, 70.1) .. controls (0.7, 69.7) and (0.8, 69.4) .. (1.1, 69.2) .. controls (1.4, 68.9) and (1.8, 68.6) .. (2.4, 68.3) .. controls (3.0, 68.0) and (3.9, 67.6) .. (4.9, 67.1) .. controls (6.0, 66.7) and (6.8, 66.1) .. (7.6, 65.6) .. controls (8.3, 65.0) and (8.9, 64.4) .. (9.2, 63.6) .. controls (9.6, 62.9) and (9.8, 62.0) .. (9.8, 60.8) -- cycle(33.2, 65.1) .. controls (33.2, 62.9) and (32.8, 60.9) .. (32.1, 59.3) .. controls (31.4, 57.6) and (30.3, 56.3) .. (28.7, 55.4) .. controls (27.2, 54.5) and (25.2, 54.0) .. (22.8, 54.0) .. controls (20.4, 54.0) and (18.4, 54.5) .. (16.9, 55.4) .. controls (15.3, 56.3) and (14.2, 57.6) .. (13.4, 59.3) .. controls (12.7, 60.9) and (12.4, 62.9) .. (12.4, 65.1) .. controls (12.4, 67.3) and (12.7, 69.3) .. (13.5, 70.9) .. controls (14.2, 72.6) and (15.3, 73.8) .. (16.9, 74.7) .. controls (18.4, 75.6) and (20.4, 76.1) .. (22.8, 76.1) .. controls (25.2, 76.1) and (27.2, 75.6) .. (28.7, 74.7) .. controls (30.3, 73.8) and (31.4, 72.5) .. (32.1, 70.9) .. controls (32.8, 69.2) and (33.2, 67.3) .. (33.2, 65.1) -- cycle(18.4, 65.1) .. controls (18.4, 63.1) and (18.8, 61.6) .. (19.4, 60.5) .. controls (20.1, 59.4) and (21.2, 58.9) .. (22.8, 58.9) .. controls (24.4, 58.9) and (25.5, 59.4) .. (26.1, 60.5) .. controls (26.8, 61.6) and (27.1, 63.1) .. (27.1, 65.1) .. controls (27.1, 67.0) and (26.8, 68.5) .. (26.1, 69.7) .. controls (25.5, 70.8) and (24.4, 71.3) .. (22.8, 71.3) .. controls (21.2, 71.3) and (20.1, 70.8) .. (19.4, 69.7) .. controls (18.8, 68.5) and (18.4, 67.0) .. (18.4, 65.1) -- cycle(46.4, 54.3) -- (42.0, 69.8) -- (41.9, 69.8) .. controls (41.9, 69.4) and (42.0, 68.8) .. (42.0, 68.1) .. controls (42.0, 67.5) and (42.1, 66.7) .. (42.1, 65.9) .. controls (42.2, 65.1) and (42.2, 64.4) .. (42.2, 63.6) -- (42.2, 54.3) -- (37.0, 54.3) -- (37.0, 75.8) -- (44.8, 75.8) -- (49.2, 60.5) -- (49.3, 60.5) -- (53.7, 75.8) -- (61.4, 75.8) -- (61.4, 54.3) -- (56.1, 54.3) -- (56.1, 63.7) .. controls (56.1, 64.4) and (56.1, 65.1) .. (56.2, 65.9) .. controls (56.2, 66.7) and (56.2, 67.4) .. (56.2, 68.1) .. controls (56.3, 68.8) and (56.3, 69.3) .. (56.3, 69.7) -- (56.2, 69.7) -- (51.9, 54.3) -- cycle(78.8, 54.3) -- (66.1, 54.3) -- (66.1, 75.8) -- (78.8, 75.8) -- (78.8, 71.1) -- (71.8, 71.1) -- (71.8, 67.7) -- (78.3, 67.7) -- (78.3, 63.1) -- (71.8, 63.1) -- (71.8, 59.0) -- (78.8, 59.0) -- cycle;} \sbox\warpbox{\tikz{\textaspath}} \setlength{\warpboxwd}{\wd\warpbox} \setlength{\warpboxht}{\ht\warpbox} \begin{tikzpicture} \begin{scope} \pgftransformnonlinear{\wavewarp} \textaspath \end{scope} \end{tikzpicture} \vspace{2cm} \newcommand*{\textastext}{% \node[transform shape, transform shape nonlinear, inner sep=0pt, outer sep=0pt, align=center, font=\sffamily\Huge\bfseries] {% SOME\\ WAVE\\ TEXT};} \sbox\warpbox{\tikz{\textastext}} \setlength{\warpboxwd}{\wd\warpbox} \setlength{\warpboxht}{\ht\warpbox} \begin{tikzpicture} \begin{scope} \pgftransformnonlinear{\wavewarp} \textastext \end{scope} \end{tikzpicture} \end{document}

  • Why does the definition of \newif use a \edef with \noexpand instead of a \def in plain \TeX?
    by Unclechromedome on August 16, 2025 at 2:23 am

    I have been experimenting with the \newif construction in plain \TeX. To keep my experiments from clashing with plain \TeX, I changed the definition slightly to \outer\def\znewif#1{\count255=\escapechar \escapechar=-1 \expandafter\expandafter\expandafter \edef\zif#1{true}{\let\noexpand#1=\noexpand\iftrue}% \expandafter\expandafter\expandafter \edef\zif#1{false}{\let\noexpand#1=\noexpand\iffalse}% \zif#1{false}\escapechar=\count255} % the condition starts out false \def\zif#1#2{\csname\expandafter\ifz\string#1#2\endcsname} {\uccode`1=`i \uccode`2=`f \uppercase{\gdef\ifz12{}}} It seemed to me that \edefs could be changed to \defs if I omitted the \noexpands. I made the changes, as follows, \outer\def\znewif#1{\count255=\escapechar \escapechar=-1 \expandafter\expandafter\expandafter \def\zif#1{true}{\let#1=\iftrue}% \expandafter\expandafter\expandafter \def\zif#1{false}{\let#1=\iffalse}% \zif#1{false}\escapechar=\count255} % the condition starts out false \def\zif#1#2{\csname\expandafter\ifz\string#1#2\endcsname} {\uccode`1=`i \uccode`2=`f \uppercase{\gdef\ifz12{}}} and it worked the same way, and \znewif\ifalpha {\tt\meaning\ifalpha} {\tt\meaning\alphatrue} {\tt\meaning\alphafalse} gives the same output. So why does the definition of \newif use \edef and \noexpand?

  • How to draw this nested heptagon with proper length scale?
    by Explorer on August 15, 2025 at 6:31 pm

    Description: I want to plot this following image: It seemed that both the inner and outer figure are both regular heptagon. Code: Now I give the tried of the below: \documentclass[tikz,border=3pt]{standalone} \usepackage{tkz-euclide} \usetikzlibrary{positioning} \begin{document} \begin{tikzpicture}[line cap=round,scale=2] \tkzDefPoint(0,0){O} \tkzDefPoint(0,0.3*4.25){A}%<- 4.25 here is tuned \tkzDefPoint(0,0.3){B} \tkzDefRegPolygon[center,sides=7,name=P](O,A) \tkzDrawPolygon[semithick](P1,P...,P7) \tkzLabelPoints(P1,P...,P7) \tkzDrawPoints[black](P1,P...,P7) \tkzDefRegPolygon[center,sides=7,name=Q](O,B) \tkzDrawPolygon[semithick,dashed](Q1,Q...,Q7) \tkzLabelPoints(Q1,Q...,Q7) \tkzDrawPoints[black](Q1,Q...,Q7) \draw[magenta] (Q6) -- (P1) -- (Q7); \end{tikzpicture} \end{document} I use \tkzDefRegPolygon to determine it "regular", and I tuned the parameter(for I don't know how many times of lenght |OG'| and |OA|) of 4.25 in code \tkzDefPoint(0,0.3*4.25){A}. The code gives: But... the scale is not similar to the target picture, in my opinion.... this may resulted from the target's heptagon is not perfectly "regular"; or something wrong in my parameter 4.25's tunning.... Question: Claim: My purpose is to "better mimic" the target figure However, with the mwe, the brief lookings is not so similar with the original target, the inner heptagon is too small, which cause the result looks not the same/similar as my target picture. I wonder... How can I make my result more similar to the target(or make inner hepatgon larger)? And meanwhile, is that possible to use mathmaticas calculation to not just tuning the parameter of 4.25(which is not exactly right)?

  • How may Unicode symbols be indexed?
    by Frode Alfson Bjørdal on August 15, 2025 at 5:17 pm

    Confer May imakeidx line up the indexed pages better, and avoid the comma separator?, which constitutes one basis for this question. I have problems with indexing unicode symbols. To understand the complications, consult the following LuaLatex dependent MWE, where the produced index distorts the invoked Unicode symbols which are rendered correctly on pages 2, 4, 5, 7, 8, and 10: \begin{filecontents*}{symbols.mst} item_0 "\n\\symitem{" delim_0 "}{" delim_t "}" \end{filecontents*} \documentclass{article} \usepackage{polyglossia} \usepackage{unicode-math} \setmainlanguage[variant=american]{english} \setotherlanguages{german,russian,greek} \setmainfont{TeX Gyre Termes} \setsansfont{Noto Sans}[Scale=MatchLowercase] \setmonofont{Noto Sans Mono}[Scale=MatchLowercase] \newfontfamily{\cyrillicfont}{Tempora} \newfontfamily{\greekfont}{Tempora} \newfontfamily{\fcyc}{Cyklop}%TO LEARN ABOUT FONTSWITCHER \newfontfamily{\QTBrushStroke}{QTBrushStroke.otf}%Frontpage \newfontface{\poundsignfont}{clarai.otf} %\newfontfamily{\Elegante}{Elegante}%For a decorative text. \setmathfont{texgyretermes-math.otf} \setmathfont{Euler-Math.otf}[range=\symscr] \setmathfont{NewCMMath-Book.otf}[range={cal, bfcal}] \setmathfont{texgyretermes-math.otf}[range=] \newcommand{\libra}{{\poundsignfont\symbol{"2114}}} \usepackage{imakeidx} \makeindex[name=symbols,title=INDEX OF SPECIAL SYMBOLS] \ExplSyntaxOn \NewDocumentCommand{\symitem}{mm} { \makebox[0.5\columnwidth][s] { #1\hfill \int_compare:nTF { \clist_count:n {#2} == 1 } {% only one page number #2 } {% more page numbers \seq_set_from_clist:Nn \l_tmpa_seq {#2} \seq_pop_left:NN \l_tmpa_seq \l_tmpa_tl \tl_use:N \l_tmpa_tl \makebox[0pt][l]{,~\seq_use:Nn \l_tmpa_seq {,~}} } } } \NewDocumentCommand{\symsave}{mo} { \prop_if_in:NnTF \g__fab_sym_prop {#1} {% the item has already been indexed \__fab_sym_add:enn { \prop_item:Nn \g__fab_sym_prop {#1} } {#1} {#2} } {% the item is new \int_gincr:N \g__fab_sym_int \prop_gput:Nne \g__fab_sym_prop {#1} { \int_to_arabic:n \g__fab_sym_int } \__fab_sym_add:enn { \int_to_arabic:n \g__fab_sym_int } {#1} {#2} } } \prop_new:N \g__fab_sym_prop \int_new:N \g__fab_sym_int \cs_new_protected:Nn \__fab_sym_add:nnn { \tl_if_novalue:nTF {#3} {% no formatting argument \index[symbols]{#1@#2} } { \index[symbols]{#1@#2|#3} } } \cs_generate_variant:Nn \__fab_sym_add:nnn {e} \ExplSyntaxOff \begin{document} \symsave{$\land$}$\land$\verb|\symsave{$\land$}| \medskip \symsave{$\lnot$}$\lnot$\verb|\symsave{$\lnot$}| \newpage {\fontspec{Symbola}\symbol{"023B0}}\symsave{{\fontspec{Symbola}\symbol{"023B0}}}\verb|\symsave{{\fontspec{Symbola}\symbol{"023B0}}}| \newpage \symsave{$\land$}[textbf]$\land$\verb|\symsave{$\land$}[textbf]| \medskip \symsave{$\lor$}$\lor$\verb|\symsave{$\lor$}| \medskip \symsave{$\rightarrow$}$\rightarrow$\verb|\symsave{$\rightarrow$}| \medskip \symsave{$\lor$}$\lor$\verb|\symsave{$\lor$}| \medskip \symsave{$\leftrightarrow$}$\leftrightarrow$\verb|\symsave{$\leftrightarrow$}| \newpage {\fontspec{Symbola}\symbol{"027C5}}\symsave{{\fontspec{Symbola}\symbol{"027C5}} }\verb|\symsave{{\fontspec{Symbola}\symbol{"027C5}}}| \newpage {\fontspec{Symbola}\symbol{"02991}}\symsave{{\fontspec{Symbola}\symbol{"02991}}}\verb|\symsave{{\fontspec{Symbola}\symbol{"02991}}}| \newpage \symsave{$\lor$}$\lor$\verb|\symsave{$\lor$}| \medskip \symsave{$\leftrightarrow$}$\leftrightarrow$\verb|\symsave{$\leftrightarrow$}| \medskip \symsave{$\exists$}$\exists$\verb|\symsave{$\exists$}| \medskip \symsave{$\forall$}$\forall$\verb|\symsave{$\forall$}| \medskip \symsave{$\subset$}$\subset$\verb|\symsave{$\subset$}| \medskip \symsave{$\{\;\}$}$\{\;\}$\verb|\symsave{$\{\;\}$}| \newpage {\fontspec{Symbola}\symbol{"02993}}\symsave{{\fontspec{Symbola}\symbol{"02993}}}\verb|\symsave{{\fontspec{Symbola}\symbol{"02993}}}| \newpage {\fontspec{Symbola}\symbol{"02995}}\symsave{{\fontspec{Symbola}\symbol{"02995}}}\verb|\symsave{{\fontspec{Symbola}\symbol{"02995}}}| \newpage \symsave{$\kappa$-tree}$\kappa$-tree\verb|\symsave{$\kappa$-tree}| \medskip \symsave{$\phi^M$}$\phi^M$\verb|\symsave{$\phi^M$}| \medskip \symsave{$\subset$}$\subset$\verb|\symsave{$\subset$}| \medskip \symsave{$\{\;\}$}$\{\;\}$\verb|\symsave{$\{\;\}$}| \medskip \newpage {\fontspec{Symbola}\symbol{"029D8}}\symsave{{\fontspec{Symbola}\symbol{"029D8}}}\verb|\symsave{{\fontspec{Symbola}\symbol{"029D8}}}| \printindex[symbols] \end{document}

  • 3 springs in series tikz
    by Antoine on August 14, 2025 at 12:19 pm

    To illustrate the propagation of longitudinal waves using a spring, I'd like to create a diagram similar to this one. I've already created the following code, but the result isn't very good. % Author: Izaak Neutelings (September 2020) \documentclass[border=3pt,tikz]{standalone} \usepackage{physics} \usepackage{tikz} \usepackage[outline]{contour} % glow around text \usetikzlibrary{patterns,snakes} \usetikzlibrary{arrows.meta} % for arrow size \contourlength{0.4pt} \tikzstyle{ground}=[preaction={fill,top color=black!10,bottom color=black!5,shading angle=20}, fill,pattern=north east lines,draw=none,minimum width=0.3,minimum height=0.6] \tikzstyle{spring}=[line width=0.8,blue!7!black!80,snake=coil,segment amplitude=5,segment length=5,line cap=round] \begin{document} % HORIZONTAL spring \begin{tikzpicture} \def\H{5} % wall height \def\T{0.3} % wall thickness \def\W{10} % ground length \def\D{0.25} % ground depth \def\h{0.6} % mass height \def\w{0.7} % mass width \def\x{1.6} % mass x position \draw[ground] (0,0) |-++ (-\T,\H) |-++ (\T+\W,-\H-\D) -- (\W,0) -- cycle; \draw (0,\H) -- (0,0) -- (\W,0); %Passage à t1 \draw[spring,segment length=6] (0,4) --++ (10,0); \draw[spring,segment length=2.2] (0.75,4) --++ (1,0); %\draw[spring,segment length=4] (1,4) --++ (8,0); %Passage à t2 \draw[spring,segment length=6] (0,3) --++ (10,0); \draw[spring,segment length=2.2] (2.3,3) --++ (1,0); \end{tikzpicture} \end{document} Any ideas on how to improve it?

  • Example of using plugs and sockets
    by yannisl on August 12, 2025 at 2:14 pm

    I have read the the ltsockets.dtx documentation as well as applications of plugs and sockets in the lttagging.dtx and also watched the TUG video. I am struggling to think of examples where the concept can be used in packages or author snippets. I understand the concept was developed, essentially for speed vs templates. Can anyone suggest areas where the concept can be useful with some concrete examples? I am not looking for code, just description of examples.

  • Unexpected kerning after math mode in unicode-math
    by HerpDerpington on August 11, 2025 at 11:35 am

    Without changing anything in the document, including the unicode-math package seems to modify the kerning of letters in math mode or at the boundary between math and regular text. Compare this example \documentclass{article} \usepackage{fontspec} %\usepackage{unicode-math} \begin{document} \noindent Lorem ipsum dolor sit $F$ amet \\ \noindent Lorem ipsum dolor sit $E$ amet \end{document} with both \usepackage{unicode-math} commented in and out. The upper two are with unicode-math (built with lualatex): I do not know if this expected, but I think the upper two look a bit worse, since the math part is not centered between the words. This is especially true for "thinner" letters, such as the F. Can I somehow balance this better? Does unicode-math treat the math part as normal text and use the kerning specifications of the font, such as the italic correction setting? Edit It seems the italics correction can fix this at least partially: \documentclass{article} \usepackage{fontspec} \usepackage{unicode-math} \mathitalicsmode=1 \begin{document} \noindent Lorem ipsum dolor sit~$F\/$~amet \\ \noindent Lorem ipsum dolor sit~$F$~amet \\ \noindent Lorem ipsum dolor sit~$E\/$~amet \\ \noindent Lorem ipsum dolor sit~$E$~amet \\ \end{document} which becomes So I guess an additional question is: Can I automaticall apply the italics correction at the end of every $ ... $? So what happens with punctuation after the closing $? Consider \documentclass{article} \usepackage{fontspec} \usepackage{unicode-math} \mathitalicsmode=1 \begin{document} \noindent Lorem ipsum dolor sit $F$. \\ \noindent Lorem ipsum dolor sit $F\/$. \\ \noindent Lorem ipsum dolor sit \textit{F}. \\ \noindent Lorem ipsum dolor sit F. \\ \end{document} This becomes which, to me at least, seems to be better with the italics correction applied after $F$. Without it, the dot seems to be almost below the F. But to be honest only the \textit option is really optimal here...

  • when is it sensible to use names for expl3 variables with non-spec type suffixes?
    by cfr on August 11, 2025 at 1:02 am

    Snippet from fontspec's documentation: Semi-colon-lists Not a real data structure but sensible to name accordingly. 163 \tl_new:N \g_@@_rawfeatures_sclist 164 \tl_new:N \l_@@_pre_feat_sclist Is it1? If so, when is such naming sensible in general? 1 If the package were not in the LaTeX project's repository, I'd assume the answer was negative. But since it is ....

  • Spacing issues with parentheses in Libertinus
    by B Legrand on August 10, 2025 at 10:19 am

    I am using the Libertinus Math font in its latest OpenType version (7.051) with LuaLaTeX, but I noticed that the spacing around parentheses does not look quite right — characters outside the parentheses appear too close to them. For comparison, I tried the libertinust1math package, which uses the Type 1 version of the font. Here is a side-by-side comparison: OpenType version on the left/above, Type 1 version on the right/below: The Type 1 version seems to have more harmonious spacing. How can I fix this issue when using the OpenType version? The MWE: \documentclass{article} \usepackage{amsmath, unicode-math} \setmathfont{LibertinusMath-Regular} %OTF version % \usepackage{libertinust1math} \begin{document} \begin{gather*} H \Bigl( \frac{a}{2} \Bigr)\\ n \Bigl( \frac{a}{2} \Bigr)\\ f \Bigl( \frac{a}{2} \Bigr)\\ f (x)\\ \end{gather*} \end{document} Edit 1 I have discovered the LuaLaTeX primitives \Umathordopenspacing and \Umathcloseordspacing (which control the spacing before and after a pair of delimiters and an "ord"). In both the OpenType and Type 1 versions of Libertinus Math, these parameters have the default value 0mu, so they are not the source of the difference. However, changing them for the OpenType version like this (for example): \Umathordopenspacing\displaystyle=3mu plus 1mu minus 0.5mu \Umathcloseordspacing\displaystyle=3mu plus 1mu minus 0.5mu seems to fix the problem. My concern is that this change causes other unintended issues, see below the wrong spacing of $f(x)$ for instance: In any case, these parameters alone do not explain why the OpenType and Type 1 versions have different spacing. Edit 2 I found a possibly related passage in the LuaTeX manual (June 2025, p.127): Setting \mathflattenmode=31 changes the spacing when using the OpenType version while the Type 1 version does not show this behaviour. Here is a side-by-side comparison: OpenType version on the left/above, Type 1 version on the right/below: Here is a MWE: \documentclass{article} \usepackage{amsmath, unicode-math} \setmathfont{LibertinusMath-Regular.otf} % \usepackage{libertinust1math} \begin{document} $V \mathbin{\mathbin{v}} V$\par $V \mathord{\mathord{v}} V$\par \mathflattenmode=31 $V \mathbin{\mathbin{v}} V$\par $V \mathord{\mathord{v}} V$\par \end{document}

  • Acccesing non-Unicode glyphs by name with Lua(La)TeX and HarfBuzz
    by Javier Bezos on August 10, 2025 at 8:25 am

    This is a continuation of How to access non-Unicode glyphs from OTFs with Lua(La)TeX?, which solved the problem with the Node renderer, but not for HarfBuzz. Here is the original example slightly modified: \documentclass{article} \usepackage{fontspec} \setmainfont{Shobhika} \begin{document} The BhaRa.dv character code is: \directlua{tex.sprint(luaotfload.aux.slot_of_name(font.current(), [[BhaRa.dv]]))} The BhaRa.dv character is: \directlua{tex.sprint("\\char" .. luaotfload.aux.slot_of_name(font.current(), [[BhaRa.dv]]))} \end{document} It prints: The BhaRa.dv character code is: 983168 The BhaRa.dv character is: भ्र The code point 983168 is in the Supplementary Private Use Area-A. But with: \setmainfont[Renderer=HarfBuzz]{Shobhika} the following error is raised: ! Bad character code (1180580). l.11 ...ot_of_name(font.current(), [[BhaRa.dv]]))} Clearly, the HarfBuzz renderer uses a different strategy to deal with non-Unicode glyphs, because this value is outside the Unicode range (the limit is ~1114000). The ideal solution would be something similar to luaotfload.aux.slot_of_name, but if this is not possible, I wonder if there is a way to force HarfBuzz to map these ‘characters’ to the PUA. Perhaps with a virtual font? Another approach? EDIT. Although the answer by @MarcelKruger is very clever, sadly when validating the PDF it fails with a ‘character encoding’ error. As I explain in a comment, with \XeTeXglyph and also with the Node renderer the result is a valid Unicode string (092D 094D 0930), but with the answer the glyph is shown, indeed, but as a single character which, when copypasted, is the ‘replacement character’ (FFFD) — this is what we usually get with invalid chars. So, I’m going to un-accept it. EDIT 2. Thanks to a comment (@Neith), I’ve discovered it’s an open issue. But I’m still wondering if there is some workaround, since it’s a required feature in some contexts, and after all it’s available in XeTeX and with the Node renderer. EDIT 3. Accepted again. Comments to it (by @KhaledHosny) are very relevant.

  • Color Discrepancy in Figures Between LuaLaTeX and XeLaTeX
    by Kumaresh PS on August 4, 2025 at 2:08 pm

    I am encountering a color inconsistency when rendering the same image mentioned in this link using LuaLaTeX and XeLaTeX. The setup is as follows: Input: \documentclass{article} \usepackage{graphicx} \begin{document} \begin{figure}\includegraphics[trim=1cm 2.5cm 1cm 1cm, clip]{sample.jpg}\end{figure} \end{document} XeLaTeX Output: LuaLaTeX Output: As shown above, the color rendering differs between the two engines. Any insights or solutions to ensure consistency in output would be appreciated.

  • Improving a correspondence
    by Patricio on August 4, 2025 at 1:28 pm

    I have the following code \documentclass[a4paper]{book} \usepackage{amsmath} \usepackage{amssymb} \begin{document} \begin{center} \begin{tabular}{ccccc} $z$ & $\prec$ & $\underbrace{x\sim x'\sim x''}$ & $\prec$ & $y$\\ $\downarrow$ & &$\downarrow$ & &$\downarrow$\\ 6 & $<$ & $\overbrace{12=12=12}$ & $<$ & 21\\ \end{tabular} \end{center} \end{document} that produces the output I believe that the spacing doesn't look good and this is most likely due to my choice of the tabular environment (I've also tried the array environment, but I get the Illegal character in array arg error). How can I improve on my ideas?

  • A icon-symbol for a certified email
    by Sebastiano on August 3, 2025 at 11:45 am

    In Italy, the term PEC (acronym of "Posta Elettronica Certificata" or certified email) is commonly associated with a logo depicting a closed envelope with a ribbon or seal, symbolizing the certified nature of the service. I'm looking for an icon (like a symbol and not an image), using the engine pdfLaTeX, that visually represents this concept. I’ve already checked several packages, including fontawesome7 (available on CTAN but not yet on MiKTeX), lucide-icons, academicons, tablericons, rpgicons, and simpleicons, but haven’t found anything that matches the image I'm looking for. Is there an symbol in any of these packages (or others) that shows an envelope with a ribbon/seal, or something similar that could visually represent the PEC?

  • Underline with siunitx is longer than the number
    by Thev on August 3, 2025 at 7:22 am

    Problem: When underline is used with siunitx, the underline stretches too far, as you can see (Col F). Ideally, it should only underline the number, not the entire space of the cell. MWE: (apologies if it is a little long, I didn't want to omit things and then discover package clashes later) \documentclass[9pt,twoside]{extarticle} \usepackage[sfdefault]{noto} %% noto sans base \usepackage[]{geometry} \geometry{a4paper, top=0.8in, bottom=0.8in, left=0.5in,right=0.5in} % tabular \usepackage{longtable} \usepackage{siunitx} \usepackage{booktabs} % formatting within table \usepackage[normalem]{ulem} \robustify\bfseries \robustify\uline \newrobustcmd\B{\bfseries} \newrobustcmd{\U}[1]{\uline{\tablenum[table-format=6.0]{#1}}} \newrobustcmd{\UB}[1]{\uline{\tablenum[table-format=6.0]{\B#1}}} % siunitx setup \sisetup{ round-mode=places, round-precision=0, group-separator={,}, group-minimum-digits=4, % groups digits by thousands input-ignore={,}, detect-all, detect-weight=true, detect-inline-weight=math, tight-spacing=true, table-number-alignment = right % Align numbers to the right } \begin{document} \renewcommand{\arraystretch}{0.75} \fontsize{8.4pt}{11pt}\selectfont \begin{longtable}{ @{}p{1cm} >{\raggedright\arraybackslash}p{0.8cm} >{\raggedright\arraybackslash}p{5.3cm} >{\centering\arraybackslash}p{1.2cm} S[table-format=11.0] S[table-format=1.0] S[table-format=11.0] S[table-format=6.0] S[table-format=6.0]@{} } \toprule \\[-0.1in] \multicolumn{1}{c}{\textit{Col A}} & \multicolumn{2}{c}{\textit{Col B}} & \multicolumn{1}{c}{\textit{Col C}} & \multicolumn{1}{c}{\textit{Col D}} & \multicolumn{1}{c}{} & \multicolumn{1}{c}{\textit{Col E}} & \multicolumn{2}{c}{\textit{Col F}} \\[0.07in] \multicolumn{1}{c}{} & \multicolumn{2}{c}{} & \multicolumn{1}{c}{\textit{(Items)}} & \multicolumn{1}{c}{\textit{2025}} & \multicolumn{1}{c}{} & \multicolumn{1}{c}{\textit{2026}} & \multicolumn{1}{c}{\textit{2025}} & \multicolumn{1}{c}{\textit{2026}} \\[0.05in] \midrule \\[-0.01in] \multicolumn{1}{c}{} & \multicolumn{2}{c}{} & \multicolumn{1}{c}{} & \multicolumn{1}{c}{\textit{USD}} & \multicolumn{1}{c}{} & \multicolumn{1}{c}{\textit{USD}} & \multicolumn{1}{c}{\phantom{888888}} & \multicolumn{1}{c}{\phantom{888888}} \\ \\ \endhead \endfoot \bfseries 010000 & \multicolumn{2}{p{4cm}}{\smash{\parbox[t]{\linewidth}{\raggedright \bfseries ITEM 1}}} & & 4000000 & & \B 4000000 & & \\*[0.07in] \cline{5-5} \cline{7-7} \\* \vspace{0\baselineskip} & & & 10000 & 2000000 & & \B 2000000 & \U{7000} & \UB{7000} \\* \\* & & & 20000 & 2000000 & & \B 2000000 & & \\* \\* \\ & 010100 & {\smash{\parbox[t]{\linewidth}{\raggedright Sub-Item 1}}} & & 7000000 & & \B 7000000 & & \\*[0.07in] \cline{5-5} \cline{7-7} \\* \vspace{0\baselineskip} & & & 10000 & 700000 & & \B 700000 & 2000 & \B 2000 \\* \\* \\ \\ \cline{5-5} \cline{7-7} \\* \\*[-0.04in] \multicolumn{4}{l}{OVERALL FOR THE YEAR} & 10000000 & & \B 10000000 & \U{7000} & \UB{7000} \\*[0.1in] \cline{5-5} \cline{7-7} \\ \end{longtable} \end{document}

  • Draw rectangles with semi-circular ends in TikZ
    by Mihir Neve on August 1, 2025 at 5:06 pm

    I want to draw the following image via TikZ. I needed some help in drawing one of the tubular shapes (such as the one joining the 3 vertices on the left). I have tried using the node command with rounded rectangles for the horizontal and vertical tubes, for instance with the code suggested in this answer. However, this node fitting doesn't work well for the slanted shapes in the above picture as it returns a squarish rectangle with the two end nodes placed diagonally opposite. My question is effectively as follows: Is there a nice way to make a tubular shape (long rectangle flanked by semicircles on opposite ends) that connects any two fixed nodes (like in the picture above). Thanks!

  • Stereographic projection in latex
    by Octavius on August 1, 2025 at 3:02 pm

    I wanted to generate the following graph: I want to modify the following latex code to obtain my graph \documentclass[tikz,border=10pt]{standalone} \usepackage{tikz} \usepackage{amsmath} \usepackage{tikz-3dplot} \usetikzlibrary{3d, calc} \begin{document} % Ángulo de visualización \tdplotsetmaincoords{60}{120} \begin{tikzpicture}[tdplot_main_coords, scale=3] % Nuevo radio reducido de la esfera \def\radius{0.6} % Ejes coordenados \draw[->, thick] (0,0,0) -- (1.2,0,0); % eje x sin etiqueta \draw[->, thick] (0,0,0) -- (0,0,1.2) node[anchor=south west] {\textcolor{magenta}{$\mathbb{R}^{m+1}$}}; \draw[->, thick] (0,0,0) -- (-0.7,-0.7,0); % eje y negativo para efecto 3D % Plano R^m \fill[cyan!20, opacity=0.3] (-1,-1,0) -- (1,-1,0) -- (1,1,0) -- (-1,1,0) -- cycle; \node at (0.9,-1,0.03) {\textcolor{magenta}{$\mathbb{R}^m$}}; % nueva posición en la esquina izquierda % Esfera más pequeña \shade[ball color=orange!60, opacity=0.8] (0,0,0) circle (\radius); % Líneas de latitud y longitud (esfera decorativa) \foreach \theta in {15,30,...,165} \draw[opacity=0.2] plot[domain=0:360] ({\radius*sin(\theta)*cos(\x)}, {\radius*sin(\theta)*sin(\x)}, {\radius*cos(\theta)}); \foreach \phi in {0,30,...,150} \draw[opacity=0.2] plot[domain=0:180] ({\radius*sin(\x)*cos(\phi)}, {\radius*sin(\x)*sin(\phi)}, {\radius*cos(\x)}); % Punto x sobre la esfera más pequeña \coordinate (x) at (0.3, 0.2, 0.4); \filldraw[blue] (x) circle (0.5pt) node[anchor=west] {\small $x$}; % Punto P (fuera del centro) \coordinate (P) at (-1.3, 0, 0); \filldraw[black] (P) circle (0.5pt) node[anchor=east] {\small $P$}; \draw[dashed] (P) -- (x); % Punto φ(x) \path (x) -- (P) coordinate[pos=1.8] (fx); \filldraw[red] (fx) circle (0.5pt) node[anchor=south] {\small $\varphi(x)$}; \draw[dashed, thick, red!70!black] (x) -- (fx); % Centro \filldraw[black] (0,0,0) circle (0.4pt); \end{tikzpicture} \end{document} I get the following graph: but I want it to be like mine, I hope for some suggestion. Thanks