• lualatex writing strange things into ~/.texlive
    by user2609605 on February 23, 2026 at 10:30 pm

    I installed texlive with the following profile TEXDIR /usr/local/texlive/2025 TEXMFCONFIG ~/.texlive2025/texmf-config TEXMFHOME ~/texmf TEXMFLOCAL /usr/local/texlive/2025/texmf-local TEXMFSYSCONFIG /usr/local/texlive/2025/texmf-config TEXMFSYSVAR /usr/local/texlive/2025/texmf-var TEXMFVAR ~/.texlive2025/texmf-var # platforms TBD: configure with new setting based on instTexliverc and local plattform binary_aarch64-linux 0 binary_amd64-freebsd 0 binary_amd64-netbsd 0 binary_armhf-linux 0 binary_i386-freebsd 0 binary_i386-linux 0 binary_i386-netbsd 0 binary_i386-solaris 0 binary_universal-darwin 0 binary_windows 1 binary_x86_64-cygwin 0 binary_x86_64-darwinlegacy 0 binary_x86_64-linux 1 binary_x86_64-linuxmusl 0 binary_x86_64-solaris 0 # OPTIONs: Maximal Performance & Stability # installation option s instopt_adjustpath 0 instopt_adjustrepo 1 # default instopt_letter 0 # TBD: must be tied to $PAPER instopt_portable 1 instopt_write18_restricted 1 # TBD: must be tied to new setting # turned options into tlpdbopt tlpdbopt_autobackup 0 #tlpdbopt_backupdir tlpkg/backups # not needed because tlpdbopt_autobackup 0 tlpdbopt_create_formats 1 tlpdbopt_desktop_integration 0 tlpdbopt_file_assocs 0 tlpdbopt_generate_updmap 0 # doubt tlpdbopt_install_docfiles 1 # TBD: make configurable tlpdbopt_install_srcfiles 1 # TBD: make configurable #tlpdbopt_location https://ftp.math.utah.edu/pub/tex/historic/systems/texlive # TBD: configure tlpdbopt_post_code 1 tlpdbopt_sys_bin /usr/local/bin # unused because of instopt_adjustpath 0? tlpdbopt_sys_info /usr/local/share/info # unused because of instopt_adjustpath 0? tlpdbopt_sys_man /usr/local/share/man # unused because of instopt_adjustpath 0? tlpdbopt_w32_multi_user 0 This profile is just based on the one written back on some older installation and adapted. I want to focus on the variables in particular TEXMFVAR ~/.texlive2025/texmf-var The first observation is, that ~/.texlive2025 seems unused, i.e. does not show up but lualatex writes ~/.texlive. If I erase it reappears. I wonder whether my setting is ignored. Since I have in parallel release 2024 and 2025 I would like to keep separated. If I understand the settings in the profile right, this is done, but reality differs: all is written into one folder, namely ~/.texlive. If I have a look inside, some strange files show up: ~/.texlive/texmf-var/luatex-cache/generic/names/luaotfload-names.lua.gz gunzipping unveils: ... ["/usr/share/fonts/truetype/luxisri.ttf"]={ ["index"]={ [false]=458, }, ["timestamp"]=1770577183, }, ["/usr/share/fonts/xscreensaver/OCRA.ttf"]={ ["index"]={ [false]=180, }, ["timestamp"]=1763843231, }, ... which means that lualatex scans my system fonts. This is not a nice observation because I want to make my texlive reproducible. How can I prevent this problem??? Next bad ovservation: ~/.texlive/texmf-var/luamplib_cache/luamplib_input_F4_05someMetapost_mp I am sure this is from luamplib and the name is that of a specific figure in some (Chapter 4, Figure 5) so part of my document leaks into my home folder. Also very bad but not as bad as the above problem, because I can just avoid luamplib. Last problem: TEXMFHOME ~/texmf does not show up, but I am worried what this is for and what kind of information is stored there and I fear also mixing up several releases of texlive.

  • Formatting a sequence of items with comma and ending with 'and' or 'respectively'
    by mf67 on February 23, 2026 at 10:02 pm

    Can someone help me create a macro like \MyList{A;B;C;D;E;F} which returns “A, B, C, D, E[,] respectively F" independently on how many ”arguments” (2+) that are specified and also support math, e.g. \MyList{\(A\);\(B\);\(C\);\(D\);\(E\);\(F\)} ? (I used the [,] notation since I’m not sure if the Oxford comma is used today.) If the number of arguments is two; \MyList{A;B} I would like it to return “A respectively B”. Edit: I tried using sinuitx but it might not be suitable for this task as it mainly(?) handles numbers. Here is a test \documentclass{article} \usepackage{siunitx} \begin{document} \numlist[parse-numbers=false]{A;2;3} \numlist[parse-numbers=false]{\text{A};2;3} \numlist[parse-numbers=false]{\(A+B\);2;3} \end{document} but it gives an error on the last line and I would like to have ”roman letters” if no ”math mode” is used, and avoid using \text{}.

  • Is there a resource that goes through (La)TeX fonts, gives them a pairing, and a description?
    by Barnabas on February 23, 2026 at 8:52 pm

    Is there a resource that goes through (La)TeX fonts, gives them a pairing, and a description? I asking, which fonts like serif for body text, and sans serif for headers and stuff complement each other; and fonts good for long reading like a book? To be clear: it would pair Serif fonts with Sans Serif fonts, specifically ones that are shipped with TeX Live and MiKTeX. I think this would be very handy for everybody, especially people who do not know which fonts to use for the headings and which ones for their body text. With type families that have matching faces (Serif, Sans Serif, Monospaced,etc) is easy, e.g., Latin Modern, Kp-Fonts, etc. The amount of pairings is just baffling, and you searched the web for TeX font pairings and came up with nothing. 🙂 Hopefully, this question doesn't violate any rules, and I don't think I need a MWE?

  • tabular: add lines until the end of the text body is reached
    by cis on February 23, 2026 at 12:56 pm

    Can I configure this loop, or a similar loop, to add rows until the end of the text body is reached? A small gap at the end will probably be unavoidable. Could this be achieved with \pdfpos? \documentclass[a5paper]{article} \usepackage[margin=14mm, showframe=true, paperheight=126mm, ]{geometry} \newcounter{mycount} \setcounter{mycount}{0} \def\mylines{}% \loop\ifnum\themycount<7% \addtocounter{mycount}{1} \expandafter\def\expandafter\mylines\expandafter{% \mylines & & \themycount \\ }% \repeat% \begin{document} \section{Table} \begin{tabular}{| c c | c|} \hline \multicolumn{3}{|c|}{Something} \\ \hline A & B & (My Head) \\ \hline a & b & n\\ a & b & n\\ a & b & n\\ \mylines \hline A & B & (My Foot)\\ \hline \end{tabular} \end{document}

  • Controlling Subsection Visibility in LaTeX Table of Contents
    by Aimar on February 23, 2026 at 10:43 am

    I am using the amsart document class in LaTeX. I would like the table of contents to display all sections while including only a single, specific subsection. All other subsections should remain numbered and visible in the document, but should not appear in the table of contents. \documentclass{amsart} \usepackage{hyperref} \begin{document} \title{title} \author{Author Name} \maketitle \tableofcontents \section{First Section} \subsection*{This subsection should NOT appear in the TOC} \subsection{This subsection SHOULD appear in the TOC} \section{Second Section} \subsection*{Another subsection NOT in the TOC} \end{document}

  • wrong citation format
    by Faith on February 23, 2026 at 9:48 am

    My problem ist that when I try to cite e.g. \textcite{zotero-item-155} it appears as "AG Boden, (2024)" in the text instead of "AG Boden (2024)". And When I do (\cite{BlumeLehrbuchBodenkunde10}) it appears as "(Blume et al. 2010)" instead of "(Blume et al., 2010)". When I do \parencite{liuLandUseDependent2018} it also appears as "(Liu et al. 2018)" in the text. My preamble looks like this: \documentclass[a4paper,12pt]{article} \usepackage[backend=biber, style=apa]{biblatex} %\addbibresource{Literatur.bib} % not available \addbibresource{biblatex-examples.bib} % \usepackage{anyfontsize} % \usepackage{makecell} % \usepackage{setspace} % \fontsize{13pt}{19.5pt}\selectfont % \onehalfspacing % \usepackage{booktabs} % \usepackage{xcolor} % \usepackage{csquotes} % \usepackage{circuitikz} % \usepackage{ragged2e} % \usepackage[most]{tcolorbox} \usepackage[ngerman]{babel} % \usepackage{mathptmx} \usepackage[T1]{fontenc} % \usepackage{graphicx} %\usepackage{amsfonts} %\usepackage{amssymb} % \usepackage{caption} % \usepackage{placeins} % \usepackage{subcaption} % \usepackage{float} % \usepackage{amsmath} % \captionsetup[table]{justification=raggedright, singlelinecheck=false} % \captionsetup[figure]{labelformat=mylabel, format=plain, singlelinecheck=false, justification=raggedright} % \usepackage{tocloft} % \setlength{\bibitemsep}{1.5\baselineskip} % \usepackage{hyperref} % \hypersetup{ % colorlinks=false, % pdfborder={0 0 0} % } % \usepackage[a4paper, left=3cm, right=3cm, top=2cm, bottom=2cm]{geometry} \DefineBibliographyStrings{ngerman}{% andothers = {et al.}, } % \renewcommand\thefigure{\arabic{figure}} % \DeclareCaptionLabelFormat{mylabel}{Abbildung #2} \DeclareDelimFormat*{nameyeardelim}{\addcomma\space} \DeclareDelimFormat[bib]{andothersdelim}{\addcomma\space} \DeclareLanguageMapping{ngerman}{ngerman-apa} \begin{document} Textcite one author: \textcite{glashow} Regular cite more authors: \cite{yoon} Parencite more authors: \parencite{herrmann} \printbibliography \end{document}

  • How to draw arc segments of circular quiver diagram elegant with tikz?
    by Explorer on February 23, 2026 at 9:23 am

    Claim This post is more likely asking for better approach, focused on the arc's plot. And that is similar to, but I don't find the same one: Drawing cyclic quiver Drawing a circular graph using xypic https://tex.stackexchange.com/a/759710/322482 Descrption I found that just with: \draw[<->,shortstyle,violet] (\ang:\RR cm) arc[radius=\RR cm,start angle=\ang,delta angle=\deltaang]; The arc is not exactly centered at (0,0)(the violet part), thus I learnt from here and calculate the \deltaangg with cosline rule manually. Code \documentclass[tikz,border=5pt]{standalone} \usetikzlibrary{arrows.meta} \begin{document} \def\NN{5} \def\RR{5} \def\rr{0.5} \def\deltaang{\fpeval{360/\NN}} \def\deltaangg{\fpeval{acosd((2*\RR^2-\rr^2)/(2*\RR^2))}} % cosine rule \begin{tikzpicture}[ thick,>=Stealth,shortstyle/.style={shorten >=\rr cm,shorten <=\rr cm}] \foreach \i in {1,...,\NN}{ \def\ang{\fpeval{\deltaang*(\i-1)}} \path[draw,fill=gray!75] (\ang:\RR cm) circle[radius=\rr cm]; \def\startang{\fpeval{\ang+\deltaangg}} \def\endang{\fpeval{\ang+\deltaang-\deltaangg}} %%%%%%%%%%%%%% \draw[<->,shortstyle,violet] (\ang:\RR cm) arc[radius=\RR cm,start angle=\ang,delta angle=\deltaang]; %%%%%%%%%%%%%% % https://tex.stackexchange.com/a/66265/322482 \draw[<->,magenta] ([{shift=(\startang:\RR cm)}]0,0) arc[radius=\RR cm,start angle=\startang,end angle=\endang]; \foreach[parse=true] \j in {2,...,{\NN-2}}{ \def\nextang{\fpeval{\ang+\deltaang*\j}} \draw[shortstyle,<->] (\ang:\RR cm) -- (\nextang:\RR cm); } } \end{tikzpicture} \end{document} Question The magenta arcs is what I want, but I found it too hard to calculate \def\deltaangg{\fpeval{acosd((2*\RR^2-\rr^2)/(2*\RR^2))}}. Any suggestions on the code?

  • Setting pages of an index entry with an specific font
    by Knudsen on February 23, 2026 at 6:24 am

    I have always used \documentclass{article} \usepackage{fontspec} \setmainfont{Times New Roman} \newfontfamily\semibold[Ligatures={TeX, Common}]{Times LT Std Semibold} \usepackage{imakeidx} \makeindex[program=texindy, options=-L english -C utf8, title=Index] \begin{document} Some text\index{Important Topic|textbf}. Some text\index{Not Important Topic}. \printindex \end{document} to be processed with xelatex -shell-escape main.tex, which sets the page of the entry in boldface using the standard font used by \textbf{}. How can I set the page in a particular (semibold) font? Or, for that matter, any other font?

  • Text above horizontal arrow in longtblr / tblr with minimal vertical spacing
    by GJW on February 23, 2026 at 12:40 am

    I would like text to be above a horizontal arrow in longtblr, with the following constraints longtblr package Define start and stop points of arrow relative to column borders - i.e. enable the table is dynamic if width of columns change Minimal space between arrow bar and the text Text in column A centred between rows 2 and 3 A screen grab of the desired outcome is attached. Here is a minimal example illustrating what I currently have: \documentclass{article} \usepackage{tabularray} \usepackage{tikz} \usetikzlibrary{calc} \begin{document} \begin{longtblr}{ colspec={|c|c|c|}, vlines, hlines, row{3} = {ht=0pt}, % arrow row height } % --- First row --- A & B & C \\ % --- SECOND row: merge columns 2 and 3 --- 1 & \SetCell{c=2} 2 & \\ % --- Arrow row (thin) --- & \SetCell{cmd=\tikz[remember picture]\node (Bstart) {};} & \SetCell{cmd=\tikz[remember picture]\node (Cend) {};} \\ \end{longtblr} % --- Draw the arrow --- \begin{tikzpicture}[overlay, remember picture] \draw[red, thick, <->] ($(Bstart.west)+(-\pgflinewidth/2,0)$) -- ($(Cend.east)+(\pgflinewidth/2,0)$); \end{tikzpicture} \end{document}

  • Vsplit : Why loses vsplit the eveness of columns? [closed]
    by MBE on February 23, 2026 at 12:06 am

    I cannot build a real MWE. I post a working example. Just imagine, the rows were whole pages (\vsize) I have a file with ca. 100 pages, two columns. I vsplit one big single box into 200 and ship them out. All works well, so far. But, in some cases or on some pages,the top lines are not even, and the bottomlines aren't as well. I tried starting all the boxes with a \hbox, without success. Does someone have an idea? \parindent=0pt \hsize=150mm \setbox20=\vtop{\hsize0.4\hsize Lorem ipsum dolor sit amet, consectetuer adipiscing elit. Ut purus elit, vestibulum ut, placerat ac, adipiscing vitae, felis. Curabitur dictum gravida mauris. Nam arcu libero, nonummy eget, consectetuer id, vulputate a, magna. Donec vehicula augue eu neque. Pellentesque habitant morbi tristique senectus et netus et malesuada fames ac turpis egestas. Mauris ut leo. Cras viverra metus rhoncus sem. Nulla et lectus vestibulum urna fringilla ultrices. Phasellus eu tellus sit amet tortor gravida placerat. Integer sapien est, iaculis in, pretium quis, viverra ac, nunc. Lorem ipsum dolor sit amet, consectetuer adipiscing elit. Ut purus elit, vestibulum ut, placerat ac, adipiscing vitae, felis. Curabitur dictum gravida mauris. Nam arcu libero, nonummy eget, consectetuer id, vulputate a, magna. Donec vehicula augue eu neque. Pellentesque habitant morbi tristique senectus et netus et malesuada fames ac turpis egestas. Mauris ut leo. Cras viverra metus rhoncus sem. Nulla et lectus vestibulum urna fringilla ultrices. Phasellus eu tellus sit amet tortor gravida placerat. Integer sapien est, iaculis in, pretium quis, viverra ac, nunc. .} \newdimen\splitheight \splitheight=0.12\vsize \newcount\start \newcount\stop \start=21 \stop=31 \loop \ifnum\start<\stop \setbox\the\start=\vsplit20 to \splitheight{} \advance\start by 1 \repeat \start=21 \stop=31 \loop \ifnum\start<\stop \hskip1pt \copy\the\start \hskip20pt\copy\the\start \break\hskip10pt%\hskip10pt \advance\start by 1 \repeat \bye

  • texlive profile: how to specify the scheme?
    by user2609605 on February 22, 2026 at 9:53 pm

    I tried to install texlive from a profile... I just adapted the profile written after some installation and this works quite well -- except two details: This is the modified scheme that works: # Scheme: not recognized #selected_scheme scheme-small # paths, recommended to set all of them # TBD: configure $ROOT/$YEAR TEXDIR /usr/local/texlive/2025 # TBD: configure ~/.texlive$YEAR/texmf-config, find a solution TEXMFCONFIG ~/.texlive2025/texmf-config # TBD: find a solution TEXMFHOME ~/texmf # TBD: configure $ROOT/$YEAR/texmf-local TEXMFLOCAL /usr/local/texlive/2025/texmf-local # TBD: configure $ROOT/$YEAR/texmf-config TEXMFSYSCONFIG /usr/local/texlive/2025/texmf-config # TBD: configure $ROOT/$YEAR/texmf-var TEXMFSYSVAR /usr/local/texlive/2025/texmf-var # TBD: configure ~/.texlive$YEAR/texmf-var, find a solution TEXMFVAR ~/.texlive2025/texmf-var # platforms TBD: configure with new setting based on instTexliverc and local plattform binary_aarch64-linux 0 binary_amd64-freebsd 0 binary_amd64-netbsd 0 binary_armhf-linux 0 instopt_adjustpath 0 instopt_adjustrepo 1 instopt_letter 0 instopt_portable 1 instopt_write18_restricted 1 #instopt_location https://mirror.ctan.org/systems/texlive/tlnet ... #tlpdbopt_location https://mirror.ctan.org/systems/texlive/tlnet tlpdbopt_autobackup 0 #tlpdbopt_backupdir tlpkg/backups # not needed because tlpdbopt_autobackup 0 tlpdbopt_create_formats 1 tlpdbopt_desktop_integration 0 ... In two respects I could not put all pieces of information into the profile: The selected_scheme scheme-small is not recognized. I tried some variants, but without success. So as you see in the listing above, I commented out selected_scheme scheme-small and substituted by an option as shown below. Likewise I could not enter the repository into the profile. First the written profile did not contain any information on that. In tlpkg/TeXLive/TLCOnfig.pm some settings are specified, quite nice, seems to be the repository url, but again it is not recognized: "location" => [ "u", "__MASTER__", "repository", "Default package repository" ], but trying to add location to the profile did not work and again i substitute with an option for the installer. Now I install with a mixture between profile and other options: ./install-tl -repository "$repo" \ -scheme "$SCHEME" \ -profile "../texlive$YEAR.profile" This seems to work, but I think it is against the intention of the developers. I tried to explain better.

  • Wrong links in \hyperref
    by Alex Degtyarev on February 22, 2026 at 9:01 pm

    Sorry everyone. I just did an update, which was probably a mistake, and encountered another problem with hyperref. For years I've been using a workaround which I borrowed from a journal, and it worked. Well, I understand that this is an undocumented feature, but there seems (seemed?) to be no other way to have everything numbered consecutively. Here's a minimal example: \documentclass{amsart} \usepackage{hyperref} \newtheorem{theorem}{Theorem}[section] \makeatletter \let\c@equation\c@theorem \let\theequation\thetheorem \makeatother \begin{document} \section{1} \begin{equation} a=b\label{1} \end{equation} \newpage \section{2} \begin{equation} c=d\label{2} \end{equation} \newpage \eqref1 \eqref2 \end{document} Both links lead to eqn. 1.1, and the log reports multiple anchors with the same name. What would the new hack be? Or is there a documented way now to have all theorems, lemmas, ... and equations numbered consecutively within sections and, at the same time, have \autoref work correctly?

  • I don't get how to make vertical space between a \paragraph{} and a simple line
    by Lucord on February 22, 2026 at 8:58 pm

    this is my first LaTeX question and I'm really exited about it 😀 Jokes apart I'm just asking how to make vertical space between a paragraph and a simple new line. I tried to use "\\", but it doesn't work, it gives me "There's no line here to end." to the line where i m writing. 7) "/paragra{}" 8) \\ 9) x And at the line 9 gives me that error. Any idea?

  • Multiple images stacked with a single caption, no extra vertical space
    by palloc on February 22, 2026 at 7:53 pm

    I'm trying to create a LaTeX document where I have several images stacked vertically, with no extra vertical space between them, and only one caption for all images (appearing under the last image). The problem is that each \IMG creates a separate figure, so each image gets its own caption and there’s extra vertical space between images. What I want: Multiple images stacked vertically with no extra vertical space. Only one caption for all images (appearing under the last one). Allow overlays on the images (x, y, text). This is how it should look like: The code what I got from taiwan12 with little modification (link: https://tex.stackexchange.com/a/760076/287423) : \documentclass{report} \usepackage{graphicx} \usepackage{float} \usepackage{xcolor} \usepackage{xparse} \ExplSyntaxOn % variables \tl_new:N \l_taiwanxii_image_tl \tl_new:N \l_taiwanxii_caption_tl \tl_new:N \l_taiwanxii_shortcaption_tl \tl_new:N \l_taiwanxii_label_tl \tl_new:N \l_taiwanxii_pos_tl \fp_new:N \l_taiwanxii_scale_fp \fp_new:N \l_taiwanxii_overlayscale_fp \clist_new:N \l_taiwanxii_x_clist \clist_new:N \l_taiwanxii_y_clist \clist_new:N \l_taiwanxii_text_clist % keys \keys_define:nn { taiwanxii } { image .tl_set:N = \l_taiwanxii_image_tl, caption .tl_set:N = \l_taiwanxii_caption_tl, shortcaption .tl_set:N = \l_taiwanxii_shortcaption_tl, label .tl_set:N = \l_taiwanxii_label_tl, pos .tl_set:N = \l_taiwanxii_pos_tl, scale .fp_set:N = \l_taiwanxii_scale_fp, overlayscale .fp_set:N = \l_taiwanxii_overlayscale_fp, x .clist_set:N = \l_taiwanxii_x_clist, y .clist_set:N = \l_taiwanxii_y_clist, text .clist_set:N = \l_taiwanxii_text_clist, } \NewDocumentCommand{\IMG}{m} { % reset \tl_clear:N \l_taiwanxii_image_tl \tl_clear:N \l_taiwanxii_caption_tl \tl_clear:N \l_taiwanxii_shortcaption_tl \tl_clear:N \l_taiwanxii_label_tl \tl_clear:N \l_taiwanxii_pos_tl \tl_clear:N \l_taiwanxii_pos_tl \clist_clear:N \l_taiwanxii_x_clist \clist_clear:N \l_taiwanxii_y_clist \clist_clear:N \l_taiwanxii_text_clist \tl_set:Nn \l_taiwanxii_pos_tl {H} \fp_set:Nn \l_taiwanxii_scale_fp {1} \fp_set:Nn \l_taiwanxii_overlayscale_fp {1} \keys_set:nn { taiwanxii } { #1 } % shortcaption \tl_if_empty:NT \l_taiwanxii_shortcaption_tl { \tl_set_eq:NN \l_taiwanxii_shortcaption_tl \l_taiwanxii_caption_tl } \use:e { \exp_not:N \begin{figure}[\l_taiwanxii_pos_tl] } \centering \sbox0{\includegraphics[scale=\fp_use:N \l_taiwanxii_scale_fp]{\l_taiwanxii_image_tl}} \usebox0 \int_zero:N \l_tmpa_int \clist_map_inline:Nn \l_taiwanxii_x_clist { \int_incr:N \l_tmpa_int \tl_set:Nn \l_tmpa_tl {##1} \tl_set:Nx \l_tmpb_tl { \clist_item:Nn \l_taiwanxii_y_clist { \int_use:N \l_tmpa_int } } \tl_set:Nx \l_tmpc_tl { \clist_item:Nn \l_taiwanxii_text_clist { \int_use:N \l_tmpa_int } } \rlap{ \hspace{\dimexpr \l_tmpa_tl\wd0-\wd0\relax} \raisebox{\dimexpr \ht0-\l_tmpb_tl\ht0\relax}{ \makebox[0pt][l]{ \raisebox{-\height}{ \scalebox{\fp_use:N \l_taiwanxii_overlayscale_fp}{ \fcolorbox{black}{white}{ \shortstack[c]{\l_tmpc_tl} } } } } } } } \caption[\l_taiwanxii_shortcaption_tl]{\l_taiwanxii_caption_tl} \label{fig:\l_taiwanxii_label_tl} \end{figure} } \ExplSyntaxOff \begin{document} \listoffigures \IMG{ image = example-image, caption = Caption I, shortcaption = Caption, label = figA, pos = H, scale = 0.6, x = {0.0,0.5,0.2,0.7,0.8}, y = {0.0,0.2,0.3,0.65,0.9}, text = {AA\\BB,AABB,A,B,C}, overlayscale = 0.75, } \IMG{ image = example-image, caption = Caption II, shortcaption = Caption, label = figB, pos = H, scale = 0.6, x = {0.2,0.5}, y = {0.2,0.3}, text = {AABB,A}, overlayscale = 1, } \end{document}

  • glossaries: No error or warning for undefined user-entries
    by Wolfi on February 22, 2026 at 6:40 pm

    On using the glossaries package, I am also making use of the user... entries. When referencing one of these user... entries there is no error or warning generated, even when a user entry is referenced which wasn't defined. Such references simply and quietly expand to nothing. Is there any possibility to get an error or warning when an undefined user... entry is referenced in the document? Here is a MWE: \documentclass{article} \usepackage[utf8]{inputenc} \usepackage{glossaries} \makeglossaries \newglossaryentry{symb:one} { name={\ensuremath{a}}, user1={\ensuremath{b}}, description={Description of symbol one} } \begin{document} Reference to \verb|\gls{symb:one}|: -\gls{symb:one}-\\ Reference to \verb|\glsuseri{symb:one}|: -\glsuseri{symb:one}-\\ Reference to \verb|\glsuserii{symb:one}|: -\glsuserii{symb:one}- % no error or warning generated here, % although user2 is not defined \printglossaries \end{document}

  • verse environment that checks if the verse is numbered and has a title
    by user1850133 on February 22, 2026 at 5:11 pm

    I need a verse environment that for each verse, checks if there is a heading line and a number at the end and puts them with a special formatting if it finds. Of course not forgetting to dump that verse too. And if the verse does not have either the header or the number or both, skip this task. In the past I once asked for a verse environment that automatically numbers the verses. (Environment honouring newlines and add stuff before empty lines). I want that your solution is based on that one there that i validated. Don't use fontsize as it is creating a problem (though subtle). Here a header is starting with > and takes the entire line as the header. This header must be put bold in the document. The number at the end of the verse is always the last character in its line and preceded by "||" and any white-spaces. Latex must dump the verse up to the "||" and" puts the number this way 1 || 2 || 3 || after the verse's "||". \documentclass[a4paper]{article} \usepackage{fancyhdr} \setlength{\parindent}{0pt} \fancyhead[C]{lipsum text (dummy text)} \begin{document} lipsum text \\ (dummy text) \begin{myenv} Laborum molestias nam possimus omnis. Libero sit maiores quas asperiores nobis est nulla. Culpa sequi iste deserunt. ||1 Adipisci fuga et quis dicta est et odit. Illo aut nulla qui incidunt necessitatibus nulla qui. Sunt cumque voluptatem quasi quam ||2 >the peacock says ... % this is the "heading line" commodi culpa quaerat sunt. Debitis accusantium et porro et libero nulla ut est. Asperiores sed exercitationem aut. Ex sapiente ||3 >the elephant says Debitis nobis fugiat doloremque voluptates enim ratione. Unde || % not numbered, this one magni beatae magni. Unde voluptatum qui odio corporis quia. ||4 \end{myenv} \end{document}

  • Image with multiple white boxes and text/letters
    by palloc on February 22, 2026 at 4:56 pm

    I have found the following question: Extend custom \IMG macro: add percentage-based overlay label (white box + letter) at (x%, y%) with separate scale I want exactly the same, but with more options: Multiple text boxes, so having two different text boxes should be feasible Multi-line support, so not just single-line, e.g., A\\B should work I also want to use \keys_define Previous question: I have a basic macro that inserts a figure with \includegraphics, caption, and label: \documentclass{report} \usepackage{graphicx} \usepackage{float} \newcommand{\IMG}[4]{ \begin{figure}[H] \centering \includegraphics[scale=#1]{#2} \caption{#3} \label{fig:#4} \end{figure} } \begin{document} \IMG{0.5}{example-image}{Caption}{figA} \IMG{0.6}{example-image}{Caption}{figB} \end{document} I want to extend it so I can overlay a letter inside a white square with a black border on top of the image, with the position given in percentages of the image size, and with a separate scale that affects only the overlay (box + letter), not the image. Desired call syntax: \IMG{imgscale}{filename}{caption}{label}{y}{x}{letter}{overlayscale} Where: imgscale is passed to \includegraphics[scale=...] (scales the image) y and x are relative coordinates inside the image (fractions / percentages of the image size): (y=0, x=0) corresponds to the top-left corner of the image y increases downward (south) x increases to the right (east) e.g. y=0.10 means 10% from the top, x=0.05 means 5% from the left letter is something like A, B, etc. (only one letter) overlayscale scales only the overlay (white square + letter), not the image the letter should be centered inside the square Example usage I want: \IMG{0.5}{example-image}{Caption}{figA}{0.10}{0.05}{A}{1.2} This should place a small white square (black border) near the top-left, at 5% from the left and 10% from the top, and put the letter A inside it. I’m open to tikz, overpic, etc., as long as the coordinates are relative to the image (not the page). Ideally the overlay moves correctly when the image scale changes. It should look like this: Maybe the best answer: \documentclass{report} \usepackage{graphicx} \usepackage{float} \usepackage{color} \newcommand{\IMG}[7]{% don't forget % at EOL \begin{figure}[H] \centering \sbox0{\includegraphics[scale=#1]{#2}}% \usebox{0}% \rlap{\hspace{-#5\wd0}{\raisebox{#6\ht0}{\llap{\fcolorbox{black}{white}{#7}}}}}% \caption{#3} \label{fig:#4} \end{figure}% } \begin{document} \IMG{0.5}{example-image}{Caption}{figA}{.1}{.2}{A} \IMG{0.6}{example-image}{Caption}{figB}{.3}{.3}{B} \end{document} just measures the scaled image, then uses \hspace and \raisebox to move the box.

  • Usage of the `\lastskip` as a flag
    by forrest on February 22, 2026 at 10:48 am

    I would like to modify the value of \lastskip inside the macro that serves for putting asterisk between two consecutive parts of text. This \lastskip value should be detected, if present, by the other macro - one intended for typesetting quotes. To check if an asterisk separator is directly above the quote, it seems necessary to use \lastskip as a "flag" containing this information. If the "flag" is set to some chosen unique value, the macro creating the quote adjusts the space above it (the space separating the quote from the asterisk) to match the default space between the asterisk separator and the plain text below. In other words the distances marked by v in the picture should be the same. In the code below the line to be fixed is marked. It is inspired by @David Carlisle answer. \documentclass[11pt,twoside]{memoir} \usepackage[T1]{fontenc} % 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 \newlength{\myfancybreakbeforelength} \newlength{\myfancybreakafterlength} \setlength{\myfancybreakbeforelength}{1.25\baselineskip} \setlength{\myfancybreakafterlength}{.5\baselineskip} \newdimen\uniquedim \uniquedim=10000pt \newenvironment{myquotation}{% \list{}{% {\setlength\leftmargin{\the\leftmargin}% \setlength\rightmargin{0mm}}% \listparindent=\parindent% \parsep=0cm% }% \item\relax\slshape% \ifdim\lastskip=\uniquedim % check if immediately above is asterisk-separator \addvspace{\glueexpr-\topsep-\parskip-\partopsep\relax}% eliminating vskip before the current list environment if the fancy break is just preceding \fi }{% \endlist%\par\nointerlineskip% } \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 % macro generating asterisk-separator %\newskip\lastskip \newcommand{\myfancybreak}[1]{% {\par\nointerlineskip\addvspacereversed{\myfancybreakbeforelength}\centering #1\par}% distance above the asterisk-separator and the separator itself \addvspace{\myfancybreakafterlength}% distance below the separator \vskip 0pt% \leavevmode\lastskip=\uniquedim% FIXME - setting the "flag" to be recognized by myquotation environment \par\nointerlineskip% } \begin{document} \pagestyle{empty} \section{Distance between fancy anonymous breaks and plain text paragraphs} Lorem ipsum dolor sit amet, consectetuer adipiscing elit. Ut purus elit, vestibulum ut, placerat ac, adipiscing vitae, felis. Curabitur dictum gravida mauris. \myfancybreak{$\ast$Aa}% Lorem ipsum dolor sit amet, consectetuer adipiscing elit. Ut purus elit, vestibulum ut, placerat ac, adipiscing vitae, felis. Curabitur dictum gravida mauris. \newpage \section{Distance between fancy anonymous breaks and quotations/lists} \begin{myquotation}% Some own-defined or standard quotation.% \end{myquotation}% \myfancybreak{$\ast$Aa}% \begin{myquotation}% Some own-defined or standard quotation.% \end{myquotation}% \begin{myquotation}% Some own-defined or standard quotation.% \end{myquotation} \end{document}

  • Opinions on \renewcommand\[{\begin{equation}} [closed]
    by M0M0 on February 22, 2026 at 10:36 am

    Let's assume we are writing a report in a field where commonly all equations are numbered. So far I always used \begin{equation}...\end{equation} which, of course, works fine. I now noted that LyX (which I don't use myself) suggests \renewcommand\[{\begin{equation}} \renewcommand\]{\end{equation}} as a workaround to number all equations. In the case of LyX this seems to be done since it automatically inserts \[ and \] to typeset display math. However, this kept me wondering, if this is actually ... a good thing? One of the key ideas of LaTeX is to separate content from formatting. I would now argue that consequently numbering all equations is a (debatable) formatting choice. Wouldn't it then be the LaTeX-y way to use the build in display math \[ for all non-referenced equations and a only use \begin{equation} for referenced/labeld equations? This way one can decide in the preamble/class which style is used. \documentclass{article} \renewcommand\[{\begin{equation}} \renewcommand\]{\end{equation}} \begin{document} A less important equation (that we also do not refer to), if numbered or not is a stylistic choice: \[ f(x) = x^2 \] To the explicitly numbered equation~\ref{eq:1} we will refer to in the document \begin{equation} a^2 + b^2 = c^2 \label{eq:1} \end{equation} \end{document}

  • Setting an OpenType MATH kern for a particular stylistic set glyph
    by Apoorv Potnis on February 22, 2026 at 9:14 am

    How do I add a math kern for a particular glyph belonging to a particular stylistic set in an OpenType MATH font? As shown here, one adds the kern to a particular Unicode slot---[0x211D] in this case. If one chooses a particular stylistic set though, it does not work. The kern gets added to only the default glyph in the Unicode slot, and it does not carry over to the stylistic set glyph. I found that uni211D.bb is the glyph name of NewCM bb R using FontForge. Also, is it possible to define different kerns for distinct glyphs belonging to different stylistic sets, but the same Unicode point? \documentclass{article} \directlua{ local kerns = { ["NewCMMath-Book"] = { [0x211D] = { topright = { { kern = -100 } } } } } local function addkerns(tfmdata) if tfmdata.mathparameters then local kerns = kerns[tfmdata.properties.fontname] if kerns then local characters = tfmdata.characters for unicode, specification in pairs(kerns) do local character = characters[unicode] if character and not character.mathkerns then character.mathkerns = specification end end end end end fonts.handlers.otf.features.register { name = "mathkerns", description = "additional math kerns", initializers = { position = 1, base = addkerns, node = addkerns, } } } \usepackage{unicode-math} \setmainfont{NewCM10-Book.otf} \setmathfont[ StylisticSet={3}, BoldFont = NewCMMath-Bold.otf, RawFeature=+mathkerns ]{NewCMMath-Book.otf} \usepackage{lua-visual-debug} \lvdset{glyph={show=true}} \begin{document} \(\symbb{R}^n\) \end{document}

  • \refstepcounter in hyperref does not work with \offinterlineskip
    by Alex Degtyarev on February 22, 2026 at 12:34 am

    I have discovered a weirdest behavior of \refstepcounter in hyperref: it does not work with \offinterlineskip. Here is a minimal example: %Format: latex \documentclass{amsart} \usepackage{hyperref} \begin{document} text \newpage \begingroup \offinterlineskip \ialign{\strut\refstepcounter{section}\thesection#\hss\cr \label1\cr \label2\cr \label3\cr \label4\cr \crcr} \endgroup \ref1 \ref2 \ref3 \ref4 \newpage refs will lead here \end{document} All links lead to random places in the text. Can this be fixed? My current workaround is spelling out \offinterlaneskip with the baselineskip part removed.

  • What is the best way to draw a potato (like found in vector analysis/continuum mechanics courses)
    by Dimitrios ANAGNOSTOU on February 21, 2026 at 11:34 pm

    I apologized if this is a duplicate. What is the best way to draw such figures with tikz (or other packages)? For the time being just the potato like figure. I do not care for the vectors and the infinitesimal mass element. I do not want someone to do the work for me. Just some advice or suggestions.

  • Remove \\ from a value/command [duplicate]
    by ViToni on February 21, 2026 at 7:49 pm

    For a paper I have a rather long title which is setup as \title{Some very long text\\which\\needed line breaks} so that it looks fine on the cover page. However I get an error from hyperref: Package hyperref Warning: Token not allowed in a PDF string (Unicode): (hyperref) removing `\\' on input line 944. which I assume is due to: \hypersetup{ ... pdftitle={\thetitle}, .... } \thetitle (along with *date and *author) is defined as: % make title, author, date accessible for reuse \makeatletter \let\thetitle\@title \let\theauthor\@author \let\thedate\@date \makeatother Can I somehow remove the line breaks from \thetitle to allow usage with hyperref?

  • Restricting the area in which text is typeset, for letters
    by Stefan Müller on February 21, 2026 at 4:07 pm

    I want to write a letter template. The code below works but has the disadvantage that one has to state how many lines a paragraph has, so that it does not spill over into the margin where the details about the university are. This is done by \pshape. The second page is supposed to use all the available space. So no \pshape is necessary here. I think there is a conceptual mistake in this code. LaTeX should know about the region it can use. Is there a way to do this with paper size or something so that \pshapeis not necessary any longer? \documentclass[% a4paper, foldmarks=true, foldmarks=blmTP, fromlogo=true, locfield=wide, refline=nodate, firstfoot=false, pagenumber=headright ]{scrlttr2} \setlength{\textwidth}{160mm}% \addtolength{\textheight}{5\baselineskip} \addtoplength{toaddrvpos}{-16mm} \setplength{refvpos}{9,5cm} %\addtoplength{refhpos}{15mm} \setplength{locvpos}{50mm} \setplength{locwidth}{50mm} %\setplength{refhpos}{6mm} % it doesn't work for left margin \setplength{lochpos}{4mm} % right margin \setplength{locheight}{22,2cm} \usepackage{libertine} % XeLaTeX + libertine + MnSymbol (math symbols) create problems \renewcommand\ttdefault{lmtt} % change typewriter font to lmodern (smaller than tt in libertine)mtt} \usepackage{lipsum} %%%%%%%%%%%%%%%%%%%%%%% %%% Author's Metadata \newcommand*\sender{Stefan Müller} % sender's name \newcommand*\degree{Prof. Dr.} % sender's degree \newcommand*\authortitle{\degree\ \sender } % sender: degree + name \newcommand*\mail{St.Mueller@hu-berlin.de} % sender's e-mail \newcommand*\website{https://hpsg.hu-berlin.de/\~{}stefan/} % sender's website \newcommand*\officehour{Montag, 14:00–15:00} % office hours \newcommand*\telf{$+$49\,30\,2093-9631} \newcommand*\addressee{Prüfungsbüro\\ -- im Hause --} \def\pshape#1{% \parshape #1 \pshapexiicm{#1} 0pt 16cm } \def\pshapexiicm#1{% \ifnum#1>1 0pt 12,5cm \expandafter \pshapexiicm\expandafter{\the\numexpr#1-1\expandafter\relax\expandafter}\fi} \setkomavar{location}{\begin{tabular}[t]{l@{}} % Faculty {\footnotesize \textbf{Sprach- und}}\\[-1mm] {\footnotesize \textbf{literaturwissenschaftliche}}\\[-1mm] {\footnotesize \textbf{Fakultät}}\\[3mm] % Institute {\footnotesize Institut für deutsche Sprache}\\[-1mm] {\footnotesize und Linguistik}\\[3mm] {\scriptsize Sprachwissenschaft des Deutschen,}\\[-1mm] % Area {\scriptsize Syntax}\\[3mm] % Author {\scriptsize \textbf{\authortitle}}\\[-1mm] {\scriptsize \mail }\\[-1mm] {\scriptsize \website }\\[8mm] % Date {\scriptsize \textbf{Datum:}}\\[-1mm] {\scriptsize \usekomavar{date}}\\[37mm] % Address post {\scriptsize \textbf{Postanschrift:}}\\[-1mm] {\scriptsize Humboldt-Universität zu Berlin }\\[-1mm] {\scriptsize Unter den Linden 6 }\\[-1mm] {\scriptsize 10099 Berlin }\\[-1mm] {\scriptsize Telefon 030 54321 }\\[20mm] % Address office {\scriptsize \textbf{Sitz:}}\\[-1mm] {\scriptsize Seminargebäude am Hegelplatz }\\[-1mm] {\scriptsize hegelplatz 1 }\\[-1mm] {\scriptsize 1115 Berlin }\\[-1mm] {\scriptsize Raum R1411}\\[44,5mm] % Consultation hours {\scriptsize \textbf{Sprechzeiten:}}\\[-1mm] {\scriptsize Mo: 23:00--23:15}\\[-1mm] %% Bank account % {\scriptsize \textbf{Bankverbindung:}}\\[-1mm] % {\scriptsize Deutsche Bank PGK AG}\\[-1mm] % {\scriptsize BIC/SWIFT: DEUTDED110}\\[-1mm] % {\scriptsize IBAN: DE 95 1007 0848 0512 620601} \end{tabular} } \begin{document} \begin{letter}{ %% ADDRESS (see texfiles/localmetadata for the commands) \tiny{ HU | Sprach- und literaturwissenschaftliche Fakultät,\\ Institut für deutsche Sprache und Linguistik | 10099 Berlin}% % \\ \vspace{1cm} % %%ADDRESSEE (specify above) \footnotesize{ \addressee} } \setkomavar{subject}{Some subject/Betreff} %% OPENING \opening{Sehr geehrte Damen und Herren,} %\opening{To whom it may concern,} %% CONTENT OF LETTER \pshape{24} \lipsum[1] \pshape{18} Lorem ipsum dolor sit amet, consectetuer adipiscing elit. Ut purus elit, vestibulum ut, placerat ac, adipiscing vitae, felis. Curabitur dictum gravida mauris. Nam arcu libero, nonummy eget, consectetuer id, vulputate a, magna. Donec vehicula augue eu neque. Pellentesque habitant morbi tristique senectus et netus et malesuada fames ac turpis egestas. Mauris ut leo. Cras viverra metus rhoncus sem. Nulla et lectus vestibulum urna fringilla ultrices. Phasellus eu tellus sit amet tortor gravida placerat. Integer sapien est, iaculis in, pretium quis, viverra ac, nunc. Praesent eget sem vel leo ultrices bibendum. Aenean faucibus. Morbi dolor nulla, malesuada eu, pulvinar at, mollis ac, nulla. Curabitur auctor semper nulla. Donec varius orci eget risus. Duis nibh mi, congue eu, accumsan eleifend, sagittis quis, diam. Duis eget orci sit amet orci dignissim rutrum. Aenean faucibus. Morbi dolor nulla, malesuada eu, pulvinar at, mollis ac, nulla. Curabitur auctor semper nulla. Donec varius orci eget risus. Duis nibh mi, congue eu, accumsan eleifend, sagittis quis, diam. Duis eget orci sit amet orci dignissim rutrum. Aenean faucibus. Morbi dolor nulla, malesuada eu, pulvinar at, mollis ac, nulla. Curabitur auctor semper nulla. Donec varius orci eget risus. Duis nibh mi, congue eu, accumsan eleifend, sagittis quis, diam. Duis eget orci sit amet orci dignissim rutrum. Donec varius orci eget risus. Duis nibh mi, congue eu, accumsan eleifend, sagittis quis, diam. Duis eget orci sit amet orci dignissim rutrum. Aenean faucibus. Morbi dolor nulla, malesuada eu, pulvinar at, mollis ac, nulla. Curabitur auctor semper nulla. Donec varius orci eget risus. Duis nibh mi, congue eu, accumsan eleifend, sagittis quis, diam. Duis eget orci sit amet orci dignissim rutrum. \closing{Best wishes} \end{letter} \end{document}

  • Latex: Tikz - rectangle to inherit the width of another rectangle
    by GJW on February 21, 2026 at 1:44 pm

    I would like node B to have exactly the same width as node A, without explicitly specifying a fixed dimension, with the following constraints: The two nodes are not adjacent in the source code. I do not want to hard-code a width (e.g., minimum width=3cm). Node A will always be at least as wide as node B. I would prefer a solution that does not rely on manually computing dimensions via \path let unless necessary. Here is a minimal example illustrating what I currently have: \documentclass{article} \usepackage{tikz} \usetikzlibrary{calc} \begin{document} \begin{tikzpicture} \node [draw] (A) {Some text}; \path let \p1 = (A.south west), \p2 = (A.north east) in node [draw, minimum width=\x2-\x1-\pgflinewidth, minimum height=\y2-\y1-\pgflinewidth, below right] at ([yshift={\pgflinewidth}]A.south west) {more}; \end{tikzpicture} \end{document}

  • How to set anchor for chemove in the right place?
    by Solarflares on February 21, 2026 at 12:55 pm

    I want to draw an arrow with chemmove to represent the movement of an electron pair. \documentclass{article} \usepackage{chemfig} \begin{document} \setchemfig{atom sep=7mm} \setchemfig{ arrow style={,,,thick} } \schemestart[][] \chemfig{\charge{90=\|,180=\|,270=\|}{Br}-@{end}H} \+ \arrow{0}[,0] \chemfig{H-[:52]@{start}\charge{45=\|,135=\|}{O}-[:-52]H} \arrow \chemfig{\chemabove[0pt]{\charge{45=\|}{O}}{\hspace{-4mm}\scriptstyle\oplus}(-[:-30]H)(-[:90]H)(-[:-150]H)} \+ \chemabove[2pt]{\chemfig{\charge{0=\|,90=\|,180=\|,270=\|}{Br}}}{\hspace{7mm}\scriptstyle\ominus} % \chemmove{ \draw[thick, ->,shorten <=2pt, shorten >=2pt] (start).. controls +(north west:1.5cm) and +(north:1cm).. (end); } \schemestop \end{document} The output is not as expected (expected: red arrow): What is the problem? Do I set the anchors (@start / @end ) in the wrong place? Edit: As already wrote in a comment. This was not an issue of using anchor or chemmove. It is an issue of the used engine. With pdfTeX and LuaTeX my MWE works as expected. With XeTeX it does not work as expected.

  • Strange intersection glitch of knots package?
    by Explorer on February 21, 2026 at 9:20 am

    This question based on the previous question: % Source - https://tex.stackexchange.com/a/759998 % Posted by Andrew Stacey % Retrieved 2026-02-21, License - CC BY-SA 4.0 \documentclass[tikz, border=1cm]{standalone} \usetikzlibrary{decorations.pathreplacing,knots} %\url{https://tex.stackexchange.com/q/759978/86} \begin{document} \begin{tikzpicture}[ basic strand/.style={ black, double=gray!10, double distance=1pt, line cap=round, thick, }, crossing strand/.style={ line width=2pt, only when rendering/.style={% draw=gray!10,% line width=1pt, double=none, } }, rounded corners=1pt, ] \begin{knot}[ consider self intersections=true, ignore endpoint intersections=false, background colour=black, every intersection/.style={ crossing strand }, only when rendering/.style={ basic strand }, clip width=1, flip crossing=1, ] \strand (7.5,7.5)--(6.5,5.5)--(7.5,3.5)--(6.5,1.5)--(4.5,0.5)--(2.5,1.5)--(0.5,0.5)--(1.5,2.5)--(0.5,4.5)--(1.5,6.5)--(3.5,7.5)--(5.5,6.5)--(7.5,5.5)--(6.5,3.5)--(7.5,1.5)--(5.5,0.5)--(3.5,1.5)--(1.5,0.5)--(0.5,2.5)--(1.5,4.5)--(0.5,6.5)--(2.5,7.5)--(4.5,6.5)--(6.5,7.5)--(5.5,5.5)--(7.5,4.5)--(6.5,2.5)--(7.5,0.5)--(5.5,1.5) --(3.5,0.5)--(1.5,1.5)--(0.5,3.5)--(1.5,5.5) --(0.5,7.5)--(2.5,6.5)--(4.5,7.5)--(6.5,6.5) --(4.5,5.5)--(5.5,3.5) % --(7.5,2.5) ; \end{knot} \end{tikzpicture} \end{document} With --(7.5,2.5) commented, it behaves good: However, if I uncommented that line, thing changed: Is that a bug or feature? Any possibility to improve this?

  • Using tikz's backgrounds library to draw something behind text
    by Werner on February 21, 2026 at 7:20 am

    Consider the following minimal example where I want to draw a rectangle behind a sequence of numbers (to highlight them): \documentclass{article} \usepackage{tikz} \usetikzlibrary{backgrounds,calc} \NewDocumentCommand{\tikzmark}{ m }{\tikz[overlay, remember picture] \node (#1) {};} \newcounter{seq} \NewDocumentCommand{\seqstart}{}{% \stepcounter{seq}% Start a new sequence \tikzmark{seq-start-\theseq}}% Set start marker \NewDocumentCommand{\seqend}{}{% \tikzmark{seq-end-\theseq}% Set end marker \tikz[remember picture, overlay] \scoped [on background layer] \fill [fill=blue!10!white] ($(seq-start-\theseq.south west) + (-0.5pt,1pt)$) rectangle ($(seq-end-\theseq.south east) + (0.5pt,1.1\normalbaselineskip)$);% } \begin{document} \[ 12, 15, 8, 11, 4, 7, 0, 3, 16, 19, 12, 15, 8, 11, 4, 7, 0, 3, \ldots \] \[ \seqstart{}12, 15, 8, 11, 4, 7, 0, 3, 16, 19\seqend{}, 12, 15, 8, 11, 4, 7, 0, 3, \ldots \] \end{document} The idea is that \seqstart would set a (counter-driven) \tikzmark representing the start of the sequence to be marked. Then \seqend would set a \tikzmark at the end and highlight it using the background layer. The counter allows for multiple such sequence marking within a larger document. However, the output shows that the rectangle highlighting a part of the sequence is not being drawn on background layer as requested. Why is that? How can I ensure the rectangle is drawn on the background layer behind document/text elements? The backgrounds library documentation (in the tikz documentation, section 45) mentions that on background layer can only be used inside a {scope} or \scoped, which is done above.

  • Patch for lineno so \lineref creates links
    by Markus Schmassmann on February 20, 2026 at 10:19 pm

    I'm trying to write a patch for lineno, so that it's \lineref command creates links, when hyperref is loaded. The code below works except for the commented-out \lineref* version, which is not supposed to create a link. If I remove the comments from the \lineref* definition, \lineref* works, but it breaks the linking function of \pageref and the \lineref[]{} with an optional argument. \documentclass{article} \usepackage{lipsum,lineno,hyperref,suffix}\linenumbers \makeatletter % presence of modern LaTeX hook system since Oct 2020 \@ifundefined{DeclareHookRule}{ \PackageWarningNoLine{lineno}{% pre 2020-10 LaTeX, no hook system: no hyperref lineref links} }{\DeclareHookRule{begindocument/end}{lineno/hyperref}{after}{hyperref} \DeclareHookRule{begindocument/end}{lineno/hyperref}{after}{lineno} \AddToHook{begindocument/end}[lineno/hyperref]{% after hyperref/lineno \@ifpackageloaded{hyperref}{% \let\LN@orig@lineref\lineref \let\LN@orig@pageref\pageref %%% \@LN@linelabel == lineno internal called by \linelabel \let\LN@orig@linelabel\@LN@linelabel \gdef\@LN@linelabel#1{\hypertarget{#1}{\LN@orig@linelabel{#1}}} \renewcommand*{\lineref}[2][0]{% \hyperlink{#2}{\NoHyper\LN@orig@lineref[#1]{#2}\endNoHyper}% }% \renewcommand*{\pageref}[1]{% \hyperlink{#1}{\LN@orig@pageref*{#1}}% }% % \WithSuffix{\newcommand*}\lineref*[2][0]{% % \NoHyper\LN@orig@lineref[#1]{#2}\endNoHyper% % }% \WithSuffix{\newcommand*}\pageref*[1]{% \LN@orig@pageref*{#1}% }% }{}% no changes without hyperref } } \makeatother \begin{document}\noindent% Line: \lineref{line:test}\quad\lineref*{line:test}\\ page: \pageref{line:test}\quad\pageref*{line:test}\\ Line 0 offset: \lineref[0]{line:test}\\ Line 1 offset: \lineref[1]{line:test}\\ page\_old: \pageref{sec:foobar}\quad\pageref*{sec:foobar} \lipsum[1]\linelabel{line:test} \section{foobar}\label{sec:foobar} \end{document} As a bonus, does anyone have an idea how to write this patch in such a way that it works on older LaTeX distributions without DeclareHookRule?

  • Create a directed graph
    by 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}