Hot
- How to prevent auto-capitalization of `author` in biblatex-philosophy?by Alexander Wittmann on February 20, 2026 at 5:44 am
Easy as that. biblatex-philosophy capitalizes all names, including the von-part, though, depending on the language, only some of them should be capitalized, and then, I want to choose it by myself. @Article{DeCampos:Unwritten, author = {de Campos, Rogério G.}, % "de" is to be omitted from sorting, should be wrtten in small letters sortname = {Campos, Rogério G.}, title = {Dotrinas I-don't-know}, langid = {brasilian}, journaltitle = {Peitho}, date = 2022, volume = 13, pages = {185-198}} versus @Article{DiBrasi:Brasilicata, author = {Di Brasi, Brasiliero}, title = {Dottrina Brasiliana}, langid = {italian}, journaltitle = {Brasilicata}, date = 2024, volume = 2, pages = {7-49}}
- Make a distorted circle a circle again, after rescaling in the `axis` environmentby Máté Wierdl on February 20, 2026 at 3:53 am
In the graph below the red "dots" get distorted due to unequal scaling. How can I make them circles again? \documentclass{article} \usepackage{tikz} \usepackage{pgfplots} \pgfplotsset{compat=1.18} \begin{document} \begin{tikzpicture} % Parameter: epsilon \newcommand{\eps}{0.25} % Compute intersection x-values: \pgfmathsetmacro{\xint}{acos(1 - \eps)/360} \begin{axis}[xscale=2/3, yscale=0.4, width=10cm, % chose these to keep axis height=20cm, % from automatically rescaling to a square trig format=rad, domain = -1/2:1/2, axis y line=left, axis x line=bottom, axis line style = {-}, % makes arrow heads disappear; has to come % after "axis y line" and "axis x line" xtick = {-1/2, -\xint, 0, \xint, 1/2}, xticklabels = {$-1/2$, $-\delta$, $0$, $\delta$, $1/2$}, ytick = {-1, 1-\eps, 1}, yticklabels = {$-1$, $1-\epsilon$, $1$}, ] \addplot[smooth] { cos(2*pi*x) }; \draw[dashed] (-0.5, 1 - \eps) -- (0.5, 1 - \eps); \draw[dashed] (-\xint, -1) -- (-\xint, 1 - \eps); \draw[dashed] (\xint, -1) -- (\xint, 1 - \eps); \filldraw[red] (axis cs: -\xint,1 - \eps) circle (0.5cm); \filldraw[red] (axis cs: \xint,1 - \eps) circle (0.5cm); \end{axis} \end{tikzpicture} \end{document}
- What is Tax LaTax [duplicate]by Eseoghene Precious on February 20, 2026 at 3:01 am
I am trying to draw lines around a number of nodes. I very much like the definition of \convexpath definition given here, but it is not working well on my setup (MacTex 2014 with all available updates). I tried to compile Claudio Fiandrino's first solution, but what I get is the following, which is clearly not what I should be getting. Any ideas would be much appreciated.
- Uniform sequences of mathematical dotsby Sebastiano on February 19, 2026 at 10:39 pm
When I need to write a sequence of dots without using TikZ, I often define a simple macro based on \bullet or another symbol that produces two or three dots (which they can be increase and decrease in size). However, I would like to generalize this idea so that I can obtain a sequence of n dots (horizontal, diagonal, vertical). In particular, I would like the solution I define to work well in different mathematical contexts: a sequence of dots arranged horizontally on a line, a vertical sequence for example under a brace or associated with \vdots, and even a diagonal arrangement for something like \ddots. I would also like this sequence of dots to automatically adapt to different math style sizes, meaning it should work properly in \displaystyle, \scriptstyle, \scriptscriptstyle, etc. Ideally, it should be possible to scale the symbols elegantly using packages like scalerel or equivalent techniques, so that the macro can be used in subscripts, superscripts, or expressions of different sizes without visual issues. Another requirement is that these sequences of dots should be able to be grouped in pairs, triplets, quadruplets, etc., and that such groups can be represented under a brace or curly bracket to visually highlight those groupings within the formulas. The goal is to have a parameterized macro that generates an arbitrary sequence of dots with uniform spacing and consistent behavior in various mathematical contexts, simple to use and not dependent on TikZ or other packages. Is there a well-established way to approach this problem? \documentclass{article} \usepackage{mathtools,amssymb} \newcommand{\Dots}[1]{% \mathpunct{\ifnum#1>0 \cdot\fi}% \ifnum#1>1 \mathpunct{\cdot}\fi% \ifnum#1>2 \mathpunct{\cdot}\fi% \ifnum#1>3 \mathpunct{\cdot}\fi% \ifnum#1>4 \mathpunct{\cdot}\fi% \ifnum#1>5 \mathpunct{\cdot}\fi% } \begin{document} $a\Dots{1}b$ $\Dots{2}$ $\Dots{3}$ $\Dots{4}$ $\Dots{6}$ \end{document}
- How to draw a half‑sphere with 5‑degree lines along the x‑axis in TikZ/PGF?by AruGip on February 19, 2026 at 8:40 pm
I found this post and I'm trying to retrieve the version shown in the image below. Does anyone know how I can get that specific version? I've checked the documentation and explored the available properties, but I couldn't find anything that returns the same value shown there. Any ideas on how to achieve this?
- How to comfortably contribute to existing 3rd-party CTAN-available LaTex packages with git repositories, from my local computer?by ldfjglfkgj on February 19, 2026 at 8:29 pm
I have a full TeX Live installation with latest packages. Some packages I use have github or gitlab repositories. Sometimes I write small fixes in my preamble for some packages. I'd like to submit them back to the git repos of the packages, so that they can be merged and released on CTAN, for other to benefit from the fixes. For my own local documents I just git init and commit/push to my private repos, that's easy. But for fixes for \usepackage packages (or classes): should I just go to my /usr/local/texlive/... folder and do a git init in the package folder to be able to push to my personal remote github/gitlab account and open a pull request to the main repository? This doesn't feel right as it pollutes the TeX Live installations. I could copy-paste the whole package somewhere else and include it in my documents (for testing and directly using my changes) - but then I don't use the official version from TeX Live anymore and maybe miss other important releases. And I also have to copy-paste stuff around - uncomfortable, error-prone. How do other people comfortably contribute to 3rd party packages without polluting the local TeX installation or their own documents, and avoiding endless copy-paste situations? Disclaimer: this question is not about how to use git or upload directly to CTAN! I'd like to know how I can comfortably contribute to existing packages that have public git repositories and are maintained by someone on CTAN already.
- libertinus-otf package raising error when used in combination with amssymbby Alf on February 19, 2026 at 4:59 pm
I am using the libertinus-otf package and I prefer compiling with xelatex/lualatex. Using in addition the package amssymb raises an error though. Here is the MWE: % list every file used to standard output \listfiles \documentclass[ 12pt, a4paper, twoside, chapterprefix=true, fleqn, bibliography=totocnumbered]% {scrbook} \usepackage{iftex} \ifpdftex % true if compiling with pdfLaTeX \usepackage[T1]{fontenc} \usepackage{libertine} \else \usepackage{libertinus-otf} \fi \usepackage{amsmath} % <-- this is fine %\usepackage{amssymb} % <-- this is not working \begin{document} bla bla bla \end{document} Compiling with pdflatex is fine, compiling with xelatex/lualatex not when including the amssymb packages. The error message starts as follows: * Using libertinus math * ************************************* ) (/usr/share/texlive/texmf-dist/tex/latex/amsfonts/amssymb.sty (/usr/share/texlive/texmf-dist/tex/latex/amsfonts/amsfonts.sty) ! LaTeX Error: Command `\eth' already defined. and continues with equivalent error messages for \smallsetminus, \digamma, \backepsilon The output of the file list is as follows: scrbook.cls 2023/07/07 v3.41 KOMA-Script document class (book) scrkbase.sty 2023/07/07 v3.41 KOMA-Script package (KOMA-Script-dependent basics and keyval usage) scrbase.sty 2023/07/07 v3.41 KOMA-Script package (KOMA-Script-independent basics and keyval usage) scrlfile.sty 2023/07/07 v3.41 KOMA-Script package (file load hooks) scrlfile-hook.sty 2023/07/07 v3.41 KOMA-Script package (using LaTeX hooks) scrlogo.sty 2023/07/07 v3.41 KOMA-Script package (logo) keyval.sty 2022/05/29 v1.15 key=value parser (DPC) tocbasic.sty 2023/07/07 v3.41 KOMA-Script package (handling toc-files) fleqn.clo 2016/12/29 v1.2b Standard LaTeX option (flush left equations) scrsize12pt.clo 2023/07/07 v3.41 KOMA-Script font size class option (12pt) typearea.sty 2023/07/07 v3.41 KOMA-Script package (type area) iftex.sty 2022/02/03 v1.0f TeX engine tests libertinus-otf.sty 2023/09/21 v. 0.32 (Herbert Voss) Supports libertinus fonts for lualatex and xelatex. ifxetex.sty 2019/10/25 v0.7 ifxetex legacy package. Use iftex instead. ifluatex.sty 2019/10/25 v1.5 ifluatex legacy package. Use iftex instead. xkeyval.sty 2022/06/16 v2.9 package option processing (HA) xkeyval.tex 2014/12/03 v2.7a key=value parser (HA) textcomp.sty 2020/02/02 v2.0n Standard LaTeX package unicode-math.sty 2023/08/13 v0.8r Unicode maths in XeLaTeX and LuaLaTeX expl3.sty 2024-01-22 L3 programming layer (loader) l3backend-luatex.def 2024-01-04 L3 backend support: PDF output (LuaTeX) unicode-math-luatex.sty 2023/08/13 v0.8r Unicode maths in XeLaTeX and LuaLaTeX xparse.sty 2023-10-10 L3 Experimental document command parser l3keys2e.sty 2023-10-10 LaTeX2e option processing using LaTeX3 keys fontspec.sty 2022/01/15 v2.8a Font selection for XeLaTeX and LuaLaTeX fontspec-luatex.sty 2022/01/15 v2.8a Font selection for XeLaTeX and LuaLaTeX fontenc.sty 2021/04/29 v2.0v Standard LaTeX package fontspec.cfg fix-cm.sty 2020/11/24 v1.1t fixes to LaTeX ts1enc.def 2001/06/05 v3.0e (jk/car/fm) Standard LaTeX file amsmath.sty 2023/05/13 v2.17o AMS math features amstext.sty 2021/08/26 v2.01 AMS text amsgen.sty 1999/11/30 v2.0 generic functions amsbsy.sty 1999/11/29 v1.2d Bold Symbols amsopn.sty 2022/04/08 v2.04 operator names lualatex-math.sty 2022/01/01 v1.12 Patches for mathematics typesetting with LuaLaTeX etoolbox.sty 2020/10/05 v2.5k e-TeX tools for LaTeX (JAW) Any ideas how I can successfully include the amssymb package?
- Is it possible to log the contents of a box without changing pdfTeX's return value?by cfr on February 19, 2026 at 4:17 pm
Consider \documentclass{article} \begin{document} \ExplSyntaxOn \tl_set:Nn \l_tmpa_tl {abc} \tl_log:N \l_tmpa_tl \hbox_set:Nn \l_tmpa_box {abc} \box_log:N \l_tmpa_box \ExplSyntaxOff \end{document} This does exactly what I want, except that \box_log:N \l_tmpa_box changes pdfTeX's return value from 0 to 1, whereas compiling \documentclass{article} \begin{document} \ExplSyntaxOn \tl_set:Nn \l_tmpa_tl {abc} \tl_log:N \l_tmpa_tl \hbox_set:Nn \l_tmpa_box {abc} % \box_log:N \l_tmpa_box \ExplSyntaxOff \end{document} returns 0. Is it possible to log the contents of \l_tmpa_box without altering pdfTeX's exit code?
- Create a directed graphby Dimitrios ANAGNOSTOU on February 19, 2026 at 4:15 pm
I want to create the following figure. Using the following code, I managed to get something close. But I cannot figure out how to get properly the diagonal vectors without too much trial and error. Any ideas? Thanks a lot! \documentclass[a4paper,11pt]{article} \usepackage[T1]{fontenc} \usepackage[french]{babel} \usepackage{tikz} \usetikzlibrary{positioning,arrows.meta} \begin{document} \begin{figure}[!htpb] \centering \begin{tikzpicture}[ node distance=3cm, box/.style={draw, rectangle, minimum size=1.2cm, font=\large}, arr/.style={->, >=Stealth, thick} ] % Nodes \node[box] (1) {1}; \node[box, below=of 1] (2) {2}; \node[box, right=of 1] (3) {3}; \node[box, below=of 3] (4) {4}; % Labels n_i \node[above=3mm of 1] {$n_1=3$}; \node[above=3mm of 3] {$n_3=1$}; \node[below=3mm of 2] {$n_2=2$}; \node[below=3mm of 4] {$n_4=2$}; % Horizontal 1 <-> 3 (two parallel arrows) \draw[arr] ([yshift=4pt]1.east) -- ([yshift=4pt]3.west); \draw[arr] ([yshift=-4pt]3.west) -- ([yshift=-4pt]1.east); % Vertical left \draw[arr] (1) -- (2); % Vertical right \draw[arr] (4) -- (3); % Bottom horizontal \draw[arr] (2) -- (4); % Diagonals \draw[arr] (2) -- (3); \draw[arr] ([xshift=-4pt]4.north) -- ([xshift=4pt]1.south); \draw[arr] ([xshift=-4pt]1.south) -- ([xshift=4pt]4.north); \end{tikzpicture} \end{figure} \end{document}
- I am trying to \protected@edef a bmatrix, and then I token.get_macro that token from Lua, so I can print it to the .tex at a later timeby Jasper on February 19, 2026 at 3:25 pm
I am trying to \protected@edef a bmatrix, and then I token.get_macro that token from Lua, so I can print it to the .tex at a later time. The error: WARNING: mathml missing for hash E6607B372B3A7F4DE18DB36E2B449CBD ! You can't use `\spacefactor' in math mode. \@->\spacefactor \@m {} \DocumentMetadata{ lang = en ,pdfversion = 2.0 ,pdfstandard = {UA-2} ,tagging = on } \tagpdfsetup {math/mathml/luamml/load=true} \documentclass{article} \usepackage{luacode,unicode-math,tikz} \begin{document} \makeatletter \protected@edef\COUNTDOOKU{\( \begin{bmatrix} 1 & 2 \\ 3 & 4 \end{bmatrix} \)} \makeatother \begin{tikzpicture} \begin{luacode*} tex.sprint( ("\\node at (0,0) {%s};") :format( token.get_macro("COUNTDOOKU") ) ) \end{luacode*} \end{tikzpicture} \end{document}
- Adjust tabularx with X columns to text widthby cis on February 19, 2026 at 2:22 pm
In the following table, I'm trying to simulate a larger table using the original settings. The p-columns (p1, p2, ..., p7) should be evenly distributed across the remaining text width. So, I've chosen \newcolumntype{Y}{>{\centering\arraybackslash}X} for them. The rest are c-columns. To me, it looks like the table fits within the text width, but I'm still getting Overfull \hbox (1.16014pt too wide). How can I fix this? \documentclass[paper=a5]{scrartcl} \usepackage[margin=14mm, showframe]{geometry} \usepackage{xcolor} \usepackage{diagbox} \usepackage{colortbl} \usepackage{tabularx} \newcolumntype{Y}{>{\centering\arraybackslash}X} \newcolumntype{K}{>{\cellcolor{pink}}c} \newcolumntype{S}{>{\cellcolor{lightgray}}c} \begin{document} \section{Tabularx with overfull hbox} \begingroup \setlength\arrayrulewidth{1pt}% test: correctness of the rules \footnotesize\sffamily % used \noindent% \begin{tabularx}{\textwidth}{c | K | *{7}{Y} | S | l } \hline $n$ & \diagbox{$k$}{$p$} & p1 & p2 & p3 & p4 & p5 & p6 & p7 & \diagbox{$p$}{$k$} \\ \hline 100 & 22 % 3 and 2 digits & 0.1111 % with leading zero & .2222 & .3333 & .4444 & .5555 & .6666 & .7777% without ~ & 22 % 2 digits \end{tabularx} \endgroup \end{document}
- How to create "invisible" endnotes in biblatex-chicagoby PaulTanenbaum on February 19, 2026 at 2:11 pm
As The Chicago Manual of Style, 18th ed. says in paragraph 13.57, In books intended for a general audience, it may be desirable to suppress note numbers in the text. (Numbered notes may be off-putting or distracting for readers unaccustomed to academic texts.) Any notes may then be keyed to the text by page number, usually followed by the word or phrase being annotated. To be clear, in documents prepared in this way the main text includes no indication of any endnote (no superscripts or anything). The practice is the subject of an entry in the CMOS Shop Talk blog. Google tells me that such endnotes are alternatively desribed as "hidden" and as "secret." And Gemini (in the form of Google's "AI Overview") says that they "can be achieved using biblatex-chicago by leveraging specific configuration options and, in some cases, combining them with LaTeX commands." But I've not been able to work out what its further remarks mean, and I suspect that they are, umm, nonresponsive to my actual question. So, is there indeed any way to do this—or at least to approximate it—with biblatex-chicago? Or with other packages? I haven't found anything relevant in The biblatex-chicago package: Style files for biblatex (version 2.3b)
- how to put a character between dollarsby Jordi Pinyol on February 19, 2026 at 12:18 pm
In texmaker how can you put a character (or more) between dollars automatically, just like you can do with emphasis. For example: x=y -> select and execute a command -> $x=y$ a texmaker com es pot posar un caracter (o mes) entre dolars automaticament, igual que es pot fer amb emphasis. Per exemple: x=y -> seleccionem i executem un comandament -> $x=y$
- forcing kerning for italics correction in commandby Stefan Müller on February 19, 2026 at 8:30 am
I wrote a command that puts a string in italics either in math mode or in text mode. I use it for typing "types". They have to be in italics in my theory and so it is not just \textit but the command says something about the content. Now, for some situations my macro has strange effects. While \emphputs a following comma close to the italicized "f", my command does not. Is there a way to achieve this? Edit: The italics should come out as normalfont italics even if the environment is small caps: \textsc{\type{inf}}. \documentclass{scrartcl} \newcommand{\type}[1]{\ifmmode\mathit{#1}\else\textnormal{\textit{#1}}\fi} \begin{document} \noindent \emph{inf},\\ \type{inf}, \end{document}
- Is it possible to implement loop in TikZ like xypic?by YCH817 on February 18, 2026 at 8:54 pm
I have tried plotting loop arrows with different sizes using xypic and tikz : \documentclass{article} \usepackage[a4paper, landscape=true]{geometry} \usepackage{graphicx} % Required for inserting images \usepackage[curve,pdf,all]{xy} \usepackage[svgnames,dvipsnames]{xcolor} \usepackage{tikz} \begin{document} $\begin{xy} (0,0)*+<5pt,3pt>[F-:<3pt>:red][F*:<3pt>:pink]{\vphantom{fg}x}="x", \ar@`{"x"+(-10,+10),"x"+(+10,+10)}^{1} \ar@`{"x"+(-20,+20),"x"+(+20,+20)}^{2} \ar@`{"x"+(-30,+30),"x"+(+30,+30)}^{3} \ar@`{"x"+(-40,+40),"x"+(+40,+40)}^{4} \ar@`{"x"+(-50,+50),"x"+(+50,+50)}^{5} \ar@`{"x"+(-60,+60),"x"+(+60,+60)}^{6} \ar@`{"x"+(+10,-10),"x"+(-10,-10)}^{1} \ar@`{"x"+(+20,-20),"x"+(-20,-20)}^{2} \ar@`{"x"+(+30,-30),"x"+(-30,-30)}^{3} \ar@`{"x"+(+40,-40),"x"+(-40,-40)}^{4} \ar@`{"x"+(+50,-50),"x"+(-50,-50)}^{5} \ar@`{"x"+(+60,-60),"x"+(-60,-60)}^{6} \end{xy}$ % --- \tikz{ \node [ draw, line width=.4pt, rounded corners=5pt, inner sep=3pt ] (x) at (0,0) {$x\vphantom{fg}$}; \foreach \i in {1,2,3,...,6} { \draw[->] (x) .. controls +(-\i,+\i) and +(+\i,+\i) .. (x) ; \draw[->] (x) .. controls +(+\i,-\i) and +(-\i,-\i) .. (x) ; }} \end{document} and here is the output : xypic : tikz : I noticed that the loop curve produced by tikz is a little bit squashed (especially the smallest curve, I think it is quite ugly -_-||), compared to the one produced by xypic. Since I am starting to use LuaLaTeX as compiling engine and I cannot use xypic with pdf option in LuaLaTex, I wonder if there is a good way to make tikz produce loop curves like the one produced by xypic. Also luamplib code is welcome.
- Adjusting the Indentation for Paragraph Style Index Entriesby DDS on February 18, 2026 at 8:44 pm
Consider the code: \documentclass[12pt]{book} \usepackage{imakeidx} \usepackage[itemlayout= singlepar]{idxlayout} \makeindex \begin{document} \Large Some words.\index{Heading@\textbf{Heading}! 1. This is the first index entry.} \newpage Some more words.\index{Heading@\textbf{Heading}! 2. This is the second index entry.} \newpage Some more words.\index{Heading@\textbf{Heading}! 3. This is the third index entry.}\index{Heading@\textbf{Heading}! 4. This is the fourth index entry.} \newpage Some more words.\index{Heading@\textbf{Heading}! 5. This is the fifth index entry.} \idxlayout{columns=1} \printindex \end{document} which produces the Index: QUESTION: How may I make an adjustment (either increase or decrease) to the width of the indent under "Heading"? Thank you.
- Looking for a developer for Newspaper project [closed]by Rich Resnick on February 18, 2026 at 5:11 pm
I’m building a newspaper and am having trouble with Continue plugin and use of multiple flows on a single page template. If there are any experts on this forum that are interested in a consulting engagement, please reach out to me! Thank you!!
- Rotated and not rotated cells in the first table rowby forrest on February 18, 2026 at 4:57 pm
How to make a table with rotated labels in the first row and centered first-row first-column cell content that is not rotated? I found nicematrix package to be the most powerful tool for making tables, therefore I am trying to apply it. There is almost identical case, nevertheless still I can't solve my problem by the rearrangement of the code given in the answer. Code: \documentclass{standalone} \usepackage[utf8]{inputenc} \usepackage[T1]{fontenc} \usepackage{siunitx} \usepackage{makecell} \usepackage{multirow} \usepackage{nicematrix} \usepackage{booktabs} \renewcommand{\arraystretch}{1.3} \begin{document} \newcolumntype{L}[1]{>{\raggedright\let\newline\\\arraybackslash\hspace{0pt}}m{#1}} \newcolumntype{N}{S[table-format=3.0]} \begin{NiceTabular}{L{35mm}NNNNNNN} \toprule \multirow{2}{\linewidth}{\begin{minipage}[c]{\linewidth}\centering Long list of items to be listed in the table\end{minipage}}&&&&&&&\\ & \multicolumn{1}{c}{\rotate{First}} & \multicolumn{1}{c}{\rotate{Second}} & \multicolumn{1}{c}{\rotate{Third}} & \multicolumn{1}{c}{\rotate{\makecell{Fourth is much\\longer}}} & \multicolumn{1}{c}{\rotate{Fifth}} & \multicolumn{1}{c}{\rotate{Sixth}} & \multicolumn{1}{c}{\rotate{\makecell{Seventh is\\the longest item}}}\\ \midrule Description of numbers & 188 & 128 & 229 & 32 & 55 & 22 & 222\\ Very long description of numbers in the table & 765 & 654 & 534 & 34 & 45 & 56 & 67\\ One more row & 1 & 2 & 3 & 4 & 5 & 6 & 7\\ \bottomrule \end{NiceTabular} \end{document}
- Switch option 'headinclude' in KOMA-Script by pagestyleby Igor Yukhimenko on February 18, 2026 at 1:28 pm
In a KOMA document I toggle the headings \KOMAoptions{headinclude=on} \KOMAoptions{DIV=last} It works. But I need to create a custom style where this heading is not taken into account. I can create a style like this, but I don't see a way to specify this in the style parameter \documentclass[11pt, open=right, paper=200mm:136mm,% BCOR=7mm, DIV=14, headinclude=off, footinclude=off]{scrbook} \usepackage{showframe} \AfterCalculatingTypearea{% \setlength{\headsep}{1.2em} } \KOMAoptions{DIV=last} \usepackage{polyglossia} % пакет для української мови \setmainlanguage{ukrainian} \hyphenrules{ukrainian} % ВИПРАВЛЕННЯ ГІФЕНАЦІЇ ДЛЯ УКРАЇНСЬКОЇ \usepackage[final]{microtype} \usepackage{eso-pic} \usepackage[normalem]{ulem} \usepackage{scrlayer-scrpage} \usepackage{tinos} \usepackage[default]{raleway} \author{Ігор Юхименко} \title{Подарунок осені} \makeatletter \let\booktitle\@title \let\bookauthor\@author \makeatother \setsansfont{Raleway} \DeclareNewLayer[% textarea,% contents={% \rule{\textwidth}{1.2pt}% }]{page.chapter.line} \newpagestyle{scrheadchap}{}{} \AddLayersToPageStyle{scrheadchap}{page.chapter.line} \rehead{\bookauthor} \lohead{\booktitle} \RedeclareSectionCommand[ beforeskip = 8em plus 1em minus 0.5em, afterskip = 0.6em minus 0.1em, font = \Large, pagestyle = scrheadchap ]{chapter} %================================================================== % | % BEGIN OF DOCUMENT | % | %================================================================== \begin{document} Осінь. Чудова пора. Вже не відчувається літня спека. Повітря стає чи- стішим та прохолоднішим. в цей час найкраще підбивати підсумки того, що було зроблено за літо. Адже осінь проявляє все, що було зроблено та бу- ло упущено, коли для цього траплялася найкраща нагода — теплі сонячні та ясні літні дні. Як би там не було, але за осінню завжди прийде зима, яка вкриє все снігом. Тепер всі помилки видні як найкраще. Проте, навіть, якщо ти й зробив якусь помилку влітку, це — не страшно. Адже в сучасному суспіль- стві (принаймні мені б хотілося в це вірити) пропасти з голоду практично неможливо. Завжди знайдуться люди які тебе підтримають й допоможуть. І якось більш-менш вдасться дотягнути до весни. А там — вже й до літа не- далеко. І вже однозначно, з’явиться ще одна нагода виправити помилки допущені минулого року. \clearpage \KOMAoptions{headinclude=on} \KOMAoptions{DIV=last} Осінь. Чудова пора. Вже не відчувається літня спека. Повітря стає чи- стішим та прохолоднішим. в цей час найкраще підбивати підсумки того, що було зроблено за літо. Адже осінь проявляє все, що було зроблено та бу- ло упущено, коли для цього траплялася найкраща нагода — теплі сонячні та ясні літні дні. Як би там не було, але за осінню завжди прийде зима, яка вкриє все снігом. Тепер всі помилки видні як найкраще. Проте, навіть, якщо ти й зробив якусь помилку влітку, це — не страшно. Адже в сучасному суспіль- стві (принаймні мені б хотілося в це вірити) пропасти з голоду практично неможливо. Завжди знайдуться люди які тебе підтримають й допоможуть. І якось більш-менш вдасться дотягнути до весни. А там — вже й до літа не- далеко. І вже однозначно, з’явиться ще одна нагода виправити помилки допущені минулого року. \chapter{This page must have "Headinclude=off", as first} Осінь. Чудова пора. Вже не відчувається літня спека. Повітря стає чи- стішим та прохолоднішим. в цей час найкраще підбивати підсумки того, що було зроблено за літо. Адже осінь проявляє все, що було зроблено та бу- ло упущено, коли для цього траплялася найкраща нагода — теплі сонячні та ясні літні дні. Як би там не було, але за осінню завжди прийде зима, яка вкриє все снігом. Тепер всі помилки видні як найкраще. Проте, навіть, якщо ти й зробив якусь помилку влітку, це — не страшно. Адже в сучасному суспіль- стві (принаймні мені б хотілося в це вірити) пропасти з голоду практично неможливо. Завжди знайдуться люди які тебе підтримають й допоможуть. І якось більш-менш вдасться дотягнути до весни. А там — вже й до літа не- далеко. І вже однозначно, з’явиться ще одна нагода виправити помилки допущені минулого року. \clearpage Осінь. Чудова пора. Вже не відчувається літня спека. Повітря стає чи- стішим та прохолоднішим. в цей час найкраще підбивати підсумки того, що було зроблено за літо. Адже осінь проявляє все, що було зроблено та бу- ло упущено, коли для цього траплялася найкраща нагода — теплі сонячні та ясні літні дні. Як би там не було, але за осінню завжди прийде зима, яка вкриє все снігом. Тепер всі помилки видні як найкраще. Проте, навіть, якщо ти й зробив якусь помилку влітку, це — не страшно. Адже в сучасному суспіль- стві (принаймні мені б хотілося в це вірити) пропасти з голоду практично неможливо. Завжди знайдуться люди які тебе підтримають й допоможуть. І якось більш-менш вдасться дотягнути до весни. А там — вже й до літа не- далеко. І вже однозначно, з’явиться ще одна нагода виправити помилки допущені минулого року. \end{document} \newpagestyle{scrheadchap}{\KOMAOption{headinctude=off}}{} takes no effects
- uneven commutative diagramby mappingmoe on February 18, 2026 at 11:33 am
I want to draw the following commutative diagram in LaTeX: I have tried tikzcd, but I think I won't work, since the rows have different size. Is there a clean way to do it? EDIT: my first approach was the following: \documentclass[a4paper]{article} \usepackage{tikz-cd} \begin{document} \begin{tikzcd} P \arrow{l}{pr} \arrow{d}{\pi} & TP \arrow{d}{T \pi}\\ I \arrow{ur}{\tilde{\gamma}} \arrow{r}{\dot{\gamma}} & M \arrow{l}{pr} & TM \end{tikzcd} \end{document}
- How to modify `\lastskip` without inserting `\vskip`?by forrest on February 18, 2026 at 10:52 am
Or is it possible to assign \mylength to \lastskip, e.g. by \setlength{\lastskip}{\mylength}? This is the fourth time I ask this question (the previous one is here How to make a sign separating two fragments of text?), but this time I decided to focus on the first its part only. The goal is to create a macro that puts the asterisk-separator between two consecutive paragraphs. If this separator falls in the neighbourhood of some list (the second page of the attached graphics) then it should establish its surrounding vertical distances (denoted by u and v) the same as in the case of a neighbouring plain paragraph (the first page of the attached graphics). In the code below are 2 macros: \myfancybreak \myfancybreakbeforeenv But the task should be done by one macro \myfancybreak that manages with both above cases. Here (https://tex.stackexchange.com/a/668171) is the answer utilized by creation of this question. Code: \documentclass[11pt,twoside]{memoir} \usepackage[utf8]{inputenc} \usepackage[T1]{fontenc} \usepackage{mathabx} \usepackage{lipsum} \usepackage{graphicx} % output data in log-file \showoutput \showboxdepth=3 \newtoks\realoutput \realoutput\output \output{% \batchmode \showboxbreadth\maxdimen \showboxdepth\maxdimen \showbox255 \the\realoutput } % page setup \setstocksize{115mm}{120mm} \settrimmedsize{115mm}{120mm}{*} \settypeblocksize{95mm}{100mm}{*} \setlrmargins{10mm}{*}{*} \setulmargins{10mm}{*}{*} \setheadfoot{0pt}{0pt} \settypeoutlayoutunit{mm} \checkandfixthelayout \raggedbottom \makeatletter \newenvironment{myquotation}{% \list{}{% {\setlength\leftmargin{\the\leftmargin}% \setlength\rightmargin{0mm}}% \listparindent=\parindent% \parsep=0cm% }% \item\relax\slshape% }{% \endlist%\par\nointerlineskip% } \makeatother \makeatletter \def\@xaddvskipreversed{% based on the standard definition of \@xaddvskip \ifdim\lastskip<\@tempskipb \vskip-\lastskip \vskip\@tempskipb \else \ifdim\@tempskipb<\z@ \ifdim\lastskip<\z@ \else % \advance\@tempskipb\lastskip \vskip-\lastskip \vskip\@tempskipb \fi \else \vskip-\lastskip % added \vskip\@tempskipb % added \fi \fi } \def\addvspacereversed#1{% based on the standard definition of \addvspace, just changed \@xaddvskip -> \@xaddvskipreversed \ifvmode \if@minipage\else \ifdim \lastskip =\z@ \begingroup\setlength\skip@{#1}\vskip\skip@\endgroup% \else \setlength\@tempskipb{#1}% \@xaddvskipreversed \fi \fi \else \@noitemerr \fi } \makeatother \newlength{\myfancybreakbeforelength} \newlength{\myfancybreakafterlength} \setlength{\myfancybreakbeforelength}{1.25\baselineskip} \setlength{\myfancybreakafterlength}{.5\baselineskip} \newcommand{\myfancybreaktext}[1]{{\par\nointerlineskip\addvspacereversed{\myfancybreakbeforelength}\centering #1\par}} \newcommand{\myfancybreak}[1]{% \myfancybreaktext{#1}% distance above the asterisk-separator and the separator itself \addvspace{\myfancybreakafterlength}% distance below the separator \par\nointerlineskip% } \newcommand{\myfancybreakbeforeenv}[1]{% \myfancybreaktext{#1}% distance above the asterisk-separator and the separator itself \addvspace{\glueexpr-\topsep-\parskip-\partopsep+\myfancybreakafterlength\relax}% distance below the separator \vskip 0pt\par\nointerlineskip% } \begin{document} \pagestyle{empty} \section{Distance between fancy anonymous breaks and plain text paragraphs} \lipsum[1][1-3] \myfancybreak{$\ast$Aa}% \lipsum[1][1-3] \newpage \section{Distance between fancy anonymous breaks and quotations/lists} \begin{myquotation}% Some own-defined or standard quotation.% \end{myquotation}% \myfancybreakbeforeenv{$\ast$Aa}% \begin{myquotation}% Some own-defined or standard quotation.% \end{myquotation}% \begin{myquotation}% Some own-defined or standard quotation.% \end{myquotation}\newpage% \end{document}
- Issue attempting "fullwidth" image on documentby Atiroocky on February 18, 2026 at 10:22 am
I'm writting report in "Tufte-style" with scrreprt koma-script class. I'm quite happy with the result, but I cannot figure out how to put a figure in full width of the page. I want to keep using koma-script (instead of tufte-style class) because my document contains numerous formating options. To make the report looking like Tufte-style and avoid some conflicts in the margin section, I use : sidenotesplus (provides fullwidth environment with \begin{figure*}…\end{figure*}) marginfix (to avoid conflicts like overlapping, or shifting out of page in margin) Here is the MWE (I only keep 1/3 of all packages, but the misbehavior keep happening). First remark : Claude suggests me calling the addmarginenvironnement. It works, but that does not solve the root issue. Second remark: I thought of a conflict between koma-scriptand geometrypackages. I tried to disable geometryand setup the typearea and margin dimensions with koma options -> same result with the figure shifting on right. Thanks for your help 😉 \documentclass[% parskip=half, oneside, ]{scrreprt} \usepackage[% a4paper, top=10mm, right=15mm, left=90mm, bottom=10mm, headheight=15mm, includeheadfoot, marginparwidth=7cm, marginparsep=9mm, showframe, ]{geometry} \usepackage[T1]{fontenc} \usepackage{scrlayer-scrpage} \usepackage{marginfix} \usepackage[french]{babel} \usepackage{lipsum} \usepackage{xcolor} \usepackage{graphicx} \usepackage{sidecap} \usepackage{subcaption} \usepackage[% mark=arabic, size=footnote, font=sf, shape= up, per=section, ]{sidenotesplus} \pagestyle{scrheadings} \reversemarginpar \title{Report MWE} \author{Name} \date{February 2026} \begin{document} \newgeometry{ a4paper, top=10mm, right=30mm, left=30mm, bottom=10mm, headheight=15mm, includeheadfoot, } \maketitle \tableofcontents \restoregeometry %------------------------------------------------------------- \pagebreak \chapter{First chapter} \section{Introduction - figure in typearea} \lipsum[1] \begin{figure}[h!] \centering \includegraphics[width=\linewidth]{example-image-a} \caption{Figure in text} \end{figure} \newpage \section{First section - figure in margin} First paragragh with a sidenote.\sidenote{First sidenote of report}\\ \lipsum[1-2] \begin{marginfigure} \centering \includegraphics[width=\linewidth]{example-image-b} \caption{Figure in margin} \end{marginfigure} \begin{marginfigure} \centering \includegraphics[width=\linewidth]{example-image-b} \caption{Figure in margin} \end{marginfigure} \begin{marginfigure} \centering \includegraphics[width=\linewidth]{example-image-b} \caption{Figure in margin} \end{marginfigure} Last paragraph of section.\sidenote{second sidenote of report} \newpage \section{Second section - attempt full width} \lipsum[1] \begin{figure*} \centering \includegraphics[width=\linewidth]{example-image-c} \caption{Figure full width ?} \end{figure*} \newpage \section{Third section - work around with addmargin} \begin{figure}[h!] \centering \begin{addmargin*}[-\dimexpr\marginparwidth+\marginparsep\relax]{0pt} \centering \includegraphics[width=\linewidth]{example-image-c} \caption{Figure full width with workaround addmargin} \end{addmargin*} \end{figure} \end{document}
- What packages are useful for drawing topological surfaces? [closed]by Sean Wakasa on February 18, 2026 at 8:37 am
I'm writing a mathematical paper that studies the fundamental groups of surface bundles, hence I need to create images of surfaces of genus greater than 1 with loops drawn on surface. What packages can I use to make such images? See page 8 of this paper for an example of such a surface.
- Libertine font features missing when compiling with xelatex or lualatexby Alf on February 18, 2026 at 8:21 am
I want to use the libertine package in my fonts, as I prefer them over the standard font. Here is a MWE % list every file used to standard output \listfiles \documentclass[ 12pt, a4paper, twoside, chapterprefix=true, % write "Chapter X" in separate line followed by chapter title fleqn, % equations are left-aligned (instead of centered) bibliography=totocnumbered % give bibliography a chapter number and add to ToC ]{scrbook} % for hyphenation for languages with accented characters (should be before inputenc) \usepackage[T1]{fontenc} % load Libertine (Serif), Biolinum (Sans), and Libertine Mono % must be loaded AFTER fontenc \usepackage{libertine} % <---- CHECK THE COMPILATION WARNING!!!!!!!!!!!!!!!!!!!!!!! % allows you to write Umlaute directly \usepackage[utf8]{inputenc} % load the babel package for the english language \usepackage[english]{babel} \begin{document} bla bla bla \end{document} When I compile with pdflatex I get no error/warning. I prefer to use latexmk though, and when I compile with xelatex or lualatex, I get the following warnings: Package fontspec Warning: OpenType feature 'Numbers=Uppercase' (lnum) not available for font 'LinBiolinum_RB' with script 'CustomDefault' and language 'Default'. Package fontspec Warning: OpenType feature 'Numbers=Uppercase' (lnum) not available for font 'LinBiolinum_RB' with script 'CustomDefault' and language 'Default'. Package fontspec Warning: OpenType feature 'Numbers= Monospaced, Lining' (tnum) not available for font 'LinLibertine_RZI' with script 'CustomDefault' and language 'Default'. Package fontspec Warning: OpenType feature 'Numbers= Monospaced, Lining' (tnum) not available for font 'LinLibertine_RZI' with script 'CustomDefault' and language 'Default'. Package fontspec Warning: OpenType feature 'Numbers=Uppercase' (lnum) not available for font 'LinBiolinum_RB' with script 'CustomDefault' and language 'Default'. Package fontspec Warning: OpenType feature 'Numbers=Uppercase' (lnum) not available for font 'LinBiolinum_RB' with script 'CustomDefault' and language 'Default'. This is the output of *File List*: scrbook.cls 2023/07/07 v3.41 KOMA-Script document class (book) scrkbase.sty 2023/07/07 v3.41 KOMA-Script package (KOMA-Script-dependent basics and keyval usage) scrbase.sty 2023/07/07 v3.41 KOMA-Script package (KOMA-Script-independent b asics and keyval usage) scrlfile.sty 2023/07/07 v3.41 KOMA-Script package (file load hooks) scrlfile-hook.sty 2023/07/07 v3.41 KOMA-Script package (using LaTeX hooks) scrlogo.sty 2023/07/07 v3.41 KOMA-Script package (logo) keyval.sty 2022/05/29 v1.15 key=value parser (DPC) tocbasic.sty 2023/07/07 v3.41 KOMA-Script package (handling toc-files) fleqn.clo 2016/12/29 v1.2b Standard LaTeX option (flush left equations) scrsize12pt.clo 2023/07/07 v3.41 KOMA-Script font size class option (12pt) typearea.sty 2023/07/07 v3.41 KOMA-Script package (type area) fontenc.sty 2021/04/29 v2.0v Standard LaTeX package t1lmr.fd 2015/05/01 v1.6.1 Font defs for Latin Modern libertine.sty 2023/11/26 (Bob Tennent) Supports Libertine and Biolinum fonts for all LaTeX engines. ifxetex.sty 2019/10/25 v0.7 ifxetex legacy package. Use iftex instead. iftex.sty 2022/02/03 v1.0f TeX engine tests ifluatex.sty 2019/10/25 v1.5 ifluatex legacy package. Use iftex instead. xkeyval.sty 2022/06/16 v2.9 package option processing (HA) xkeyval.tex 2014/12/03 v2.7a key=value parser (HA) textcomp.sty 2020/02/02 v2.0n Standard LaTeX package fontspec.sty 2022/01/15 v2.8a Font selection for XeLaTeX and LuaLaTeX xparse.sty 2023-10-10 L3 Experimental document command parser expl3.sty 2024-01-22 L3 programming layer (loader) l3backend-luatex.def 2024-01-04 L3 backend support: PDF output (LuaTeX) fontspec-luatex.sty 2022/01/15 v2.8a Font selection for XeLaTeX and LuaLaTeX fontenc.sty 2021/04/29 v2.0v Standard LaTeX package fontspec.cfg LinLibertine_R.tex LinBiolinum_R.tex LinBiolinum_K.tex LinLibertine_I.tex LKey.tex inputenc.sty 2021/02/14 v1.3d Input encoding file babel.sty 2024/01/07 v24.1 The Babel package english.ldf 2017/06/06 v3.3r English support from the babel system babel-english.tex ts1cmr.fd 2023/04/13 v2.5m Standard LaTeX font definitions Any ideas how to get rid of that warnings, i.e. getting these missing features? Update: as requested, the output at the very end of the compilation, when using lualatex: </usr/share/texlive/texmf-dist/fonts/opentype/public/libertine/LinLibertine_R.otf> I installed the fonts by copying them into ~/.local/share/fonts/ and run fc-cache -f -v afterwards, which I thought should be sufficient - or did I miss a step?
- Making code less scattered when crossing a pagebreak in lstlistingby Danya Zh on February 18, 2026 at 4:11 am
I have a large section of code I want to embed in my pdf via lstlisting and it will not fit on a single page. I want to avoid readers having to jump from page to page when trying to understand a section of code. I believe it would be natural to either Force sections of code to be inseparable like with the samepage environment. I don't know how to implement this solution within lstlisting, and that solution seems awkward anyway (each section of code will have to be individually wrapped within a samepage). Duplicate lines of code that are being broken up. If, for example, the code pagebreaks on line 50, instead of going to line 51 on the next page, the code goes to line 45 again. This way the reader has the small section of code from the last page to hang on to. I believe I have seen this solution be implemented in some college course, but I am not sure if this is conventional or even acceptable. Feedback and implementation suggestions appreciated. Minimal example of a code being broken up by a pagebreak is provided below: \documentclass{article} \usepackage{listings} \usepackage{xcolor} \definecolor{codegreen}{rgb}{0,0.6,0} \definecolor{codegray}{rgb}{0.5,0.5,0.5} \definecolor{codepurple}{rgb}{0.58,0,0.82} \definecolor{backcolour}{rgb}{0.95,0.95,0.92} \lstdefinestyle{mystyle}{ backgroundcolor=\color{backcolour}, commentstyle=\color{codegreen}, keywordstyle=\color{magenta}, numberstyle=\tiny\color{codegray}, stringstyle=\color{codepurple}, basicstyle=\ttfamily\footnotesize, breakatwhitespace=false, breaklines=true, captionpos=t, keepspaces=true, numbers=left, numbersep=5pt, showspaces=false, showstringspaces=false, showtabs=false, tabsize=2 } \lstset{style=mystyle} \begin{document} \begin{lstlisting} [ language=C++, caption= {Code for the second part of BB84 problem. Eve eavesdrops on Alice and Bob.}, label=lst:bb84-pt2] #include <cstdlib> #include <cstdio> #include <ctime> #include <vector> using namespace std; const int SIGNAL_LENGTH = 100; int main(void) { srand(time(NULL)); // Initialize bits, bases, and keys bool alice_bits[SIGNAL_LENGTH]; bool alice_bases[SIGNAL_LENGTH]; bool bob_bits[SIGNAL_LENGTH]; bool bob_bases[SIGNAL_LENGTH]; bool eve_bits[SIGNAL_LENGTH]; bool eve_bases[SIGNAL_LENGTH]; vector<bool> alice_key; vector<bool> bob_key; int key_mismatch_count = 0; // Sending and Recieving Bits for (int i = 0; i < SIGNAL_LENGTH; i++) { alice_bases[i] = rand() % 2; bob_bases[i] = rand() % 2; eve_bases[i] = rand() % 2; alice_bits[i] = rand() % 2; eve_bits[i] = (alice_bases[i] == eve_bases[i]) ? alice_bits[i] : (rand() % 2); bob_bits[i] = (eve_bases[i] == bob_bases[i]) ? eve_bits[i] : (rand() % 2); } // Establishing keys for (int i = 0; i < SIGNAL_LENGTH; i++) { if (alice_bases[i] == bob_bases[i]) { alice_key.push_back(alice_bits[i]); bob_key.push_back(bob_bits[i]); key_mismatch_count += (bob_bits[i] != alice_bits[i]); } } // Comparing keys printf("Key length: %d\n", int(alice_key.size())); printf("\nBob's key: "); for (int i = 0; i < int(bob_key.size()); i++) { printf("%d", int(bob_key[i])); } printf("\nAlice's key: "); for (int i = 0; i < int(alice_key.size()); i++) { printf("%d", int(alice_key[i])); } if (key_mismatch_count == 0) { printf("\nThe keys are the same\n"); } else { float mismatch_percent = 100.0 * key_mismatch_count / int(alice_key.size()); printf("\nThe keys are different,\n"); printf("\nThere are %d mismatches, %.2f%% of the key,\n", key_mismatch_count, mismatch_percent); } return 0; }; \end{lstlisting} \end{document}
- Is there a template resource to validate current practices for PDF tagging complianceby Jeffrey J Weimer on February 18, 2026 at 2:24 am
Summary (TL;DR) Does a reference site exist with an up-to-date template-like file that demonstrates viable and as-yet-invalid practices to assure PDF tagging using DocumentMetaData when also wanting to use common formatting packages? Background I am just starting to assemble resources to prepare a textbook. I hope to generate an electronic PDF version that is, as best possible, fully tagged. In this period of transition with the DocumentMetaData command prefix, I struggle to find resources giving examples of best practices that work within the current developments while offering clear options to upgrade when new compatibilities are added. By reference, I was caught by surprise with the break of the caption package after returning from a holiday break and had to search a while to figure out what had happened. What I believe would help me, and perhaps others as well, is to have a template. The template would illustrate the best practice to set tagged segments in a document while also using external packages to format the "hard copy" display of content from those same segments. My list is not extensive. What are the best practices to assure the highest current standard in tagging compatibility in an electronic PDF generated through LaTeX (LauLaTeX) when formats in the "hard copy" print are also being designed as below. content headers (titlesec) toc objects (titletoc) captions (caption) placing figures (float with [H]) page headers and footers (fancyhdr) bibliographies (natbib) creating \NewDocumentEnvironment content (see below) \usepackage{float} ... \NewDocumentEnvironment{TaggedFigure}{O{1}mmm+b} { \tagstructbegin{tag=Sect} \begin{figure}[H] \centering \includegraphics[width=#1\textwidth,alt={#3}]{#2} \caption{#5} \label{fig:#4} \end{figure} } { \tagstructend } \begin{TaggedFigure} {fig-hypothesistesting} {A flow diagram of the hypothesis testing method} {hypothesistesting} In the hypothesis testing method, we discover ... \end{TaggedFigure} Closing Notes I greatly appreciate the ongoing efforts to incorporate tagging into PDFs generated by LaTeX. With due respect, the technical details mostly go over my head. I'd like to be able to find a reference site that presents the approach as below. Download this template file. It is compliant with tagged PDF to our current best practices. It includes a set of commonly used formatting packages for various components in the document. Run the template file on your LuaLaTeX installation. Check the log output. -> If the log shows that a package is not compliant, your TeX installation is likely at fault (outdated). Test the resulting PDF file for full tag compliance using the approach provided here ... -> If the resulting PDF file is not fully compliant, your LuaLaTeX compilation process is likely at fault. If the template does not include a package that you need, test the package by itself separately. Do these steps ... (e.g. add \usepackage(yourpackage), include one case that must use your required package, compile, review the log output as above, and if the package is reported as compliant re-rerun the PDF tag testing as above). I hope this request is within the guidelines of the forum.
- Generate random, unique, nonzero integersby pwesterbaan on February 17, 2026 at 8:14 pm
I've been writing some commands that I use to randomize writing exam questions. I currently have the following code for generating "variables" containing (possibly non-zero) random integers: \newcommand{\randIntLower}{1} %Lower bound on rand ints \newcommand{\randIntUpper}{5} %Upper bound on rand ints \newcommand{\randIntTemp}{} %Used for defining values in randInts \newcommand{\randInts}[2][]{% % #1 = option (default: []; Use nz for nonzero) % #2 = list of variables % Uses \randIntLower and \randIntUpper as bounds (change with renewcommand if needed) \foreach \var in {#2}{% \ifstrequal{#1}{nz}{% % nonzero method: produces +/- nonzero random integers \pgfmathparse{int(ifthenelse(rand > 0, 1, -1)*random(\randIntLower,\randIntUpper))}% \expandafter\xdef\var{\pgfmathresult}% }{% \pgfmathrandominteger{\randIntTemp}{\randIntLower}{\randIntUpper}% \expandafter\xdef\var{\randIntTemp}% }% }% } This gives me something like this: \randInts[nz]{\randOne,\randTwo,\randThree} %\randOne -> 4 %\randTwo -> -2 %\randThree -> 4 This code works well enough, with the exception that I might get repeat random numbers. I've also been running into some of the limitations of pgfmath, so I'm now trying to rewrite the above using LaTeX3 syntax (hopefully fewer issues with calculations, and optional arguments aren't as positional). My hope is to have something that behaves as such: \randInts[nz]<1>(5){randOne, randTwo, randThree} %\randOne -> 4 %\randTwo -> -2 %\randThree -> 4 \randInts*[nz]<1>(5){randOne, randTwo, randThree} %\randOne -> 4 %\randTwo -> -2 %\randThree -> 6 It grieves me to say this, but I've been trying to write this with the help of Github's CoPilot. I have been reading whatever Latex3 documentation I could find (e.g. xparse, expl3, l3kernel), but for now, this is what I've got: \ExplSyntaxOn% % Flag: whether to generate ±nonzero \bool_new:N \l__randints_nonzero_bool % Parsed bounds \int_new:N \l__randints_min_int \int_new:N \l__randints_max_int \bool_new:N \l__randints_unique_bool \clist_new:N \l__randints_used_clist \int_new:N \l__randints_range_len_int \int_new:N \l__randints_slots_int % \randInts[nz?]<min>(max){name1,name2,...} % - [nz] or [nonzero]: produce ±(magnitude), where magnitude in [min,max] % - <min> and (max) are *separate* optional delimited args; defaults are 1 and 5 % - names are bare (no leading \); defines \name globally to the drawn integer \cs_new_protected:Npn \__randints_pick_unique:nn #1 #2 { \int_set:Nn \l_tmpa_int { \int_rand:nn { #1 } { #2 } } \prg_do_while:nn { \clist_if_in:NnTF \l__randints_used_clist { \int_to_arabic:n { \l_tmpa_int } } { \prg_return_true: }{ \prg_return_false: } } { \int_set:Nn \l_tmpa_int { \int_rand:nn { #1 } { #2 } } } } \cs_new_protected:Npn \__randints_pick_unique_signed:nn #1 #2 { % Loop until we find a nonzero signed value not yet used \int_zero:N \l_tmpa_int \prg_do_while:nn { % pick magnitude \int_set:Nn \l_tmpb_int { \int_rand:nn { #1 } { #2 } } % reject zero magnitude \int_compare:nNnTF { \l_tmpb_int } = { 0 } { \prg_return_true: } { % pick sign and form signed value \int_set:Nn \l_tmpc_int { \int_rand:nn { 0 } { 1 } } \int_set:Nn \l_tmpc_int { \int_eval:n { ( \l_tmpc_int * 2 - 1 ) * \l_tmpb_int } } \clist_if_in:NnTF \l__randints_used_clist { \int_to_arabic:n { \l_tmpc_int } } { \prg_return_true: } { \int_set:Nn \l_tmpa_int { \l_tmpc_int } \prg_return_false: } } } { } } \NewDocumentCommand \randInts { s o D<>{\randIntLower} D(){\randIntUpper} m } { % Determine nonzero mode from [ #2 ] \bool_set_false:N \l__randints_nonzero_bool \IfNoValueF{#2}{ \tl_if_eq:nnT {#2} {nz} { \bool_set_true:N \l__randints_nonzero_bool } } % starred variant -> unique values (no repeats): #1 is boolean from `s` \IfBooleanTF{#1} { \bool_set_true:N \l__randints_unique_bool } { \bool_set_false:N \l__randints_unique_bool } % Normalize order (so <7>(3) becomes [3,7]) \int_set:Nn \l_tmpa_int { \int_min:nn { \l__randints_min_int } { \l__randints_max_int } } \int_set:Nn \l_tmpb_int { \int_max:nn { \l__randints_min_int } { \l__randints_max_int } } \int_set_eq:NN \l__randints_min_int \l_tmpa_int \int_set_eq:NN \l__randints_max_int \l_tmpb_int % If unique requested, check availability and clear used list \int_set:Nn \l__randints_range_len_int { \int_eval:n { \l__randints_max_int - \l__randints_min_int + 1 } } % compute available slots for uniqueness \int_set:Nn \l__randints_slots_int { \l__randints_range_len_int } \bool_if:NTF \l__randints_unique_bool { \bool_if:NTF \l__randints_nonzero_bool { \int_set:Nn \l__randints_slots_int { \int_eval:n { 2 * \l__randints_range_len_int } } \int_compare:nNnT { \l__randints_min_int } <= { 0 } { \int_compare:nNnT { \l__randints_max_int } >= { 0 } { \int_set:Nn \l__randints_slots_int { \int_eval:n { \l__randints_slots_int - 2 } } } } } { \int_set:Nn \l__randints_slots_int { \l__randints_range_len_int } } \int_compare:nNnTF { \clist_count:n {#5} } > { \l__randints_slots_int } { \PackageError{exam}{Not~enough~unique~integers}{Requested~more~unique~integers~than~available~in~range.} } { \clist_clear:N \l__randints_used_clist } } { \clist_clear:N \l__randints_used_clist } % Generate for each bare name and define \name globally \clist_map_inline:nn { #5 } { \bool_if:NTF \l__randints_nonzero_bool { % \pm nonzero: sign * magnitude (support unique/starred) \bool_if:NTF \l__randints_unique_bool { \__randints_pick_unique_signed:nn { \l__randints_min_int } { \l__randints_max_int } \cs_gset:cpn { ##1 } { \int_to_arabic:n { \l_tmpa_int } } \tl_set:Nx \l_tmpa_tl { \int_to_arabic:n { \l_tmpa_int } } \clist_put_right:Nn \l__randints_used_clist { \l_tmpa_tl } } { \cs_gset:cpn { ##1 } { \int_eval:n { ( \int_rand:nn {0}{1} * 2 - 1 ) * \int_rand:nn { \l__randints_min_int } { \l__randints_max_int } } } } } { % Plain integer in [min,max] or unique selection if starred \bool_if:NTF \l__randints_unique_bool { % pick a unique random value via recursion \__randints_pick_unique:nn { \l__randints_min_int } { \l__randints_max_int } \cs_gset:cpn { ##1 } { \int_to_arabic:n { \l_tmpa_int } } \tl_set:Nx \l_tmpa_tl { \int_to_arabic:n { \l_tmpa_int } } \clist_put_right:Nn \l__randints_used_clist { \l_tmpa_tl } } { \cs_gset:cpn { ##1 } { \int_rand:nn { \l__randints_min_int } { \l__randints_max_int } } } } } } \ExplSyntaxOff% The issues I'm running into are that prg_do_while does not actually exist. The other recommendation that Co-Pilot had was to do a recursive call, but this seems like a worse idea. So, my questions are: What is the syntax for the while loop? How should I write this code? Am I over-complicating this whole problem? EDIT Based on @David Carlisle's and @egreg's suggestions, I came up with the following code: \ExplSyntaxOn \NewDocumentCommand \newrandInts { s o D<>{\randIntLower} D(){\randIntUpper} m O{1} }{ % \randInts[nz?]<min>(max){name1,name2,...}[t] % - [nz]: produce pm(magnitude), where magnitude in [min,max] % - <min> and (max) are *separate* optional delimited args; defaults are 1 and 5 % - clist of names; defines \name globally to the drawn integer % - optional randInt multiplier t (defaults to 1) \tl_clear_new:N \l__my_number_tl \seq_clear_new:N \l_numbers_seq \tl_if_eq:nnT {#2} {nz}{ \int_step_inline:nnn {-#4}{-#3} { \seq_put_right:Nn \l_numbers_seq { \fp_eval:n{ ##1 * #6 } } } } \int_step_inline:nnn {#3}{#4} { \seq_put_right:Nn \l_numbers_seq { \fp_eval:n{ ##1 * #6 } } } \seq_shuffle:N \l_numbers_seq \clist_map_inline:nn { #5 } { \IfBooleanTF{#1}{ \seq_pop_left:NN \l_numbers_seq \l__my_number_tl \cs_gset:cpx { ##1 } { \tl_use:N \l__my_number_tl } }{ \cs_gset:cpx { ## 1 } { \seq_rand_item:N \l_numbers_seq } } } } \ExplSyntaxOff I use the code like this: \newrandInts*[nz]{a,b,c,d}[3] \a, \b, \c, \d % prints nonzero random integers between -5 and 5 % multiplied by 3 without repeats: % -3, -9, 3, -6 \newrandInts{a,b,c,d}[0.1] \a, \b, \c, \d % prints random integers between 1 and 5 % multiplied by 0.1 with repeats possible: % 0.3, 0.5, 0.4, 0.1 The multiplication by a scalar was a bit of an afterthought because my current workflow is define random integers, then scale them up.
- Spacing in Tikz Heatmapby itc on February 17, 2026 at 6:09 pm
I am struggling with the vertical space of my tikz heatmap. Specifically, my column labels are getting into the title of my diagram. The same is happening with the legend. I have put the MWE: \documentclass{standalone} \usepackage{tikz} \usetikzlibrary{matrix, positioning, backgrounds} \begin{document} \begin{tikzpicture}[ font=\sffamily, cell/.style={ rectangle, minimum width=2.5cm, minimum height=1cm, draw=white, line width=0.5mm, align=center }, label/.style={ anchor=east, font=\bfseries\small }, header/.style={ anchor=south, rotate=45, font=\bfseries\small, anchor=south west } ] % Define Colors representing the score (Low, Medium, High) \definecolor{scoreLow}{HTML}{F2F2F2} % Weak/Low \definecolor{scoreMed}{HTML}{84B7D6} % Medium/Partial \definecolor{scoreHigh}{HTML}{004C6D} % Strong/High % Legend formatting \matrix [draw=none, anchor=north west] at (-4, 2) { \node [fill=scoreHigh, text=white, minimum width=1cm] {High/Strong}; & \node [anchor=west] {Jddhdhshdhshss}; \\ \node [fill=scoreMed, text=black, minimum width=1cm] {Zprororo}; & \node [anchor=west] {Trump}; \\ \node [fill=scoreLow, text=black, minimum width=1cm] {Hhdueueu}; & \node [anchor=west] {Ghsshshshs}; \\ }; % --- THE DATA MATRIX --- % Row 1: H % High Behavioural Realism [cite: 29], Low Auditability [cite: 81], Low Probability [cite: 78], High Actionability [cite: 40] \node[cell, fill=scoreHigh, text=white] (c11) at (0,0) {High}; \node[cell, fill=scoreLow, text=black] (c12) at (2.5,0) {Low}; \node[cell, fill=scoreLow, text=black] (c13) at (5,0) {Low}; \node[cell, fill=scoreLow, text=black] (c14) at (7.5,0) {Risk}; \node[cell, fill=scoreHigh, text=white] (c15) at (10,0) {High}; % Row 2: A % Low Realism, High Auditability [cite: 82], Med Probability (Rankings) [cite: 109] \node[cell, fill=scoreLow, text=black] (c21) at (0,-1) {Low}; \node[cell, fill=scoreHigh, text=white] (c22) at (2.5,-1) {High}; \node[cell, fill=scoreMed, text=black] (c23) at (5,-1) {Med}; \node[cell, fill=scoreMed, text=black] (c24) at (7.5,-1) {Med}; \node[cell, fill=scoreMed, text=black] (c25) at (10,-1) {Med}; % Row 3: B % Input oriented [cite: 112], Low actionability alone [cite: 113] \node[cell, fill=scoreLow, text=black] (c31) at (0,-2) {Low}; \node[cell, fill=scoreMed, text=black] (c32) at (2.5,-2) {Med}; \node[cell, fill=scoreLow, text=black] (c33) at (5,-2) {Low}; \node[cell, fill=scoreHigh, text=white] (c34) at (7.5,-2) {High}; \node[cell, fill=scoreLow, text=black] (c35) at (10,-2) {Low}; % Row 4: C % Easier to document [cite: 94], Explore plausibility not prob [cite: 93] \node[cell, fill=scoreMed, text=black] (c41) at (0,-3) {Med}; \node[cell, fill=scoreHigh, text=white] (c42) at (2.5,-3) {High}; \node[cell, fill=scoreLow, text=black] (c43) at (5,-3) {Low}; \node[cell, fill=scoreMed, text=black] (c44) at (7.5,-3) {Med}; \node[cell, fill=scoreMed, text=black] (c45) at (10,-3) {Med}; % Row 5: D % Traceability/Coherence [cite: 96], Probabilistic [cite: 95] \node[cell, fill=scoreLow, text=black] (c51) at (0,-4) {Low}; \node[cell, fill=scoreHigh, text=white] (c52) at (2.5,-4) {High}; \node[cell, fill=scoreHigh, text=white] (c53) at (5,-4) {High}; \node[cell, fill=scoreLow, text=black] (c54) at (7.5,-4) {Low}; \node[cell, fill=scoreMed, text=black] (c55) at (10,-4) {Med}; % Row 6: E % Normative/Pathways[cite: 101], High Actionability \node[cell, fill=scoreLow, text=black] (c61) at (0,-5) {Low}; \node[cell, fill=scoreMed, text=black] (c62) at (2.5,-5) {Med}; \node[cell, fill=scoreLow, text=black] (c63) at (5,-5) {Low}; \node[cell, fill=scoreHigh, text=white] (c64) at (7.5,-5) {High}; \node[cell, fill=scoreHigh, text=white] (c65) at (10,-5) {High}; % Row 7: F % Calibration/Monitoring[cite: 133], High Probability, Low Realism \node[cell, fill=scoreLow, text=black] (c71) at (0,-6) {Low}; \node[cell, fill=scoreHigh, text=white] (c72) at (2.5,-6) {High}; \node[cell, fill=scoreHigh, text=white] (c73) at (5,-6) {High}; \node[cell, fill=scoreLow, text=black] (c74) at (7.5,-6) {Low}; \node[cell, fill=scoreMed, text=black] (c75) at (10,-6) {Med}; % Row 8: G % Adversarial[cite: 122], Low Auditability (often anecdotal) \node[cell, fill=scoreHigh, text=white] (c81) at (0,-7) {High}; \node[cell, fill=scoreLow, text=black] (c82) at (2.5,-7) {Low}; \node[cell, fill=scoreLow, text=black] (c83) at (5,-7) {Low}; \node[cell, fill=scoreLow, text=black] (c84) at (7.5,-7) {Low}; \node[cell, fill=scoreMed, text=black] (c85) at (10,-7) {Med}; % --- LABELS --- % Y-Axis Labels (Methods) \node[label] at (-1.5, 0) {H}; \node[label] at (-1.5, -1) {A}; \node[label] at (-1.5, -2) {B}; \node[label] at (-1.5, -3) {C}; \node[label] at (-1.5, -4) {D}; \node[label] at (-1.5, -5) {E}; \node[label] at (-1.5, -6) {F}; \node[label] at (-1.5, -7) {G}; % X-Axis Labels (Attributes) \node[header] at (0, 0.6) {Fuuueueueu djejejejjejejejejej}; \node[header] at (2.5, 0.6) {Ldhdhdhdd hdhdjddjdjdjdjeieeieiidjd}; \node[header] at (5, 0.6) {LLwhwuquahsajqjqjqjqjqqjssjsj}; \node[header] at (7.5, 0.6) {Kahhwuwuwuddeeicdjsjwjw}; \node[header] at (10, 0.6) {KKsiwiwiwiwyduweueeuee}; % Title \node[anchor=center, font=\bfseries\Large] at (3.5, 3.5) {Xfhfhhe jeeieiei nddjewoo djwiwoxdk msaaakkkwifjfjf}; \node[anchor=center, font=\small, text width=12cm, align=center] at (3.5, 2.8) {Xomtive fhfru dieieo difiwwi dkdfjdkwo ksksskskw.\\ \textit{Fsw7w8 ddijej doofoe cdirirfv iiroflvw dkoeowoxk dfeke.}}; \end{tikzpicture} \end{document} I have attached the screenshot as well:
- Listingsutf8 (plus a JSON preset) Accents moved at start of words (avéré => ééavr)by pikachuyann on February 17, 2026 at 4:15 pm
I am trying to represent a JSON in my document which for documentation purpose has french descriptions inside of strings (which I would like to keep here as the "placeholders" they are). But I don't exactly understand how the string coloring works in listings(utf8) and it seems to move all the accents to the beginning of their words, which isn't ideal. Here's a "minimal" "working" example \documentclass[11pt]{article} \usepackage[utf8]{inputenc} \usepackage[T1]{fontenc} \usepackage{xcolor} \usepackage{listingsutf8} \lstset{ inputencoding=utf8, extendedchars=\true, showstringspaces=false, } % The code for JSON is copied from https://gist.github.com/ed-cooper/1927af4ccac39b083440d436d018d253 % obviously I don't understand it fully, and the documentation of listings says absolutely nothing about how coloration of strings work (which is the problem here) \definecolor{jsondelim}{RGB}{20,105,176} \definecolor{jsonnumb}{RGB}{106, 109, 32} \definecolor{jsonstring}{rgb}{0.64,0.08,0.08} \lstdefinelanguage{json}{ numbers=left, numberstyle=\small, frame=single, rulecolor=\color{black}, showspaces=false, showtabs=false, breaklines=true, postbreak=\raisebox{0ex}[0ex][0ex]{\ensuremath{\color{gray}\hookrightarrow\space}}, breakatwhitespace=true, basicstyle=\ttfamily\small, upquote=true, morestring=[b]", stringstyle=\color{jsonstring}, literate= *{0}{{{\color{jsonnumb}0}}}{1} {1}{{{\color{jsonnumb}1}}}{1} {2}{{{\color{jsonnumb}2}}}{1} {3}{{{\color{jsonnumb}3}}}{1} {4}{{{\color{jsonnumb}4}}}{1} {5}{{{\color{jsonnumb}5}}}{1} {6}{{{\color{jsonnumb}6}}}{1} {7}{{{\color{jsonnumb}7}}}{1} {8}{{{\color{jsonnumb}8}}}{1} {9}{{{\color{jsonnumb}9}}}{1} {\{}{{{\color{jsondelim}{\{}}}}{1} {\}}{{{\color{jsondelim}{\}}}}}{1} {[}{{{\color{jsondelim}{[}}}}{1} {]}{{{\color{jsondelim}{]}}}}{1} } % --- end of copied json \begin{document} \begin{lstlisting}[language=JSON] "A string with accents - Du texte accentué - Note that accents move to the beginning of a word - Le déplacement des accents est avéré" \end{lstlisting} \end{document} It displays the string somewhat properly (in "red"), except the accents are (a) in front of their respective words (b) in black : Do any one have experienced this and has got ideas ?
- Baseline, sub- and superscripts and vertical centering in math-modeby Tapedeck Ghost on February 17, 2026 at 2:13 pm
See my edits below Subscripts are meant to be typeset below the baseline. However in math-mode LaTeX simply ignores this by default and supposes that a symbol like X_i should be centered vertically as a whole. Here is an example of what I mean: Evidently only the X should be centered and the subscript should be ignored when aligning. Why this isn't the default behaviour is beyond me (indeed, in text-mode writing $X_i$ does not raise the letter X above the baseline, because that would be equally nonsensical). Is there any way to make this a default behaviour without declaring new operators or using \raisebox every single time? Edit: As per request, here is the code: \documentclass{article} \begin{document} \[ \prod_{i\in I} X_i \quad \sum_{i\in I} X_i \] \end{document} Second Edit: In light of the fact that I was simply wrong to assume the behaviour I describe above, I've accepted @David Carlisle's answer. I add an example of what I wish to achieve: produced by the following code: \documentclass{article} \begin{document} \[ \textrm{this:}\quad \raisebox{-.07em}{$X=$}\prod_{i\in I} \raisebox{-.07em}{$X_i$} \quad \textrm{and not:} \quad X=\prod_{i\in I} X_i \] \end{document} The difference is subtle, but noticeable. Notice that the space above and below the X_i is roughly equal in the desired example. To the disbelief of @David Carlisle that any typographer of a published text would proceed in such a way , I add two examples, from Munkres, Topology, p. 38 and from Bourbaki, General Topology I p. 88, 🙂 It is not my intention to put the bottom of \sum and \prod on the baseline, but just to refute the claim that it is never done, here is an example from the french version of Bourbaki's Topologie Generale, Chapter I, page 73 🙂