• Strange output using AMSmath's \operatorname and fontsetup
    by msx on December 9, 2025 at 12:04 pm

    I have the following document \documentclass{article} \usepackage{fontsetup} \usepackage{amsmath} \newcommand{\coordRng}{\operatorname{\Gamma}} \begin{document} \(\coordRng (X)\) \(\Gamma\) \end{document} and when built by LuaLatex it has the following output: and I get the warning: Missing character: There is no 𝛤 (U+1D6E4) in font [NewCM10-Book.otf]:mode= Note that the Gamma that was supposed to be typeset by \coordRng is missing. Without the \operatorname command it typesets. If instead one does not use fontsetup, \coordRng also typesets fine.

  • What is the proper way to demonstrate tagged PDFs
    by Namal on December 9, 2025 at 9:03 am

    What is the best way to demonstrate a tagged PDF vs untagged. I don't mean a verification mark. I am looking for a, preferably linux, tool that can demonstrate it. Edit: I mean a screen reader.

  • LaTeX: How to set different geometry margins for different pages based on PDF background images?
    by John Stone on December 9, 2025 at 8:25 am

    I'm creating example papers in LaTeX with different PDF backgrounds for different pages, and demo PDFs are given as follows: First page: example-image-a.pdf Odd pages (except first): example-image-b.pdf Even pages: example-image-c.pdf I need to set different geometry margins for each page type to align text content properly with these backgrounds. Here's my minimal example: \documentclass{article} \usepackage{lipsum} \def\iExam{1} \newif\ifexam \ifnum\iExam=1 \examtrue \else \examfalse \fi % ===== background ===== \usepackage{pdfpages} \ifexam % with PDF background \AddToShipoutPictureBG{ \ifnum\value{page}=1 % first page \put(0,0){\includegraphics[width=\paperwidth,height=\paperheight]{example-image-a.pdf}} \else \ifodd\value{page} % odd page (except first page) \put(0,0){\includegraphics[width=\paperwidth,height=\paperheight]{example-image-b.pdf}} \else % even page \put(0,0){\includegraphics[width=\paperwidth,height=\paperheight]{example-image-c.pdf}} \fi \fi } \fi % ===== geometry ===== \usepackage{geometry} \ifexam % special definitions (with PDF background) \ifnum\value{page}=1 % first page \geometry{top=58mm,bottom=32mm,left=52mm,right=14mm,includeheadfoot} \else \ifodd\value{page} % odd page (except first page) \geometry{top=18mm,bottom=32mm,left=52mm,right=14mm,includeheadfoot} \else % even page \geometry{top=18mm,bottom=32mm,left=32mm,right=14mm,includeheadfoot} \fi \fi \else % ordinary definitions \geometry{top=1cm,bottom=1.5cm,left=1cm,right=1cm} \fi \begin{document} \section{earth} \lipsum[1-11] \section{universe} \lipsum[1-11] \end{document} Problem: The geometry settings are evaluated only once at document initialization (when \value{page}=1), so all pages get the first page's margins. The conditional logic based on \value{page} doesn't work as intended for subsequent pages. What I need: (just ignore the same parts e.g. bottom=32mm,right=14mm,includeheadfoot) Page 1: top=58mm, left=52mm Odd pages (3,5,...): top=18mm, left=52mm Even pages (2,4,6,...): top=18mm, left=32mm Constraints: I need a solution that works with \AddToShipoutPictureBG for background images Should handle multi-page documents with different margin requirements per page Ideally minimal and elegant (avoiding complex packages if possible) Must work in both XeLaTeX and PDFLaTeX What I've tried: Using \AtBeginShipout hooks (various packages like atbegshi, everypage) The background package with \AddEverypageHook Redefining \geometry inside the background placement logic None of these approaches have successfully changed margins per page. The main challenge seems to be that geometry settings are global, while I need per-page adjustments. Is there a way to dynamically change page margins based on the current page number, or to set different margins for odd/even pages when using different background images?

  • Checking the current page against the last page in a shipout hook
    by Erwann on December 9, 2025 at 5:30 am

    I meant to restrict the overlay to all but the last page, but this setup fails due to \zref@extractdefault{abspage}{abspage}{0} stuck at 0. Is there a solution to this specific issue, and a better approach altogether? \documentclass{article} \usepackage{lipsum} \usepackage{atbegshi} \usepackage{tikz} \usepackage{xcolor} \usepackage{zref-abspage} \usepackage{zref-lastpage} \makeatletter \ExplSyntaxOn \ProvideDocumentCommand{\OverlayTypeset}{ o m } { % \AtBeginShipout \AddToHook{shipout/background}{ \int_compare:nTF { \zref@extractdefault{abspage}{abspage}{0} < \zref@extractdefault{LastPage}{abspage}{0} } {% \int_show:n{\zref@extractdefault{abspage}{abspage}{0}} \int_show:n{\zref@extractdefault{LastPage}{abspage}{0}} \begin{tikzpicture}[remember~picture,overlay,text=red] \node[scale=6,opacity=0.5] at (current~page.center) {#2}; \end{tikzpicture} } { } } } \ExplSyntaxOff \makeatother \OverlayTypeset{DRAFT} \begin{document} \lipsum[1-10] \end{document} log: %[Loading MPS to PDF converter (version 2006.09.02).] %) (/opt/texlive/2025/texmf-dist/tex/latex/epstopdf-pkg/epstopdf-base.sty %(/opt/texlive/2025/texmf-dist/tex/latex/latexconfig/epstopdf-sys.cfg)) %> \zref@extractdefault {abspage}{abspage}{0}=0. %<recently read> } % %l.39 \end % {document} %? %> \zref@extractdefault {LastPage}{abspage}{0}=2. %<recently read> } % %l.39 \end % {document} %? %[1{/opt/texlive/2025/texmf-var/fonts/map/pdftex/updmap/pdftex.map}] %> \zref@extractdefault {abspage}{abspage}{0}=0. %<recently read> } % %l.39 \end{document} % %? %> \zref@extractdefault {LastPage}{abspage}{0}=2. %<recently read> } % %l.39 \end{document} % %? %[2] (./debug-119.aux) )</opt/texlive/2025/texmf-dist/fonts/type1/public/amsfont %s/cm/cmr10.pfb> %Output written on debug-119.pdf (2 pages, 25603 bytes). %Transcript written on debug-119.log. %Latexmk: Getting log file 'debug-119.log' %Latexmk: Examining 'debug-119.fls' %Latexmk: Examining 'debug-119.log' %Latexmk: Log file says output to 'debug-119.pdf' %Latexmk: Using bibtex to make bibliography file(s). %Latexmk: Errors, so I did not complete making targets %Collected error summary (may duplicate other messages): % pdflatex: Command for 'pdflatex' gave return code 1 % Refer to 'debug-119.log' and/or above output for details % %Latexmk: Sometimes, the -f option can be used to get latexmk % to try to force complete processing. % But normally, you will need to correct the file(s) that caused the % error, and then rerun latexmk. % In some cases, it is best to clean out generated files before rerunning % latexmk after you've corrected the files.

  • How to customize the quote environment?
    by Cham on December 9, 2025 at 1:32 am

    I'm trying to customize the quote environment for a novel (citations at the beginning of each chapter), and I'm having troubles in setting custom vertical line spacing, horizontal line length, the left/right horizontal spacing (quote margins), and the space above and below the quotes. How can I add the following parameters to the squote macro defined in the code below? Also, take note that the epigraph macro will probably by erased because currently it's clashing with the centered chapter number. I need to control the quote's left and right margins (say 1 inch on both sides), or the left marging and line length. Also, I need to control the vertical line spacing inside the quotes (say constant one half spacing between each line or something else that would be elegant. Any expert suggestion on this, for small size text?). And the vertical space above and below the quote text should be adjusted for elegance with a constant spacing (I'll have to experiment to find the proper value. Any suggestion would be appreciated). I believe the vertical spacing between the chapter title and the quote is currently too large. And since I'm currently experimenting with the macros to find the best configuration and disposition, I may have to place the quotes on the right side of the page, below the chapter title, as what the epigraph is currently doing. All my previous experiments failed. Here's a MWE with my current settings to play with: \documentclass[11pt,twoside]{book} \usepackage[T1]{fontenc} \usepackage[tt=false]{libertinus} \usepackage[french]{babel} \usepackage[stretch=50]{microtype} \usepackage[letterpaper,left=1.25in,right=1in,top=0.5in,bottom=0.5in,includeheadfoot,headheight=15pt,showframe]{geometry} \raggedbottom %\onehalfspacing %\setstretch{1.25} \setlength{\parindent}{1.5em} \linespread{1.1} \usepackage{titlesec} \usepackage{graphicx} \usepackage[dvipsnames]{xcolor} \titleformat{\chapter}[display] {\normalfont\huge\bfseries\centering} {\chaptertitlename\ \thechapter}{20pt}{\Huge} \usepackage{epigraph} \renewcommand{\textflush}{flushleft} \setlength{\epigraphrule}{0pt} %\setlength{\epigraphwidth}{0.5\textwidth} \newcommand{\epig}[2]{\epigraphhead[60]{\epigraph{\itshape{#1}}{\itshape{#2}}}} % a macro that will probably be erased. % THIS MACRO TO BE EDITED AND ADJUSTED: \newenvironment{squote}{ \begin{quote}\itshape\small}{\end{quote}} \begin{document} \chapter{A Nice chapter title here} \epig{ Some very funny quote text from nobody, and here's another line of text just to make you smile, but really, this quote environment isn't satisfaying yet, because it's too close to the chapter title. }{} \begin{squote} This is one fancy line of text to show a pretty medium long quote line, \\ this is the next line quote text to say anything wildly funny. This is another useless text of line just to show how smart I'm not. \end{squote} Some dummy text to show the paragraph spacing below the quoted text above. Oh well, another line of dumb text, and yes maybe I should use the lorem ipsum package to add something wild in there. But nevermind, I don't need it! \end{document} Here's a preview of what this MWE is doing:

  • TexStudio: Is there a way to make autocomplete suggestions less rigid
    by Aditya Ghosh on December 9, 2025 at 12:46 am

    I switched to TexStudio from Overleaf recently. I do miss the autocomplete suggestions in Overleaf where you don't have to get the cases or even the order of the words in the label right for the autocomplete to suggest it. For example, if the label is "Def cusp aut form", I would like to have it suggested to me if I type in "def aut" or "Aut". Is there a way to configure TexStudio to do this? Or a plugin perhaps?

  • One colored structure with amsart, amsthm, mdframed, thmtools
    by Sebastiano on December 8, 2025 at 9:02 pm

    I am working with the amsart class and I would like to define, using amsthm, two new environments: que (non-italic text, fully colored, including the title); ris (same characteristics). My idea is to create a sort of structured dialogue, for example: \begin{que} Text of the question… \begin{ris} Text of the answer… \end{ris} \end{que} i.e., to be able to nest risposta inside quesito without compilation errors (“nested boxes”). My MWE: \documentclass[12pt,a4paper]{amsart} \usepackage{mathtools,amssymb, amsthm} \newtheorem*{que}{\sc{Quesito}} \newtheorem*{ris}{\sc{Risposta}} \begin{document} \begin{que} Il limite di una funzione a due variabili richiede che il valore della funzione si avvicini allo stesso numero lungo qualsiasi percorso che punti verso il punto considerato. Per questo, a differenza del caso a una variabile, è spesso necessario confrontare diversi cammini o usare stime per verificare l’unicità del limite. \end{que} \begin{ris} Il limite di una funzione a due variabili esiste solo se la funzione tende allo stesso valore lungo tutti i possibili percorsi che si avvicinano al punto. \end{ris} \end{document} My requirements are: The environment title and all the text should have a specific color (e.g., red for quesito, blue for risposta). The body should remain in roman (non-italic) font; the environments must be nestable. I want to avoid adding packages, if possible - at most mdframed (a rather old package), which I only need to get a vertical bar along the full length of the text. I am not sure what the most stable and clean solution is to achieve color (including the title), roman text, and nestability, while keeping the setup as minimal as possible in terms of packages. ---> Added 9-12-2025 Using a my old answer with this MWE: \documentclass[12pt]{amsart} \usepackage{amsthm} \usepackage{amsmath,amssymb} \usepackage[svgnames]{xcolor} \RequirePackage[framemethod=default]{mdframed} \usepackage{thmtools} \newmdenv[ skipabove=7pt, skipbelow=7pt, rightline=false, leftline=true, topline=false, bottomline=false, linecolor=Green, backgroundcolor=Green!10, innerleftmargin=5pt, innerrightmargin=5pt, innertopmargin=2pt, innerbottommargin=5pt, leftmargin=0cm, rightmargin=0cm, linewidth=2.5pt ]{rBox} \newmdenv[ skipabove=7pt, skipbelow=7pt, rightline=false, leftline=true, topline=false, bottomline=false, linecolor=blue, backgroundcolor=blue!10, innerleftmargin=5pt, innerrightmargin=5pt, innertopmargin=2pt, innerbottommargin=5pt, leftmargin=0cm, rightmargin=0cm, linewidth=2.5pt ]{bBox} \declaretheoremstyle[ headfont=\normalfont\sc, bodyfont=\normalfont, notefont=\normalfont, headpunct={.} ]{col} \declaretheorem[name=Quesito,style=col]{queT} \declaretheorem[name=Risposta,style=col]{risT} \newenvironment{que}{\begin{rBox}\begin{queT}}{\end{queT}\end{rBox}} \newenvironment{ris}{\begin{bBox}\begin{risT}}{\end{risT}\end{bBox}} \newtheorem{teor}{\sc Teorema} \newtheorem*{prop}{\sc Proposizione} \newtheorem{cor}{\sc Corollario} \newtheorem*{lemma}{\sc Lemma} \newtheorem*{blankit}{} \allowdisplaybreaks \pagenumbering{arabic} \theoremstyle{definition} \newtheorem{defin}{\sc Definizione} \newtheorem{definn}{Definizioni} \theoremstyle{remark} \newtheorem{Es}{\sc Esercizio} \newtheorem{Dm}[Es]{\sc Domanda} \newtheorem{esp}[Es]{\sc Esempio} \newtheorem{Prob}[Es]{\sc Problem} \begin{document} \begin{que} Il limite di una funzione a due variabili richiede che il valore della funzione si avvicini allo stesso numero lungo qualsiasi percorso che punti verso il punto considerato. Per questo, a differenza del caso a una variabile, è spesso necessario confrontare diversi cammini o usare stime per verificare l’unicità del limite. \end{que} \begin{ris} Il limite di una funzione a due variabili esiste solo se la funzione tende allo stesso valore lungo tutti i possibili percorsi che si avvicinano al punto. \end{ris} \begin{defin} srhreheh \end{defin} \end{document} every enviroment is in normalfont but I want only for que and ris.

  • tikz-cd: Put brackets/parentheses around one column of diagram?
    by Peter LeFanu Lumsdaine on December 8, 2025 at 3:25 pm

    I would like to put parentheses around one column of a tikz-cd diagram — something like the diagram in the example below, but with the second set of parens around just the left-hand vertical of the square, not the whole square as currently. I would like the diagram otherwise roughly unchanged from how it is without the parentheses, but it’s fine if they slightly affect the alignment/spacing, so long as they don’t change the essential layout. MWE source \documentclass[a5paper]{article} \usepackage{tikz,tikz-cd} \usepackage{amssymb} \begin{document} \[ f^* \left( \begin{tikzcd}[baseline={([yshift=-axis_height]\tikzcdmatrixname)}] % vertical alignment adjusted as in https://tex.stackexchange.com/a/678935/ Z \ar[d,"g"] \\ X \end{tikzcd} \right) = \left( \begin{tikzcd}[baseline={([yshift=-axis_height]\tikzcdmatrixname)}] \bullet \ar[d] \ar[r] \ar[dr,phantom,"\lrcorner", very near start] & Z \ar[d,"g"] \\ Y \ar[r,"f"] & X \end{tikzcd} \right) \] \end{document} One approach I have tried, but did not get satisfactory: using various combinations of \phantom and \mathrlap around a copy of the diagram consisting of just the column in question, as in the following snippet. However, I couldn’t get the horizontal alignment reasonable with any arrangement I tried. \mathrlap{\left( { \begin{tikzcd}[baseline={([yshift=-axis_height]\tikzcdmatrixname)}] \bullet \phantom{\mathclap{Z}} \ar[d] \\ Y \end{tikzcd} } \right)} \left( \begin{tikzcd}[baseline={([yshift=-axis_height]\tikzcdmatrixname)}] \bullet \ar[d] \ar[r] \ar[dr,phantom,"\lrcorner", very near start] & Z \ar[d,"g"] \\ Y \ar[r,"f"] & X \end{tikzcd} \right)

  • How to avoid `\phantom{}` and empty groups in this array, while maintaining the same alignment?
    by tmc on December 8, 2025 at 2:44 pm

    I'm working on creating a specific two-column table in \LaTeX. The second column, $f(n)$, contains expressions that are linear combinations of $\alpha$, $\beta$, and $\gamma$, but not all terms are present in every row. My goal is to achieve a consistent column alignment for the coefficients of $\alpha$, $\beta$, and $\gamma$ across all rows, with consistent spacing around the $+$ signs. The terms $\alpha$, $\beta$, $\gamma$ themselves should also align. To achieve this alignment, I currently rely heavily on \phantom{} and empty {} groups, which feels overly complicated. I suspect there is a much cleaner, more idiomatic approach that I am missing. Since I'm not very proficient, could you please critique my current approach and suggest a more robust method to achieve this specific alignment? Here is my current code snippet: \documentclass{article} \begin{document} \[ \begin{array}{@{}c|c@{}} n & f(n) \\ \hline 1 & \phantom{0}\alpha\phantom{{}+0\beta+0\gamma} \\ \hline 2 & 2\alpha+\phantom{0}\beta\phantom{{}+0\gamma} \\ 3 & 2\alpha\phantom{{}+0\beta}+\phantom{0}\gamma \\ \hline 4 & 4\alpha+3\beta\phantom{{}+0\gamma} \\ 5 & 4\alpha+2\beta+\phantom{0}\gamma \\ 6 & 4\alpha+\phantom{0}\beta+2\gamma \\ 7 & 4\alpha\phantom{{}+0\beta}+3\gamma \\ \hline 8 & 8\alpha+7\beta\phantom{{}+0\gamma} \\ 9 & 8\alpha+6\beta+\phantom{0}\gamma \end{array} \] \end{document}

  • wrapfig introducing whitespace when next to text divided by sections
    by Skilopsaros on December 8, 2025 at 2:13 pm

    I'm trying to have text wrap around other text or a figure as is supposed to be done with wrapfigure. However I'm encountering an issue where there is a lot of whitespace under the wrapfig when the text that's supposed to wraping around it includes section/subsection/paragraph headers, enumerations, or lists, as is seen in the attached picture. This happens regardless of what's in the wrapfig, be in a boxed minipage, just text, or an image. I cannot figure out how to remove this whitespace. Is there some other package I should be using, or some way to fix this? This was crossposted in Stack Overflow. Link: stackoverflow.com/q/79840990/2777074 The code used to generate the image: \documentclass{article} \usepackage{graphicx} % Required for inserting images \usepackage{wrapfig} \usepackage{xcolor} \title{test} \begin{document} \section{TITLE} Lorem ipsum dolor sit amet, consectetur adipiscing elit. Aenean eu hendrerit sem. Morbi eget elit et nunc hendrerit mattis. Fusce viverra eleifend nibh et varius. Phasellus pellentesque tellus et arcu dignissim tempor. Proin justo dui, blandit at nisi eget \begin{wrapfigure}{r}{0.4\textwidth} OOOOO OOOOO OOOOO OOOOO OOOOO OOOOO OOOOO OOOOO OOOOO OOOOO OOOOO OOOOO OOOOO OOOOO OOOOO OOOOO OOOOO OOOOO OOOOO OOOOO OOOOO OOOOO OOOOO OOOOO OOOOO OOOOO OOOOO OOOOO OOOOO OOOOO OOOOO OOOOO OOOOO OOOOO OOOOO OOOOO OOOOO OOOOO OOOOO OOOOO OOOOO OOOOO OOOOO OOOOO OOOOO OOOOO OOOOO OOOOO OOOOO OOOOO OOOOO OOOOO OOOOO OOOOO OOOOO OOOOO OOOOO OOOOO OOOOO OOOOO OOOOO OOOOO OOOOO \end{wrapfigure} Fusce dictum cursus tellus, sed aliquam leo pharetra vel. Nam consectetur ligula a sem fermentum lobortis. Nam lorem ipsum, tincidunt nec orci ut, lacinia malesuada mauris \subsection{The problem is splitting this up} Maecenas dictum a arcu eu viverra. Proin tellus dolor, pulvinar et finibus quis, dictum in dui. Fusce eleifend, ligula sit amet vestibulum congue, eros dui aliquam arcu \subsection{and if we split it even more we get issues} Maecenas dictum a arcu eu viverra. Proin tellus dolor, pulvinar et finibus quis, dictum in dui. Fusce eleifend, ligula sit amet vestibulum congue, eros dui aliquam arcu \subsection{MY SUBSECTION} Nunc ultrices orci a libero cursus pretium. Donec venenatis semper libero, nec tempus quam volutpat congue. Proin nunc risus, gravida non nisl non, suscipit gravida mi. Pellentesque \subsection{MY SUBSECTION AGAIN} Nam rhoncus, nibh sit amet bibendum vehicula, lorem magna pulvinar nisi, et tempor erat orci ut odio. Sed egestas eu ligula in porttitor. Aenean \subsection{MY SUBSECTION electric boogaloo} Nam rhoncus, nibh sit amet bibendum vehicula, lorem magna pulvinar nisi, et tempor erat orci ut odio. Sed egestas eu ligula in porttitor. Aenean \section{And here for the time it works} Pellentesque hendrerit sem et sem ullamcorper dapibus at at ex. \begin{wrapfigure}{r}{0.4\textwidth} OOOOO OOOOO OOOOO OOOOO OOOOO OOOOO OOOOO OOOOO OOOOO OOOOO OOOOO OOOOO OOOOO OOOOO OOOOO OOOOO OOOOO OOOOO OOOOO OOOOO OOOOO OOOOO OOOOO OOOOO OOOOO OOOOO OOOOO OOOOO OOOOO OOOOO OOOOO OOOOO OOOOO OOOOO OOOOO OOOOO OOOOO OOOOO OOOOO OOOOO OOOOO OOOOO OOOOO OOOOO OOOOO OOOOO OOOOO OOOOO OOOOO OOOOO OOOOO OOOOO OOOOO OOOOO OOOOO OOOOO OOOOO OOOOO OOOOO OOOOO OOOOO OOOOO OOOOO \end{wrapfigure} Etiam lacus mauris, cursus sed arcu sed, auctor varius ex. Vestibulum eget lorem felis. Etiam suscipit purus risus, sed congue nisl elementum ut. Donec aliquam, turpis eu laoreet convallis, neque sem dictum lacus, nec feugiat enim tellus at ante. Vestibulum eget ullamcorper eros. Donec sem mi, maximus sit amet iaculis quis, semper vitae lacus. Donec tincidunt rhoncus lorem, vel scelerisque massa suscipit et. Pellentesque hendrerit sem et sem ullamcorper dapibus at at ex. Etiam lacus mauris, cursus sed arcu sed, auctor varius ex. Vestibulum eget lorem felis. Etiam suscipit purus risus, sed congue nisl elementum ut. Donec aliquam, turpis eu laoreet convallis, neque sem dictum lacus, nec feugiat enim tellus at ante. Vestibulum eget ullamcorper eros. Donec sem mi, maximus sit amet iaculis quis, semper vitae lacus. Donec tincidunt rhoncus lorem, vel scelerisque massa suscipit et. Morbi diam turpis, pellentesque et eleifend in, auctor at magna. Nunc mollis tortor vitae mauris egestas luctus. Ut ultricies sed neque iaculis sagittis. Morbi odio dui, consectetur vitae ligula id, euismod lobortis ex. Orci varius natoque penatibus et magnis dis parturient montes, nascetur ridiculus mus. Maecenas ornare mauris nisl, id condimentum ante consequat varius. Interdum et malesuada fames ac ante ipsum primis in faucibus. Etiam sagittis, libero eget blandit rhoncus, metus ipsum luctus tortor, eu pellentesque metus erat nec nisl. Vestibulum ut tellus blandit erat scelerisque accumsan vitae ullamcorper lacus. Curabitur vel semper nisi. Nulla facilisi. Pellentesque condimentum, magna vitae accumsan viverra, felis libero tempor ligula, et eleifend odio tortor ut massa. Etiam hendrerit eget lacus non consequat. In est lorem, scelerisque quis enim sed, dignissim sodales ex. In pretium hendrerit egestas. Quisque est eros, semper sollicitudin metus nec, mollis pharetra sem. Suspendisse et ex sit amet tellus bibendum fermentum rhoncus non ligula. Fusce eros lectus, sollicitudin non tortor accumsan, posuere iaculis nisi. Morbi eleifend dui et arcu ullamcorper, id eleifend dolor lobortis. Nunc egestas purus non elit facilisis dictum. In tristique suscipit nisi, quis rhoncus odio facilisis at. Nullam tincidunt porttitor justo quis sagittis. \end{document}

  • NewDocumentCommand with keyword arguments: how to prevent evaluation of keyword default values?
    by wmnorth on December 8, 2025 at 12:03 pm

    Consider the following MWE: \documentclass{article} \DeclareKeys [ myKeys ]{ a .store = \whereA, b .store = \whereB, } \SetKeys [ myKeys ] { a = AAA, b = \pageref{#2}, } \NewDocumentCommand{\abref}{O{} m}{% \SetKeys [ myKeys ] {#1}% \whereA\ and \whereB% } \begin{document} \section{Some topic} Ref the other page \abref{newpage} % does NOT work \vspace{2em} Ref the other page \abref[b = \pageref{newpage}]{newpage} % works \newpage foobar \label{newpage} \end{document} It produces the following output: The problem lies in the fact the default value for parameter b, viz. \pageref{#2}, gets evaluated too early.(*) I have a workaround for this: use a placeholder instead (<pnum> shall we say), and replace it inside the command definition (requires xstring): \IfSubStr{\whereB}{<pnum>}% {\StrSubstitute{\whereB}{<pnum>}{\pageref{#2}}}% But my question is if there is some way to prevent that early evaluation, thus making the workaround redundant. I have tried, e.g., \noexpand and some such incantations, but with no luck. Thank you in advance for your help. (*) In fact it produces the following warning: LaTeX Warning: Reference `##2' on page 1 undefined on input line 24.

  • How to distribute items (cards) evenly on a A4 page in Latex?
    by user32017992 on December 8, 2025 at 12:02 pm

    I need to print cards (bussiness for example) on both sides of A4 paper so they must match exactly.I was trying to do some calculations and search for hidden margin, but none of those worked. code: https://github.com/moravechynek/latex_cards \documentclass[a4paper,12pt]{article} \usepackage[utf8]{inputenc} \usepackage[T1]{fontenc} \usepackage{lmodern} \usepackage[english]{babel} \usepackage{graphicx} \graphicspath{{graphics/}} \usepackage{tikz} \usepackage{geometry} \geometry{margin=0mm} \setlength{\parindent}{0pt} % Card size (mm) \newcommand{\cardW}{63.5} \newcommand{\cardH}{88.9} % Gaps (mm): 4 gaps for 3 cards \newcommand{\gapX}{4.875} % (210 - 3*63.5) / 4 \newcommand{\gapY}{7.575} % (297 - 3*88.9) / 4 % A4 dimensions \newcommand{\Awidth}{210} \newcommand{\Aheight}{297} % Padding inside card \newcommand{\pad}{3} % FRONT CARD TEMPLATE \newcommand{\CardFront}[2]{% \begin{tikzpicture}[x=1mm, y=1mm] \useasboundingbox (0,0) rectangle (\cardW,\cardH); \draw[rounded corners=2mm, line width=0.3mm] (\pad,\pad) rectangle (\cardW-\pad,\cardH-\pad); \node[anchor=north,font=\LARGE] at (\cardW/2, \cardH-\pad-15) {#1}; \end{tikzpicture} } % BACK CARD TEMPLATE \newcommand{\CardBack}[1]{% \begin{tikzpicture}[x=1mm, y=1mm] \useasboundingbox (0,0) rectangle (\cardW,\cardH); \draw[rounded corners=2mm, line width=0.3mm] (\pad,\pad) rectangle (\cardW-\pad,\cardH-\pad); \node[anchor=north,font=\normalsize] at (\cardW/2, \cardH/1.4-\pad) {#1}; \end{tikzpicture} } \def\CardEntries{ 4 000, 4 800, 6 000, 8 000, 10 000, 12 000, 24 000, 16 000, 20 000 } \begin{document} \thispagestyle{empty} % FRONT SIDE (9 CARDS) \begin{tikzpicture}[x=1mm,y=1mm] \foreach [count=\idx from 0] \tl/\price in \CardEntries { \pgfmathtruncatemacro{\row}{floor(\idx/3)} \pgfmathtruncatemacro{\col}{\idx - 3*\row} \pgfmathsetmacro{\cx}{\gapX*(\col+1) + \cardW*\col + \cardW/2} \pgfmathsetmacro{\cy}{\Aheight - (\gapY*(\row+1) + \cardH*\row + \cardH/2)} \node at (\cx,\cy) {\CardFront{\tl}{\price}}; } \end{tikzpicture} \newpage \thispagestyle{empty} % BACK SIDE (9 CARDS) \begin{tikzpicture}[x=1mm,y=1mm] \foreach [count=\idx from 0] \tl/\price in \CardEntries { \pgfmathtruncatemacro{\row}{floor(\idx/3)} \pgfmathtruncatemacro{\col}{\idx - 3*\row} \pgfmathsetmacro{\cx}{\gapX*(\col+1) + \cardW*\col + \cardW/2} \pgfmathsetmacro{\cy}{\Aheight - (\gapY*(\row+1) + \cardH*\row + \cardH/2)} \node at (\cx,\cy) {\CardBack{Back}}; } \end{tikzpicture} \end{document}

  • Boxed text + figure on the left
    by Jacopo Remondina on December 8, 2025 at 11:11 am

    I would like to have a framed box that contains some (justified) text and, on the side, a figure with its label and caption, something like this: I think/I read on other threads that some starting points may be the "wrapfigure" package, parbox(es) and/or minipages, but I cannot find an example where these features are used the way I want, and I cannot understand it by myself (tried the whole morning). Anyone has any idea? Thanks in advance, Jacorem EDIT: what I tried so far: wrap text around a figure inside a floating box In this case, the float is the whole box and the caption/label is given to it + the image is at the left of the text. I would like to give the caption to only the image and place it under the image itself. I think that one can adapt a little bit the code of this example, but since I do not want the whole box to be treated as a figure (as I said, I want the caption to be put under the figure, not somewhere else), I changed the figure environment to a minipage one, and I put the figure environment inside the sbox0 ==> compilation error cannot really understand how to use the \hangafter/\hangindent command to switch left and right I'm not sure that simple moving the caption in the \sbox0 may work Floating "Tip" box using wrapfigure No figure Making a boxed minipage environment No figure tried mixing this and several other possibilities (including creating a single cell table) starting with code-less suggestions found online, resulting in error or very bad layout (like text overlapping itself and/or the reduced textwith perduring in the whole section)

  • How to layout the two-side notes using Latex
    by xuehao on December 8, 2025 at 4:49 am

    The following is an example from an English book. I'm planning to rewrite it in latex. The layout is with an itemize of points in the middle, and with "CONNECTIONS" notes along the two sides. I tried to solve it using TikZ, but the vertical align is hard to control. \documentclass{article} \usepackage{graphicx} % Required for inserting images \usepackage{tikz} \begin{document} \begin{center} \begin{tikzpicture} \node[draw,text width=3.1cm] at (0cm,0) {CONNECTIONS Because \\ \vspace{\baselineskip} It \\ and \\ Though \\ Since ... not \\ only \\ but also \vspace{\baselineskip} }; \node[draw,text width=6.3cm] at (5.1cm,0) {\begin{center} POINTS \end{center} 1. Brazil needs to be developed. \\ 2. New city, Brasilia, built 600 miles, Rio. \\ 3. Designed Lucio Costa. \\ 4. Became capital 1960. \\ 5. Planned for modern living. \\ 6. People at first reluctant to go. \\ 7. 1960 - population increasing. \\ 8. Established as capital. }; \node[draw,text width=3.1cm] at (10.2cm,0) {CONNECTIONS \vspace{\baselineskip} which was built \\ and which \\ \vspace{\baselineskip} It \\ but \\ However, with the increase }; \end{tikzpicture} \end{center} \end{document} Anyone could give me any clever solution for this task? Final solution I tried by myself: using a trick of \phantom to solve the vertical align. \documentclass{article} \usepackage{graphicx} % Required for inserting images \usepackage{tikz} \begin{document} \begin{center} \begin{center} \begin{tikzpicture} \node[draw=none,text width=3.1cm] at (0cm, 0) { CONNECTIONS \\ \textit{Because} \\ \phantom{a} \\ \phantom{a} \\ \textit{It} \\ \textit{and} \\ \textit{Though} \\ \phantom{a} \\ \textit{Since ... not only} \\ \phantom{a} \\ \textit{but also} }; \draw[line width=1pt] (1.8cm,2.1cm) -- (1.7cm,2.1cm) -- (1.7cm,0.9cm) -- (1.8cm,0.9cm); \draw[line width=1pt] (1.8cm,0.7cm) -- (1.7cm,0.7cm) -- (1.7cm,-0.1cm) -- (1.8cm,-0.1cm); \draw[line width=1pt] (1.8cm,-0.3cm) -- (1.7cm,-0.3cm) -- (1.7cm,-1cm) -- (1.8cm,-1cm); \draw[line width=1pt] (1.8cm,-1.2cm) -- (1.7cm,-1.2cm) -- (1.7cm,-2.5cm) -- (1.8cm,-2.5cm); \draw[line width=1pt] (8.4cm,2.1cm) -- (8.5cm,2.1cm) -- (8.5cm,1.8cm) -- (8.4cm,1.8cm); \draw[line width=1pt] (8.4cm,1.6cm) -- (8.5cm,1.6cm) -- (8.5cm,-0.1cm) -- (8.4cm,-0.1cm); \draw[line width=1pt] (8.4cm,-0.3cm) -- (8.5cm,-0.3cm) -- (8.5cm,-1cm) -- (8.4cm,-1cm); \draw[line width=1pt] (8.4cm,-1.2cm) -- (8.5cm,-1.2cm) -- (8.5cm,-2.5cm) -- (8.4cm,-2.5cm); \node[draw=none,text width=6.3cm] at (5.1cm,0) { \phantom{aaaaaaaaaaaa} POINTS \\ 1. Brazil needs to be developed. \\ 2. New city, Brasilia, built 600 miles, \\ Rio. \\ 3. Designed Lucio Costa. \\ 4. Became capital 1960. \\ 5. Planned for modern living. \\ 6. People at first reluctant to go. \\ 7. 1960 - population increasing. \\ \phantom{a} \\ 8. Established as capital. }; \node[draw=none,text width=3.1cm] at (10.2cm,0) { CONNECTIONS \\ \phantom{a} \\ \textit{which was built} \\ \phantom{a} \\ \textit{and which} \\ \phantom{a} \\ \textit{It} \\ \textit{but} \\ \textit{However, with the} \\ \textit{increase} \\ \phantom{a} \\ }; \end{tikzpicture} \end{center} \end{document}

  • Drawing a sphere and ellipsoid together
    by Knudsen on December 8, 2025 at 4:00 am

    I would like to draw a sphere, of radius 3, and an ellipsoid of semi-axis 2, 3 and 4 together. They intersect at two great circles on the sphere (marked in red). I started out with the sphere and the great circles: \documentclass[border=2mm]{standalone} \usepackage{tikz} \usetikzlibrary{3dtools}% https://github.com/marmotghost/tikz-3dtools \begin{document} \begin{tikzpicture}[3d/install view={phi=120,theta=70},line cap=butt, line join=round,declare function={R=3;},c/.style={circle,fill,inner sep=1pt}] \path (0,0,0) coordinate (O) ; \draw[blue,3d/screen coords] (O) circle[radius=R]; \shade[ball color=white,3d/screen coords,opacity=0.7] (O) circle[radius=R]; % \shade[ball color=blue!30,3d/screen coords,opacity=0.7,xscale=2,yscale=3,zscale=4] (O) circle[radius=1]; \path pic[blue]{3d/circle on sphere={R=R,C={(O)}}}; \path pic[red]{3d/circle on sphere={R=R, n={(0.592,0,-1)}}}; % plane x = sqrt{7/10) z \path pic[red]{3d/circle on sphere={R=R, n={(0.592,0,1)}}}; % plane x = sqrt{7/10) z \draw[3d/hidden] (0,0,0) -- (0,0,R) (O)--(R,0,0) (O)--(0,R,0) (O)--(0,-R,0); \draw[3d/visible, -stealth] (R,0,0) -- (R + 4,0,0) node[below]{$x$}; \draw[3d/visible, -stealth] (0,R,0) -- (0,R + 1,0) node[right]{$y$}; \draw[3d/visible, -stealth] (0,0,R) -- (0,0,R + 1.5) node[above]{$z$}; \end{tikzpicture} \end{document} and everything is right so far: but when I remove the comment on the line that I would expect to draw the ellipsoid \shade[ball color=blue!30,3d/screen coords,opacity=0.7,xscale=2,yscale=3,zscale=4] (O) circle[radius=1]; I get something that is far from what I expected, including the fact that the zscale is not understood. How can one add the intersecting elipsoide to this image?

  • How to add a mirror like shadow effect to a title?
    by Cham on December 8, 2025 at 12:44 am

    I would like to add a reversed gray shadow under a title to mimmic a mirror effect. How can we do that with standard pdflatex (the live tex distribution)? Currtently, the code below only add a dull projected shadow under the title. Is there a way to vertically reverse the shadow? Here's a MWE to edit and play with: \documentclass[11pt,twoside]{book} \usepackage[T1]{fontenc} \usepackage[tt=false]{libertinus} \usepackage[french]{babel} \usepackage[stretch=50]{microtype} \usepackage[letterpaper,left=1.25in,right=1in,top=0.5in,bottom=0.5in,includeheadfoot,headheight=15pt]{geometry} \usepackage[dvipsnames]{xcolor} \usepackage{shadowtext} \begin{document} \begin{titlepage} \shadowoffsetx{2.5pt} \shadowoffsety{3.5pt} \shadowcolor{gray!40} \centering \vspace*{\baselineskip} \vfill {\textcolor{black}{\fontsize{26}{0}\selectfont\sffamily\textbf{\shadowtext{DOCUMENT TITLE}}}} \\[2.5\baselineskip] \vfill {\textcolor{black}{\huge\sffamily Author}} \vfill \end{titlepage} Text \end{document}

  • Center a table in a list
    by mf67 on December 7, 2025 at 10:29 pm

    How do I get the table to respect the “new” left margin/indent in a list so it centres correctly, rather than the full-page text width? \documentclass[10pt]{book} \usepackage{booktabs} \usepackage{tabularx} \usepackage{floatrow} \usepackage[singlelinecheck=false]{caption} \usepackage{lipsum} \begin{document} \begin{enumerate} \item \lipsum[1][1-5] \begin{table}[H] \ttabbox {\caption{Grupp 2}} {\begin{tabularx}{0.7\textwidth}{XX} \toprule \multicolumn{2}{c}{Maschile} \\ Singolare -o & Plurale -i\\ \midrule ragazzo & ragazzi\\ giardino & giardini\\ \bottomrule \end{tabularx}} \end{table} \lipsum[1][1-5] \end{enumerate} \begin{table}[H] \ttabbox {\caption{Grupp 2}} {\begin{tabularx}{0.7\textwidth}{XX} \toprule \multicolumn{2}{c}{Maschile} \\ Singolare -o & Plurale -i\\ \midrule ragazzo & ragazzi\\ giardino & giardini\\ \bottomrule \end{tabularx}} \end{table} \end{document} As shown in the image, the first table in the list is centred within the margins of the whole page.

  • Section Number Alignment and Wrapping a Figure with Text [closed]
    by Chathura on December 7, 2025 at 7:45 pm

    \documentclass[11pt,a4paper]{article} % Use XeLaTeX to compile % Go to Menu > Compiler and set it to XeLaTeX \usepackage{wrapfig} \usepackage{fontspec} \usepackage{polyglossia} \usepackage{siunitx} \usepackage[export]{adjustbox} \usepackage{ragged2e} \usepackage{blindtext} \usepackage{multicol} \setlength{\columnsep}{0.2cm} \usepackage{graphicx} \usepackage{caption} \usepackage{subcaption} %Paper margin>> \usepackage{geometry} \geometry{a4paper, hmargin={1.3cm,1.6cm}, top=1.6cm, bottom=1.7cm } %Paper margin<< %Border Of the document>> \usepackage{background} \usetikzlibrary{calc} \SetBgScale{1} \SetBgAngle{0} \SetBgColor{black} \SetBgContents{ \begin{tikzpicture}[overlay,remember picture] \draw [line width=1pt,rounded corners=10pt,] ($ (current page.north west) + (1.5cm,-1.5cm) $) rectangle ($ (current page.south east) + (-1.5cm,1.5cm) $); \end{tikzpicture}} %Border Of the document<< % --- Font Declarations --- % Set the main font for the document (e.g., Sinhala) \setmainfont[Script=Sinhala]{AbhayaLibre-Regular.ttf} % Define a new command for English numbers and text % \newfontfamily creates a font family that you can call when needed % We'll use a standard serif font like Latin Modern Roman for numbers \newfontfamily\englishfont{Times new roman} % Create a command for easy switching % \si for Sinhala text, which uses the main font \newcommand{\si}[1]{#1} % \en for English text or numbers \newcommand{\en}[1]{{\englishfont #1}} % --- Language Setup --- % Set the main document language to Sinhala \setdefaultlanguage{sinhala} % Set English as another language \setotherlanguage{english} \begin{document} \begin{multicols*}{2} \section{(Newton's law of motion for objects moving in a rough horizontal plane)} \begin{enumerate} \item \includegraphics[]{image.jpg} Newton's laws of motion are fundamental principles that describe the relationship between the motion of an object and the forces acting on it. These laws, which are the foundation of classical mechanics, can be paraphrased as follows: \begin{enumerate} \item First Law: A body remains at rest, or in motion at a constant speed in a straight line, unless it is acted upon by a force. \item Second Law: At any instant of time, the net force on a body is equal to the body's acceleration multiplied by its mass or, equivalently, the rate at which the body's momentum is changing with time. \item Third Law: When two objects interact, they apply forces to each other of equal magnitude and opposite direction. \end{enumerate} \item \includegraphics[]{image.jpg} Newton's laws of motion are fundamental principles that des... \begin{enumerate} \item First Law: A body remains at rest, or in motion at a constant speed in a straight line, unless it is acted upon by a force. \item Second Law: At any instant of time, the net force on a body is equal to the body's acceleration multiplied by its mass or, equivalently, the rate at which the body's momentum is changing with time. \item Third Law: When two objects interact, they apply forces to each other of equal magnitude and opposite direction. \end{enumerate} \end{enumerate} \end{multicols*}{} \end{document}

  • How to use OT3 encoding? Does it redefine existing macros?
    by Grzegorz Brzczyszczykiewicz on December 7, 2025 at 11:54 am

    Please help. OT3 is a very old encoding and I want to use it for stylistic reasons to make my document look old. EDIT: I figured out how, but I have a new question: does OT3 and \usepackage{ipa} redefine existing macros from other encodings?

  • Vertical continues line, no \cmidrule gap, in table with booktabs looks [duplicate]
    by Fr3d on December 7, 2025 at 10:46 am

    Good morning, I would like to know if there is a tweak, or better an other package that would let me have a continues vertical line in table IF it doesn't intersect any horizontal line. As I know booktabs wasn't designed for vertical lines. I'm using a lot of \cmidrule{a-b}, yet it leave a gap in the space where its not drawn. The code: \documentclass[a4paper, % svgnames, dvipsnames, % landscape, 9pt ]{article} %\usepackage{fontspec} \usepackage{ifthen} \usepackage[dvipsnames,table]{xcolor} % già presente in GRAPHICX?? \usepackage{graphicx} % Required for inserting images \usepackage{tikz} \usepackage{geometry}%[a4paper, total={27cm, 18cm}]{geometry} % invertiti per il fatto che è di LARGO \geometry{ %%impostiamo i margini personalizzati per il CV a4paper, left=6mm, right=6mm, top=4mm, bottom=4mm, } \usepackage{ragged2e} % toglie il rientro anglosassone di inizio paragrafo \usepackage{adjustbox} % \usepackage{lscape} \usepackage[small,compact]{titlesec} %% Small Compact => che fa?? \usepackage{amssymb} \usepackage{amsmath} \usepackage{mathtools} %\usepackage[printwatermark,%disablegeometry %]{xwatermark} %\usepackage{draftwatermark} %scive solo BOZZA, poche personalizzazioni => § XWATERMARK § %% Aggiunta Watermark in stampa \usepackage{xparse} %% Creare comandi %\usepackage{pgf} % \usepackage{tabulary} \usepackage{booktabs, tabularx} \usepackage{dcolumn} \usepackage[]{mdframed} \usepackage{multirow} \usepackage{multicol} \setlength{\columnsep}{9.5mm} \usepackage{makecell} \usepackage{pbox} \usepackage[most]{tcolorbox} \usepackage{footnote} \usepackage{tablefootnote} \usepackage[stable]{footmisc} %% Footnote nei titoletti \usepackage[narrower, %% Margine supplementare, ~ in linea con la tabella notessf %% Stile in Sans Serif ]{parnotes} \usepackage{enumerate} % in quest'ordine altrimenti non trova i vari parsep \usepackage{enumitem} \usepackage{array} % OPZ ma richiesto per LOGIX.pkg \usepackage{hyperref} %% Dopo tablefootnote o causa problemi %\usepackage{fdsymbol} % simbolini speciali % tolto per errore con "math$ definition" \usepackage{pifont} % permette di avere i simbolini del bridge % \usepackage{arev} % permette di avere i simbolini del bridge \usepackage{fontspec} \usepackage{anyfontsize} %\usepackage{fontawesome} \usepackage{fontawesome5} %\usepackage{MnSymbol} % tolto per errore con "math$ definition" % \usepackage[dvipsnames]{xcolor} % già presente in GRAPHICX?? %%%%%%%%%%%%%%%%%%%%%%%%%%% %%%% Math cursive bold \usepackage{mathptmx}% http://ctan.org/pkg/mathptmx \DeclareMathAlphabet{\mathbfit}{T1}{lmr}{b}{it} %\usepackage{unicode-math} %\setmathfont{rm} %%%%%%%%%%%%%%%%%%%%%%%%%%% %% Simboli per il bridge \def\picche{\textcolor{blue}{\ding{171}}$\,$} \def\cuori{\textcolor{Red}{\ding{170}}$\,$} \def\quadri{\textcolor{YellowOrange}{\ding{169}}$\,$} \def\fiori{\textcolor{OliveGreen}{\ding{168}}$\,$} \newcommand{\cParnote}[2][black]{% %% Numerino del PARNOTES colorato {\color{#1}\parnote{#2}}% } %% Comando per avere le licite del contratto. \newcommand\biddingBox[3][]{% \ifthenelse{\equal{#1}{}} %% Condizione %% True statement { \Biddingbox{\textbf{#2}$\,${\textbf{#3}}} } %% False statement { % \ifthenelse{\equal{#1}{Alert}}%% Condizione % %% True statement % { \BiddingboxAlert{\textbf{#2}$\,${\textbf{#3}}} % } % %% False statement % { % \Biddingbox{\textbf{#2}$\,${\textcolor{#3}{\scriptsize\faAsterisk$\!$}}} % } } } \NewDocumentCommand{\Livello}{ O{Fuchsia} }{ \textcolor{#1}{\scriptsize\faAsterisk$\!$} } \newtcbox{\Biddingbox}[1][white]{on line, arc=1.6pt, colback=white, colframe=black, % before upper={\rule[-3pt]{0pt}{10pt}}, boxrule=.55pt, %right skip=-3.35pt, left skip=-1.35pt, right skip=-.55ex, left skip=-.09ex, boxsep=0pt, left=1.49pt, right=1.49pt, top=1.25pt, bottom=1.25pt }%\hspace{-6em} \newtcbox{\BiddingboxAlert}[1][white]{on line, enhanced, nobeforeafter,%tcbox raise base, boxrule=0.55pt,%top=0mm,bottom=0mm, top=1.25pt, bottom=1.25pt, %left=1.49pt, right=1.49pt, %right=0mm, left=2.8mm, arc=1.6pt, right skip=-.95ex, left skip=-.39ex, boxsep=0pt,%before upper={\vphantom{dlg}}, colframe=blue,%coltext=green!25!black, %font=\bfseries, colback=white, overlay={\begin{tcbclipinterior} \fill[blue!95!OliveGreen!67!black] (frame.south west) rectangle node[text=white!82!black,font=\sffamily\bfseries\scriptsize,%rotate=90 ] {A} ([xshift=2.73mm]frame.north west);\end{tcbclipinterior} } } %% Visto \newcommand{\OKay}{\textcolor{ForestGreen}{\ding{52}}$\,$} %% Croce \newcommand{\NotOk}{\textcolor{red}{\ding{55}}$\,$} \begin{document} \thispagestyle{empty} % togliamo il numero di pagina \setmainfont{Arial} %\SetWatermarkText{BOZZA} %\SetWatermarkScale{1} %\DraftwatermarkOptions{stamp=true,color=red!35} %\newwatermark[allpages,color=red!35,angle=45,scale=7,xpos=0,ypos=0]{BOZZA} \begin{multicols*}{2} %\vspace{-2.3mm} \section*{Conta Punti Onore} %\vspace{-1.7mm} \begin{center} \fontsize{8pt}{9pt}\selectfont \setlength{\tabcolsep}{2.5pt} \begin{tabular}{l|l} \toprule Conta PO & Possibili aperture \\ \midrule $\bullet$ 6-10 PO& \biddingBox[]{2}{\quadri}, \biddingBox[]{2}{\cuori}, \biddingBox[]{2}{\picche} \\ $\bullet$ 12-19 PO & \biddingBox{1}{\Livello} (Livello 1)\\ % \hspace{2mm} $\smallblacktriangleright$ 15-17 PO & \SA{1} \\ \hspace{2mm} $\blacktriangleright$ 15-17 PO & \biddingBox[]{1}{SA} \\ $\bullet$ 20-21 PO & \biddingBox[]{2}{SA} \\ $\bullet$ 22-23 PO & \biddingBox[]{2}{\fiori}, \biddingBox[]{2}{\quadri}\\ \bottomrule \end{tabular} \end{center} %\vspace{-1.6mm} Il numero di prese è facilmente determinabile con il punteggio di linea, %\vspace{-1.63mm} \begin{center} % \scriptsize \fontsize{8pt}{9pt}\selectfont \setlength{\tabcolsep}{2.5pt} \begin{tabular}{r|c|c|c|c|c|c|c} \toprule % \emph{5$^{\circ}$} \picche / \cuori & \Picche{1} o \Cuori{1} \\ % \emph{4$^{\circ}$} \quadri & \Quadri{1} \\ % \emph{altro} & \Fiori{1}\\ PO & 20-21 & 22-23 & 24-25 & 26-28 & 29-32 & 33-34 & 35-37 \\ Prese& \textbf{7}& \textbf{8}& \textbf{9}& \textbf{10}& \textbf{11}& \textbf{12}& \textbf{13} \\ \midrule \multirow{2}{*}{\emph{\fontsize{7pt}{9pt}\selectfont \bfseries Manches}} & & & \multirow{2}{*}{\biddingBox[]{3}{SA}} & \biddingBox[]{4}{\picche}& \biddingBox[]{5}{\quadri} & \multirow{2}{*}{\bfseries SLAM} & \multirow{2}{*}{\bfseries G-slam} \\ & & & &\biddingBox[]{4}{\cuori} &\biddingBox[]{5}{\fiori} & & \\ \bottomrule \end{tabular} \end{center} \subsection{Steyman} \label{sec:Steyman} %\vspace{-2.3mm} Per invitare una ricerca ai nobili per una possibile \emph{Manche}. %\vspace{-3.2mm} \begin{center} \fontsize{8pt}{9pt}\selectfont \setlength{\tabcolsep}{2.5pt} \begin{tabular}{r|rl|rl|rl} \toprule Apertore & \multicolumn{2}{c|}{Appoggio} & \multicolumn{2}{c|}{Apertore} & \multicolumn{2}{c}{Compagno} \\ \midrule \multirow{8.5}{*}{\biddingBox{1}{SA}} & \multirow{8.5}{*}{\biddingBox{2}{\fiori} \cParnote[magenta]{Ora mai è diventata d'uso comune, e non si allerta più}} & \multirow{8.5}{*}{\makecell[l]{ 8+ PO \\con $\mathbfit{4}^{\circ}$\cuori\\ o \emph{$\mathbfit{4}^{\circ}$}\picche o\\ entramabi}} & \biddingBox{2}{\quadri} & \makecell[l]{ no \emph{$\mathbfit{4}^{\circ}$}\\ nobili} & \biddingBox{3}{SA} & \\ \cmidrule{4-7} & & & \biddingBox{2}{\cuori} & \makecell[l]{appoggio\\ \cuori \emph{$\mathbfit{4}^{\circ}$}} & \biddingBox{3}{SA} & \makecell[l]{\biddingBox{4}{\cuori} se ha \\appoggio \emph{$\mathbfit{5}^{\circ}$}} \\ \cmidrule{4-7} & & & \biddingBox{2}{\picche} & \makecell[l]{appoggio\\ \picche \emph{$\mathbfit{4}^{\circ}$}} & \biddingBox{3}{SA} & \makecell[l]{\biddingBox{4}{\picche} se ha \\appoggio \emph{$\mathbfit{5}^{\circ}$}} \\ \cmidrule{4-7} & & & \biddingBox{2}{SA} & \makecell[l]{entrambi \\Nobili \emph{$\mathbfit{4}^{\circ}$}} & \multicolumn{2}{c}{\makecell[l]{Nobile (\biddingBox{3}{\picche} / \biddingBox{3}{\cuori}) \\assente o debole}} \\ \bottomrule \end{tabular} \end{center} \renewcommand{\parnoteintercmd}{\\} %% Per averle una sotto l'latra il "a capo" ossia "\\" \renewcommand{\parnotevskip}{1pt} %% Per metterle più in alto \vspace{-3.1mm} %% Done to cram more explanation tables into the coloumn \parnotes %\vspace{-5.9mm} %%%%%%%%---------------------------------------------------- %% %% All the other Bidding convetions as well as the "Contre" explaination %% %%%%%%%%____________________________________________________ \end{multicols*} \end{document} Leaving this ghost like line. I like the booktabs for its horizontal readability, as it gives priority to horizontal lines vs vertical lines when enclosing cells, yet this gap annoys me. EDIT #1 What I've noticed is that booktabs gives you a gap in your vertical line when drawing a \cmidrule{a-b}, but it's totally absent when the \cmidrule is taken out. Again I'm asking about a way to prioritize horizontal lines, meaning when absent, the vertical should be continued. I searching for a solution different than this solution there, as it's deeply discouraged Above pic has no \cmidrule between the 2H and 2S bidding, magically, the gap in the vertical line separating 1NT and 2C also vanishes. Hence my statement about getting rid of this ghost line for every partial \midrule; it looks like the \cmidrule command is behaving like a \midrule, only difference is the visible horizontal line drawn from the column a to b. The answers at the question, all have completely enclosed cells. I'm going for this "design idea" because it's the better readability in my Bridge course with a 28-86 age range. EDIT #2 To clarify: the discontinued vlines in booktabs is OK, but ONLY between 2 hlines. As alrady wrote in Edit #1, the vertical gap in the vlines in case of no hlines is my problem: I'm searching a way to close the gap. Drawing incoming.....

  • tex.print(value) fails with "Missing $" Error
    by xcn on December 7, 2025 at 2:45 am

    This LuaLaTeX code tries to process key-value pairs from a Lua string. The Lua function parse_kv_pairs takes a string containing comma-separated key-value pairs, removes whitespace, and splits the string by commas. tex.print(key .. "\\par") can print keys properly, but tex.print(value) can't output raw Lua strings (e.g., "260", "174", ...) and produces a Missing $ inserted. error. How can I fix this error? \documentclass[12pt]{article} \usepackage{luacode} \begin{luacode*} function parse_kv_pairs(kv_string) local pairs = {} for pair in string.gmatch(kv_string:gsub("%s+", ""), "([^,]+)") do local key, value = pair:match("([^=]+)=(.+)") if key and value then tex.print(key .. "\\par") -- tex.print(value) end end end \end{luacode*} \NewDocumentCommand{\defvar}{m}{% \directlua{parse_kv_pairs("#1")}% } \begin{document} \defvar{ m = 260, n=174, lj=5.68, bb=0.2, lo=lj+bb, h=190, ta=30, tb=20, qj = math.atan(n/m) * 180 / 3.1416, co = round(m / (m^2 + n^2)^0.5, 3) } \end{document}

  • Get the height of the first line of a paragraph
    by Sergey Slyusarev on December 6, 2025 at 11:17 pm

    Suppose I have a paragraph, and the first line of it may or may not contain an inline picture or a big character with the height greater than that of normal characters. Something like this: Lorem ipsum dolor sit amet, {\huge X} consectetur adipiscing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo consequat. Duis aute irure dolor in reprehenderit in voluptate velit esse cillum dolore eu fugiat nulla pariatur. Excepteur sint occaecat cupidatat non proident, sunt in culpa qui officia deserunt mollit anim id est laborum. I need a way to get the height of this first line with this character after the paragraph is already set. Something like a macro of the form \lastParagraphFirstLineHeight which would return the value. Is there way to do it in plain TeX, or, if not, maybe in LuaTeX?

  • How to set font family in `minted` style to an arbitrary font?
    by yury10578 on December 6, 2025 at 8:36 pm

    I'm trying to set up tcolorbox blocks using minted engine. I want to use a font of my choice in those, not the default monospaced one (or tt or helvetica, per minted manual). Let's say I want 'Code New Roman'. In the following MWE the commented out style-setting line works, but requires of me knowing that (internal?) format. The line without \exfont works but sets the document's default font for tcolorbox blocks. If the line with \exfont is set last and so is actually used in listings, listings do not compile. At the same time, this tex fragment works in the main body of document. Is it possible to make the line with \exfont work? Or do that auto-adjustment to a specific font in some other way? \documentclass{article} \usepackage{fontspec} \usepackage[all]{tcolorbox} \newfontfamily\exfont{Code New Roman} \newtcblisting{exprog}{ listing only, listing engine=minted,. % minted options={ fontfamily={CodeNewRoman(0)} }, % minted expects that sort of string minted options={ fontfamily={\exfont\csname f@family\endcsname} }, % doesn't work minted options={ fontfamily={\csname f@family\endcsname} }, % works but sets the default font for tcolorbox blocks } \begin{document} {\exfont\csname f@family\endcsname} % works \begin{exprog} ts( n : integer ) : function: double; \end{exprog} \end{document}

  • Accented character type \e`
    by Sebastiano on December 6, 2025 at 6:02 pm

    Sometimes I see the accented è written in LaTeX sources as a command like this: \`e I've always wondered the reason. On my laptop (a modern machine), I can type è directly using the keyboard, and the document compiles without any issues. Is the use of "`e" due to a specific keyboard layout (for example on Mac), or is it just a historical LaTeX convention?

  • Using Perl from Git installation for latexdiff
    by Daneel Olivaw on December 6, 2025 at 2:18 pm

    Problem I am encountering a problem which has already been raised in this site: Can't locate Algorithm/Diff.pm in @INC (you may need to install the Algorithm::Diff module) Can't locate Algorithm/Diff.pm in @INC (you may need to install the Algorithm::Diff module) - solution to earlier question does not work Namely when I try to run latexdiff old.tex new.tex > diff.tex I am getting the following exception: Can't locate Algorithm/Diff.pm in @INC (you may need to install the Algorithm::Diff module) (@INC entries checked: C:/Users/<user_name>/AppData/Local/Programs/MiKTeX/scripts/latexdiff/ /usr/lib/perl5/site_perl /usr/share/perl5/site_perl /usr/lib/perl5/vendor_perl /usr/share/perl5/vendor_perl /usr/lib/perl5/core_perl /usr/share/perl5/core_perl ) at C:/Users/<user_name>/AppData/Local/Programs/MiKTeX/scripts/latexdiff/latexdiff line 256. BEGIN failed--compilation aborted at C:/Users/<user_name>/AppData/Local/Programs/MiKTeX/scripts/latexdiff/latexdiff line 256. How can I fix this issue? Should I retry some of the below actions, but by modifying paths, etc.? Solutions tried No answers have been provided to the 2nd question. Re the first one, unfortunately the most upvoted answer does not work for me: when I try to run perl -MCPAN -e "install Algorithm::Diff" in bash, I am getting the following error: Can't locate CPAN/Author.pm in @INC (you may need to install the CPAN::Author module) (@INC entries checked: /usr/lib/perl5/site_perl /usr/share/perl5/site_perl /usr/lib/perl5/vendor_perl /usr/share/perl5/vendor_perl /usr/lib/perl5/core_perl /usr/share/perl5/core_perl ) at /usr/share/perl5/core_perl/CPAN.pm line 19. BEGIN failed--compilation aborted at /usr/share/perl5/core_perl/CPAN.pm line 19. Compilation failed in require. BEGIN failed--compilation aborted. The second answer also does not work either as pacman is not recognized. I have tried this answer which suggests adding environment variables PERL5LIB and PERLLIB but with no success. I have also found this other question but the indications given in the answers do not seem applicable to my case, or have not worked. Additional information When I run where perl in bash, I see the used installation comes from Git: $ where perl C:\Program Files\Git\usr\bin\perl.exe I actually see the following structure in the Git installation: Git\usr | |__bin\ | |__core_perl\ | |__vendor_perl\ | | ... | |__perl.exe | |__lib\ | |__perl5\ | |__core_perl\ | |__vendor_perl\ | |__share\ |__perl5\ |__core_perl\ |__vendor_perl\

  • How to draw cone with infinitely many extremal rays
    by Fradns on December 6, 2025 at 10:21 am

    Suppose we are working in the three-dimensional real vector space V. A cone is a subset C of V such that if an element v of V lies in C, then all of its nonnegative multiples also lie in C. I would like to draw, using TikZ, a cone that simulates infinitely many extremal rays, all accumulating toward a fixed one. A section of the cone should therefore look like a “polygon with infinitely many sides”. For example, the cone here Tikz: cones with a wide base is a circular one. I would like mine to be "polyhedral" away from the accumulation ray. How would you do that?

  • Inserting a Graphical Image as a Cover Page in Latex Thesis
    by ranaya on December 6, 2025 at 8:11 am

    I am compiling my thesis using Latex, which eventually generates a PDF file. In addition to its textual content, I want to insert a graphical image (.png) as its cover page. This is what I am doing with the help of titlepic, pdfpages Latex packages. In my permeable: \usepackage{titlepic} \usepackage{pdfpages} In my document class: \begin{document} \includepdf[pages=1]{./figures/ThesisCover.png} \end{document} Now this brings the following Latex error: ! Undefined control sequence. l.31 \if@titlepage The control sequence at the end of the top line of your error message was never \def'ed. If you have misspelled it (e.g., \hobx'), type I' and the correct spelling (e.g., `I\hbox'). Otherwise just continue, and I'll forget about whatever was undefined. Can anybody shed a light on how to solve this problem ? Thanks

  • The method of marching cubes (for implicit surfaces) is very slow, and does not reach the level of accuracy of existing pictures. How to improve?
    by Jasper on December 6, 2025 at 5:58 am

    I was inspired by some of the illustrations in https://math.stackexchange.com/a/46222. I wanted to try graphing implicit surfaces myself, and came across the method of marching cubes. See https://paulbourke.net/geometry/polygonise/. I collaborated with AI to produce the following code. If you are opposed to AI, this is your fair chance to recognize this fact and not participate in answering this question. It is extremely slow for many subdivisions, and unfortunately, I need many subdivisions to even remotely approach the desired graphic. The desired graphic is something like this: I would very much like for my attempt to be almost isomorphic (same shape) to the original picture. I cut out a large portion of occlusion code to get this to run in my lifetime. I hope to use far less triangles, and for it to adapt to regions of high and low density if possible. One idea I had was to take an initial coarse subdivision set, then up the samples in regions where the surface was not found up to a maximum depth. Then we could only sample highly where it is needed. This is just speculation though, and sounds very difficult to achieve. Obviously the desired technology exists currently, because of the desired picture's existence. MWE: \documentclass[tikz,border=3mm]{standalone} \usepackage{luacode} \begin{document} % Run LuaTeX code to generate the triangles \begin{luacode*} -- Parameters local nx, ny, nz = 80, 80, 80 -- grid resolution local x0, y0, z0 = -1, -1, -1 local x1, y1, z1 = 1, 1, 1 local isovalue = 0.0 local dx = (x1-x0)/nx local dy = (y1-y0)/ny local dz = (z1-z0)/nz -- Scalar function local function f(u, v, w) return (2.92*(u-1)*u*u*(u+1) + 1.7*v*v)^2 * ((v*v - 0.88)^2) + (2.92*(v-1)*v*v*(v+1) + 1.7*w*w)^2 * ((w*w - 0.88)^2) + (2.92*(w-1)*w*w*(w+1) + 1.7*u*u)^2 * ((u*u - 0.88)^2) - 0.02 end -- On-demand vertex value local function vertex_value(i,j,k) return f(x0 + i*dx, y0 + j*dy, z0 + k*dz) end -- Edge bisection local function edge_root(p0,p1,v0,v1,tol) local a,b = 0,1 local fa,fb = v0,v1 for iter=1,20 do local m = 0.5*(a+b) local pm = { x = p0.x + m*(p1.x-p0.x), y = p0.y + m*(p1.y-p0.y), z = p0.z + m*(p1.z-p0.z) } local fm = f(pm.x, pm.y, pm.z) if math.abs(fm)<tol then return pm end if fa*fm<=0 then b,fb = m,fm else a,fa = m,fm end end return {x=p0.x+0.5*(p1.x-p0.x), y=p0.y+0.5*(p1.y-p0.y), z=p0.z+0.5*(p1.z-p0.z)} end -- Minimal demo marching cubes table -- https://paulbourke.net/geometry/polygonise/ local raw_table = {{-1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1}, {0, 8, 3, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1}, {0, 1, 9, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1}, {1, 8, 3, 9, 8, 1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1}, {1, 2, 10, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1}, {0, 8, 3, 1, 2, 10, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1}, {9, 2, 10, 0, 2, 9, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1}, {2, 8, 3, 2, 10, 8, 10, 9, 8, -1, -1, -1, -1, -1, -1, -1}, {3, 11, 2, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1}, {0, 11, 2, 8, 11, 0, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1}, {1, 9, 0, 2, 3, 11, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1}, {1, 11, 2, 1, 9, 11, 9, 8, 11, -1, -1, -1, -1, -1, -1, -1}, {3, 10, 1, 11, 10, 3, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1}, {0, 10, 1, 0, 8, 10, 8, 11, 10, -1, -1, -1, -1, -1, -1, -1}, {3, 9, 0, 3, 11, 9, 11, 10, 9, -1, -1, -1, -1, -1, -1, -1}, {9, 8, 10, 10, 8, 11, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1}, {4, 7, 8, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1}, {4, 3, 0, 7, 3, 4, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1}, {0, 1, 9, 8, 4, 7, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1}, {4, 1, 9, 4, 7, 1, 7, 3, 1, -1, -1, -1, -1, -1, -1, -1}, {1, 2, 10, 8, 4, 7, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1}, {3, 4, 7, 3, 0, 4, 1, 2, 10, -1, -1, -1, -1, -1, -1, -1}, {9, 2, 10, 9, 0, 2, 8, 4, 7, -1, -1, -1, -1, -1, -1, -1}, {2, 10, 9, 2, 9, 7, 2, 7, 3, 7, 9, 4, -1, -1, -1, -1}, {8, 4, 7, 3, 11, 2, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1}, {11, 4, 7, 11, 2, 4, 2, 0, 4, -1, -1, -1, -1, -1, -1, -1}, {9, 0, 1, 8, 4, 7, 2, 3, 11, -1, -1, -1, -1, -1, -1, -1}, {4, 7, 11, 9, 4, 11, 9, 11, 2, 9, 2, 1, -1, -1, -1, -1}, {3, 10, 1, 3, 11, 10, 7, 8, 4, -1, -1, -1, -1, -1, -1, -1}, {1, 11, 10, 1, 4, 11, 1, 0, 4, 7, 11, 4, -1, -1, -1, -1}, {4, 7, 8, 9, 0, 11, 9, 11, 10, 11, 0, 3, -1, -1, -1, -1}, {4, 7, 11, 4, 11, 9, 9, 11, 10, -1, -1, -1, -1, -1, -1, -1}, {9, 5, 4, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1}, {9, 5, 4, 0, 8, 3, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1}, {0, 5, 4, 1, 5, 0, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1}, {8, 5, 4, 8, 3, 5, 3, 1, 5, -1, -1, -1, -1, -1, -1, -1}, {1, 2, 10, 9, 5, 4, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1}, {3, 0, 8, 1, 2, 10, 4, 9, 5, -1, -1, -1, -1, -1, -1, -1}, {5, 2, 10, 5, 4, 2, 4, 0, 2, -1, -1, -1, -1, -1, -1, -1}, {2, 10, 5, 3, 2, 5, 3, 5, 4, 3, 4, 8, -1, -1, -1, -1}, {9, 5, 4, 2, 3, 11, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1}, {0, 11, 2, 0, 8, 11, 4, 9, 5, -1, -1, -1, -1, -1, -1, -1}, {0, 5, 4, 0, 1, 5, 2, 3, 11, -1, -1, -1, -1, -1, -1, -1}, {2, 1, 5, 2, 5, 8, 2, 8, 11, 4, 8, 5, -1, -1, -1, -1}, {10, 3, 11, 10, 1, 3, 9, 5, 4, -1, -1, -1, -1, -1, -1, -1}, {4, 9, 5, 0, 8, 1, 8, 10, 1, 8, 11, 10, -1, -1, -1, -1}, {5, 4, 0, 5, 0, 11, 5, 11, 10, 11, 0, 3, -1, -1, -1, -1}, {5, 4, 8, 5, 8, 10, 10, 8, 11, -1, -1, -1, -1, -1, -1, -1}, {9, 7, 8, 5, 7, 9, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1}, {9, 3, 0, 9, 5, 3, 5, 7, 3, -1, -1, -1, -1, -1, -1, -1}, {0, 7, 8, 0, 1, 7, 1, 5, 7, -1, -1, -1, -1, -1, -1, -1}, {1, 5, 3, 3, 5, 7, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1}, {9, 7, 8, 9, 5, 7, 10, 1, 2, -1, -1, -1, -1, -1, -1, -1}, {10, 1, 2, 9, 5, 0, 5, 3, 0, 5, 7, 3, -1, -1, -1, -1}, {8, 0, 2, 8, 2, 5, 8, 5, 7, 10, 5, 2, -1, -1, -1, -1}, {2, 10, 5, 2, 5, 3, 3, 5, 7, -1, -1, -1, -1, -1, -1, -1}, {7, 9, 5, 7, 8, 9, 3, 11, 2, -1, -1, -1, -1, -1, -1, -1}, {9, 5, 7, 9, 7, 2, 9, 2, 0, 2, 7, 11, -1, -1, -1, -1}, {2, 3, 11, 0, 1, 8, 1, 7, 8, 1, 5, 7, -1, -1, -1, -1}, {11, 2, 1, 11, 1, 7, 7, 1, 5, -1, -1, -1, -1, -1, -1, -1}, {9, 5, 8, 8, 5, 7, 10, 1, 3, 10, 3, 11, -1, -1, -1, -1}, {5, 7, 0, 5, 0, 9, 7, 11, 0, 1, 0, 10, 11, 10, 0, -1}, {11, 10, 0, 11, 0, 3, 10, 5, 0, 8, 0, 7, 5, 7, 0, -1}, {11, 10, 5, 7, 11, 5, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1}, {10, 6, 5, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1}, {0, 8, 3, 5, 10, 6, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1}, {9, 0, 1, 5, 10, 6, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1}, {1, 8, 3, 1, 9, 8, 5, 10, 6, -1, -1, -1, -1, -1, -1, -1}, {1, 6, 5, 2, 6, 1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1}, {1, 6, 5, 1, 2, 6, 3, 0, 8, -1, -1, -1, -1, -1, -1, -1}, {9, 6, 5, 9, 0, 6, 0, 2, 6, -1, -1, -1, -1, -1, -1, -1}, {5, 9, 8, 5, 8, 2, 5, 2, 6, 3, 2, 8, -1, -1, -1, -1}, {2, 3, 11, 10, 6, 5, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1}, {11, 0, 8, 11, 2, 0, 10, 6, 5, -1, -1, -1, -1, -1, -1, -1}, {0, 1, 9, 2, 3, 11, 5, 10, 6, -1, -1, -1, -1, -1, -1, -1}, {5, 10, 6, 1, 9, 2, 9, 11, 2, 9, 8, 11, -1, -1, -1, -1}, {6, 3, 11, 6, 5, 3, 5, 1, 3, -1, -1, -1, -1, -1, -1, -1}, {0, 8, 11, 0, 11, 5, 0, 5, 1, 5, 11, 6, -1, -1, -1, -1}, {3, 11, 6, 0, 3, 6, 0, 6, 5, 0, 5, 9, -1, -1, -1, -1}, {6, 5, 9, 6, 9, 11, 11, 9, 8, -1, -1, -1, -1, -1, -1, -1}, {5, 10, 6, 4, 7, 8, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1}, {4, 3, 0, 4, 7, 3, 6, 5, 10, -1, -1, -1, -1, -1, -1, -1}, {1, 9, 0, 5, 10, 6, 8, 4, 7, -1, -1, -1, -1, -1, -1, -1}, {10, 6, 5, 1, 9, 7, 1, 7, 3, 7, 9, 4, -1, -1, -1, -1}, {6, 1, 2, 6, 5, 1, 4, 7, 8, -1, -1, -1, -1, -1, -1, -1}, {1, 2, 5, 5, 2, 6, 3, 0, 4, 3, 4, 7, -1, -1, -1, -1}, {8, 4, 7, 9, 0, 5, 0, 6, 5, 0, 2, 6, -1, -1, -1, -1}, {7, 3, 9, 7, 9, 4, 3, 2, 9, 5, 9, 6, 2, 6, 9, -1}, {3, 11, 2, 7, 8, 4, 10, 6, 5, -1, -1, -1, -1, -1, -1, -1}, {5, 10, 6, 4, 7, 2, 4, 2, 0, 2, 7, 11, -1, -1, -1, -1}, {0, 1, 9, 4, 7, 8, 2, 3, 11, 5, 10, 6, -1, -1, -1, -1}, {9, 2, 1, 9, 11, 2, 9, 4, 11, 7, 11, 4, 5, 10, 6, -1}, {8, 4, 7, 3, 11, 5, 3, 5, 1, 5, 11, 6, -1, -1, -1, -1}, {5, 1, 11, 5, 11, 6, 1, 0, 11, 7, 11, 4, 0, 4, 11, -1}, {0, 5, 9, 0, 6, 5, 0, 3, 6, 11, 6, 3, 8, 4, 7, -1}, {6, 5, 9, 6, 9, 11, 4, 7, 9, 7, 11, 9, -1, -1, -1, -1}, {10, 4, 9, 6, 4, 10, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1}, {4, 10, 6, 4, 9, 10, 0, 8, 3, -1, -1, -1, -1, -1, -1, -1}, {10, 0, 1, 10, 6, 0, 6, 4, 0, -1, -1, -1, -1, -1, -1, -1}, {8, 3, 1, 8, 1, 6, 8, 6, 4, 6, 1, 10, -1, -1, -1, -1}, {1, 4, 9, 1, 2, 4, 2, 6, 4, -1, -1, -1, -1, -1, -1, -1}, {3, 0, 8, 1, 2, 9, 2, 4, 9, 2, 6, 4, -1, -1, -1, -1}, {0, 2, 4, 4, 2, 6, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1}, {8, 3, 2, 8, 2, 4, 4, 2, 6, -1, -1, -1, -1, -1, -1, -1}, {10, 4, 9, 10, 6, 4, 11, 2, 3, -1, -1, -1, -1, -1, -1, -1}, {0, 8, 2, 2, 8, 11, 4, 9, 10, 4, 10, 6, -1, -1, -1, -1}, {3, 11, 2, 0, 1, 6, 0, 6, 4, 6, 1, 10, -1, -1, -1, -1}, {6, 4, 1, 6, 1, 10, 4, 8, 1, 2, 1, 11, 8, 11, 1, -1}, {9, 6, 4, 9, 3, 6, 9, 1, 3, 11, 6, 3, -1, -1, -1, -1}, {8, 11, 1, 8, 1, 0, 11, 6, 1, 9, 1, 4, 6, 4, 1, -1}, {3, 11, 6, 3, 6, 0, 0, 6, 4, -1, -1, -1, -1, -1, -1, -1}, {6, 4, 8, 11, 6, 8, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1}, {7, 10, 6, 7, 8, 10, 8, 9, 10, -1, -1, -1, -1, -1, -1, -1}, {0, 7, 3, 0, 10, 7, 0, 9, 10, 6, 7, 10, -1, -1, -1, -1}, {10, 6, 7, 1, 10, 7, 1, 7, 8, 1, 8, 0, -1, -1, -1, -1}, {10, 6, 7, 10, 7, 1, 1, 7, 3, -1, -1, -1, -1, -1, -1, -1}, {1, 2, 6, 1, 6, 8, 1, 8, 9, 8, 6, 7, -1, -1, -1, -1}, {2, 6, 9, 2, 9, 1, 6, 7, 9, 0, 9, 3, 7, 3, 9, -1}, {7, 8, 0, 7, 0, 6, 6, 0, 2, -1, -1, -1, -1, -1, -1, -1}, {7, 3, 2, 6, 7, 2, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1}, {2, 3, 11, 10, 6, 8, 10, 8, 9, 8, 6, 7, -1, -1, -1, -1}, {2, 0, 7, 2, 7, 11, 0, 9, 7, 6, 7, 10, 9, 10, 7, -1}, {1, 8, 0, 1, 7, 8, 1, 10, 7, 6, 7, 10, 2, 3, 11, -1}, {11, 2, 1, 11, 1, 7, 10, 6, 1, 6, 7, 1, -1, -1, -1, -1}, {8, 9, 6, 8, 6, 7, 9, 1, 6, 11, 6, 3, 1, 3, 6, -1}, {0, 9, 1, 11, 6, 7, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1}, {7, 8, 0, 7, 0, 6, 3, 11, 0, 11, 6, 0, -1, -1, -1, -1}, {7, 11, 6, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1}, {7, 6, 11, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1}, {3, 0, 8, 11, 7, 6, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1}, {0, 1, 9, 11, 7, 6, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1}, {8, 1, 9, 8, 3, 1, 11, 7, 6, -1, -1, -1, -1, -1, -1, -1}, {10, 1, 2, 6, 11, 7, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1}, {1, 2, 10, 3, 0, 8, 6, 11, 7, -1, -1, -1, -1, -1, -1, -1}, {2, 9, 0, 2, 10, 9, 6, 11, 7, -1, -1, -1, -1, -1, -1, -1}, {6, 11, 7, 2, 10, 3, 10, 8, 3, 10, 9, 8, -1, -1, -1, -1}, {7, 2, 3, 6, 2, 7, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1}, {7, 0, 8, 7, 6, 0, 6, 2, 0, -1, -1, -1, -1, -1, -1, -1}, {2, 7, 6, 2, 3, 7, 0, 1, 9, -1, -1, -1, -1, -1, -1, -1}, {1, 6, 2, 1, 8, 6, 1, 9, 8, 8, 7, 6, -1, -1, -1, -1}, {10, 7, 6, 10, 1, 7, 1, 3, 7, -1, -1, -1, -1, -1, -1, -1}, {10, 7, 6, 1, 7, 10, 1, 8, 7, 1, 0, 8, -1, -1, -1, -1}, {0, 3, 7, 0, 7, 10, 0, 10, 9, 6, 10, 7, -1, -1, -1, -1}, {7, 6, 10, 7, 10, 8, 8, 10, 9, -1, -1, -1, -1, -1, -1, -1}, {6, 8, 4, 11, 8, 6, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1}, {3, 6, 11, 3, 0, 6, 0, 4, 6, -1, -1, -1, -1, -1, -1, -1}, {8, 6, 11, 8, 4, 6, 9, 0, 1, -1, -1, -1, -1, -1, -1, -1}, {9, 4, 6, 9, 6, 3, 9, 3, 1, 11, 3, 6, -1, -1, -1, -1}, {6, 8, 4, 6, 11, 8, 2, 10, 1, -1, -1, -1, -1, -1, -1, -1}, {1, 2, 10, 3, 0, 11, 0, 6, 11, 0, 4, 6, -1, -1, -1, -1}, {4, 11, 8, 4, 6, 11, 0, 2, 9, 2, 10, 9, -1, -1, -1, -1}, {10, 9, 3, 10, 3, 2, 9, 4, 3, 11, 3, 6, 4, 6, 3, -1}, {8, 2, 3, 8, 4, 2, 4, 6, 2, -1, -1, -1, -1, -1, -1, -1}, {0, 4, 2, 4, 6, 2, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1}, {1, 9, 0, 2, 3, 4, 2, 4, 6, 4, 3, 8, -1, -1, -1, -1}, {1, 9, 4, 1, 4, 2, 2, 4, 6, -1, -1, -1, -1, -1, -1, -1}, {8, 1, 3, 8, 6, 1, 8, 4, 6, 6, 10, 1, -1, -1, -1, -1}, {10, 1, 0, 10, 0, 6, 6, 0, 4, -1, -1, -1, -1, -1, -1, -1}, {4, 6, 3, 4, 3, 8, 6, 10, 3, 0, 3, 9, 10, 9, 3, -1}, {10, 9, 4, 6, 10, 4, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1}, {4, 9, 5, 7, 6, 11, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1}, {0, 8, 3, 4, 9, 5, 11, 7, 6, -1, -1, -1, -1, -1, -1, -1}, {5, 0, 1, 5, 4, 0, 7, 6, 11, -1, -1, -1, -1, -1, -1, -1}, {11, 7, 6, 8, 3, 4, 3, 5, 4, 3, 1, 5, -1, -1, -1, -1}, {9, 5, 4, 10, 1, 2, 7, 6, 11, -1, -1, -1, -1, -1, -1, -1}, {6, 11, 7, 1, 2, 10, 0, 8, 3, 4, 9, 5, -1, -1, -1, -1}, {7, 6, 11, 5, 4, 10, 4, 2, 10, 4, 0, 2, -1, -1, -1, -1}, {3, 4, 8, 3, 5, 4, 3, 2, 5, 10, 5, 2, 11, 7, 6, -1}, {7, 2, 3, 7, 6, 2, 5, 4, 9, -1, -1, -1, -1, -1, -1, -1}, {9, 5, 4, 0, 8, 6, 0, 6, 2, 6, 8, 7, -1, -1, -1, -1}, {3, 6, 2, 3, 7, 6, 1, 5, 0, 5, 4, 0, -1, -1, -1, -1}, {6, 2, 8, 6, 8, 7, 2, 1, 8, 4, 8, 5, 1, 5, 8, -1}, {9, 5, 4, 10, 1, 6, 1, 7, 6, 1, 3, 7, -1, -1, -1, -1}, {1, 6, 10, 1, 7, 6, 1, 0, 7, 8, 7, 0, 9, 5, 4, -1}, {4, 0, 10, 4, 10, 5, 0, 3, 10, 6, 10, 7, 3, 7, 10, -1}, {7, 6, 10, 7, 10, 8, 5, 4, 10, 4, 8, 10, -1, -1, -1, -1}, {6, 9, 5, 6, 11, 9, 11, 8, 9, -1, -1, -1, -1, -1, -1, -1}, {3, 6, 11, 0, 6, 3, 0, 5, 6, 0, 9, 5, -1, -1, -1, -1}, {0, 11, 8, 0, 5, 11, 0, 1, 5, 5, 6, 11, -1, -1, -1, -1}, {6, 11, 3, 6, 3, 5, 5, 3, 1, -1, -1, -1, -1, -1, -1, -1}, {1, 2, 10, 9, 5, 11, 9, 11, 8, 11, 5, 6, -1, -1, -1, -1}, {0, 11, 3, 0, 6, 11, 0, 9, 6, 5, 6, 9, 1, 2, 10, -1}, {11, 8, 5, 11, 5, 6, 8, 0, 5, 10, 5, 2, 0, 2, 5, -1}, {6, 11, 3, 6, 3, 5, 2, 10, 3, 10, 5, 3, -1, -1, -1, -1}, {5, 8, 9, 5, 2, 8, 5, 6, 2, 3, 8, 2, -1, -1, -1, -1}, {9, 5, 6, 9, 6, 0, 0, 6, 2, -1, -1, -1, -1, -1, -1, -1}, {1, 5, 8, 1, 8, 0, 5, 6, 8, 3, 8, 2, 6, 2, 8, -1}, {1, 5, 6, 2, 1, 6, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1}, {1, 3, 6, 1, 6, 10, 3, 8, 6, 5, 6, 9, 8, 9, 6, -1}, {10, 1, 0, 10, 0, 6, 9, 5, 0, 5, 6, 0, -1, -1, -1, -1}, {0, 3, 8, 5, 6, 10, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1}, {10, 5, 6, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1}, {11, 5, 10, 7, 5, 11, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1}, {11, 5, 10, 11, 7, 5, 8, 3, 0, -1, -1, -1, -1, -1, -1, -1}, {5, 11, 7, 5, 10, 11, 1, 9, 0, -1, -1, -1, -1, -1, -1, -1}, {10, 7, 5, 10, 11, 7, 9, 8, 1, 8, 3, 1, -1, -1, -1, -1}, {11, 1, 2, 11, 7, 1, 7, 5, 1, -1, -1, -1, -1, -1, -1, -1}, {0, 8, 3, 1, 2, 7, 1, 7, 5, 7, 2, 11, -1, -1, -1, -1}, {9, 7, 5, 9, 2, 7, 9, 0, 2, 2, 11, 7, -1, -1, -1, -1}, {7, 5, 2, 7, 2, 11, 5, 9, 2, 3, 2, 8, 9, 8, 2, -1}, {2, 5, 10, 2, 3, 5, 3, 7, 5, -1, -1, -1, -1, -1, -1, -1}, {8, 2, 0, 8, 5, 2, 8, 7, 5, 10, 2, 5, -1, -1, -1, -1}, {9, 0, 1, 5, 10, 3, 5, 3, 7, 3, 10, 2, -1, -1, -1, -1}, {9, 8, 2, 9, 2, 1, 8, 7, 2, 10, 2, 5, 7, 5, 2, -1}, {1, 3, 5, 3, 7, 5, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1}, {0, 8, 7, 0, 7, 1, 1, 7, 5, -1, -1, -1, -1, -1, -1, -1}, {9, 0, 3, 9, 3, 5, 5, 3, 7, -1, -1, -1, -1, -1, -1, -1}, {9, 8, 7, 5, 9, 7, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1}, {5, 8, 4, 5, 10, 8, 10, 11, 8, -1, -1, -1, -1, -1, -1, -1}, {5, 0, 4, 5, 11, 0, 5, 10, 11, 11, 3, 0, -1, -1, -1, -1}, {0, 1, 9, 8, 4, 10, 8, 10, 11, 10, 4, 5, -1, -1, -1, -1}, {10, 11, 4, 10, 4, 5, 11, 3, 4, 9, 4, 1, 3, 1, 4, -1}, {2, 5, 1, 2, 8, 5, 2, 11, 8, 4, 5, 8, -1, -1, -1, -1}, {0, 4, 11, 0, 11, 3, 4, 5, 11, 2, 11, 1, 5, 1, 11, -1}, {0, 2, 5, 0, 5, 9, 2, 11, 5, 4, 5, 8, 11, 8, 5, -1}, {9, 4, 5, 2, 11, 3, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1}, {2, 5, 10, 3, 5, 2, 3, 4, 5, 3, 8, 4, -1, -1, -1, -1}, {5, 10, 2, 5, 2, 4, 4, 2, 0, -1, -1, -1, -1, -1, -1, -1}, {3, 10, 2, 3, 5, 10, 3, 8, 5, 4, 5, 8, 0, 1, 9, -1}, {5, 10, 2, 5, 2, 4, 1, 9, 2, 9, 4, 2, -1, -1, -1, -1}, {8, 4, 5, 8, 5, 3, 3, 5, 1, -1, -1, -1, -1, -1, -1, -1}, {0, 4, 5, 1, 0, 5, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1}, {8, 4, 5, 8, 5, 3, 9, 0, 5, 0, 3, 5, -1, -1, -1, -1}, {9, 4, 5, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1}, {4, 11, 7, 4, 9, 11, 9, 10, 11, -1, -1, -1, -1, -1, -1, -1}, {0, 8, 3, 4, 9, 7, 9, 11, 7, 9, 10, 11, -1, -1, -1, -1}, {1, 10, 11, 1, 11, 4, 1, 4, 0, 7, 4, 11, -1, -1, -1, -1}, {3, 1, 4, 3, 4, 8, 1, 10, 4, 7, 4, 11, 10, 11, 4, -1}, {4, 11, 7, 9, 11, 4, 9, 2, 11, 9, 1, 2, -1, -1, -1, -1}, {9, 7, 4, 9, 11, 7, 9, 1, 11, 2, 11, 1, 0, 8, 3, -1}, {11, 7, 4, 11, 4, 2, 2, 4, 0, -1, -1, -1, -1, -1, -1, -1}, {11, 7, 4, 11, 4, 2, 8, 3, 4, 3, 2, 4, -1, -1, -1, -1}, {2, 9, 10, 2, 7, 9, 2, 3, 7, 7, 4, 9, -1, -1, -1, -1}, {9, 10, 7, 9, 7, 4, 10, 2, 7, 8, 7, 0, 2, 0, 7, -1}, {3, 7, 10, 3, 10, 2, 7, 4, 10, 1, 10, 0, 4, 0, 10, -1}, {1, 10, 2, 8, 7, 4, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1}, {4, 9, 1, 4, 1, 7, 7, 1, 3, -1, -1, -1, -1, -1, -1, -1}, {4, 9, 1, 4, 1, 7, 0, 8, 1, 8, 7, 1, -1, -1, -1, -1}, {4, 0, 3, 7, 4, 3, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1}, {4, 8, 7, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1}, {9, 10, 8, 10, 11, 8, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1}, {3, 0, 9, 3, 9, 11, 11, 9, 10, -1, -1, -1, -1, -1, -1, -1}, {0, 1, 10, 0, 10, 8, 8, 10, 11, -1, -1, -1, -1, -1, -1, -1}, {3, 1, 10, 11, 3, 10, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1}, {1, 2, 11, 1, 11, 9, 9, 11, 8, -1, -1, -1, -1, -1, -1, -1}, {3, 0, 9, 3, 9, 11, 1, 2, 9, 2, 11, 9, -1, -1, -1, -1}, {0, 2, 11, 8, 0, 11, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1}, {3, 2, 11, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1}, {2, 3, 8, 2, 8, 10, 10, 8, 9, -1, -1, -1, -1, -1, -1, -1}, {9, 10, 2, 0, 9, 2, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1}, {2, 3, 8, 2, 8, 10, 0, 1, 8, 1, 10, 8, -1, -1, -1, -1}, {1, 10, 2, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1}, {1, 3, 8, 9, 1, 8, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1}, {0, 9, 1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1}, {0, 3, 8, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1}, {-1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1}} -- Convert raw_table to marching_cubes_table (list of triangles per config) local triTable = {} for idx, entry in ipairs(raw_table) do local triangles = {} local i = 1 while entry[i] ~= -1 do if entry[i+2] ~= -1 then table.insert(triangles, {entry[i], entry[i+1], entry[i+2]}) i = i + 3 else break end end triTable[idx] = triangles -- 1-based end -- Edge to corners mapping (1-based) local edge_to_corners = { {1,2},{2,3},{3,4},{4,1}, {5,6},{6,7},{7,8},{8,5}, {1,5},{2,6},{3,7},{4,8} } -- Corner offsets and edges local cornerOffsets = {{0,0,0},{1,0,0},{1,1,0},{0,1,0},{0,0,1},{1,0,1},{1,1,1},{0,1,1}} local edgeIndex = {{1,2},{2,3},{3,4},{4,1},{5,6},{6,7},{7,8},{8,5},{1,5},{2,6},{3,7},{4,8}} -- Preallocated triangle points local pts = {{},{},{}} -- Open output file local f = io.open("triangles.tex","w") f:write([[ \documentclass[tikz,border=3mm]{standalone} \begin{document} \begin{tikzpicture} ]]) -- Main loop for i=0,nx-1 do for j=0,ny-1 do for k=0,nz-1 do -- corner values on-demand local cubeVals = {} for ci=1,8 do local ox,oy,oz = cornerOffsets[ci][1], cornerOffsets[ci][2], cornerOffsets[ci][3] cubeVals[ci] = vertex_value(i+ox,j+oy,k+oz) end -- cube index local cubeIndex = 0 for ci=1,8 do if cubeVals[ci]<isovalue then cubeIndex = cubeIndex + 2^(ci-1) end end if cubeIndex ~=1 and cubeIndex ~=256 then local x = x0 + i*dx local y = y0 + j*dy local z = z0 + k*dz -- corner positions local p = {} for ci=1,8 do p[ci] = {x=x+cornerOffsets[ci][1]*dx, y=y+cornerOffsets[ci][2]*dy, z=z+cornerOffsets[ci][3]*dz} end -- triangles -- triangles for _, tri in ipairs(triTable[cubeIndex+1] or {}) do for ei=1,3 do local e = tri[ei] local c1,c2 = edgeIndex[e+1][1], edgeIndex[e+1][2] local v1,v2 = cubeVals[c1], cubeVals[c2] local pos = edge_root(p[c1],p[c2],v1,v2,1e-6) pts[ei].x = pos.x pts[ei].y = pos.y pts[ei].z = pos.z -- <--- THIS LINE IS MISSING end f:write(string.format([[\draw[fill=blue!20,draw=blue!60,line join = round, ultra thin] (%.5f,%.5f,%.5f) -- (%.5f,%.5f,%.5f) -- (%.5f,%.5f,%.5f) -- cycle; ]], pts[1].x, pts[1].y, pts[1].z, pts[2].x, pts[2].y, pts[2].z, pts[3].x, pts[3].y, pts[3].z)) end end end end end f:write([[\end{tikzpicture}\end{document}]]) f:close() \end{luacode*} \end{document}

  • \ifthenelse and modulo
    by Raffaele Santoro on December 6, 2025 at 4:07 am

    I have a list of numbers from 1 to 12. I want to print the numbers 3,6,9 and 12 in purple, the others in blue. With my code: \documentclass{standalone} \usepackage{tikz,ifthen} \begin{document} \begin{tikzpicture} \foreach \i in {1,...,12}{ \ifthenelse {\i/3=int(\i/3)} {\draw[purple] (.75*\i,0) node () {\i};}{\draw[blue] (.75*\i,0) node () {\i};} } \end{tikzpicture} \end{document} I have errors and all numbers in blue. Why?

  • Vertical text with multicolumn and tabularx looks weird
    by domi on December 5, 2025 at 7:18 pm

    I have the following snippet \documentclass{article} \usepackage{tabularx} \usepackage{rotating} \usepackage{multirow} \newcolumntype{C}{>{\centering\arraybackslash}X} \newcolumntype{V}{>{\centering\arraybackslash}m{1.5cm}} \newcommand{\verttext}[1]{\rotatebox{90}{\parbox{3cm}{\centering\textbf{#1}}}} \renewcommand{\arraystretch}{1.5} \begin{document} \begin{table}[h] \centering \begin{tabularx}{\textwidth}{V | V | C | C |} \multicolumn{2}{c}{} & \multicolumn{2}{c}{Ausmass des Interesses am Unternehmen} \\ \cline{3-4} \multicolumn{1}{c}{} & \multicolumn{1}{c|}{} & Gering & Hoch \\ \cline{2-4} \multirow{2}{*}{\verttext{Ausmass der Macht}} & \verttext{Hoch} & Zufrieden stellen & Key Players \\ \cline{2-4} & \verttext{Gering} & minimal betreuen & informieren \\ \cline{2-4} \end{tabularx} \end{table} \end{document} which looks like this: as you can see, the "Ausmass der Macht" isnt centered (its two cell high) and shouldn't be wrapped. The two cells (Hoch + Gering) are high enough so the text shouldn't be wrapped. I already found a kinda similar question here: Vertical Text using multirow in the Table though I have no clue how to resolve that issue. Thanks in advance 🙂