Week
- Fully expanding a macro with optional keys inside another macro (in expl3)by modallyFragile on December 4, 2026 at 9:31 pm
(TL;DR: why does the expected output not match the actual output in the MWE?) Motivation/explanation: I'm writing a package for querying SQL in LaTeX. As part of this I have: a \colvalue macro which prints the value of a particular column, within a query. a system where @{<key>} templates within a query string can be replaced with values from a <key>=<val> list specified in the query command. The query command is set up so that the user can specify nested queries. In principle (and in practice), these could be constructed using templates which expand column values from earlier queries. Here is an example: \begin{itemize} \sqlquery[ name = people, % code to execute for each row each = { \begin{itemize} % Nested query \sqlquery[ name = clients, each = {\item \colvalue[query=clients]{name}} % |---------- note this ----------| ]{select * from client where account_manager = @{id}}[id=\colvalue[query=people]{personid}] \begin{itemize} } ]{select * from people} \end{itemize} This prints a list of people, and for each person, a list underneath them of the clients to whom they are assigned. Notice the labelled use of \colvalue, which in the inner query, but references the outer query, in order to include in the query string information from the outer query's results. This use of \colvalue must be completely expandable because of how the query string is expanded and used. Problem. So, I want to write a \colvalue macro which is completely expandable, inside another command (\sqlquery above) which substitutes values for @{<key>} templates inside a string. In the MWE below I've used a simpler command as the thing in \colvalue has to be embedded -- its just called \replace. \colvalue takes an optional key/value list (with a limited number of possible keys), and a mandatory column name. My question: how can I write a macro which completely expandably parses a small key/value list, and then does something with the values and its mandatory argument, all while inside the argument to another macro? My exact requirements are that: \colvalue only recognise certain keys in the optional argument (below I specify just one) and throws an error for any others. (There might in principle be further keys though, which is why I can't just use a single optional argument.) \colvalue can somehow store, and then do something with, the values of the optional keys. \colvalue is fully expandable inside \replace. I have tried to do this and nearly succeeded. In my MWE \colvalue only recognises the key query in its optional key/value list, and should expand to [<value of query key>]<mandatory arg>. It does this when used outside of \replace. Inside \replace, it doesn't seem to handle the query argument properly. Why not? \documentclass{article} \ExplSyntaxOn % * Colvalue \msg_new:nnn { mwe / colvalue } { unknown-key } { Key ~ `#1' ~ not ~ defined. } \msg_new:nnn { mwe / colvalue } { no-value } { All ~ keys ~ must ~ have ~ a ~ value. } % <key> <val> \cs_new:Nn \__mwe_colvalue_parse_key_val:nn { \str_case:nnF { #1 } { { query } { \lua_now:e { colvalue_query = "#2" } } } { \msg_expandable_error:nnn { mwe / colvalue } { unknown-key } { #1 } } } \cs_new:Nn \__mwe_colvalue_parse_key:n { \msg_expandable_error:nn { mwe / colvalue } { no-value } } \NewExpandableDocumentCommand{\colvalue}{ O{} m }{ \keyval_parse:nnn { \__mwe_colvalue_parse_key:n } { \__mwe_colvalue_parse_key_val:nn } { #1 } \lua_now:e { tex.print("[" .. colvalue_query .. "]") } \lua_now:e { tex.print("#2") } } % * replace \msg_new:nnn { mwe / replace } { no-value } { All ~ keys ~ must ~ have ~ a ~ value. } % 1: string variable to replace in % 2: key % 3: value \cs_new:Nn \__mwe_replace_key_val:Nnn { \exp_args:Nnne \str_replace_all:Nnn #1 { @{#2} } { #3 } } \cs_new:Nn \__mwe_replace_key:n { \msg_expandable_error:nn { mwe / replace } { no-value } } \NewDocumentCommand{\replace}{ +m +O{} }{ \tl_set:Nn \l_tmpa_str { #1 } \keyval_parse:nnn { \__mwe_replace_key:n } { \exp_args:Nnne \__mwe_replace_key_val:Nnn \l_tmpa_str } { #2 } % Print result \l_tmpa_str } \ExplSyntaxOff \begin{document} % Prints "[foo]bar" as expected \colvalue[query=foo]{bar} % Desire output: "one [qux]two three" % Actual output: "one [foo]two three" \replace{one @{baz} three}[baz={\colvalue[query=qux]{two}}] \end{document} TIA.
- Re-defining ~ to be narrow nobreak spaceby rallg on December 4, 2026 at 6:54 pm
A few days ago, someone asked a question (closed, due to lack of detail) concerning re-definition of ~. I posted a poor answer, quickly spanked in comments, which I removed. My poor answer was copy-paste from my own working code, but I failed to copy-paste other code that was necessary. Character ~ is a standard-width nonbreaking space, which can stretch or shrink like any other space. I wish to re-define it, so that it is a narrow-width nonbreaking space. Hopefully it will stretch and shrink like any other space, but I can live with limitations. Understand that I am not using any packages, or writing equations, that rely on on ~ being full-width. My code, MWE: \documentclass{article} \AddToHook{begindocument/end}{%% \def\,{\leavevmode\nobreak\hspace{.16em plus .06em minus .1em}} \protected\edef~{%% \noexpand%% \ifincsname%% \noexpand\expandafter\string~\noexpand%% \else%% \noexpand\expandafter\noexpand\,\noexpand%% \fi%% }%% }%% \begin{document} Hello World.\par Hello~World. \end{document} That works with lualatex. The second line has less space width. My question: Should I worry about possible infinite loops, or other problems? Other than itself, I am unaware of any csname that has ~ in it.
- How do I change what the document automatically puts for my preamble?by Rainofrisk on December 3, 2026 at 9:42 pm
I’m using Overleaf to learn LaTeX while taking notes, and whenever I create a new “blank” document it automatically includes a title, author name, and introduction section header. I have no use for these, so i simply delete them and add my preamble — so, my question is how can I change what it automatically inserts when I create a new document? It’s a little inconvenient.
- How can I use the fraktura font from kpfonts without changing other fonts?by kaba on December 3, 2026 at 12:19 pm
The following code \documentclass[a4paper,12pt]{article} \usepackage[T1]{fontenc} \usepackage{amssymb} \begin{document} $\mathfrak{ABCDEFGHIJKLMNOPQRSTUVWXYZ}$ $\mathfrak{abcdefghijklmnopqrstuvwxyz}$ \end{document} results in I have trouble reading many of these characters, among them A, G, O, Q, S, V, Y, k, x, y, z. In addition, k and t look almost the same: I would like to use the fraktura font from the kpfonts package: \documentclass[a4paper,12pt]{article} \usepackage[T1]{fontenc} \usepackage{kpfonts} \begin{document} $\mathfrak{ABCDEFGHIJKLMNOPQRSTUVWXYZ}$ $\mathfrak{abcdefghijklmnopqrstuvwxyz}$ \end{document} which produces All of these symbols are very clear. However, I don't want to change any other symbols apart from the fraktura symbols. How can I use the fraktura font from kpfonts without changing any other fonts?
- How to solve the error \__dim_eval_end: tabularray [duplicate]by GowriSaro on December 3, 2026 at 7:46 am
Based on my previous post Not sure what is the error, I'm using "tabularray" and now facing another error, which not able to fix as I have little bit knowledge in the package tabularray \documentclass[twocolumn]{article} \usepackage{amsmath} \usepackage{array} \usepackage{xcolor} \usepackage{tabularray} \UseTblrLibrary{booktabs} \begin{document} \begin{table} \caption{Comparison of Results. \label{table4-02601079261512425}} \centering \begin{tblr}{@{} l l l l l l l @{}} \toprule {Study} & {} & \SetCell[c=4]{l} Previous studies \\ {} & {Present\break study ({\%})} & {Rosengart\break et al. ({\%})} & {Haucap and\break Just ({\%})} & {Cipriani\break et al. ({\%})} & \SetCell[c=2]{l} Frey\break et al. ({\%})\\ \midrule {Business first-year students} & {5.38} & {61.43} & {41} & {54.08} & \SetCell[c=2]{l} 59\\ {\textit{Z} (\textit{p}-value)} & {–} & {−20.19***\break (\textit{p} {<} .001)} & {−12.68***\break (\textit{p} {<} .001)} & {−18.22***\break (\textit{p} {<} .001)} & \SetCell[c=2]{l} −19.25***\break (\textit{p} {<} .001)\\ {Business final-year students} & {13.28} & {57.31} & {60} & {53.40} & \SetCell[c=2]{l} 62\\ {\textit{Z} (\textit{p}-value)} & {–} & {−16.33***\break (\textit{p} {<} .001)} & {−14.34***\break (\textit{p} {<} .001)} & {−15.62***\break (\textit{p} {<} .001)} & \SetCell[c=2]{l} −16.79***\break (\textit{p} {<} .001)\\ \bottomrule \end{tblr} \end{table} \end{document} And the error is: ! Missing number, treated as zero. __dim_eval_end Need your advise please, I'm using xeLaTeX engine
- Why is \iftrue not working inside a beamer tikzpicture around a scope environment? [duplicate]by Jasper on December 3, 2026 at 6:15 am
Why is \iftrue not working inside a beamer tikzpicture around a scope environment? \documentclass{beamer} \usepackage{tikz} \begin{document} \begin{frame} \begin{tikzpicture} \iftrue \begin{scope} \draw (0,0) circle[radius=1]; \end{scope} \fi \end{tikzpicture} \end{frame} \end{document} ! Incomplete \ifx; all text was ignored after line 9. <inserted text> \fi
- TikZ errors when defining a drawing inside a LaTeX .sty fileby MossyParadox on December 2, 2026 at 11:45 pm
I am trying to modify the package mahjonggame by making the tiles look different. I have been designing the new tiles in a separate LaTeX document using TikZ, then copying the drawing commands into the package's .sty file. I then load the modified .sty file into another LaTeX document to test how the new tile looks. However, I keep encounter errors. For example, I have defined a new tile as follows: \cs_new_protected:cpn { __mhj_face_5z: }{ \draw[rounded corners=8pt, mahnavyblue, line width=2.5mm] (1,1.5) rectangle (0,0); \node at (0,0) {}; \draw[mahnavyblue, line width=1.5mm] (0.15,1.1875) -- (0.3125,1.35); % Top-left \draw[mahnavyblue, line width=1.5mm] (0.85,1.1875) -- (0.6875,1.35); % Top-right \draw[mahnavyblue, line width=1.5mm] (0.15,0.3125) -- (0.3125,0.15); % Bottom-left \draw[mahnavyblue, line width=1.5mm] (0.85,0.3125) -- (0.6875,0.15); % Bottom-right \draw[rounded corners=8pt, mahnavyblue, line width=2.5mm] (0.85,1.35) rectangle (0.15,0.15); \node at (0,0) {}; \draw[mahnavyblue, line width=2.5mm] (0.15,1.10) -- (0.40,1.35); % Top-left \draw[mahnavyblue, line width=2.5mm] (0.85,1.10) -- (0.60,1.35); % Top-right \draw[mahnavyblue, line width=2.5mm] (0.15,0.40) -- (0.40,0.15); % Bottom-left \draw[mahnavyblue, line width=2.5mm] (0.85,0.40) -- (0.60,0.15); % Bottom-right } The drawing looks like this when compiled in the separate LaTeX document. However, when I load the modified .sty file into my test document and compile it, I get errors such as: Package pgfkeys Error: I do not know the key '/tikz/roundedcorners', to which you passed '8pt', and I am going to ignore it. Perhaps you misspelled it. Package pgfkeys Error: I do not know the key '/tikz/linewidth', to which you passed '2.5mm', and I am going to ignore it. Perhaps you misspelled it I have never modified something like this before and cannot figure out what went wrong. My questions are: Why do the spaces in TikZ option names such as rounded corners and line width cause errors when the drawing commands? How can I fix this? Is there a straightforward way to scale the entire drawing down while preserving the relative proportions and positions of all its elements? The current drawing is slightly too large for the tile. Thank you for your kind help. EDIT: add MWE (@jlab) \documentclass{article} \usepackage{mahjonggame} \ExplSyntaxOn \cs_set_protected:cpn { __mhj_face_5z: } { \draw[rounded corners=8pt, mahnavyblue, line width=2.5mm] (1,1.5) rectangle (0,0); \node at (0,0) {}; \draw[mahnavyblue, line width=1.5mm] (0.15,1.1875) -- (0.3125,1.35); % Top-left \draw[mahnavyblue, line width=1.5mm] (0.85,1.1875) -- (0.6875,1.35); % Top-right \draw[mahnavyblue, line width=1.5mm] (0.15,0.3125) -- (0.3125,0.15); % Bottom-left \draw[mahnavyblue, line width=1.5mm] (0.85,0.3125) -- (0.6875,0.15); % Bottom-right \draw[rounded corners=8pt, mahnavyblue, line width=2.5mm] (0.85,1.35) rectangle (0.15,0.15); \node at (0,0) {}; \draw[mahnavyblue, line width=2.5mm] (0.15,1.10) -- (0.40,1.35); % Top-left \draw[mahnavyblue, line width=2.5mm] (0.85,1.10) -- (0.60,1.35); % Top-right \draw[mahnavyblue, line width=2.5mm] (0.15,0.40) -- (0.40,0.15); % Bottom-left \draw[mahnavyblue, line width=2.5mm] (0.85,0.40) -- (0.60,0.15); % Bottom-right } \exp_args:NNc \NewCommandCopy \test { __mhj_face_5z: } \ExplSyntaxOff \begin{document} \begin{tikzpicture} \test \end{tikzpicture} \end{document}
- luaotfload "font...defines no feature" error messageby Frisket on December 2, 2026 at 9:20 pm
I am getting thousands of these messages in my log file (running lualatex): luaotfload | aux : font no 124 (nil) defines no feature for script latn with language eng The font number changes, but it doesn't identify the font by name. How do I find out which font it is referring to, and why a font used for the English language is considered not to have a Latin script? Or perhaps the message has a different meaning. I am using fontspec and loading these fonts (but it happens with anything else I use except omitting them and using CM): \documentclass{article} \usepackage{fontspec} \setmainfont{Alegreya} \setsansfont{Montserrat} \setmonofont{zcoN} \begin{document} x \end{document} Can the messages safely be ignored? Or should I be doing something else?
- Extracting hyperlink-targets of footnotemarks when using \DocumentMetadata [closed]by Stephen on December 2, 2026 at 6:57 pm
\DocumentMetadata{} \documentclass{article} \usepackage{hyperref} \begin{document} Text.\footnote{first} More text.\footnote[99]{second} Still more text.\footnotemark \footnotetext{third} \end{document} The footnote-links go to footnote*.1, footnote*.3, and footnote*.5. How can I extract those link targets? Background: In a situation \footnotetext{third} does not set any link-anchor, so I need to set it manually to the "footnote*.5". (And compiling, manually looking at the numbers in the pdf-file and then setting the anchors accordingly, is no option for a changing, longer document with recompiles.)
- Prevent piton to split when using tcolorboxby cacamailg on December 2, 2026 at 2:48 pm
The following code generates a warning Package tcolorbox Warning: The upper box part has become overfull. It seems page/column break is not correctly detected. \documentclass[twocolumn]{article} \usepackage{newtx} % https://tex.stackexchange.com/questions/769104 % https://tex.stackexchange.com/questions/770117 \usepackage{piton} \usepackage{tcolorbox} \tcbuselibrary{breakable} \PitonOptions{% begin-escape=@,end-escape=@, begin-escape-math=$,end-escape-math=$, } \NewPitonEnvironment{algorithm}{O{}} {% \PitonOptions{% tcolorbox, splittable=2, % added option after edit line-numbers, line-numbers/format=\tiny, line-numbers/sep=\labelsep, continuation-symbol={}, end-of-broken-line={}, indent-broken-lines, font-command=\footnotesize, language=verbatim, gobble=2, #1, }% \tcbset{% after skip=0pt, sharp corners, size=fbox, %colback=lightgray, %colframe=lightgray, }% }{} \begin{document} dummy text dummy text dummy text dummy text dummy text dummy text dummy text dummy text dummy text dummy text dummy text dummy text dummy text dummy text dummy text dummy text dummy text dummy text dummy text dummy text dummy text dummy text dummy text dummy text dummy text dummy text dummy text dummy text dummy text dummy text dummy text dummy text dummy text dummy text dummy text dummy text dummy text dummy text dummy text dummy text dummy text dummy text dummy text dummy text dummy text dummy text dummy text dummy text dummy text dummy text dummy text dummy text dummy text dummy text dummy text dummy text dummy text dummy text dummy text dummy text dummy text dummy text dummy text dummy text dummy text dummy text dummy text dummy text dummy text dummy text dummy text dummy text dummy text dummy text dummy text dummy text dummy text dummy text dummy text dummy text dummy text dummy text dummy text dummy text dummy text dummy text dummy text dummy text dummy text dummy text dummy text dummy text dummy text dummy text dummy text dummy text dummy text dummy text dummy text dummy text dummy text dummy text dummy text dummy text dummy text dummy text dummy text dummy text dummy text dummy text dummy text dummy text dummy text dummy text dummy text dummy text dummy text dummy text dummy text dummy text dummy text dummy text dummy text dummy text dummy text dummy text \begin{figure}[!htpb] \begin{algorithm} dummy text dummy text dummy text dummy text dummy text dummy text dummy text dummy text dummy text dummy text dummy text dummy text dummy text dummy text dummy text dummy text dummy text dummy text dummy text dummy text dummy text dummy text dummy text dummy text dummy text dummy text dummy text dummy text dummy text dummy text dummy text dummy text dummy text dummy text dummy text dummy text dummy text dummy text dummy text dummy text dummy text dummy text dummy text dummy text dummy text dummy text dummy text dummy text dummy text dummy text dummy text dummy text dummy text dummy text dummy text dummy text dummy text dummy text dummy text dummy text dummy text dummy text dummy text dummy text dummy text dummy text dummy text dummy text dummy text dummy text dummy text dummy text dummy text dummy text dummy text dummy text dummy text dummy text dummy text dummy text dummy text dummy text dummy text dummy text dummy text dummy text dummy text dummy text dummy text dummy text dummy text \end{algorithm} \caption{alg1} \end{figure} dummy text dummy text dummy text dummy text dummy text dummy text dummy text dummy text dummy text dummy text dummy text dummy text dummy text dummy text dummy text dummy text dummy text dummy text dummy text dummy text dummy text dummy text dummy text dummy text dummy text dummy text dummy text dummy text dummy text dummy text dummy text dummy text dummy text dummy text dummy text dummy text dummy text dummy text dummy text dummy text dummy text dummy text dummy text dummy text dummy text dummy text dummy text dummy text dummy text dummy text dummy text dummy text dummy text dummy text dummy text dummy text dummy text dummy text dummy text dummy text dummy text dummy text dummy text dummy text dummy text dummy text dummy text dummy text dummy text dummy text dummy text dummy text dummy text dummy text dummy text dummy text dummy text dummy text dummy text dummy text dummy text dummy text dummy text dummy text dummy text dummy text dummy text dummy text dummy text dummy text dummy text dummy text dummy text dummy text dummy text dummy text dummy text dummy text dummy text dummy text dummy text dummy text dummy text dummy text dummy text dummy text dummy text dummy text dummy text dummy text dummy text dummy text \pagebreak dummy text dummy text dummy text dummy text dummy text dummy text dummy text dummy text dummy text dummy text dummy text dummy text dummy text dummy text dummy text dummy text dummy text dummy text dummy text dummy text dummy text dummy text dummy text dummy text dummy text dummy text dummy text dummy text dummy text dummy text dummy text dummy text dummy text dummy text dummy text dummy text dummy text dummy text dummy text dummy text dummy text dummy text dummy text dummy text dummy text dummy text dummy text dummy text dummy text dummy text dummy text dummy text dummy text dummy text dummy text dummy text dummy text dummy text dummy text dummy text dummy text dummy text dummy text dummy text dummy text dummy text dummy text dummy text dummy text dummy text dummy text dummy text dummy text dummy text dummy text dummy text dummy text dummy text dummy text dummy text dummy text dummy text dummy text dummy text dummy text dummy text dummy text dummy text dummy text dummy text dummy text dummy text dummy text dummy text dummy text dummy text dummy text dummy text dummy text dummy text dummy text dummy text dummy text dummy text dummy text dummy text dummy text dummy text dummy text dummy text dummy text dummy text dummy text dummy text dummy text dummy text dummy text dummy text dummy text dummy text dummy text dummy text dummy text dummy text dummy text dummy text \begin{figure}[!htpb] \hbox{% \begin{algorithm} dummy text dummy text dummy text dummy text dummy text dummy text dummy text dummy text dummy text dummy text dummy text dummy text dummy text dummy text dummy text dummy text dummy text dummy text dummy text dummy text dummy text dummy text dummy text dummy text dummy text dummy text dummy text dummy text dummy text dummy text dummy text dummy text dummy text dummy text dummy text dummy text dummy text dummy text dummy text dummy text dummy text dummy text dummy text dummy text dummy text dummy text dummy text dummy text dummy text dummy text dummy text dummy text dummy text dummy text dummy text dummy text dummy text dummy text dummy text dummy text dummy text dummy text dummy text dummy text dummy text dummy text dummy text dummy text dummy text dummy text dummy text dummy text dummy text dummy text dummy text dummy text dummy text dummy text dummy text dummy text dummy text dummy text dummy text dummy text dummy text dummy text dummy text dummy text dummy text dummy text dummy text \end{algorithm} } \caption{alg2} \end{figure} dummy text dummy text dummy text dummy text dummy text dummy text dummy text dummy text dummy text dummy text dummy text dummy text dummy text dummy text dummy text dummy text dummy text dummy text dummy text dummy text dummy text dummy text dummy text dummy text dummy text dummy text dummy text dummy text dummy text dummy text dummy text dummy text dummy text dummy text dummy text dummy text dummy text dummy text dummy text dummy text dummy text dummy text dummy text dummy text dummy text dummy text dummy text dummy text dummy text dummy text dummy text dummy text dummy text dummy text dummy text dummy text dummy text dummy text dummy text dummy text dummy text dummy text dummy text dummy text dummy text dummy text dummy text dummy text dummy text dummy text dummy text dummy text dummy text dummy text dummy text dummy text dummy text dummy text dummy text dummy text dummy text dummy text dummy text dummy text dummy text dummy text dummy text dummy text dummy text dummy text dummy text dummy text dummy text dummy text dummy text dummy text dummy text dummy text dummy text dummy text dummy text dummy text dummy text dummy text dummy text dummy text dummy text dummy text dummy text dummy text dummy text dummy text \end{document} I do not need the piton environment to be breakable. So In the second example I added \hbox{} and now it seems to work properly. But a spurious vertical space (\baselineskip ?) is added. If the option splittable=2 is added to piton options in the first example, it also seems to work. But now a break is added where it is not needed. Is the a way to prevent piton environment to split, as in the second example, but without the supirous space? [EDIT] With option splittable=2, it works. I still need to remove the line frame at split, though. But here a question rises... What shall be the proper splittable value? The documentation mentions 4 as a good value.
- Apply formatting within Piton and still represent line breakby cacamailg on December 2, 2026 at 9:15 am
In the next example there are two piton environments. When formatting is applied to a line, the line break is no longer represented with the arrow. How can the formatting be applied and keep the line break representation? \documentclass[twocolumn]{article} \usepackage{newtx} \newcommand\alert[1]{\textbf{#1}} % https://tex.stackexchange.com/questions/769104 % https://tex.stackexchange.com/questions/770117 \usepackage{piton} \usepackage{tcolorbox} \tcbuselibrary{breakable} \PitonOptions{ raw-detected-commands={\alert}, begin-escape=@,end-escape=@, begin-escape-math=$,end-escape-math=$, } \NewPitonEnvironment{algorithm}{O{}} {% \PitonOptions{% tcolorbox, line-numbers, line-numbers/format=\tiny, line-numbers/sep=\labelsep, continuation-symbol={}, end-of-broken-line={}, indent-broken-lines, font-command=\footnotesize, language=verbatim, gobble=2, #1, }% \tcbset{% after skip=0pt, sharp corners, size=fbox, %colback=lightgray, %colframe=lightgray, }% }{} \begin{document} \begin{algorithm} dummy text dummy text dummy text dummy text dummy text dummy text dummy text dummy text dummy text dummy text dummy text dummy text dummy text dummy text \end{algorithm} \begin{algorithm} \alert{dummy text dummy text dummy text dummy text dummy text dummy text dummy text} dummy text dummy text dummy text dummy text dummy text dummy text dummy text \end{algorithm} \end{document}
- pgffor calculations off by a small amount in a simple case [duplicate]by Jasper on December 2, 2026 at 4:50 am
What is going on with these pgffor calculations? This seems to be such a simple case that this discrepancy is surprising. \documentclass[tikz,border=1cm]{standalone} \begin{document} \begin{tikzpicture} \foreach[count = \c from 1] \i in {0.1,0.2,...,0.9}{ \node[fill=white, font=\tiny] at (\c,0) {\i}; } \end{tikzpicture} \end{document}
- How to use bw ice, bw snow, and bw gas material styles in physketch? [closed]by Sebastiano on December 1, 2026 at 10:08 pm
I’d like to use one of these three options, bw ice, bw snow, bw gas, but I’m struggling to understand the manual of physketch now. I am using a recently updated MiKTeX distribution. As things stand, I don’t know how to compile this non-working MWE. \documentclass[a4paper,11pt]{article} \usepackage{physketch} \physketchset{materials=bw} \usepackage{physketch.mechanics} \begin{document} \begin{figure}[htbp] \centering \begin{tikzpicture}[font=\small] \fill[orange!25, draw=orange!60!black] (0,0) rectangle (3.0,1.2); \fill[red!12, draw=red!45!black] (3.0,0) rectangle (6.0,1.2); \fill[blue!12, draw=blue!45!black] (6.0,0) rectangle (9.0,1.2); \fill[bw ice, pattern color=blue!80!black] (0,0) rectangle (3.0,1.2); \fill[bw snow, pattern color=blue!70!black] (3.0,0) rectangle (6.0,1.2); \fill[bw gas, pattern color=blue!50!black] (6.0,0) rectangle (9.0,1.2); \draw[->, very thick, blue!70!black] (3.1,0.6) -- (5.9,0.6); \node[align=center] at (1.5,-0.45) {concentrazione\\alta}; \node[align=center] at (4.5,-0.45) {concentrazione\\media}; \node[align=center] at (7.5,-0.45) {concentrazione\\bassa}; \node[font=\bfseries, blue!70!black] at (4.5,1.55) {direzione del flusso $q(x,t)$}; \end{tikzpicture} \caption{Il farmaco diffonde dalle zone a concentrazione maggiore verso quelle a concentrazione minore.} \label{fig:flusso} \end{figure} \end{document} My error with MikTeX: Package pgfkeys Error: I do not know the key '/physketch/materials', to which you passed 'bw', and I am going to ignore it. Perhaps you misspelled it. See the pgfkeys package documentation for explanation. Type H for immediate help. ... l.7 \physketchset{materials=bw} ? log. file: This is pdfTeX, Version 3.141592653-2.6-1.40.29 (MiKTeX 26.5) (preloaded format=pdflatex 2026.11.23) 1 DEC 2026 23:03 entering extended mode \write18 enabled. %&-line parsing enabled. **"C:/Users/sebys/OneDrive/Desktop/new question/mwe-basic.tex" (C:/Users/sebys/OneDrive/Desktop/new question/mwe-basic.tex LaTeX2e <2026-11-01> L3 programming layer <2026-09-09> (C:\Users\sebys\AppData\Local\Programs\MiKTeX\tex/latex/base\article.cls Document Class: article 2026-06-04 v1.4n Standard LaTeX document class (C:\Users\sebys\AppData\Local\Programs\MiKTeX\tex/latex/base\size11.clo File: size11.clo 2026-06-04 v1.4n Standard LaTeX file (size option) ) \c@part=\count276 \c@section=\count277 \c@subsection=\count278 \c@subsubsection=\count279 \c@paragraph=\count280 \c@subparagraph=\count281 \c@figure=\count282 \c@table=\count283 \abovecaptionskip=\skip49 \belowcaptionskip=\skip50 \bibindent=\dimen150 ) (C:\Users\sebys\AppData\Local\Programs\MiKTeX\tex/latex/physketch\physketch.sty Package: physketch 2026/10/29 v0.1.1 TikZ styles and pictures for physics drawi ngs (C:\Users\sebys\AppData\Local\Programs\MiKTeX\tex/latex/physketch\physketch.gen eral.sty Package: physketch.general 2026/10/29 v0.1.1 physketch: common styles (C:\Users\sebys\AppData\Local\Programs\MiKTeX\tex/latex/pgf/frontendlayer\tikz. sty (C:\Users\sebys\AppData\Local\Programs\MiKTeX\tex/latex/pgf/basiclayer\pgf.sty (C:\Users\sebys\AppData\Local\Programs\MiKTeX\tex/latex/pgf/utilities\pgfrcs.st y (C:\Users\sebys\AppData\Local\Programs\MiKTeX\tex/generic/pgf/utilities\pgfutil -common.tex \pgfutil@everybye=\toks17 \pgfutil@tempdima=\dimen151 \pgfutil@tempdimb=\dimen152 ) (C:\Users\sebys\AppData\Local\Programs\MiKTeX\tex/generic/pgf/utilities\pgfutil -latex.def \pgfutil@abb=\box53 ) (C:\Users\sebys\AppData\Local\Programs\MiKTeX\tex/generic/pgf/utilities\pgfrcs. code.tex (C:\Users\sebys\AppData\Local\Programs\MiKTeX\tex/generic/pgf\pgf.revision.tex) Package: pgfrcs 2026-08-01 v3.1.12 (3.1.12) )) Package: pgf 2026-08-01 v3.1.12 (3.1.12) (C:\Users\sebys\AppData\Local\Programs\MiKTeX\tex/latex/pgf/basiclayer\pgfcore. sty (C:\Users\sebys\AppData\Local\Programs\MiKTeX\tex/latex/graphics\graphicx.sty Package: graphicx 2026-06-26 v1.2e Enhanced LaTeX Graphics (DPC,SPQR) (C:\Users\sebys\AppData\Local\Programs\MiKTeX\tex/latex/graphics\keyval.sty Package: keyval 2026-06-01 v1.15 key=value parser (DPC) \KV@toks@=\toks18 ) (C:\Users\sebys\AppData\Local\Programs\MiKTeX\tex/latex/graphics\graphics.sty Package: graphics 2026-05-17 v1.4h Standard LaTeX Graphics (DPC,SPQR) (C:\Users\sebys\AppData\Local\Programs\MiKTeX\tex/latex/graphics\trig.sty Package: trig 2023/12/02 v1.11 sin cos tan (DPC) ) (C:\Users\sebys\AppData\Local\Programs\MiKTeX\tex/latex/graphics-cfg\graphics.c fg File: graphics.cfg 2016/06/04 v1.11 sample graphics configuration ) Package graphics Info: Driver file: pdftex.def on input line 106. (C:\Users\sebys\AppData\Local\Programs\MiKTeX\tex/latex/graphics-def\pdftex.def File: pdftex.def 2025/09/29 v1.2d Graphics/color driver for pdftex )) \Gin@req@height=\dimen153 \Gin@req@width=\dimen154 ) (C:\Users\sebys\AppData\Local\Programs\MiKTeX\tex/latex/pgf/systemlayer\pgfsys. sty (C:\Users\sebys\AppData\Local\Programs\MiKTeX\tex/generic/pgf/systemlayer\pgfsy s.code.tex Package: pgfsys 2026-08-01 v3.1.12 (3.1.12) (C:\Users\sebys\AppData\Local\Programs\MiKTeX\tex/generic/pgf/utilities\pgfkeys .code.tex \pgfkeys@pathtoks=\toks19 \pgfkeys@temptoks=\toks20 (C:\Users\sebys\AppData\Local\Programs\MiKTeX\tex/generic/pgf/utilities\pgfkeys libraryfiltered.code.tex \pgfkeys@tmptoks=\toks21 )) \pgf@x=\dimen155 \pgf@y=\dimen156 \pgf@xa=\dimen157 \pgf@ya=\dimen158 \pgf@xb=\dimen159 \pgf@yb=\dimen160 \pgf@xc=\dimen161 \pgf@yc=\dimen162 \pgf@xd=\dimen163 \pgf@yd=\dimen164 \w@pgf@writea=\write3 \r@pgf@reada=\read2 \c@pgf@counta=\count284 \c@pgf@countb=\count285 \c@pgf@countc=\count286 \c@pgf@countd=\count287 \t@pgf@toka=\toks22 \t@pgf@tokb=\toks23 \t@pgf@tokc=\toks24 \pgf@sys@id@count=\count288 (C:\Users\sebys\AppData\Local\Programs\MiKTeX\tex/generic/pgf/systemlayer\pgf.c fg File: pgf.cfg 2026-08-01 v3.1.12 (3.1.12) ) Driver file for pgf: pgfsys-pdftex.def (C:\Users\sebys\AppData\Local\Programs\MiKTeX\tex/generic/pgf/systemlayer\pgfsy s-pdftex.def File: pgfsys-pdftex.def 2026-08-01 v3.1.12 (3.1.12) (C:\Users\sebys\AppData\Local\Programs\MiKTeX\tex/generic/pgf/systemlayer\pgfsy s-common-pdf.def File: pgfsys-common-pdf.def 2026-08-01 v3.1.12 (3.1.12) ))) (C:\Users\sebys\AppData\Local\Programs\MiKTeX\tex/generic/pgf/systemlayer\pgfsy ssoftpath.code.tex File: pgfsyssoftpath.code.tex 2026-08-01 v3.1.12 (3.1.12) \pgfsyssoftpath@smallbuffer@items=\count289 \pgfsyssoftpath@bigbuffer@items=\count290 ) (C:\Users\sebys\AppData\Local\Programs\MiKTeX\tex/generic/pgf/systemlayer\pgfsy sprotocol.code.tex File: pgfsysprotocol.code.tex 2026-08-01 v3.1.12 (3.1.12) )) (C:\Users\sebys\AppData\Local\Programs\MiKTeX\tex/latex/xcolor\xcolor.sty Package: xcolor 2024/09/29 v3.02 LaTeX color extensions (UK) (C:\Users\sebys\AppData\Local\Programs\MiKTeX\tex/latex/graphics-cfg\color.cfg File: color.cfg 2016/01/02 v1.6 sample color configuration ) Package xcolor Info: Driver file: pdftex.def on input line 274. (C:\Users\sebys\AppData\Local\Programs\MiKTeX\tex/latex/graphics\mathcolor.ltx) Package xcolor Info: Model `cmy' substituted by `cmy0' on input line 1349. Package xcolor Info: Model `hsb' substituted by `rgb' on input line 1353. Package xcolor Info: Model `RGB' extended on input line 1365. Package xcolor Info: Model `HTML' substituted by `rgb' on input line 1367. Package xcolor Info: Model `Hsb' substituted by `hsb' on input line 1368. Package xcolor Info: Model `tHsb' substituted by `hsb' on input line 1369. Package xcolor Info: Model `HSB' substituted by `hsb' on input line 1370. Package xcolor Info: Model `Gray' substituted by `gray' on input line 1371. Package xcolor Info: Model `wave' substituted by `hsb' on input line 1372. ) (C:\Users\sebys\AppData\Local\Programs\MiKTeX\tex/generic/pgf/basiclayer\pgfcor e.code.tex Package: pgfcore 2026-08-01 v3.1.12 (3.1.12) (C:\Users\sebys\AppData\Local\Programs\MiKTeX\tex/generic/pgf/math\pgfmath.code .tex (C:\Users\sebys\AppData\Local\Programs\MiKTeX\tex/generic/pgf/math\pgfmathutil. code.tex) (C:\Users\sebys\AppData\Local\Programs\MiKTeX\tex/generic/pgf/math\pgfmathparse r.code.tex \pgfmath@dimen=\dimen165 \pgfmath@count=\count291 \pgfmath@box=\box54 \pgfmath@toks=\toks25 \pgfmath@stack@operand=\toks26 \pgfmath@stack@operation=\toks27 ) (C:\Users\sebys\AppData\Local\Programs\MiKTeX\tex/generic/pgf/math\pgfmathfunct ions.code.tex) (C:\Users\sebys\AppData\Local\Programs\MiKTeX\tex/generic/pgf/math\pgfmathfunct ions.basic.code.tex) (C:\Users\sebys\AppData\Local\Programs\MiKTeX\tex/generic/pgf/math\pgfmathfunct ions.trigonometric.code.tex) (C:\Users\sebys\AppData\Local\Programs\MiKTeX\tex/generic/pgf/math\pgfmathfunct ions.random.code.tex) (C:\Users\sebys\AppData\Local\Programs\MiKTeX\tex/generic/pgf/math\pgfmathfunct ions.comparison.code.tex) (C:\Users\sebys\AppData\Local\Programs\MiKTeX\tex/generic/pgf/math\pgfmathfunct ions.base.code.tex) (C:\Users\sebys\AppData\Local\Programs\MiKTeX\tex/generic/pgf/math\pgfmathfunct ions.round.code.tex) (C:\Users\sebys\AppData\Local\Programs\MiKTeX\tex/generic/pgf/math\pgfmathfunct ions.misc.code.tex) (C:\Users\sebys\AppData\Local\Programs\MiKTeX\tex/generic/pgf/math\pgfmathfunct ions.integerarithmetics.code.tex) (C:\Users\sebys\AppData\Local\Programs\MiKTeX\tex/generic/pgf/math\pgfmathcalc. code.tex) (C:\Users\sebys\AppData\Local\Programs\MiKTeX\tex/generic/pgf/math\pgfmathfloat .code.tex \c@pgfmathroundto@lastzeros=\count292 )) (C:\Users\sebys\AppData\Local\Programs\MiKTeX\tex/generic/pgf/math\pgfint.code. tex) (C:\Users\sebys\AppData\Local\Programs\MiKTeX\tex/generic/pgf/basiclayer\pgfcor epoints.code.tex File: pgfcorepoints.code.tex 2026-08-01 v3.1.12 (3.1.12) \pgf@picminx=\dimen166 \pgf@picmaxx=\dimen167 \pgf@picminy=\dimen168 \pgf@picmaxy=\dimen169 \pgf@pathminx=\dimen170 \pgf@pathmaxx=\dimen171 \pgf@pathminy=\dimen172 \pgf@pathmaxy=\dimen173 \pgf@xx=\dimen174 \pgf@xy=\dimen175 \pgf@yx=\dimen176 \pgf@yy=\dimen177 \pgf@zx=\dimen178 \pgf@zy=\dimen179 ) (C:\Users\sebys\AppData\Local\Programs\MiKTeX\tex/generic/pgf/basiclayer\pgfcor epathconstruct.code.tex File: pgfcorepathconstruct.code.tex 2026-08-01 v3.1.12 (3.1.12) \pgf@path@lastx=\dimen180 \pgf@path@lasty=\dimen181 ) (C:\Users\sebys\AppData\Local\Programs\MiKTeX\tex/generic/pgf/basiclayer\pgfcor epathusage.code.tex File: pgfcorepathusage.code.tex 2026-08-01 v3.1.12 (3.1.12) \pgf@shorten@end@additional=\dimen182 \pgf@shorten@start@additional=\dimen183 ) (C:\Users\sebys\AppData\Local\Programs\MiKTeX\tex/generic/pgf/basiclayer\pgfcor escopes.code.tex File: pgfcorescopes.code.tex 2026-08-01 v3.1.12 (3.1.12) \pgfpic=\box55 \pgf@hbox=\box56 \pgf@layerbox@main=\box57 \pgf@picture@serial@count=\count293 ) (C:\Users\sebys\AppData\Local\Programs\MiKTeX\tex/generic/pgf/basiclayer\pgfcor egraphicstate.code.tex File: pgfcoregraphicstate.code.tex 2026-08-01 v3.1.12 (3.1.12) \pgflinewidth=\dimen184 ) (C:\Users\sebys\AppData\Local\Programs\MiKTeX\tex/generic/pgf/basiclayer\pgfcor etransformations.code.tex File: pgfcoretransformations.code.tex 2026-08-01 v3.1.12 (3.1.12) \pgf@pt@x=\dimen185 \pgf@pt@y=\dimen186 \pgf@pt@temp=\dimen187 ) (C:\Users\sebys\AppData\Local\Programs\MiKTeX\tex/generic/pgf/basiclayer\pgfcor equick.code.tex File: pgfcorequick.code.tex 2026-08-01 v3.1.12 (3.1.12) ) (C:\Users\sebys\AppData\Local\Programs\MiKTeX\tex/generic/pgf/basiclayer\pgfcor eobjects.code.tex File: pgfcoreobjects.code.tex 2026-08-01 v3.1.12 (3.1.12) ) (C:\Users\sebys\AppData\Local\Programs\MiKTeX\tex/generic/pgf/basiclayer\pgfcor epathprocessing.code.tex File: pgfcorepathprocessing.code.tex 2026-08-01 v3.1.12 (3.1.12) ) (C:\Users\sebys\AppData\Local\Programs\MiKTeX\tex/generic/pgf/basiclayer\pgfcor earrows.code.tex File: pgfcorearrows.code.tex 2026-08-01 v3.1.12 (3.1.12) \pgfarrowsep=\dimen188 ) (C:\Users\sebys\AppData\Local\Programs\MiKTeX\tex/generic/pgf/basiclayer\pgfcor eshade.code.tex File: pgfcoreshade.code.tex 2026-08-01 v3.1.12 (3.1.12) \pgf@max=\dimen189 \pgf@sys@shading@range@num=\count294 \pgf@shadingcount=\count295 ) (C:\Users\sebys\AppData\Local\Programs\MiKTeX\tex/generic/pgf/basiclayer\pgfcor eimage.code.tex File: pgfcoreimage.code.tex 2026-08-01 v3.1.12 (3.1.12) ) (C:\Users\sebys\AppData\Local\Programs\MiKTeX\tex/generic/pgf/basiclayer\pgfcor eexternal.code.tex File: pgfcoreexternal.code.tex 2026-08-01 v3.1.12 (3.1.12) \pgfexternal@startupbox=\box58 ) (C:\Users\sebys\AppData\Local\Programs\MiKTeX\tex/generic/pgf/basiclayer\pgfcor elayers.code.tex File: pgfcorelayers.code.tex 2026-08-01 v3.1.12 (3.1.12) ) (C:\Users\sebys\AppData\Local\Programs\MiKTeX\tex/generic/pgf/basiclayer\pgfcor etransparency.code.tex File: pgfcoretransparency.code.tex 2026-08-01 v3.1.12 (3.1.12) ) (C:\Users\sebys\AppData\Local\Programs\MiKTeX\tex/generic/pgf/basiclayer\pgfcor epatterns.code.tex File: pgfcorepatterns.code.tex 2026-08-01 v3.1.12 (3.1.12) ) (C:\Users\sebys\AppData\Local\Programs\MiKTeX\tex/generic/pgf/basiclayer\pgfcor erdf.code.tex File: pgfcorerdf.code.tex 2026-08-01 v3.1.12 (3.1.12) ))) (C:\Users\sebys\AppData\Local\Programs\MiKTeX\tex/generic/pgf/modules\pgfmodule shapes.code.tex File: pgfmoduleshapes.code.tex 2026-08-01 v3.1.12 (3.1.12) \pgfnodeparttextbox=\box59 ) (C:\Users\sebys\AppData\Local\Programs\MiKTeX\tex/generic/pgf/modules\pgfmodule plot.code.tex File: pgfmoduleplot.code.tex 2026-08-01 v3.1.12 (3.1.12) ) (C:\Users\sebys\AppData\Local\Programs\MiKTeX\tex/latex/pgf/compatibility\pgfco mp-version-0-65.sty Package: pgfcomp-version-0-65 2026-08-01 v3.1.12 (3.1.12) \pgf@nodesepstart=\dimen190 \pgf@nodesepend=\dimen191 ) (C:\Users\sebys\AppData\Local\Programs\MiKTeX\tex/latex/pgf/compatibility\pgfco mp-version-1-18.sty Package: pgfcomp-version-1-18 2026-08-01 v3.1.12 (3.1.12) )) (C:\Users\sebys\AppData\Local\Programs\MiKTeX\tex/latex/pgf/utilities\pgffor.st y (C:\Users\sebys\AppData\Local\Programs\MiKTeX\tex/latex/pgf/utilities\pgfkeys.s ty (C:\Users\sebys\AppData\Local\Programs\MiKTeX\tex/generic/pgf/utilities\pgfkeys .code.tex)) (C:\Users\sebys\AppData\Local\Programs\MiKTeX\tex/latex/pgf/math\pgfmath.sty (C:\Users\sebys\AppData\Local\Programs\MiKTeX\tex/generic/pgf/math\pgfmath.code .tex)) (C:\Users\sebys\AppData\Local\Programs\MiKTeX\tex/generic/pgf/utilities\pgffor. code.tex Package: pgffor 2026-08-01 v3.1.12 (3.1.12) \pgffor@iter=\dimen192 \pgffor@skip=\dimen193 \pgffor@stack=\toks28 \pgffor@toks=\toks29 )) (C:\Users\sebys\AppData\Local\Programs\MiKTeX\tex/generic/pgf/frontendlayer/tik z\tikz.code.tex Package: tikz 2026-08-01 v3.1.12 (3.1.12) (C:\Users\sebys\AppData\Local\Programs\MiKTeX\tex/generic/pgf/libraries\pgflibr aryplothandlers.code.tex File: pgflibraryplothandlers.code.tex 2026-08-01 v3.1.12 (3.1.12) \pgf@plot@mark@count=\count296 \pgfplotmarksize=\dimen194 ) \tikz@lastx=\dimen195 \tikz@lasty=\dimen196 \tikz@lastxsaved=\dimen197 \tikz@lastysaved=\dimen198 \tikz@lastmovetox=\dimen199 \tikz@lastmovetoy=\dimen256 \tikzleveldistance=\dimen257 \tikzsiblingdistance=\dimen258 \tikz@figbox=\box60 \tikz@figbox@bg=\box61 \tikz@tempbox=\box62 \tikz@tempbox@bg=\box63 \tikztreelevel=\count297 \tikznumberofchildren=\count298 \tikznumberofcurrentchild=\count299 \tikz@fig@count=\count300 (C:\Users\sebys\AppData\Local\Programs\MiKTeX\tex/generic/pgf/modules\pgfmodule matrix.code.tex File: pgfmodulematrix.code.tex 2026-08-01 v3.1.12 (3.1.12) \pgfmatrixcurrentrow=\count301 \pgfmatrixcurrentcolumn=\count302 \pgf@matrix@numberofcolumns=\count303 ) \tikz@expandcount=\count304 (C:\Users\sebys\AppData\Local\Programs\MiKTeX\tex/generic/pgf/frontendlayer/tik z/libraries\tikzlibrarytopaths.code.tex File: tikzlibrarytopaths.code.tex 2026-08-01 v3.1.12 (3.1.12) ))) (C:\Users\sebys\AppData\Local\Programs\MiKTeX\tex/generic/pgf/libraries\pgflibr aryarrows.meta.code.tex File: pgflibraryarrows.meta.code.tex 2026-08-01 v3.1.12 (3.1.12) \pgfarrowinset=\dimen259 \pgfarrowlength=\dimen260 \pgfarrowwidth=\dimen261 \pgfarrowlinewidth=\dimen262 ) (C:\Users\sebys\AppData\Local\Programs\MiKTeX\tex/generic/pgf/frontendlayer/tik z/libraries\tikzlibrarycalc.code.tex File: tikzlibrarycalc.code.tex 2026-08-01 v3.1.12 (3.1.12) ) (C:\Users\sebys\AppData\Local\Programs\MiKTeX\tex/generic/pgf/frontendlayer/tik z/libraries\tikzlibrarydecorations.markings.code.tex (C:\Users\sebys\AppData\Local\Programs\MiKTeX\tex/generic/pgf/frontendlayer/tik z/libraries\tikzlibrarydecorations.code.tex (C:\Users\sebys\AppData\Local\Programs\MiKTeX\tex/generic/pgf/modules\pgfmodule decorations.code.tex \pgfdecoratedcompleteddistance=\dimen263 \pgfdecoratedremainingdistance=\dimen264 \pgfdecoratedinputsegmentcompleteddistance=\dimen265 \pgfdecoratedinputsegmentremainingdistance=\dimen266 \pgf@decorate@distancetomove=\dimen267 \pgf@decorate@repeatstate=\count305 \pgfdecorationsegmentamplitude=\dimen268 \pgfdecorationsegmentlength=\dimen269 ) \tikz@lib@dec@box=\box64 ) (C:\Users\sebys\AppData\Local\Programs\MiKTeX\tex/generic/pgf/libraries/decorat ions\pgflibrarydecorations.markings.code.tex)) (C:\Users\sebys\AppData\Local\Programs\MiKTeX\tex/generic/pgf/frontendlayer/tik z/libraries\tikzlibrarydecorations.pathreplacing.code.tex (C:\Users\sebys\AppData\Local\Programs\MiKTeX\tex/generic/pgf/libraries/decorat ions\pgflibrarydecorations.pathreplacing.code.tex)) (C:\Users\sebys\AppData\Local\Programs\MiKTeX\tex/generic/pgf/frontendlayer/tik z/libraries\tikzlibrarypatterns.meta.code.tex (C:\Users\sebys\AppData\Local\Programs\MiKTeX\tex/generic/pgf/libraries\pgflibr arypatterns.meta.code.tex))) (C:\Users\sebys\AppData\Local\Programs\MiKTeX\tex/latex/physketch\physketch.mec hanics.sty Package: physketch.mechanics 2026/10/29 v0.1.1 physketch: mechanics ) (C:\Users\sebys\AppData\Local\Programs\MiKTeX\tex/latex/physketch\physketch.opt ics.sty Package: physketch.optics 2026/10/29 v0.1.1 physketch: optics ) (C:\Users\sebys\AppData\Local\Programs\MiKTeX\tex/latex/physketch\physketch.cir cuits.sty Package: physketch.circuits 2026/10/29 v0.1.1 physketch: circuits (C:\Users\sebys\AppData\Local\Programs\MiKTeX\tex/latex/circuitikz\circuitikz.s ty Package: circuitikz 2026/09/12{} The CircuiTikz circuit drawing package version 1.8.7 (C:\Users\sebys\AppData\Local\Programs\MiKTeX\tex/generic/pgf/frontendlayer/tik z/libraries\tikzlibrarybending.code.tex File: tikzlibrarybending.code.tex 2026-08-01 v3.1.12 (3.1.12) (C:\Users\sebys\AppData\Local\Programs\MiKTeX\tex/generic/pgf/modules\pgfmodule bending.code.tex File: pgfmodulebending.code.tex 2026-08-01 v3.1.12 (3.1.12) (C:\Users\sebys\AppData\Local\Programs\MiKTeX\tex/generic/pgf/modules\pgfmodule nonlineartransformations.code.tex File: pgfmodulenonlineartransformations.code.tex 2026-08-01 v3.1.12 (3.1.12) \pgftransformnonlinearflatness=\dimen270 ) (C:\Users\sebys\AppData\Local\Programs\MiKTeX\tex/generic/pgf/libraries\pgflibr arycurvilinear.code.tex File: pgflibrarycurvilinear.code.tex 2026-08-01 v3.1.12 (3.1.12) \pgf@curvilinear@time@a=\dimen271 \pgf@curvilinear@length@a=\dimen272 \pgf@curvilinear@length@b=\dimen273 \pgf@curvilinear@length@c=\dimen274 \pgf@curvilinear@length@d=\dimen275 ) \pgf@arrows@the@rigidity=\dimen276 )) (C:\Users\sebys\AppData\Local\Programs\MiKTeX\tex/generic/pgf/frontendlayer/tik z/libraries\tikzlibraryfpu.code.tex (C:\Users\sebys\AppData\Local\Programs\MiKTeX\tex/generic/pgf/libraries\pgflibr aryfpu.code.tex)) (C:\Users\sebys\AppData\Local\Programs\MiKTeX\tex/generic/circuitikz\pgfcirc.de fines.tex \pgf@circ@count@a=\count306 \pgf@circ@count@b=\count307 \pgf@circ@count@c=\count308 \pgf@circ@res@up=\dimen277 \pgf@circ@res@down=\dimen278 \pgf@circ@res@zero=\dimen279 \pgf@circ@res@left=\dimen280 \pgf@circ@res@right=\dimen281 \pgf@circ@res@other=\dimen282 \pgf@circ@res@step=\dimen283 \pgf@circ@res@temp=\dimen284 \pgf@circ@Rlen=\dimen285 \pgf@circ@scaled@Rlen=\dimen286 \pgfstartlinewidth=\dimen287 ) (C:\Users\sebys\AppData\Local\Programs\MiKTeX\tex/generic/circuitikz\pgfcircuti ls.tex \ctikz@scratchbox=\box65 ) (C:\Users\sebys\AppData\Local\Programs\MiKTeX\tex/generic/circuitikz\pgfcircpat h.tex \ctikz@vif@count=\count309 ) (C:\Users\sebys\AppData\Local\Programs\MiKTeX\tex/generic/circuitikz\pgfcircsha pes.tex) (C:\Users\sebys\AppData\Local\Programs\MiKTeX\tex/generic/circuitikz\pgfcircmon opoles.tex) (C:\Users\sebys\AppData\Local\Programs\MiKTeX\tex/generic/circuitikz\pgfcircbip oles.tex) (C:\Users\sebys\AppData\Local\Programs\MiKTeX\tex/generic/circuitikz\pgfcirctri poles.tex \pgf@circ@res@count=\count310 ) (C:\Users\sebys\AppData\Local\Programs\MiKTeX\tex/generic/circuitikz\pgfcircqua dpoles.tex) (C:\Users\sebys\AppData\Local\Programs\MiKTeX\tex/generic/circuitikz\pgfcircmul tipoles.tex) (C:\Users\sebys\AppData\Local\Programs\MiKTeX\tex/generic/circuitikz\pgfcirclab el.tex) (C:\Users\sebys\AppData\Local\Programs\MiKTeX\tex/generic/circuitikz\pgfcircvol tage.tex \pgfcirc@labelshift=\dimen288 ) (C:\Users\sebys\AppData\Local\Programs\MiKTeX\tex/generic/circuitikz\pgfcirccur rent.tex) (C:\Users\sebys\AppData\Local\Programs\MiKTeX\tex/generic/circuitikz\pgfcircflo w.tex)))) ! Package pgfkeys Error: I do not know the key '/physketch/materials', to which you passed 'bw', and I am going to ignore it. Perhaps you misspelled it. See the pgfkeys package documentation for explanation. Type H <return> for immediate help. ... l.3 \physketchset{materials=bw} ? ! Emergency stop. ... l.3 \physketchset{materials=bw} End of file on the terminal! Here is how much of TeX's memory you used: 31354 strings out of 467271 848167 string characters out of 5401091 1495004 words of memory out of 5000000 60557 multiletter control sequences out of 15000+600000 628789 words of font info for 41 fonts, out of 8000000 for 9000 1141 hyphenation exceptions out of 8191 132i,1n,135p,520b,142s stack positions out of 10000i,1000n,20000p,200000b,200000s ! ==> Fatal error occurred, no output PDF file produced! I in the MikTeX path have the v. 0.2 of physketch: I would kindly ask that this question be reopened, as there may be other users who, like me, are experiencing the same problem.
- Drug diffusion particles and concentration gradients to a TikZ skin modelby Sebastiano on December 1, 2026 at 9:27 pm
I have created a TikZ illustration showing transdermal drug diffusion from a patch through the skin layers (epidermis, dermis, and subcutaneous tissue). Here is my current MWE: \documentclass[a4paper,11pt]{article} \usepackage{tikz} \usetikzlibrary{arrows.meta, decorations.pathmorphing} \begin{document} \begin{figure}[htbp] \centering \begin{tikzpicture}[ scale=0.8, transform shape, font=\sffamily, >=Stealth ] \definecolor{epiSopra}{RGB}{244, 224, 195} \definecolor{epiFronte}{RGB}{246, 232, 206} \definecolor{epiMacchia}{RGB}{232, 208, 175} \definecolor{epiLinea}{RGB}{224, 198, 165} \definecolor{dermaSup}{RGB}{244, 198, 194} \definecolor{dermaInf}{RGB}{238, 178, 173} \definecolor{dermaPunto}{RGB}{218, 152, 148} \definecolor{sfondoSotto}{RGB}{228, 202, 145} \definecolor{cellulaAdiposa}{RGB}{252, 245, 220} \definecolor{cerottoSopra}{RGB}{252, 218, 182} \definecolor{cerottoFronte}{RGB}{250, 206, 162} \definecolor{cerottoBordo}{RGB}{190, 130, 75} \definecolor{memSopra}{RGB}{232, 232, 232} \definecolor{memFronte}{RGB}{215, 215, 215} \definecolor{memBordo}{RGB}{140, 140, 140} \definecolor{rossoCapillare}{RGB}{185, 10, 10} \definecolor{farmacoBlu}{RGB}{0, 30, 195} \definecolor{testoGrigio}{RGB}{75, 75, 75} \definecolor{parentesiGrigia}{RGB}{110, 110, 110} \def\w{6.8} \def\inset{0.8} \def\topH{0.55} \fill[black!10, rounded corners=4pt] (0, -0.18) rectangle (\w, 0.05); \begin{scope}[yshift=0cm] \def\h{0.95} \fill[sfondoSotto] (0,0) rectangle (\w,\h); \begin{scope} \clip (0,0) rectangle (\w,\h); \foreach \row in {0,1} { \foreach \col in {0,...,11} { \pgfmathsetmacro{\x}{0.25 + \col*0.62 - \row*0.28} \pgfmathsetmacro{\y}{0.22 + \row*0.45} \fill[cellulaAdiposa, rounded corners=2.5pt] (\x-0.26, \y-0.14) rectangle (\x+0.26, \y+0.14); } } \end{scope} \draw[rossoCapillare, line width=2.2pt, line cap=round] (0.15, 0.48) .. controls (1.4, 0.25) and (2.6, 0.70) .. (3.8, 0.48) .. controls (5.0, 0.26) and (6.0, 0.68) .. (\w-0.15, 0.48); \draw[parentesiGrigia, line width=0.8pt] (\w+0.45, 0.03) -- (\w+0.7, 0.03) -- (\w+0.7, \h-0.03) -- (\w+0.45, \h-0.03); \draw[parentesiGrigia, line width=0.8pt] (\w+0.7, \h/2) -- (\w+0.95, \h/2); \node[anchor=west, align=left, text=testoGrigio, font=\sffamily\normalsize] at (\w+1.05, \h/2) {Tessuto sottocutaneo\\e \textcolor{rossoCapillare}{\textbf{capillari sanguigni}}}; \end{scope} \begin{scope}[yshift=0.95cm] \def\h{2.85} \fill[dermaInf] (0,0) rectangle (\w,\h); \begin{scope} \clip (0,0) rectangle (\w, \h-0.55); \foreach \x/\y/\rx/\ry/\ang in { 0.6/0.4/0.12/0.06/20, 1.4/0.9/0.15/0.07/-15, 2.3/0.3/0.10/0.06/40, 3.1/1.1/0.14/0.06/10, 4.2/0.5/0.16/0.07/-25, 5.3/0.8/0.12/0.06/30, 6.1/0.3/0.14/0.06/-10, 0.9/1.6/0.13/0.06/15, 1.9/1.9/0.15/0.07/-35, 2.8/1.7/0.11/0.05/25, 3.8/2.0/0.14/0.06/-15, 4.9/1.6/0.15/0.07/20, 5.9/1.8/0.12/0.06/-30, 1.2/2.2/0.10/0.05/10, 4.5/2.2/0.11/0.05/-20 } { \fill[dermaPunto, rotate around={\ang:(\x,\y)}] (\x,\y) ellipse (\rx cm and \ry cm); } \end{scope} \fill[dermaSup] (0,\h) -- (\w,\h) -- (\w, \h-0.55) decorate [decoration={snake, amplitude=2.2mm, segment length=9mm}] { -- (0, \h-0.55) } -- cycle; \node[text=black!75, font=\sffamily\small\itshape] at (\w/2, 1.35) {diffusione del farmaco}; \draw[dermaPunto, line width=1pt] (0,\h) -- (\w,\h); \draw[parentesiGrigia, line width=0.8pt] (\w+0.45, 0.03) -- (\w+0.7, 0.03) -- (\w+0.7, \h-0.03) -- (\w+0.45, \h-0.03); \draw[parentesiGrigia, line width=0.8pt] (\w+0.7, \h/2) -- (\w+0.95, \h/2); \node[anchor=west, text=testoGrigio, font=\sffamily\large] at (\w+1.05, \h/2) {Derma}; \end{scope} \begin{scope}[yshift=3.80cm] \def\h{0.55} \fill[epiFronte] (0,0) rectangle (\w,\h); \fill[epiSopra] (0,\h) -- (\inset, \h+\topH) -- (\w-\inset, \h+\topH) -- (\w,\h) -- cycle; \foreach \x/\y/\rx/\ry in { 1.5/0.82/0.22/0.07, 2.8/0.70/0.26/0.08, 4.3/0.85/0.24/0.07, 5.4/0.72/0.20/0.06, 2.1/0.98/0.18/0.05, 3.6/0.96/0.22/0.06, 4.9/0.99/0.16/0.05 } { \fill[epiMacchia] (\x,\y) ellipse (\rx cm and \ry cm); } \draw[epiLinea, line width=0.7pt] (0, 0.28) -- (\w, 0.28); \draw[epiLinea, line width=0.5pt] (0.5, 0.14) -- (4.2, 0.14); \draw[epiLinea, line width=0.5pt] (3.5, 0.42) -- (6.5, 0.42); \pgfmathsetmacro{\totalH}{\h + \topH} \draw[parentesiGrigia, line width=0.8pt] (\w+0.45, 0.03) -- (\w+0.7, 0.03) -- (\w+0.7, \totalH) -- (\w+0.45, \totalH); \draw[parentesiGrigia, line width=0.8pt] (\w+0.7, \totalH/2) -- (\w+0.95, \totalH/2); \node[anchor=west, text=testoGrigio, font=\sffamily\large] at (\w+1.05, \totalH/2) {Epidermide}; \end{scope} \begin{scope}[yshift=5.00cm] \def\h{0.25} \def\mInset{0.55} \def\mTopH{0.35} \fill[memFronte, draw=memBordo, line width=0.6pt] (\mInset, 0) rectangle (\w-\mInset, \h); \fill[memSopra, draw=memBordo, line width=0.6pt] (\mInset, \h) -- (\mInset+0.35, \h+\mTopH) -- (\w-\mInset-0.35, \h+\mTopH) -- (\w-\mInset, \h) -- cycle; \node[font=\sffamily\scriptsize, text=black!80] at (\w/2, \h/2) {membrana di controllo (eventuale)}; \end{scope} \begin{scope}[yshift=5.65cm] \def\h{0.70} \def\pInset{0.55} \def\pTopH{0.40} \fill[cerottoFronte, draw=cerottoBordo, line width=0.8pt, rounded corners=2pt] (\pInset, 0) rectangle (\w-\pInset, \h); \fill[cerottoSopra, draw=cerottoBordo, line width=0.8pt] (\pInset, \h) -- (\pInset+0.35, \h+\pTopH) -- (\w-\pInset-0.35, \h+\pTopH) -- (\w-\pInset, \h) -- cycle; \node[font=\sffamily\bfseries\normalsize] at (\w/2, 0.45) {CEROTTO}; \node[font=\sffamily\footnotesize] at (\w/2, 0.18) {farmaco a concentrazione $C_0$}; \end{scope} \def\axisX{-0.55} \draw[line width=0.8pt] (\axisX - 0.12, 4.35) -- (\axisX + 0.12, 4.35); \draw[line width=0.8pt] (\axisX - 0.12, 0.95) -- (\axisX + 0.12, 0.95); \draw[->, line width=0.9pt] (\axisX, 4.35) -- (\axisX, 0.98); \node[anchor=east, font=\normalsize] at (\axisX - 0.18, 4.35) {$x = 0$}; \node[anchor=east, font=\normalsize] at (\axisX - 0.18, 2.65) {$x$}; \node[anchor=east, font=\normalsize] at (\axisX - 0.18, 0.95) {$x = L$}; \node[anchor=west, align=left, font=\sffamily\footnotesize, text=farmacoBlu] at (\w - 0.8, 6.60) {Direzione di\\diffusione}; \foreach \x in {1.8, 3.4, 5.0} { \draw[->, farmacoBlu, line width=1.1pt] (\x, 5.55) -- (\x, 4.45); \draw[->, farmacoBlu, line width=1.1pt, dashed] (\x, 3.70) -- (\x, 1.05); } \end{tikzpicture} \caption{Schema di diffusione transdermica del farmaco da un cerotto.} \label{fig:diffusione-transdermica} \end{figure} \end{document} How can I add drug molecules (different colours or dots/particles) whose density and opacity gradually decrease from the patch ($C_0$) down through the epidermis and dermis toward the blood capillaries? Any suggestions or improvements on styling is welcome.
- Not sure what is the error, I'm using "tabularray"by GowriSaro on December 1, 2026 at 10:54 am
My code are: \documentclass[twocolumn]{article} \usepackage{amsmath} \usepackage{array} \usepackage{xcolor} \usepackage{tabularray} \UseTblrLibrary{booktabs} \NewColumnType{S}{>{\raggedright\hangindent=1em\arraybackslash}X}% \begin{document} \begin{table} \caption{Comparison of Results. \label{table4-02601079261512425}} {\centering\begin{tblr}{@{}SSSSSSS@{}} \toprule {Study} & {} & \SetCell[c=4]{l} Previous studies\\ {Present study ({\%})} & {Rosengart et al. ({\%})} & {Haucap and Just ({\%})} & {Cipriani et al. ({\%})} & \SetCell[c=2]{l} Frey et al. ({\%})\\ \midrule {Business first-year students} & {5.38} & {61.43} & {41} & {54.08} & \SetCell[c=2]{l} 59\\ {\textit{Z} (\textit{p}-value)} & {–} & {−20.19*** (\textit{p} {<} .001)} & {−12.68*** (\textit{p} {<} .001)} & {−18.22*** (\textit{p} {<} .001)} & \SetCell[c=2]{l} −19.25*** (\textit{p} {<} .001)\\ {Business final-year students} & {13.28} & {57.31} & {60} & {53.40} & \SetCell[c=2]{l} 62\\ {\textit{Z} (\textit{p}-value)} & {–} & {−16.33*** (\textit{p} {<} .001)} & {−14.34*** (\textit{p} {<} .001)} & {−15.62*** (\textit{p} {<} .001)} & \SetCell[c=2]{l} −16.79*** (\textit{p} {<} .001)\\ \bottomrule \end{tblr}}{} \end{table} \end{document} It produced the error: ! Missing number, treated as zero. __dim_eval_end: l.23 \end {tblr}}{} ? Not sure where the error was, please help, I'm using xelatex engine
- ConTeXt: grouping of close footnotes with commas and dashesby Georgian Ilie on December 1, 2026 at 6:40 am
Good morning, I would like to know wheter the scripts of close footnotes can be grouped together. For instance, with this code: \setuppapersize[A5] \starttext Hello\footnote{this is a footnote}\footnote{this is another footnote} \stoptext I obtain two separate footnote scripts: What I'd like to do is to bind the scripts "1" and "2" by a comma (i.e., to have "1,2"). Similarly, when I use three footnotes I'd like to represent the script interval (i.e., to see "1–3". Is it possible to achieve these results? Thank you in advance for your help.
- Extra space if \caption is redefined into \marginnoteby Denis Bitouzé on November 30, 2026 at 10:07 pm
In the following MCE: There is no space between the content of the first table and the right margin. Before the second table, \caption is redefined as a margin note, which creates additional space between the content of that second table and the right margin. The only way to avoid this space is to add % immediately after the table contents and \caption{…} (third table), which is tedious. How can I avoid having to add these % characters when redefining \caption to prevent this extra space? \documentclass{article} \usepackage[paperheight=5cm,showframe]{geometry} \usepackage{marginnote} \begin{document} \begin{table} \raggedleft Foo \caption{Usual caption} \end{table} \RenewDocumentCommand{\caption}{ m }{\marginnote{\tiny#1}} \begin{table} \raggedleft Foo \caption{Margin note caption} \end{table} \begin{table} \raggedleft Foo% \caption{Margin note caption}% \end{table} \end{document}
- Boolean clipping errors due to nonuniform tessellation under stereographic projection in LuaDrawby Jasper on November 29, 2026 at 7:27 pm
NOTE: I used AI to more easily find the specific edge case I was looking for, and to help compose an MWE demonstrating it, as well as the failure of an attempted fix. Consider the solution given in https://tex.stackexchange.com/a/770259. Since stereographic projection is not distance-preserving, a circle tessellated uniformly on the sphere is tessellated nonuniformly after projection. As points approach the projection pole, the distances between consecutive projected points increase. Consequently, some line segments intersect the clipping region even though the circular arcs they approximate do not. One might attempt to exclude these segments by filtering out those exceeding unit length. However, this also removes legitimate segments in regions where the tessellation is coarser. The following MWE demonstrates both problems by toggling filter. How can the tessellation be made sufficiently uniform after projection to avoid these clipping errors? % Adapted from https://tex.stackexchange.com/a/770259 % Posted by nidarfp, modified by community. See post 'Timeline' for change history. % Retrieved 2026-11-29, License - CC BY-SA 4.0 % Changes: fixed rotation and optional unit-length segment filter. \documentclass[tikz,border=0]{standalone} \usepackage[3d]{luadraw} \colorlet{tileblue}{blue!55} \colorlet{tileorange}{orange!65} \begin{document} \begin{luadraw}{name=mobius-filter,exec=true,auto=true} local ld = luadraw local cpx, pt3d = ld.cpx, ld.pt3d local Z, M = cpx.Z, pt3d.M local Origin, vecI, vecJ, vecK = pt3d.Origin, pt3d.vecI, pt3d.vecJ, pt3d.vecK local sin, cos, pi = math.sin, math.cos, math.pi local filter = false -- true: discard segments of Euclidean length > 1 local angle = 90/7 local r, R, h = 4.5, 1, 0 local g = ld.graph3d:new{ window3d = {-r,r,-r,r,-r,r}, viewdir = {"central",35,55,20}, window = {-7,6.25,-5,3.5}, size = {14,14} } require 'luadraw_spherical' require 'luadraw_pdfliteral' local frame = {M(-r,-r,h), M(r,-r,h), M(r,r,h), M(-r,r,h), "l", "cl"} local facets, colorsA, colorsB = {}, {}, {} local axis = {Origin, -vecI} local tileB = {178/255, 63/255, 140/255} local tileO = {1, 94/255, 48/255} local function containsPole(f) local list = {} for k,A in ipairs(f) do if A.z < 0 then return false end list[k] = Z(A.x,A.y) end local n,d = #list,0 for k = 1,n do local a,b = list[k],list[k%n+1] if d == 0 then d = cpx.det(a,b) elseif d*cpx.det(a,b) <= 0 then return false end end return true end -- Split each component rather than reconnecting across rejected edges. local function unitFilter(L) local result = {} for _,line in ipairs(L) do local part = {line[1]} for j = 2,#line do if pt3d.abs(line[j]-line[j-1]) > 1 then if #part > 1 then table.insert(result,part) end part = {} end table.insert(part,line[j]) end if #part > 1 then table.insert(result,part) end end return result end local function dot(u,v) local sv = sin(v) return M(cos(v),sin(u)*sv,-cos(u)*sv) end for i = 0,13 do for j = 0,12 do local a,b = pi/14+i*pi/7,pi/14+(i+1)*pi/7 local c,d = j*pi/13,(j+1)*pi/13 local F = {} pt3d.insert3d(F,dot(a,c)); pt3d.insert3d(F,dot(b,c)) pt3d.insert3d(F,dot(b,d)); pt3d.insert3d(F,dot(a,d)) table.insert(colorsA,(i+j)%2 == 0 and "tileblue" or "tileorange") table.insert(colorsB,(i+j)%2 == 0 and tileB or tileO) table.insert(facets,F) end end local P = ld.parallelep(M(-r,-r,-r),2*r*vecI,2*r*vecJ,2*r*vecK) g:Define_sphere({radius=R,edgestyle="noline"}) local plane = {} local F = ld.rotate3d(facets,angle,axis) for i,facet in ipairs(F) do local colorA,colorB = colorsA[i],colorsB[i] local pole = containsPole(facet) g:DSfacet(facet,{fill=colorA,fillopacity=0.7,style="noline"}) local p1 = ld.projstereo_Sfacet(facet,M(0,0,R),h,true) local L = ld.path3d(p1) if filter then L = unitFilter(L) end L = ld.clippolyline3d(L,P,false,true) if L ~= nil and #L > 0 then if pole then g:Beginclip(ld.polyline2path3d(L),true) g:Dpath3d(frame,"draw=none,fill="..ld.rgb(colorB)) g:Endclip() else table.insert(plane,g:Proj3d(L)) table.insert(plane,{draw="none",fill=colorB}) end end end g:Dliteralpolyline(table.unpack(plane)) g:Dpath3d(frame) local O,r1,N = table.unpack(g:Sphere_outline(Origin,R).data) local A,B = table.unpack(g:Sphere_tangency(Origin,R,{Origin,vecK})) g:Beginclip({A,O,B,R,1,vecK,"ca",O,A,r1,1,N,"ca"}) g:Dspherical() g:Endclip() g:Sendtotex() g:Cleargraph() \end{luadraw} \end{document}
- BibLaTeX MLA adding extra space after semicolon in citation when using hyperref and preceding citation does not end in a numberby Zachary Martinez on November 29, 2026 at 6:34 pm
The BibLaTeX MLA package is adding extra space after the semicolons that are inserted into parenthetical citations to separate two or more citations when the hyperref package is loaded and the citation doesn't end with a page number How can I make it so that it does not add more space than normal? I have found a workaround by this code: \makeatletter \renewcommand\hyper@natanchorstart[2]{} \renewcommand\hyper@natanchorend{} \makeatother and entering my body text in a NoHyper environment. This removes the space but also removes the citations' links to the bibliography, which I would like to preserve. And if I don't use the NoHyper environment, the citations still link to the bibliography page, but to random parts of it, not to the beginning of its corresponding entry; that is not optimal. Working example: \documentclass{article} \usepackage[style=mla]{biblatex} \addbibresource{art-appreciation-the-paper.bib} \begin{filecontents}{art-appreciation-the-paper.bib} @book{Hibbard, author = {Hibbard, Howard}, date = {1985}, date-added = {2026-11-25 18:45:24 -0600}, date-modified = {2026-11-25 18:46:03 -0600}, origdate = {1983}, publisher = {Westview Press}, title = {Caravaggio}} @online{Graham-Dixon, author = {Graham-Dixon, Andrew}, date = {2026-09-16}, date-added = {2026-11-25 15:39:40 -0600}, date-modified = {2026-11-25 19:43:22 -0600}, journaltitle = {Encyclopedia Britannica}, title = {Caravaggio}, url = {https://www.britannica.com/biography/Caravaggio}} @book{Artbook, date = {1999}, date-added = {2026-11-25 00:30:27 -0600}, date-modified = {2026-11-25 00:33:44 -0600}, editor = {Kruger, Anna}, publisher = {DK Publishing Inc.}, title = {ArtBook: Caravaggio}, translator = {Gilbert, John}} @article{Biografia, date-added = {2026-11-25 00:23:12 -0600}, date-modified = {2026-11-25 00:34:53 -0600}, eprinttype = {Internet Archive}, journal = {Rai International Online}, shorttitle = {Biografía De}, title = {Biografía de Caravaggio (Michelangelo Merisi) (1571 - 1610)}, url = {https://web.archive.org/web/20090416123558/http://www.italica.rai.it/index.php?categoria=bio&scheda=caravaggio_prima_parte}, urldate = {2009-04-16}} \end{filecontents} \usepackage[colorlinks=true, citecolor=, urlcolor=blue]{hyperref} \begin{document} \raggedright \autocite{Biografia,Graham-Dixon}\\ \autocites[10]{Artbook}{Biografia}\\ \autocites[10]{Artbook}{Graham-Dixon}[3]{Hibbard}. \end{document} Thank you!!! PS I tried to add screenshots but the system doesn't appear to be working properly. It will not preview images as it did a few days ago when I first wrote this draft. Sorry.
- \pause is not working as I want in beamerby Rup_Cantor on November 29, 2026 at 3:24 pm
I am having a problem while using \pause in my beamer file. Here is an MWE from my code: \documentclass{beamer} \usepackage{tikz} \usetheme{moloch} \begin{document} \begin{frame}{Examples} \begin{center} \tikzset{ vertex/.style={circle, draw=black, fill=white, inner sep=0pt, minimum size=4pt, thick} } \begin{tikzpicture}[baseline=(c.base), thick, scale=0.7] \node[vertex] (a) at (0,0) {}; \node[vertex] (b) at (1.2,0) {}; \node[vertex] (c) at (0,1.2) {}; \node[vertex] (d) at (1.2,1.2) {}; \draw (a)--(b); \draw (c)--(d); \node[draw=none] at (0.6,-0.8) {\small $\{ 0,0,2,2\}$}; \pause \node[vertex] (p) at (4.5,0.5) {}; \node[vertex] (q) at (5.7,0.5) {}; \node[vertex] (r) at (6.9,0.5) {}; \node[vertex] (m) at (8.1,0.5) {}; \draw (p)--(q); \draw (m)--(r); \draw[red] (q)--(r); \node[draw=none] at (6.3,-0.7) {\small $\{ 0,2-\sqrt{2},2,2+\sqrt{2}\}$}; \end{tikzpicture} \end{center} \pause \begin{itemize} \item[$\blacksquare$] adding an edge may result into integral variation or may not \pause \item[$\blacksquare$] sometimes the variation occurs in one place \pause \item[$\blacksquare$] sometimes the variation occurs in two places \end{itemize} \end{frame} \end{document} This produces as follows: which is of course not what I want. I want the first graph to be shown at first then the second and then the texts to appear. How can I fix this issue?
- Creating an example like environment in beamerby Sourav on November 29, 2026 at 12:20 pm
Consider the following MWE : \documentclass[aspect ratio=169]{beamer} \usetheme{moloch} \setbeamertemplate{theorems}[numbered] \begin{frame}{Some Examples} \begin{example} Foo. \end{example} \end{frame} \begin{frame}{Non examples} % want to have a non example environment \end{frame} \end{document} I want to have a "non example" environment with the same shade of green with which the text "Example 1" is printed. Moreover, I want it to be numbered from beginning as 1,2,... and not be continued from the counter where examples end. How can I do so?
- The glossary isn't printingby Suhrud Ekbote on November 29, 2026 at 12:04 pm
I have scoured practically every other question on here about this and none of them have helped. I'm using TeXShop on a Mac, and I'm not using a separate document for the glossary since I don't need that many terms. I'm following the Overleaf tutorial and I'm pretty sure it's to the letter. This is my code: \documentclass[10pt, a4paper, twoside]{book} \usepackage{glossaries} \makeglossaries %\newglossaryentry{ } {name= , description={ }} \newglossaryentry{Pupuli Wekili Maro} { name=Pupuli Wekili Malo, description={Publius Vergilius Maro, author of the Aeneid} } \begin{document} \printglossary[title=List of Tokiponisations] \end{document} and this is the output:
- Concentration/flux map sequence for diffusion (Fick's laws): stationary caseby Sebastiano on November 29, 2026 at 11:26 am
I would like to create a sequence of illustrations of diffusion (concentration and flux) and Fick's laws under steady-state conditions from a transdermal patch across a layer $x \in [0, L]$, where the following conditions hold: The concentration decreases linearly: $c(x,t) = C_0(1 - x/L)$, with boundary conditions $c(0,t) = C_0$ and $c(L,t) = 0$, where $L$ is the thickness of the dermis; The diffusive flux is constant: $\q(x,t) = \left(\frac{D C_0}{L}, 0\right)$. Since I do not know how to use Mathematica 14, I would like to create an animation or a sequence of panels in TikZ/PGFPlots. I am not sure if this code is a starting point and if it can also be easily adapted to model non-stationary (time-dependent) problems. I have done this: \documentclass{article} \usepackage{tikz, pgfplots} \pgfplotsset{compat=1.18} \begin{document} \begin{center} \begin{tikzpicture} \pgfplotsset{mappa/.style={view={0}{90}, width=1.8cm, height=4.5cm, scale only axis, xmin=0, xmax=1, ymin=0, ymax=1, y dir=reverse, xtick=\empty, ytick={0,0.5,1}, yticklabels={$0$,$L/2$,$L$}, ylabel={profondit\`a $x$}, colormap/jet, colorbar, domain=0:1, y domain=0:1, samples=2, samples y=40}} \begin{axis}[mappa, title={$c(x)/C_0$}, point meta min=0, point meta max=1, colorbar style={ytick={0,0.5,1}}, name=A] \addplot3[surf, shader=interp]{1-y}; \end{axis} \begin{axis}[mappa, at={(A.east)}, xshift=1.7cm, anchor=west, title={$q_x/(DC_0/L)$}, point meta min=0, point meta max=2, colorbar style={ytick={0,1,2}}, ylabel={}, yticklabel=\empty, name=B] \addplot3[surf, shader=interp]{1}; \end{axis} \begin{axis}[at={(B.east)}, xshift=1.9cm, anchor=west, width=3cm, height=4.5cm, scale only axis, xmin=0, xmax=1, ymin=0, ymax=1.1, xlabel={$x/L$}, legend style={font=\scriptsize, at={(0.5,1.04)}, anchor=south}] \addplot[blue, very thick, domain=0:1] {1-x}; \addlegendentry{$c/C_0$} \addplot[red, very thick, dashed, domain=0:1] {1}; \addlegendentry{$q_x/(DC_0/L)$} \end{axis} \end{tikzpicture} \end{center} \end{document} Is it possible to animate it?
- hyperref without zref-clever: ref type in black and numbering in blueby Akira on November 29, 2026 at 10:45 am
I have a tex file taken from this answer: \documentclass{article} % In LaTeX 2026-06-01, alias counters for theorem-like % environments are created automatically. \IfFormatAtLeastTF{2026/06/01} {} {\usepackage{aliascnt}} \usepackage{amsthm} \usepackage{mathtools} % before hyperref \mathtoolsset{showonlyrefs} \usepackage[notcite,notref]{showkeys} \usepackage[hypertexnames=false]{hyperref} \hypersetup{ colorlinks=true, linkcolor=blue, filecolor=blue, urlcolor=red, citecolor=magenta } \numberwithin{equation}{section} \newtheorem{theorem}{Theorem}[section] \IfFormatAtLeastTF{2026/06/01} {% % Current LaTeX: the alias counter is created automatically. \newcommand{\addtheorem}[2]{% \newtheorem{#1}[theorem]{#2}% \ExpandArgs{c}\newcommand{#1autorefname}{#2}% }% } {% % Older LaTeX: create the alias counter using aliascnt. \newcommand{\addtheorem}[2]{% \newaliascnt{#1}{theorem}% \newtheorem{#1}[#1]{#2}% \aliascntresetthe{#1}% \ExpandArgs{c}\newcommand{#1autorefname}{#2}% }% } \addtheorem{corollary}{Corollary} \addtheorem{lemma}{Lemma} \addtheorem{proposition}{Proposition} \theoremstyle{definition} \addtheorem{definition}{Definition} \addtheorem{assumption}{Assumption} \addtheorem{remark}{Remark} \addtheorem{example}{Example} \renewcommand{\sectionautorefname}{Section} % Make \autoref compatible with mathtools' showonlyrefs. \NewCommandCopy{\originalautoref}{\autoref} \RenewDocumentCommand{\autoref}{s m}{% \noeqref{#2}% \IfBooleanTF{#1} {\originalautoref*{#2}}% {\originalautoref{#2}}% } \begin{document} \section{Introduction} \label{chap} \begin{lemma} \label{lem:1} If $U$, then $V$. \end{lemma} \begin{theorem} \label{thm} If A then \begin{align} B & = C, \label{thm:eq1} \\ X & = Y, \label{thm:eq4} \\ U & = V. \label{thm:eq5} \end{align} \end{theorem} From \autoref{thm} and \autoref{lem:1} in \autoref{chap}, we have \autoref{thm:eq1} and \autoref{thm:eq5}. \end{document} In above screenshot, Theorem 1.2 is blue. I would like to keep the numbering 1.2 blue, but Theorem black. Also, the whole Theorem 1.1 remains clickable. Could you explain how to do so? With zref-clever, the answers are available in here and here. Unfortunately, zref-clever seems to not be maintained anymore.
- OpTeX: a usable template for startersby Akira on November 29, 2026 at 10:30 am
Recently, I have come to know OpTeX https://petr.olsak.net/optex. With the help of AI, I am able to create a usable template, which mimics what I already have with LaTeX: Section numbering Theorem environments Cross-reference numbering AI tends to produce unnecessarily complicated code. OpTeX is niche and I am unable to evaluate the correctness of below macro. I hope to have a robust template. Could you have a check on it below? % ------------------------------------------------------------------ % 1) "Smart" cross-reference label % -- sections/chapters: store "Chapter 3" / "Section 2.4" / "Subsection 2.4.1" \_def\_printrefnum [#1@#2]{\_leavevmode % we must be in horizontal mode \_ifnonum \_else #1\_numprint\_therefnum #2\_fi \_edef\_zcrefword{\_ifcase\_sectionlevel\_relax \_or Chapter\_or Section\_or Subsection\_fi}% \_wlabel {\_zcrefword~\_therefnum}% \_ifnotoc \_else \_incr \_tocrefnum \_dest[toc:\_the\_tocrefnum]% \_ewref\_Xtoc{{\_the\_sectionlevel}{\_secinfo}% {\_therefnum}{\_theoutline}\_detokenize\_ea{\_savedtitle}}% \_fi \_gdef\_theoutline{}% } % -- theorem/lemma (\numberedpar): store "Theorem 2.3" / "Lemma 2.4" \_def \_printnumberedpar #1#2{\_par \_noindent\_wlabel {#2~\_numprint{#1}}% {\_bf #2 \_numprint{#1}\_istoksempty\_opt\_iffalse \_space \_the\_opt \_fi.}\_space \_ignorespaces } \_def\zcref{\ref} \_def\eqref{\ref} % equations already store "(2.3)" % ------------------------------------------------------------------ % 2) Suppress numbering of non-referenced equations \refdecl{% \_def\_Xusedref#1{\_expandafter\_gdef\_csname zuse:#1\_endcsname{}}% } \openref % make sure the .ref file exists so \_wref below is not a no-op \_let\_OrigOpTeXref=\ref \_def\ref[#1]{\_wref\_Xusedref{{#1}}\_OrigOpTeXref[#1]} \_def\_ineqmark{\_incr\_dnum \_ifx\_lastlabel\_undefined \_ifinner\_else\_eqno\_fi \_wlabel\_thednum \_hbox{\_numprint\_thednum}% \_else \_ifcsname zuse:\_lastlabel\_endcsname \_ifinner\_else\_eqno\_fi \_wlabel\_thednum \_hbox{\_numprint\_thednum}% \_else \_decr\_dnum % give the number back \_wlabel{}% % \wlabel still creates the \dest[ref:...] destination itself \_fi \_fi } \_def\_thednum {(\_othe\_chapnum.\_othe\_secnum.\_the\_dnum)} % ------------------------------------------------------------------ % 3) General styling \hyperlinks \Blue \Blue % internal links blue \everytocline={\Blue} \_parskip=4pt plus2pt minus1pt \fontfam[LMfonts] \typosize[10/12] \fontfam[Heros] \fontfam[LMfonts] % register \Heros as a family switch, then \def\theorem {\numberedpar A{Theorem}} \def\endtheorem {\par} \def\lemma {\numberedpar A{Lemma}} \def\endlemma {\par} \_def\_titfont{\_scalemain\_typoscale[\_magstep4/\_magstep5]\_boldify\Heros} \_def\_printsec#1{\_par \_abovetitle{\_penalty-151}\_bigskip {\_secfont \_noindent \_raggedright \_printrefnum[@.\_quad]#1\_nbpar}\_insertmark{#1}% \_nobreak \_belowtitle{\_medskip} \_firstnoindent } \tit OpTeX \maketoc \label[sec:math] \sec Math With OpTeX we could write maths. Equations can be referenced. For example, see \eqref[eqn:def-m] in \zcref[sec:math]. \label[eqn:famous-emc] $$ E = mc^2 \eqmark $$ with \label[eqn:def-m] $$ m = {m_0 \over \sqrt{1 - {v^2\over c^2}}} \eqmark $$ \label[lem:testlemma] \lemma Not all abc \endlemma As we see in \zcref[lem:testlemma], the situation is fine. \outlines{1} \bye
- \ifnum throwing error despite using \pgfmathtruncatemacroby Stephanie on November 28, 2026 at 9:58 pm
I'm trying to use the result of a calculation to control flow within a tikzpicture. After consulting this answer and this reddit post, I switched to using the \pgfmathtruncatemacro command and added \relax to the \ifnum statement. However, the \ifnum statement flagged below still gives me the errors Missing number, treated as zero. and Missing = inserted for \ifnum. I also tried several solutions from here and here related to the fpu library, but everything I tried either gave me additional errors, or had no apparent effect. The calculations themselves appear to be correct, so I don't think it's the over/underflow errors referenced in that last link. The code below does run, but the \ifnum statement always executes the True condition whether or not that's actually the case. Is there something else I can do to force \testrefrtheta to be an integer? \documentclass[border=5pt]{standalone} \usepackage{ifthen,tikz,pgfplots} \begin{document} \begin{tikzpicture} % Indices of refraction \def\nnone{1.0} \def\nntwo{2.4} % reference scales \def\H{1.25} \def\normx{-2} % x-component of the incident ray \def\vecx{0.7875} %n_1 sin(theta_1) = n_2 sin(theta_2) % Calculate incident sin(theta) = 0.63 \pgfmathsetmacro{\incidentsin}{\vecx/\H} %sintheta_i=x/y % Calculate refracted sin(theta) = n_1 sin(theta_1) / n_2 = 0.2625 \pgfmathsetmacro{\refrsin}{\nnone*\incidentsin/\nntwo} % Use inverse sin to calculate refracted angle, and print in red as a test -> 15.22 degrees \pgfmathsetmacro{\refrtheta}{asin(\refrsin)} % Use truncatemacro to get the integer (rounded down) of the refracted angle, and print in dark green as a test \pgfmathtruncatemacro{\testrefrtheta}{floor(\refrtheta)} \node[red] at (\normx,0) {\refrtheta}; \node[green!50!black] at (\normx*2,\H/2) {\large \testrefrtheta}; % Print refracted angle in different colors depending on its value %%%%%%%%%%%%%%%%%%%%%%%%%%%%%% % This is where the error comes in - it always runs the first command even if that command is false \ifnum {\testrefrtheta} > {90}\relax% \node[blue] at (1.75,\H) {\Large \testrefrtheta}; \else \node[red] at (1.75,\H) {\Large \testrefrtheta}; \fi %%%%%%%%%%%%%%%%%%%%%%%%%%%%% \end{tikzpicture} \end{document}
- Generate {4,5} hyperbolic tiling with LuaDraw. I cannot figure out a simple way to generate them, and would appreciate an explanation as to how I canby Jasper on November 28, 2026 at 3:29 pm
Note: As I am still a beginner in luadraw, I had substantial help from AI to write the MWE of this question. I've mapped a Cartesian grid onto the hyperboloid and then projected it onto the Poincaré disk. \documentclass[border=3.14mm]{standalone} \usepackage[3d]{luadraw} \colorlet{tileblue}{blue!30} \colorlet{tileorange}{orange!80} \begin{document} \begin{luadraw}{name=grid} local ld = luadraw local M = ld.pt3d.M local sqrt, sin, cos, pi = math.sqrt, math.sin, math.cos, math.pi local O, I, K = M(0,0,0), M(1,0,0), M(0,0,1) local n, h = 4, .5 local g = ld.graph3d:new{ window3d={-8,8,-4,4,-4,4}, viewdir="xOy", window={-8,8,-3.2,4.2}, size={17,7.86,1} } local function H(p) return M(p.x,p.y,sqrt(1+p.x^2+p.y^2)) end local function P(p) return M(p.x,p.y,0)/(1+p.z) end local function disk(p) return P(H(p)) end local function view(p) p = ld.rotate3d(p,15,{O,K}) return ld.rotate3d(p,-43,{O,I}) end local L, R = M(-5.4,.8,0), M(5.5,.8,0) local function source(p) return L+view(p) end local function target(p) return R+2.1*p end local function surface(p) return view(H(p)) end local function boundary(f,i,j) local A = {M(i*h,j*h,0), M((i+1)*h,j*h,0), M((i+1)*h,(j+1)*h,0), M(i*h,(j+1)*h,0)} local B = {} for k=1,4 do local a,b = A[k],A[k%4+1] for l=0,23 do B[#B+1] = f(a+(l/24)*(b-a)) end end return B end local function circle(f) local A = {} for k=0,179 do local t=2*pi*k/180 A[#A+1]=f(M(cos(t),sin(t),0)) end return A end local facets, edges = {},{} local function onDisk(p) return target(disk(p)) end g:Dpolyline3d(circle(view),true,"gray,fill=gray!8") g:Dpolyline3d(circle(target),true,"black,fill=gray!8") for i=-n,n-1 do for j=-n,n-1 do local color = (i+j)%2==0 and "tileblue" or "white" if i==0 and j==-3 then color="tileorange" end g:Dpolyline3d(boundary(source,i,j),true,"black,thin,fill="..color) g:Dpolyline3d(boundary(onDisk,i,j),true,"black,thin,fill="..color) g:Dpolyline3d(boundary(function(p) return view(disk(p)) end,i,j), true,"gray,very thin,fill="..color) facets[#facets+1] = ld.surface(function(u,v) return surface(M(u,v,0)) end,i*h,(i+1)*h,j*h,(j+1)*h,{8,8}) facets[#facets+1] = {mode=5,color=color,contrast=.3} edges[#edges+1] = boundary(surface,i,j) end end local C = M(0,0,-1) local A = {M(0,-1.5,0),M(.5,-1.5,0),M(.5,-1,0),M(0,-1,0)} for _,p in ipairs(A) do g:Dpolyline3d({view(C),view(H(p))},false,"orange!90!black,thin") end g:Dmixfacet(table.unpack(facets)) for _,B in ipairs(edges) do g:Dpolyline3d(B,true,"black,very thin") end for _,p in ipairs(A) do g:Dpolyline3d({view(disk(p)),view(H(p))},false,"orange!90!black,thin,dashed") end g:Dlabel3d("$C=(0,0,-1)$",view(C)+M(0,-.27,0),{}) g:Dlabel3d("Cartesian grid",L+M(0,-2.25,0),{}) g:Dlabel3d("Hyperboloid",M(0,3.75,0),{}) g:Dlabel3d("Poincar\\'e disk",R+M(0,-2.5,0),{}) g:Dpolyline3d({M(-3,.8,0),M(-2.55,.8,0)},false,"->,thick") g:Dpolyline3d({M(2.75,.8,0),M(3.15,.8,0)},false,"->,thick") g:Dlabel3d("$H$",M(-2.77,1.05,0),{}) g:Dlabel3d("$P$",M(2.95,1.05,0),{}) g:Show() \end{luadraw} \end{document} What I'd like to do is generate a tiling in the Cartesian plane such that its image under these maps is a regular hyperbolic tiling, say {4,5} (https://en.wikipedia.org/wiki/4-5_kisrhombille). How would one go about generating such tiles? I cannot figure out a simple way to generate them, and would appreciate an explanation as to how I can. My goal is to make a Poincaré animation, similar to this one of the Klein disk that I made with AI, and do not understand the tiling process of. Though, I do understand how to set up the map once tiled.
- Shifting endpoint of an arrowby Jo Jo on November 28, 2026 at 1:10 pm
I'm trying to shift at custom the point where the left arrow ends by using xshift and yshift without success. Any hint? Below, find my code (compiled via LuaLaTeX). Many thanks. \documentclass{beamer} \usepackage{nicematrix} \usepackage{tikz} \usetikzlibrary{tikzmark,calc,positioning,fit,arrows,shapes,backgrounds,shapes.geometric,arrows.meta,patterns.meta,decorations.pathreplacing} \begin{document} \begin{frame} \begin{equation*} \begin{bNiceArray}{cccc}[margin] \CodeBefore \begin{tikzpicture} \fill [green!50!black,opacity=0.7] ([xshift=3pt,yshift=-2pt]1-|1) rectangle ([xshift=-3pt,yshift=-1pt]5-|2); \end{tikzpicture} \Body \tikzmarknode[outer sep=3pt]{x}{v_{11}} & v_{12} & \ldots & v_{1n} \\[5pt] v_{21} & v_{22} & \ldots & v_{2n} \\[5pt] \vdots & \vdots & \ddots & \vdots \\[5pt] v_{n1} & v_{n2} & \ldots & v_{nn} \end{bNiceArray} \begin{bNiceArray}{cccc}[margin] \tikzmarknode[outer sep=4pt]{a}{\lambda_{1}} & 0 & \ldots & 0 \\[5pt] 0 & \lambda_{2} & \ddots & \vdots \\[5pt] \vdots & \ddots & \ddots & 0 \\[5pt] 0 & \ldots & 0 & \lambda_{n} \CodeAfter \tikz \draw[color=green!50!black,very thick,opacity=0.7] (1-1) circle (3mm); \end{bNiceArray} \end{equation*} \begin{tikzpicture}[remember picture,overlay] \draw[green!50!black,<->,opacity=0.7] ([xshift=-8pt, yshift=10pt]x) edge [out=25, in=130] (a); \end{tikzpicture} \end{frame} \end{document} Current result:
- Forest: box around tree with attached nodesby Guido Vanden Wyngaerd on November 28, 2026 at 9:33 am
I'm trying to get a box around a (sub)tree, which should look like this: This is the MWE: \documentclass{article} \usepackage{forest} \useforestlibrary{linguistics} \forestapplylibrarydefaults{linguistics} \begin{document} \begin{forest} [,no edge, tikz={ \node[draw=gray!50,line width=2pt,rounded corners,fit to=tree] (wksp) {}; } [JP,tikz={\node[left] (bell) at (.west) {\emph{bell}$\quad\leftrightarrow\quad$};} [J] [EvalP,name=EvalNP [Eval] [AP [\phantom{text},roof]]]] [PlP,tikz={\node[right] (e) at (.east) {$\quad\leftrightarrow\quad$\emph{e}};} [Pl] [MP [M,name=M]]]] \end{forest} \end{document} But it produces this, with the bell outside of the box, and I want it inside: I've tried various solutions (eg with fit=(bell)(M)), but this produces an error. The hack that I currently use is to attach an invisible (phantom) node to the top (unlabelled) node, which works but needs a lot of tinkering to come out right, so I am wondering if there is a better way.
- Filling stereographically projected spherical tiles in LuaDrawby Jasper on November 28, 2026 at 6:47 am
Note: I had substantial help from AI to write the MWE of this question. I am stereographically projecting a tiled sphere onto its equatorial plane. Each projected tile is clipped against a rectangular prism before being filled. Due to the singularity of stereographic projection at the north pole, the tile containing that point maps to an unbounded region and is filled incorrectly. How can the projected tiles be filled correctly within the clipping region using luadraw? As I am still learning, I had substantial help from AI to write this script: \documentclass[ tikz, border=3.14mm ]{standalone} \usepackage[3d]{luadraw} \colorlet{tileblue}{blue!55} \colorlet{tileorange}{orange!65} \begin{document} \begin{luadraw*}{name=spherical-tiling} local ld = luadraw local M = ld.pt3d.M local sin, cos, pi = math.sin, math.cos, math.pi local r = 4.5 local frames = 48 local correct = false local axis = {M(0,0,0), M(1,1,0)} local equator = {M(0,0,0), M(0,0,1)} local prism = ld.parallelep( M(-r,-r,-1), M(2*r,0,0), M(0,2*r,0), M(0,0,2) ) local frame = { M(-r,-r,0), M(r,-r,0), M(r,r,0), M(-r,r,0) } local function stereo(p) return M(p.x,p.y,0)/(1-p.z) end local function boundary(f,a,b,c,d) local P = {} local function edge(u1,v1,u2,v2) for k = 0,59 do local t = k/60 local p = f(u1+t*(u2-u1),v1+t*(v2-v1)) if #P == 0 or ld.pt3d.abs(p-P[#P]) > 1e-10 then table.insert(P,p) end end end edge(a,c,b,c) edge(b,c,b,d) edge(b,d,a,d) edge(a,d,a,c) if ld.pt3d.abs(P[1]-P[#P]) < 1e-10 then table.remove(P) end return P end local function addtile(scene,facets,color) if #facets > 0 then table.insert(scene,facets) table.insert(scene,{ mode=5, color=color, contrast=.3, twoside=false }) end end for k = 0,frames-1 do local angle = 12-9*k/(frames-1) local g = ld.graph3d:new{ window3d={-r,r,-r,r,-1,1}, viewdir={35,55}, adjust2d=true, size={14,14} } local function sphere(u,v) return ld.rotate3d( M(sin(v),cos(v)*cos(u),cos(v)*sin(u)), angle,axis ) end local function projection(u,v) return stereo(sphere(u,v)) end local north = ld.rotate3d(M(0,0,1),-angle,axis) local uN = math.atan(north.z,north.y) if uN < 0 then uN = uN+2*pi end local vN = math.asin(north.x) local upper, lower, plane = {}, {}, {} local pole = nil for i = 0,11 do for j = 0,11 do local a,b = i*pi/6, (i+1)*pi/6 local c,d = -pi/2+j*pi/12, -pi/2+(j+1)*pi/12 local containsPole = a < uN and uN < b and c < vN and vN < d local color = (i+j)%2 == 0 and "tileblue" or "tileorange" if containsPole then color = "red" end -- Spherical tile, split at the equatorial plane. local F = ld.surface(sphere,a,b,c,d,{8,8}) local A,B = ld.cutfacet(F,equator) addtile(upper,A,color) addtile(lower,B,color) -- Project and clip the closed tile boundary. local P = boundary(projection,a,b,c,d) P = ld.clip3d({P},prism,false) if #P > 0 then if containsPole then pole = P else table.insert(plane,{polygon=P, color=color}) end end end end -- Draw in depth order: lower hemisphere, plane, upper hemisphere. g:Dmixfacet(table.unpack(lower)) g:Dpolyline3d(frame,true, "draw=black,thin,fill="..(correct and "red" or "white") ) for _,tile in ipairs(plane) do g:Dpolyline3d(tile.polygon,true,"draw=none,fill="..tile.color) end if pole and not correct then g:Dpolyline3d(pole,true,"draw=red,fill=red,fill opacity=.45") end g:Dpolyline3d(frame,true,"black,thin") g:Dmixfacet(table.unpack(upper)) g:Sendtotex() end \end{luadraw*} \end{document}