• Assigning set lengths for intervals in LaTeX
    by Nico on May 4, 2026 at 2:53 pm

    For one of my statistics projects I need to calculate some confidence intervals. I put them all in a table, but it bothers me that the square brackets are not lining up. Is there a way to make it so that all of them line up at the beginning and at the end? I added a MWE and a picture. \documentclass[11pt]{article} \usepackage{amsmath} \usepackage{graphicx} \usepackage{booktabs} \usepackage{float} \usepackage[margin=2.5cm]{geometry} \begin{document} \begin{table}[h] \centering \begin{tabular}{lccc} \toprule Variable & Confidence interval mean & Confidence interval median & Confidence interval variance \\ \midrule BMI & $[27.31,29.02]$ & $[26.52,28.06]$ & $[37.53,54.90]$ \\ WHR & $[0.86,0.88]$ & $[0.86,0.89]$ & $[0.004,0.006]$ \\ MAP & $[99.06,102.86]$ & $[97.33,101.33]$ & $[183.93,282.34]$\\ CHR & $[4.08,4.45]$ & $[3.70,4.25]$ & $[1.71,2.61]$ \\ Age & $[42.19,46.09]$ & $[40.00,45.00]$ & $[206.73,287.33]$ \\ Stab\_glu & $[89.34,95.99]$ & $[85.00,89.00]$ & $[283.18,1405.86]$ \\ Glyhb & $[4.69,4.87]$ & $[4.62,4.79]$ & $[0.43,0.64]$ \\ \bottomrule \end{tabular} \caption{Confidence intervals for diabetic negative data} \label{tab:CI diabetic negative} \end{table} \end{document}

  • Make uppercase for french-babel part name (as "Première partie") in headers
    by valentin on May 4, 2026 at 2:00 pm

    A question similar to Capitalize French part name. What I wish : I would like the headers to be written uppercase : on even pages : CHAPITRE X. TITLE OF THE CHAPTER on odd pages : PREMIÈRE PARTIE. TITLE OF THE PART What I tried : I used the fancyhdr package and here is a minimal working example : \documentclass[twoside]{book} \usepackage[french]{babel} \usepackage[T1]{fontenc} \usepackage{fancyhdr} \usepackage{lipsum} % Defining command \parttitle \newcommand*\parttitle{} \let\origpart\part \renewcommand*{\part}[2][]{% \ifx\\#1\\% argument optionnel absent ? \origpart{#2}% \renewcommand*\parttitle{#2}% \else \origpart[#1]{#2}% \renewcommand*\parttitle{#1}% \fi } % Defining command \chaptertitle \newcommand*\chaptertitle{} \let\origchapter\chapter \renewcommand*{\chapter}[2][]{% \ifx\\#1\\% argument optionnel absent ? \origchapter{#2}% \renewcommand*\chaptertitle{#2}% \else \origchapter[#1]{#2}% \renewcommand*\chaptertitle{#1}% \fi } %Defining right and left marks \renewcommand{\leftmark}{\MakeUppercase{\chaptername \ \thechapter. \ \chaptertitle}} \renewcommand{\rightmark}{\MakeUppercase{\partname. \ \parttitle}} % Defining header style \pagestyle{fancy} \fancyfoot{} \fancyfoot[C]{\thepage} \fancyhead{} \fancyhead[RO]{\emph{\rightmark}} \fancyhead[LE]{\emph{\leftmark}} \begin{document} \part{Titre de la partie} \chapter{Titre du chapitre} \lipsum[1-10] \end{document} Doing this yields the correct result for even pages (btw it matches the default setting of fancyhdr) : Yet, on odd pages, the part title is written uppercase but not the partname : I would like the "Première partie" to be written uppercase. What I understand so far : With babel in French, part names are by default written as "Première partie", "Deuxième partie", etc. (and not as "Partie 1", "Partie 2", etc.). The doc of the babel french package explains (p.38-39) : \StartBabelCommands*{french}{captions}[unicode, fontenc=TU EU1 EU2, charset=utf8] \SetString{\partnameord}{partie} \SetString{\partfirst}{Première} \SetString{\partsecond}{Deuxième} When PartNameFull=true (default), \part{} is printed in French as “Première partie’’ instead of “Partie I’’. As logic is prohibited inside \SetString, let’s hide the test about PartNameFull in \FB@partname. \SetStringLoop{ordinal#1}{% \frenchpartfirst,\frenchpartsecond,Troisième,Quatrième,% Cinquième,Sixième,Septième,Huitième,Neuvième,Dixième,Onzième,% Douzième,Treizième,Quatorzième,Quinzième,Seizième,% Dix-septième,Dix-huitième,Dix-neuvième,Vingtième} \AfterBabelCommands{% \NewDocumentCommand\FB@emptypart{}{\def\thepart{\unskip}}% \NewDocumentCommand\FB@partname{}{% \ifFBPartNameFull \csname ordinal\romannumeral\value{part}\endcsname\space \partnameord\FB@emptypart \else Partie% \fi}% } \SetString{\partname}{\FB@partname} \EndBabelCommands When setting the babel in another language, the part is expressed as "Parte 1", "Part 1", "Teil 1" and not as "Première partie" as in french-babel. As well, when setting PartNameFull = false, the part is written in French as "Partie 1". In those cases, the command \MakeUppercase{\partname} works well and I get the part name uppercase as wanted. For instance in English : So I guess the issue is in the composition of the part name when PartNameFull = true, but I couldn't figure where the problem is and how to solve it.

  • Draw a half-plane figure (à la elasticity/solid mechanics books)
    by Dimitrios ANAGNOSTOU on May 4, 2026 at 9:21 am

    How can one create a figure like the following? Here is my attempt. I use the plot function with a combination of a parabola (for the general shape) and a sine wave (to create the "wiggles"). \documentclass[tikz,border=10pt]{standalone} \usepackage{amsmath} \begin{document} \begin{tikzpicture}[>=latex] % Draw the wavy boundary % We use a parabola-like base: 0.2*x^2 - 2 % We add a small sine component for the "roughness" \draw[thick] plot [domain=-3.2:3.2, samples=100, smooth] (\x, {0.2*\x*\x - 2 + 0.08*sin(600*\x)}); % Draw Horizontal Axis (x, u) \draw[->] (-3.5,0) -- (3.5,0) node[below right] {$x, u$}; % Draw Vertical Axis (y, v) \draw[->] (0,-2.5) -- (0,0.8) node[right] {$y, v$}; % Origin label \node[below left] at (0,0) {$0$}; \end{tikzpicture} \end{document} My problem is that the boundary appears too 'wavy'. Also there is a small unecessary part above the x-axis. Any ideas to improve the figure?

  • Column alignment in a table
    by N. Hunt on May 3, 2026 at 11:16 pm

    From the following tex, \documentclass[a4paper,14pt]{extarticle} \usepackage[a4paper,left=0.75in,top=0.25in,bottom=0.25in,landscape]{geometry} \usepackage{fontspec} \usepackage{polyglossia} \setmainfont[Ligatures=TeX]{Gentium} \usepackage[Latin,Greek]{ucharclasses} \usepackage{multicol} \usepackage{booktabs} \usepackage{multirow} \setromanfont{Gentium-Regular} \setmainlanguage{greek} \setotherlanguage{english} \setlength{\tabcolsep}{10pt} \setlength{\parindent}{0pt} \begin{document} \thispagestyle{empty} \begin{table}[!ht] \renewcommand{\arraystretch}{1.25} \begin{tabular}{l c l} \multicolumn{3}{c}{\textsc{First Declension}}\\ \multicolumn{1}{c}{\textsc{Masc.}} & & \multicolumn{1}{c}{\textsc{Fem.}} \\ xxx, xxxx & & xxx, xxx, x \\ xxx, [xxx] & & xxx, xxxx \\ x, x & & x, x \\ xxx, xxxx & & xxx, xxx, xxxx \\ xxx, xxx, x & & xxx, xxx, x \\ \multicolumn{3}{c}{x} \\ \multicolumn{3}{c}{xxx} \\ \multicolumn{3}{c}{xxx} \\ \multicolumn{3}{c}{xxx, [xxxx]} \\ \multicolumn{3}{c}{xxx, [xxx, xxxx, xxxx, xxx, xxxx]} \\ \multicolumn{3}{c}{xxxx} \\ \end{tabular} \end{table} \end{document} I get this output: I would like to know how to get the right-hand column, specifically, the top 5 rows of the right-hand column, moved to the right, to give a better appearance of the bottom 6 rows being centered.

  • How to make error messages that count in luatexbase.module_XXX
    by Jasper on May 3, 2026 at 2:09 pm

    I have a Lua based package. I want to make error messages that count. I can make obvious ones which are dependent on common sense, such as type checking in some places, but I want to know what broader considerations I should make before going in with error reporting. \documentclass{article} \ExplSyntaxOn \lua_load_module:n { main } \NewDocumentCommand { \myfunction } {} { \__jasper_myfunction: } \ExplSyntaxOff \begin{document} \myfunction \end{document} local function register_tex_cmd(name, func, args, protected) name = "__jasper_" .. name .. ":" .. ("n"):rep(#args) local scanners = {} for _, arg in ipairs(args) do scanners[#scanners+1] = token['scan_' .. arg] end local scanning_func = function() local values = {} for _, scanner in ipairs(scanners) do values[#values+1] = scanner() end func(table.unpack(values)) end local index = luatexbase.new_luafunction(name) lua.get_functions_table()[index] = scanning_func if protected then token.set_lua(name, index, "protected") else token.set_lua(name, index) end end local myfunction = function() luatexbase.module_info('mypackage', "For your information") end register_tex_cmd("myfunction", function() myfunction() end, { })

  • TikZ mark line end with x
    by Viesturs on May 3, 2026 at 11:26 am

    The task is to draw a line with an end marker x: The code \documentclass[tikz,border=5pt]{standalone} \begin{document} \begin{tikzpicture} \draw (0,0)--(2,3) node[pos=1] {$\times$}; \end{tikzpicture} \end{document} produces the output How to draw an end marker x that is rotated relative to the line?

  • (Hopf fibration) I want to know how I can obtain the stereographic projection of a spherical circle in R4 to R3, based on a point on a 2sphere in R3
    by Jasper on May 3, 2026 at 10:43 am

    I want to draw the Hopf fibration. In the Hopf fibration, each point on a sphere is mapped to a 4D spherical circle. We can elliptically (Mobiusly) transform the points on the 2sphere to produce beautiful geometric transformations when we stereographically project the 3sphere into R3. I think I could get it if I already had the map from the point to the circle on the 3sphere in R4. So that's my question. I want to know how I can obtain the stereographic projection of a spherical circle in R4 to R3, based on a point on a 2sphere in R3. Here is an MWE of a sphere: % Source - https://tex.stackexchange.com/a/735942 % Posted by Jasper Habicht, modified by community. See post 'Timeline' for change history % Retrieved 2026-05-03, License - CC BY-SA 4.0 \documentclass[border=10pt]{standalone} \usepackage{tikz, tikz-3dplot} \begin{document} \def\myr{3} \tdplotsetmaincoords{65}{125} \begin{tikzpicture} \coordinate (O) (0,0); \draw[thick, ball color=cyan!50!blue, opacity=0.5, draw opacity=1] (O) circle[radius={\myr}]; \node[right] at (O) {$O$}; \begin{scope}[tdplot_main_coords, rotate=-10] \begin{scope}[canvas is xy plane at z=0] % Back half circle (dashed) \draw[dashed] (\tdplotmainphi:\myr) arc[start angle={\tdplotmainphi}, end angle={\tdplotmainphi+180}, radius={\myr}] coordinate (R); % Front half circle (solid) + BL \draw[thick] (\tdplotmainphi:\myr) arc[start angle={\tdplotmainphi}, end angle={\tdplotmainphi-180}, radius={\myr}] coordinate (L); \fill (O) circle[radius={2pt}]; \end{scope} \begin{scope}[canvas is xy plane at z={\myr+0.75}] \draw[-stealth] (\tdplotmainphi:0.5) arc[start angle={\tdplotmainphi}, end angle={\tdplotmainphi+300}, radius={0.5}]; \end{scope} \begin{scope}[canvas is xy plane at z={\myr}] \fill (0,0) circle[radius={2pt}]; \end{scope} \begin{scope}[canvas is xy plane at z={-\myr}] \fill (0,0) circle[radius={2pt}]; \end{scope} \begin{scope}[canvas is yz plane at x=0] \draw[dashed] (\tdplotmainphi:\myr) arc[start angle={\tdplotmainphi}, end angle={\tdplotmainphi+180}, radius={\myr}]; \draw[thick] (\tdplotmainphi:\myr) arc[start angle={\tdplotmainphi}, end angle={\tdplotmainphi-180}, radius={\myr}]; \end{scope} \begin{scope}[canvas is xz plane at y=0] \draw[dashed] (\tdplotmainphi:\myr) arc[start angle={\tdplotmainphi}, end angle={\tdplotmainphi+180}, radius={\myr}]; \draw[thick] (\tdplotmainphi:\myr) arc[start angle={\tdplotmainphi}, end angle={\tdplotmainphi-180}, radius={\myr}]; % Axis \draw[dashed] (0,{\myr}) -- (0,{-\myr}); \draw (0,{\myr}) -- (0,{\myr+1.25}) (0,{-\myr}) -- (0,{-\myr-1.25}); \end{scope} \end{scope} \draw (O) -- (R) node[pos=0.25, above] {$r$}; \end{tikzpicture} \end{document} https://philogb.github.io/page/hopf/# https://en.wikipedia.org/wiki/Hopf_fibration

  • How to plot a curved line a cross the thickness of the beams
    by Tldi You on May 3, 2026 at 7:36 am

    Deformed and undeformed configurations of the beam Hello everyone, I am trying to reproduce this image using LaTeX TikZ. I have written the code below, but I am encountering difficulties when drawing the curved line through the thickness (the yellow line). Any suggestions would be greatly appreciated. \documentclass[tikz,border=5mm]{standalone} \usepackage{tikz} \usetikzlibrary{arrows.meta, decorations.pathmorphing, positioning, calc} \begin{document} \begin{tikzpicture}[>=Stealth, scale=1.5] % Styles \tikzset{ zigzag/.style={decoration={zigzag, segment length=2mm, amplitude=1mm}, decorate}, break/.style={decoration={zigzag, segment length=4mm, amplitude=2mm}, decorate}, dot/.style={circle, fill=black, inner sep=1.2pt}, hollowdot/.style={circle, draw=black, fill=white, inner sep=1.2pt} } % --- Undeformed Beam (Top Part) --- \begin{scope}[shift={(0,2.5)}] % Beam edges \draw (-1.5, 0.4) -- (2, 0.4); \draw (-1.5, -0.4) -- (2, -0.4); \draw [zigzag] (-1.5, -0.4) -- (-1.5, 0.4); \draw [zigzag] (2, -0.4) -- (2, 0.4); % Neutral axis \draw [dotted, thick] (-1.5, 0) -- (2.5, 0) node[right] {$x, u$}; \draw [->] (2.3, 0) -- (2.7, 0); % Center vertical line and z-axis indicator \draw (0, 0.4) -- (0, -0.4); \node [hollowdot] at (0,0) {}; \draw [->] (0.2, 0) -- (0.2, -0.3); \node [right, font=\small] at (0.2, -0.15) {$z$}; % Left coordinate system and x-dimension \draw (-2.8, 0) -- (-2.3, 0); \draw [break] (-2.3, 0) -- (-1.9, 0); \draw (-1.9, 0) -- (-1.5, 0); \draw (-2.8, 0) -- (-2.8, -0.8) node[below, font=\small] {$z, w$}; \draw [->] (-2.8, -0.6) -- (-2.8, -1); \draw [->] (-2.8, -0.6) -- (0, -0.6); \node [fill=white, inner sep=1pt, font=\small] at (-1.4, -0.6) {$x$}; % Vertical reference line extending down \draw [thin, gray!60] (0, -0.4) -- (0, -3.5); \end{scope} % --- Deformed Beam (Bottom Part) --- \begin{scope}[shift={(0,1)}] % Curved beam boundaries \draw (-1.5, 0.4) to[bend right=15] (2, 0.4); \draw (-1.5, -0.4) to[bend right=15] (2, -0.4); \draw [zigzag] (-1.5, -0.4) -- (-1.5, 0.4); \draw [zigzag] (2, -0.4) -- (2, 0.4); \draw [dashed] (-1.8, 0) to[bend right=15] (2.3, 0); % Reference point (u0, w0) on the neutral axis \coordinate (P0) at (0.8, -0.30); \node [hollowdot] at (P0) {}; \node [below right, xshift=50pt, yshift=-20pt, font=\small] (L0) {$(u_0, w_0)$}; \draw [->, shorten >=2pt] (L0.west) -- (P0); % Vertical dashed reference line through P0 %\draw [red,dashed] ($(P0) + (0, 1.2)$) -- ($(P0) + (0, -0.5)$); \draw [red,dashed] (P0) -- ($(P0) + (115:1.0)$); % Deformed cross-section line \draw [yellow,thick] ($(P0) + (-0.3, 0.6)$) to[bend left=25] ($(P0) + (0.1, -0.6)$); % Point (u, w) on the cross-section \coordinate (P) at ($(P0) + (-0.01, -0.25)$); \node [dot] at (P) {}; \node [left, xshift=-2pt, yshift=2pt, font=\small] at (P) {$(u, w)$}; % Rotation angles at the top % Angle phi_x (rotation of the cross-section) \draw [->] ($(P0) + (0, 0.8)$) arc (90:115:0.8); \node [left, font=\small] at ($(P0) + (105:0.9)$) {$\phi_x$}; % Angle -dw0/dx (rotation of the normal) \draw [->] ($(P0) + (0, 0.8)$) arc (95:90:0.8); \node [right, xshift=6pt, font=\small] at ($(P0) + (80:0.8)$) {$-\frac{\partial w_0}{\partial x}$}; \draw [green,dashed] (P0) -- ($(P0) + (90:1.2)$); % Slope angle at the neutral axis \draw [blue,dashed] (P0) -- ($(P0) + (1.5, 0)$); \draw [yellow,dashed] ($(P0) + (-0.5, -0.1)$) -- ($(P0) + (1.3, 0.20)$); % tangent line \draw [->] ($(P0) + (1.4, 0)$) arc (0:10:1.2); \node [right, font=\small] at ($(P0) + (5:1.4)$) {$-\frac{\partial w_0}{\partial x}$}; \end{scope} \end{tikzpicture} \end{document}

  • Can you help me identify this font [duplicate]
    by Name Redacted on May 3, 2026 at 1:18 am

    Fonts I've tried the following to no avail: Libertinus Math Latin Modern Math STIX Two Math New Computer Modern Math Asana Math TeX Gyre Termes Math TeX Gyre Pagella Math TeX Gyre Schola Math

  • is there an easier way to draw a dotplot
    by Arne Timperman on May 2, 2026 at 7:23 am

    I want to draw this dotplot: The only way I could think of is: \documentclass{article} \usepackage{tikz} \usepackage{pgfplots} \usepackage{statistics} \usetikzlibrary{patterns} \begin{document} \begin{tikzpicture} \begin{axis}[ width=12cm, height=5cm, ymin=0, ymax=20, xmin=0, xmax=1.3, axis y line=left, axis x line=bottom, ytick=\empty, xlabel={$x$}, tick style={draw=none} ] % Dotplot (voorbeelddata) \addplot[ only marks, mark=*, mark size=2.5pt, green!70!black ] coordinates { % linkerzijde (0.35,1) (0.40,1) (0.45,1) (0.40,2) (0.45,2) (0.50,2) (0.45,3) (0.50,3) (0.55,3) (0.50,4) (0.55,4) (0.60,4) % midden (hoogste stapel) (0.60,1) (0.65,1) (0.70,1) (0.75,1) (0.60,2) (0.65,2) (0.70,2) (0.75,2) (0.60,3) (0.65,3) (0.70,3) (0.75,3) (0.65,4) (0.70,4) (0.65,5) (0.70,5) (0.65,6) (0.65,7) % rechterzijde (0.80,1) (0.85,1) (0.80,2) (0.85,2) (0.85,3) }; \end{axis} \end{tikzpicture} \end{document} Resulting in this not very satisfying result: Any suggestions?

  • What's wrong with this fancy title page?
    by Cham on May 1, 2026 at 11:42 pm

    I'm playing with a book cover (a novel) with the title separated on three lines. The first part is left aligned to the page, the middle part is centered, and the last part is (should be) right aligned. Currently, my title page is almost right, but I'm experiencing an horizontal glitch that I don't understand. Here's the MWE code that shows the issue. What is wrong with it? \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} % Option showframe pour montrer les bordures. \raggedbottom \hyphenpenalty=2000 \exhyphenpenalty=2000 \usepackage{titlesec} \usepackage{graphicx} \usepackage[dvipsnames]{xcolor} \usepackage{float} \usepackage[titles]{tocloft} \usepackage[dvipsnames]{xcolor} \usepackage{transparent} \usepackage{tikz} \usetikzlibrary{calc} \titleformat{\chapter}[display] {\normalfont\huge\bfseries\centering} {\chaptertitlename\ \thechapter}{20pt}{\Huge} \begin{document} \frontmatter \begin{titlepage} \definecolor{lightbrown}{RGB}{177, 149, 93} \definecolor{darkred1}{RGB}{60, 25, 0} \pagecolor{darkred1} \begin{tikzpicture}[remember picture, overlay] \draw[line width = 1in,color = white] ($(current page.north west) + (0.25in,0.25in)$) rectangle ($(current page.south east) + (0.25in,-0.25in)$); \draw[line width = 0.25pt,color = black] ($(current page.north west) + (0.75in,-0.25in)$) rectangle ($(current page.south east) + (-0.25in,0.25in)$); \draw[line width = 1pt,color = white] ($(current page.north west) + (1in,-0.5in)$) rectangle ($(current page.south east) + (-0.5in,0.5in)$); \end{tikzpicture} \centering {\textcolor{lightbrown}{\Huge\sffamily Author's name}} \vfill \raggedright {\textcolor{lightbrown}{\fontsize{58}{0}\selectfont\sffamily\textbf{{WOORLDS}}}} \\[2.5\baselineskip] \centering {\textcolor{lightbrown}{\fontsize{48}{0}\selectfont\sffamily\textbf{{of}}}} \\[2.5\baselineskip] \raggedleft {\textcolor{lightbrown}{\fontsize{58}{0}\selectfont\sffamily\textbf{{WOORMS}}}} \\[2\baselineskip] \vfill \centering \vfill \vfill \vfill {\textcolor{brown}{\Large\selectfont\sffamily Copyright Notice}} \end{titlepage} \pagecolor{white} \end{document} Also, the middle part should be well centered, horizontally AND vertically between the first and last part of the title. I'm not sure the code is properly done. Any advice on this would be greatly appreciated. Here's a preview of what this code is doing (don't mind about the weird title. This is just for the the MWE): As you could see on the picture, the last part of the title ("WOORMS") have more space to its right that the left of the fist part ("WOORLDS"). Also, I'm not sure that the middle part ("of") is well centered, vertically and horizontally.

  • How to add extrusion glow of irregular shape different from `shadow scale`?
    by Explorer on May 1, 2026 at 6:50 pm

    What I want to achieve is something like: Noted that the "glow" here is somewhat like a "shadow" path out of the border. However, I have tried blur shadow={shadow xshift=0pt,shadow yshift=0pt,shadow scale=1.05}: \documentclass[tikz,border=5pt]{standalone} \usetikzlibrary{shadows.blur,spy} \begin{document} \begin{tikzpicture}[spy using outlines={circle, magnification=3, size=3cm}] \draw[fill=gray!25,draw,rounded corners,blur shadow={shadow xshift=0pt,shadow yshift=0pt,shadow scale=1.05}] (40:4) arc[start angle=40,end angle=140,radius=4] -- (140:2) arc[start angle=140,end angle=40,radius=2] -- cycle; \draw[fill=white] (0,2.75) -- ++(.5,-.25) -- (0,3.5) -- ++(-.5,-1) -- cycle; \spy[red] on (140:2) in node at (-2,-1); \spy[blue] on (40:2) in node at (+2,-1); \end{tikzpicture} \end{document} The shadow glow is not what I was after: Is that possible to provide the shadows for such ideal glow for irregular shape?

  • Align Text in Header
    by jeroen2009 on May 1, 2026 at 2:49 pm

    In the following example I am getting an additional unwanted empty line in the header text and I am looking to get the header text in the right cell aligned left. Is there an easy way to achieve this? \documentclass[a4paper,12pt]{book} \usepackage[utf8]{inputenc} \usepackage[demo]{graphicx} \usepackage{array} \usepackage{lastpage} \usepackage{lipsum} \usepackage{fancyhdr} \usepackage[hmargin=20mm,top=3cm,headheight=65pt,footskip=10pt]{geometry} \usepackage{tgheros} \renewcommand*\familydefault{\sfdefault} \usepackage[T1]{fontenc} \pagestyle{fancy} \renewcommand{\headrulewidth}{0pt} \fancyhead[CE,CO,LE,LO,RE,RO]{} %% clear out all headers \fancyhead[C]{% \begin{tabular}{|m{3.0cm}|m{9.3cm}|m{3.2cm}|} \hline \raisebox{-.2\height}{\includegraphics[height=7mm]{logo.png}} & \centering \raisebox{-.2\height}{\fontsize{18}{18}\selectfont{\textbf{Operating Procedure}}} & \centering {\fontsize{6.5}{6.5}\selectfont{Doc. Ref.: abcdef\\ REV1 of \today\\ Page \thepage\ of \pageref{LastPage}}}\tabularnewline \hline \end{tabular}% } \fancyfoot[CE,CO,LE,LO,RE,RO]{} %% clear out all footers \begin{document} \chapter{Chapter title} \thispagestyle{fancy} \section{Section title} \lipsum[1-10] \end{document}```

  • polyglossia and \AtBeginDocument
    by Antonis on May 1, 2026 at 6:32 am

    When polyglossia is loaded it seems that \AtBeginDocument fails to do its work. The following code \documentclass[12pt]{article} \usepackage{fontsetup} \usepackage{polyglossia} \setmainlanguage{english} \setotherlanguage{greek} \AtBeginDocument{\addfontfeatures{StylisticSet=6,StylisticSet=7}} \begin{document} θυμήθηκα \addfontfeatures{StylisticSet=6,StylisticSet=7} θυμήθηκα \end{document} produces So the \AtBeginDocument did not work (the thetas must be different as in the second line). Now if you comment out the lines of polyglossia, things work as expected, that is both lines produce the same output as in the second line of the picture above. What is wrong with the above code or with polyglossia?

  • Create a simple emoji language for babel
    by David Purton on May 1, 2026 at 2:42 am

    I have my doubts about the wisdom of this… But with LuaLaTeX, babel is really great at switching between fonts and languages automatically without mark up. And the settings for the language can by included in an ini file. I wondered about using this feature in a document that is already multilinugual and uses babel so I can just insert emojis wherever without thinking. This following MWE works, but I was wondering: Is this really a good idea? Is there a better way? Can the set up be done wihtout a separate babel-emoji.ini file? MWE %! TeX Program = lualatex \documentclass{article} \begin{filecontents}[overwrite]{babel-emoji.ini} [identification] charset = utf8 script.name = emoji [characters] ranges = 1F300..1F9FF 2600..26FF 2700..27BF \end{filecontents} \usepackage[english]{babel} \babelprovide[import=emoji, onchar=fonts]{emoji} \babelfont[emoji]{rm}{Noto Color Emoji} \begin{document} A \texttt{babel} integrated emoji: 😀 \end{document}

  • Borromean Knot Brunnian link
    by Julio Michael Stern on April 30, 2026 at 10:18 pm

    I am trying to use TiKZ to draw a Borromean knot with 3 Wasp figures. I am getting the wrong superpositions. A single wasp is produced by the following code. Can someone help me to write a TiKZ code for this Brunnian entanglement with 12 crossings. Wasp: \documentclass[border=5mm]{standalone} \usepackage{tikz} \begin{document} \begin{tikzpicture} % Estilos para o anel do mosaico \tikzset{ vespa ring/.style={ draw=red, line width=11pt, line join=round }, white stripe/.style={ draw=white, line width=2pt, % Removida a opacidade para evitar manchas line join=round } } % Macro final da "Cintura de Vespa" com cabeça circular e elevada \newcommand{\vespawaist}{ (0.8, 0) % Cintura direita .. controls (0.8, 1.0) and (2.0, 1.8) .. (1.5, 2.4) % Ombro .. controls (1.0, 3.0) and (-1.0, 3.0) .. (-1.5, 2.4) % Topo elevado .. controls (-2.0, 1.8) and (-0.8, 1.0) .. (-0.8, 0) % Cintura esquerda .. controls (-0.8, -1.0) and (-2.0, -1.8) .. (-1.5, -2.4) % Ombro inferior .. controls (-1.0, -3.0) and (1.0, -3.0) .. (1.5, -2.4) % Base elevada .. controls (2.0, -1.8) and (0.8, -1.0) .. (0.8, 0) % Fecha -- cycle } % Desenho em camadas para garantir o branco puro \draw[vespa ring] \vespawaist; \draw[white stripe] \vespawaist; \end{tikzpicture} \end{document}

  • Apply transformation xslant to node shape but not text
    by Paul on April 30, 2026 at 6:11 pm

    I want to create a multi part parallelogram input block for a flowchart. There is no multi part trapezium shape that exist so for now I used a standard rectangular multi part shape with the xslant option to make it look like a parallelogram. I defined a style that I can easily reuse. The problem is that the text is also slanted, and if possible I would like it normal. Is there a way to apply xslant only to the shape and not to the text ? I tried creating a second node only for the text but the problem is that the paralellogram doesn't resize properly to fit the text. My MWE : \documentclass[class=article]{standalone} \usepackage[]{xcolor} \usepackage{tikz} \usetikzlibrary{shapes} \tikzstyle{io} = [rectangle split, rectangle split parts=2, xslant=0.4, draw, rectangle split part fill={blue!50,blue!20}, text centered, minimum width=4.25cm, minimum height=2cm] \begin{document} \begin{tikzpicture} \draw (0,0) node[io,name = ,align = center]{Parameters\nodepart{two} $\alpha$, $\eta$}; \end{tikzpicture} \end{document} Thanks for your help.

  • Use "plot" inside a \draw path in tikz
    by flawr on April 30, 2026 at 5:36 pm

    Is there a way to continue a path we draw using \draw with a plot, just as we do for instance also with arc or similar commands? In the example below I have a straight line, but I'd like the plot to append directly to that line, as indicated by the red dots. I can of course do that e.g. with plot[shift={(1,1)},...], but that means that I have to repeat that second coordinate in the path, which makes it again more cumbersome to use if we want to change something later (and the second straight line segment then points to the original endpoint without the shift). So this is more a question about "ergonomically" using this plot command inside other paths. E.g., I also like using the ++ syntax to precisely extend a path a certain distance horizontally, without having to repeat the previous y-coordinate, and I was wondering whether there is something similar we can do with the plot command inside such a path. \documentclass{standalone} \usepackage{tikz} \usepackage{xcolor} \usepackage{pgfplots} \pgfplotsset{compat=1.17} \usetikzlibrary{calc} \begin{document} \begin{tikzpicture}[domain=0:4] \draw[black!10!white, dashed] (0, 0) grid (4, 2); \draw (0, 1) -- (1, 1) node[left] {} plot[domain=0:1, samples=100] function{sin(6.3*x)} node[right] {} -- ++(1, 0); \end{tikzpicture} \end{document}

  • Horizontally centering a tikz node on a page
    by Sambo on April 30, 2026 at 3:30 pm

    My question is essentially the same as this question, but I'm asking again because the answer provided is not very resilient. In particular, it doesn't work for the kind of diagram I want. I want to use Tikz to draw a diagram with lots of nodes and arrows; essentially, a flowchart. The diagram should start with a single node which is centered on the page (in the MWE below, this is the "Hello there" box). If I try to just use the \centering command, the whole picture gets centered, which is not what I want. The answer I linked above suggests using the \useasboundingbox command. However, this doesn't seem to do what I want. Here is my minimal working example: \documentclass[a4paper, 11pt]{article} \usepackage{tikz} \begin{document} This is a line of text which has been written with no purpose other than to help illustrate how the figure below appears on a page. \begin{figure}[ht] \centering \begin{tikzpicture}[rect/.style={rectangle, draw=black, thin}] \node[rect] (box1) at (0,0) {Hello there}; % Location 1 \node[rect] (box2) at (5,-1) {Hi}; % Location 2 \end{tikzpicture} \end{figure} This is a line of text which has been written with no purpose other than to help illustrate how the figure above appears on a page. \end{document} The linked answer suggests using the command \useasboundingbox (box1.south east) rectangle (box1.north west);. If I put this command at location 2, then the bounding box includes both boxes "Hello there" and "Hi", and the box "Hello there" is not centered (see below). If I put this command at location 1, then the bounding box only includes the "Hello there" box; this centers it the way I want, but then the box "Hi" ends up overlapping with the text below (see below). How can I make the "Hello there" box be centered on the page?

  • Draw simple figures: l3draw vs PGF performances
    by PHL on April 30, 2026 at 3:08 am

    I have some lua code that generates coordinates of many triangles/quadrilaterals I then want to draw/fill. See this answer about Penrose tilings for a concrete example. The drawing is actually done in TikZ via the luadraw package, but I am wondering if I can make the code faster by replacing TikZ with l3draw. Rewriting my actual code to remove TikZ and luadraw dependences (and use l3draw or any other drawing tool) is not a complex task, but will ask me some time due to my limited programming skills. So I would prefer to know in advance if this is a good idea or not. Apart possibly performance, is there any other reasons to use l3draw over pgf for this kind of task? Edit: I am not using TikZ/pgf for the rest of the document. Suggesting to use another environment (as picture) is a valid answer.

  • Incompatibility between PyLuaTeX and luadraw?
    by mathmandan on April 29, 2026 at 8:25 pm

    Consider this MWE: \documentclass{article} %\usepackage{luadraw} % Un-comment this line to get an error \usepackage[executable=python]{pyluatex} % May need to substitute: % \usepackage[executable=python3]{pyluatex} % \usepackage[executable=python.exe]{pyluatex} % (Or whatever works on your system) \begin{document} ok \end{document} The above compiles fine for me (using LuaLaTeX, with the --shell-escape option, from a TeXLive distribution in Windows 11 Enterprise). I get a document showing the text "ok" (without the quotes), as expected. However, if I uncomment the usepackage{luadraw} line, then I get an error: This is LuaHBTeX, Version 1.24.0 (TeX Live 2026) system commands enabled. (./test100.tex LaTeX2e <2025-11-01> L3 programming layer <2026-03-20> (c:/texlive/2026/texmf-dist/tex/latex/base/article.cls Document Class: article 2025/01/22 v1.4n Standard LaTeX document class (c:/texlive/2026/texmf-dist/tex/latex/base/size10.clo)) ... ... (Some more stuff that seems OK) ... (c:/texlive/2026/texmf-dist/tex/lualatex/pyluatex/pyluatex.sty...xlive/2026/tex mf-dist/tex/lualatex/pyluatex/pyluatex.lua:58: attempt to index a function valu e (global 'set') stack traceback: ...xlive/2026/texmf-dist/tex/lualatex/pyluatex/pyluatex.lua:58: in main chunk [C]: in function 'require' [\directlua]:1: in main chunk. l.23 } ? Note: if I uncomment the \usepackage{luadraw} and put it after the \usepackage{pyluatex}, then it actually does compile without error. However, if I then replace the ok with something that uses pyluatex, like \py{'ok'}, then I get another error. So simply switching the loading order does not really solve the issue. Note: I recently (April 29, 2026) ran tlmgr update --all, and also re-installed a current version (version 2.8) of luadraw (using l3build install as described at https://github.com/pfradin/luadraw). Question: Is it possible to use both pyluatex and luadraw together in one document? Secondary question: Is this a bug, and if so, is there one package that is at fault? I would be happy to file a bug report somewhere if that is appropriate. Neither package seems to cause problems for me on its own; it is only when both are loaded that I am experiencing a problem.

  • Representation of a double cone with section and orthogonal projections
    by Sebastiano on April 29, 2026 at 8:08 pm

    I should create a drawing that illustrates this domain in 3D: T= \{(x, y, z) \in \mathbb{R}^3\colon x^2 +y^2\leq (z-9)^2, 0\leq z\leq 3 \}. It is a double cone with vertex at (0,0,3) if it were x^2 +y^2= (z-9)^2. I may have to change the scale but I don’t want the drawing to look worse. How can I colour the two-sloped cone part that satisfies the inequality x^2 +y^2\leq (z-9)^2? ...and then adding 0\leq z\leq 3? \documentclass{article} \usepackage{tikz} \usetikzlibrary{patterns} \usepackage{tikz-3dplot} \usepackage[active,tightpage]{preview} \PreviewEnvironment{tikzpicture} \setlength\PreviewBorder{2pt} \begin{document} \tdplotsetmaincoords{60}{110} \begin{tikzpicture}[tdplot_main_coords,scale=0.9] \pgfmathsetmacro{\tini}{0.5*pi} \pgfmathsetmacro{\tfin}{1.85*pi} \pgfmathsetmacro{\tend}{2.5*pi} \def\h{10.2} \draw[thick,->] (0,0,0) -- (3.5,0,0) node[below left] {$x$}; \draw[dashed] (0,0,0) -- (-2.5,0,0); \draw[thick,->] (0,0,0) -- (0,3.5,0) node[right] {$y$}; \draw[dashed] (0,0,0) -- (0,-2.5,0); \draw[thick,->] (0,0,0) -- (0,0,12) node[above] {$z$}; \fill (0,0,9) circle (1pt); \node[right] at (0,0,9) {$(0,0,9)$}; \foreach \angulo in {0,2,...,358}{ \draw[cyan,very thick,opacity=0.12,rotate around z=\angulo] plot[domain=0:2,smooth,variable=\t] ({0},{\t},{9 + \t}); \draw[cyan,very thick,opacity=0.12,rotate around z=\angulo] plot[domain=0:2,smooth,variable=\t] ({0},{\t},{9 - \t}); } \foreach \z in {7.6,7.8,...,10.4}{ \pgfmathsetmacro{\r}{abs(\z-9)} \draw[cyan,thick,opacity=0.35] plot[domain=\tini:\tfin,smooth,variable=\t] ({\r*cos(\t r)},{\r*sin(\t r)},{\z}); } \foreach \z in {7.6,7.8,...,10.4}{ \pgfmathsetmacro{\r}{abs(\z-9)} \draw[cyan,thick,opacity=0.35] plot[domain=\tfin:\tend,smooth,variable=\t] ({\r*cos(\t r)},{\r*sin(\t r)},{\z}); } \pgfmathsetmacro{\r}{abs(\h-9)} \draw[red,very thick] plot[domain=0:360,smooth,variable=\t] ({\r*cos(\t)},{\r*sin(\t)},{\h}); \node[red, above right] at ({\r},0,\h) {$z=h$}; \fill[yellow,opacity=0.35] plot[domain=0:360,smooth,variable=\t] ({\r*cos(\t)},{\r*sin(\t)},0); \draw[red,thick] plot[domain=0:360,smooth,variable=\t] ({\r*cos(\t)},{\r*sin(\t)},0); \foreach \angle in {0,45,...,315}{ \pgfmathsetmacro{\x}{\r*cos(\angle)} \pgfmathsetmacro{\y}{\r*sin(\angle)} \draw[gray,dashed,opacity=0.5] (\x,\y,0) -- (\x,\y,\h); } \node[blue,right] at (0,0,11.5) {$x^2 + y^2 = (z-9)^2$}; \end{tikzpicture} \end{document}

  • What is the proper way of implementing specific formatting requirements?
    by Simon on April 29, 2026 at 7:14 pm

    I want to implement given formatting requirements, however, I feel overwhelmed by the number of parameters and their dependencies, and, thus, I don't know which to begin with, as I feel like all of them need to be considered simultaniously. Furthermore, there are even more formatting requirements to fulfill, yet, the following should be the most essential ones, which is why I want to implement these first and condensed them in a table: I use the KOMA-script class scrreprt and would have used the parskip=full- option to seperate paragraphs from each other. If there is any info missing, please tell me and I'll provide it. And if some requirement seems odd, please also let me know. Thanks in advance! EDIT - This MWE should cover all eventualities: \LoadClass[a4paper,parskip=full-]{scrreprt} \RequirePackage[top=3.5cm,bottom=2.5cm,left=3cm,right=3cm]{geometry} \begin{document} \chapter{Chapter Chapter Chapter Chapter Chapter} \section{Section Section Section Section Section Section Section Section} \subsection{Subsection Subsection Subsection Subsection Subsection Subsection Subsection} \subsubsection{Subsubsection Subsubsection Subsubsection Subsubsection Subsubsection Subsubsection} Paragraph Paragraph Paragraph Paragraph Paragraph Paragraph Paragraph Paragraph Paragraph Paragraph \subsubsection{Subsubsection} Paragraph \subsection{Subsection} Paragraph \section{Section} Paragraph \end{document} EDIT 2 - Update This here shows how \onehalfspacing works: \LoadClass[a4paper,fontsize=12pt]{scrreprt}%try 10pt/11pt/12pt (or any other font size) \RequirePackage{setspace}%provides \setstretch{} \makeatletter \newcommand{\myonehalfspacing}{\normalsize\setstretch{\fpeval{1.5 * \f@size / \f@baselineskip}}} \makeatother %\myonehalfspacing \makeatletter \newcommand{\reportformattingtobecheckedfor}[1]{#1 When implementing \texttt{\string#1}, the reciprocal of the ratio of normal fontsize corresponding \f@size pt, but called 1\@ptsize pt, to its updated baselineskip of \the\baselineskip, defaulting \f@baselineskip, is \fpeval{\baselineskip / \f@size}.\hrule} \makeatother \begin{document} \hrule \reportformattingtobecheckedfor{\onehalfspacing} \reportformattingtobecheckedfor{\myonehalfspacing} \end{document} With this info, the updated MWE looks as follows: After the initial \LoadClass[a4paper,fontsize=12pt,parskip=full-]{scrreprt} \RequirePackage[top=2cm,bottom=2cm,left=3cm,right=3cm]{geometry}%changed to fit one page to exclude page break effects \RequirePackage[T1]{fontenc} \RequirePackage{setspace}%provides \setstretch{} , you could - for 1.5x-linespacing and formatted section headings - continue the preamble with \makeatletter \newcommand{\ratioofnormaltooneandhalfspacing}{} \AtBeginDocument{ \begingroup \normalsize \xdef\ratioofnormaltooneandhalfspacing{\fpeval{\f@size pt/\f@baselineskip*1.5}} \endgroup \myonehalfspacing%has to be called here to work, other than %\onehalfspacing %that can be called anywhere (don't know why here) --> toggle first % in this line on/off to compare, no need to % previous line } \newcommand{\myonehalfspacing}{\setstretch{\ratioofnormaltooneandhalfspacing}} \newcommand{\relativeonehalfspacingtoabsolute}[1]{\fpeval{#1/\ratioofnormaltooneandhalfspacing}}%would have wanted to wrap the fraction with round(...,0) to get the nearest int, doesn't give expected result (don't know why) \makeatother \RedeclareSectionCommand[ font=\normalfont\fontsize{20}{\relativeonehalfspacingtoabsolute{25}}\bfseries, beforeskip=42pt, afterskip=24pt ]{chapter} \RedeclareSectionCommand[ font=\normalfont\fontsize{16}{\relativeonehalfspacingtoabsolute{20}}\bfseries, beforeskip=28pt, afterskip=14pt ]{section} \RedeclareSectionCommand[ font=\normalfont\fontsize{14}{\relativeonehalfspacingtoabsolute{18}}\bfseries, beforeskip=20pt, afterskip=12pt ]{subsection} \RedeclareSectionCommand[ font=\normalfont\fontsize{12}{\relativeonehalfspacingtoabsolute{18}}\itshape, beforeskip=18pt, afterskip=12pt ]{subsubsection} or instead of this just write \makeatletter \newcommand{\myonehalfspacing}{\normalsize\setstretch{\fpeval{1.5 * \f@size / \f@baselineskip}}} \makeatother \myonehalfspacing %\onehalfspacing \addtokomafont{disposition}{\setstretch{1}} \RedeclareSectionCommand[ font=\normalfont\fontsize{20}{25}\bfseries, beforeskip=42pt, afterskip=24pt ]{chapter} \RedeclareSectionCommand[ font=\normalfont\fontsize{16}{20}\bfseries, beforeskip=28pt, afterskip=14pt ]{section} \RedeclareSectionCommand[ font=\normalfont\fontsize{14}{18}\bfseries, beforeskip=20pt, afterskip=12pt ]{subsection} \RedeclareSectionCommand[ font=\normalfont\fontsize{12}{18}\itshape, beforeskip=18pt, afterskip=12pt ]{subsubsection} , either way, you end the preamble with %from https://texwelt.de/fragen/21544/koma-script-abstande-bei-uberschriften-exakt-einstellen-welche-werte-sind-notwendig (not EN, but DE): \RequirePackage{xpatch} \makeatletter \At@startsection{\addtolength{\@tempskipa}{-\parskip}} % Jetzt folgt ein übler Hack ohne Garantie, dass der auch zukünftig noch funktionieren wird! \xpatchcmd{\@xsect}{\vskip\@tempskipa}{\vskip\dimexpr\@tempskipa-\parskip\relax}{}{} \makeatother % to eliminate the added vertical spacing that parskip effects, and with \makeatletter \newcommand{\reportcurrentformatting}{$\rightarrow\frac{\strip@pt\baselineskip\mathrm{pt}}{\f@size\mathrm{pt}}=\fpeval{\baselineskip / \f@size}$}%for debugging \makeatother for debugging, completed by \begin{document} \chapter{Chapter Chapter Chapter Chapter Chapter \reportcurrentformatting} \hrule \section{Section Section Section Section Section Section Section \reportcurrentformatting} \hrule \subsection{Subsection Subsection Subsection Subsection Subsection \reportcurrentformatting} \hrule \subsubsection{Subsubsection Subsubsection Subsubsection Subsubsection Subsubsection Subsubsection \reportcurrentformatting} \hrule Paragraph Paragraph Paragraph Paragraph Paragraph Paragraph Paragraph Paragraph Paragraph \reportcurrentformatting \hrule \hrule Paragraph \reportcurrentformatting \hrule \subsubsection{Subsubsection \reportcurrentformatting} \hrule Paragraph \reportcurrentformatting \hrule \subsection{Subsection \reportcurrentformatting} \hrule Paragraph \reportcurrentformatting \hrule \section{Section \reportcurrentformatting} \hrule Paragraph \reportcurrentformatting \hrule \chapter{Chapter \reportcurrentformatting} \hrule Paragraph \reportcurrentformatting \hrule \end{document} . The MWE's output looks like this (1st page cropped): At this point, the two only remaining areas where I need help are: Does the code that should eliminate the added vertical spacing around the section headings which parskip effects look correct and effective? Is there a way to check the respective sizes of beforeskip and afterskip? In theory, they should be correct as they were set manually, yet, when I compare the font size of chapter and the line spacing of section (they should be the same) measured with a ruler on a monitor (I know ... but it aint stupid if it works) they are not the same, or am I misunderstanding their theoritical (not code) definition here? If these (bonus) questions justify a new post, please let me know. Just thought they benefit from the overall context of the original question and are still somewhat linked to it. Thanks once again!

  • Creating a custom symbol in TikZ whose colour agrees with that of the surrounding text
    by varkor on April 29, 2026 at 11:36 am

    I have created a custom ⍟ symbol using TikZ, which works well, except that it ignores the colour of the surrounding text. MWE: \documentclass{article} \usepackage{tikz} \usepackage{scalerel} \newsavebox{\whitecircstar}\sbox{\whitecircstar}{\kern.075em\tikz{\node[draw, circle,line width=.36pt, inner sep=0]{$*$};}\kern.075em} \newcommand{\ostar}{\mathbin{\scalerel*{\usebox{\whitecircstar}}{\odot}}} \begin{document} \textcolor{red}{Before $\ostar$ After} \end{document} Output: How can I make \ostar the same colour as the surrounding text? My understanding was that . was a special symbol for the current colour in xcolor, but adding color=. to the node arguments had no effect.

  • $\implies$ makes "! Missing } inserted" error
    by Harry on April 29, 2026 at 11:17 am

    In my tex I have a sentence: No external torque $\implies$ Angular momentum $L$ is conserved: After I compile the tex file, it throws out "! Missing } inserted" error. If I delete the $\implies$ in the above sentence, all is fine. Why and how to solve it? The whole tex code (I run it with XeLatex+MakeIndex+BibTex): \documentclass{beamer} % 默认就是 4:3 \usetheme{Madrid} \usecolortheme{seahorse} \usepackage{amsmath} \usepackage{amssymb} \usepackage{physics} \usepackage{tikz} \usepackage{tikz-3dplot} \usetikzlibrary{calc, decorations.markings, arrows.meta, angles, quotes} \usetikzlibrary{patterns,decorations.pathmorphing} \usepackage{amsfonts} \usepackage[utf8]{inputenc} \usepackage[T3,T1]{fontenc} \usepackage{tipa} \usepackage{xcolor} \usepackage{booktabs} % 用于绘制专业的表格线 \usepackage{setspace} \usepackage{fontspec} % 如果你是 Windows 用户,通常 Arial 包含最全的音标字符 \setmainfont{Arial} \usepackage{siunitx} \begin{document} \begin{frame}{Exercise: Angular Momentum Conservation} \textbf{Problem:} \\ Two flywheels $A$ and $B$ share a common axis. Initially, $B$ is at rest, and $A$ rotates with angular velocity $\omega_A$. After they are coupled by clutch $C$, they rotate together with velocity $\omega$. Find $J_B$ if $A$'s moment of inertia is $J_A$. \textbf{Solution:} \\ No external torque $\implies$ Angular momentum $L$ is conserved: \begin{equation*} J_A \omega_A = (J_A + J_B) \omega \end{equation*} \pause \end{frame} \end{document}

  • LuaLatex fontspec problem
    by Stéphane Ducasse on April 29, 2026 at 9:28 am

    I face the following problem since I migrated to texlive 2025 with the deprecation of gentium-tug When I build my books on a minimnal installation I get the following error (/home/runner/texlive/texmf-dist/tex/latex/fontspec/fontspec.sty (/home/runner/texlive/texmf-dist/tex/latex/fontspec/fontspec-luatex.sty (/home/runner/texlive/texmf-dist/tex/latex/base/fontenc.sty) (/home/runner/texlive/texmf-dist/tex/latex/fontspec/fontspec.cfg))) luaotfload | db : Reload initiated (formats: otf,ttf,ttc); reason: File not found: "Gentium-Regular.ttf". ! Package fontspec Error: (fontspec) The font "Gentium-Regular" cannot be found; this (fontspec) may be but usually is not a fontspec bug. Either (fontspec) there is a typo in the font name/file, the font is (fontspec) not installed (correctly), or there is a bug in (fontspec) the underlying font loading engine (fontspec) (XeTeX/luaotfload). It is working locally on my LaTeX 2025 installation going from %%% %%% Fonts & paragraph typography %%% \RequirePackage{fontspec,gentiumbook,opensans,FiraMono} \setmainfont{Gentium Book Plus} \setsansfont{Open Sans}[ \@ifpackagelater{opensans}{2019/06/19}% test for font naming bug {}% 2019/06/20 fixed it {BoldFont = {* Bold},} Scale=MatchLowercase, Numbers=OldStyle ] \setmonofont{Fira Mono}[ Scale=MatchLowercase, HyphenChar={-} % enable hyphenation (disabled by default in mono fonts) % caveat: LuaLaTeX doesn't support changing the actual character % alternative solution: \usepackage[htt]{hyphenat} ] to %%% %%% Fonts & paragraph typography %%% \RequirePackage{fontspec,opensans,FiraMono} \setmainfont{GentiumBookPlus} \setsansfont{Open Sans}[ sBoldFont = {* Bold}, Scale=MatchLowercase, Numbers=OldStyle ] \setmonofont{Fira Mono}[ Scale=MatchLowercase, HyphenChar={-} % enable hyphenation (disabled by default in mono fonts) % caveat: LuaLaTeX doesn't support changing the actual character % alternative solution: \usepackage[htt]{hyphenat} ] It works but my problem is that I build a system that helps users to generate books written in markdown and automatically translated to LaTeX and I propose a smaller version of texlive and hosting it on github Here are the dependencies I extract from my builds. TeX Live 2025 is frozen and will no longer be routinely updated. This happens when a new release is made, or will be made shortly. For general status information about TeX Live, see its home page: https://tug.org/texlive tlmgr: package repository https://ftp.tu-chemnitz.de/pub/tug/historic/systems/texlive/2025/tlnet-final/ (verified) tlmgr install: package already present: cm tlmgr install: package already present: graphics tlmgr install: package already present: graphics-cfg tlmgr install: package already present: graphics-def tlmgr install: package already present: l3backend tlmgr install: package already present: l3kernel tlmgr install: package already present: latex tlmgr install: package already present: latex-fonts tlmgr install: package already present: latexconfig tlmgr install: package already present: lua-uni-algos tlmgr install: package already present: lualibs tlmgr install: package already present: luaotfload tlmgr install: package already present: tex-ini-files tlmgr install: package already present: unicode-data [1/65, ??:??/??:??] install: atbegshi [5k] [2/65, 00:01/01:18:23] install: atveryend [2k] [3/65, 00:01/01:02:50] install: auxhook [2k] [4/65, 00:02/01:38:01] install: bigintcalc [7k] [5/65, 00:02/52:40] install: bitset [6k] [6/65, 00:02/37:28] install: booktabs [3k] [7/65, 00:03/50:34] install: environ [2k] [8/65, 00:03/46:34] install: epstopdf.x86_64-linux [1k] [9/65, 00:03/45:52] install: epstopdf [15k] [10/65, 00:04/37:52] install: epstopdf-pkg [5k] [11/65, 00:04/34:12] install: etexcmds [3k] [12/65, 00:05/40:27] install: etoolbox [9k] [13/65, 00:05/33:57] install: euenc [4k] [14/65, 00:05/32:02] install: filehook [5k] [15/65, 00:06/35:25] install: fira [15170k] [16/65, 00:09/00:12] install: fontaxes [5k] [17/65, 00:09/00:12] install: fontspec [27k] [18/65, 00:09/00:12] install: footmisc [8k] [19/65, 00:10/00:14] install: fp [19k] [20/65, 00:10/00:14] install: gentium-otf [3k] [21/65, 00:11/00:15] install: gettitlestring [3k] [22/65, 00:11/00:15] install: hycolor [4k] [23/65, 00:11/00:15] install: hyperref [88k] [24/65, 00:12/00:16] install: iftex [4k] [25/65, 00:12/00:16] install: import [3k] [26/65, 00:13/00:18] install: infwarerr [3k] [27/65, 00:13/00:18] install: intcalc [6k] [28/65, 00:13/00:18] install: kvdefinekeys [3k] [29/65, 00:14/00:19] install: kvoptions [8k] [30/65, 00:14/00:19] install: kvsetkeys [4k] [31/65, 00:14/00:19] install: l3packages [20k] [32/65, 00:15/00:21] install: letltxmacro [3k] [33/65, 00:15/00:21] install: listings [149k] [34/65, 00:16/00:22] install: ltxcmds [5k] [35/65, 00:16/00:22] install: makecmds [2k] [36/65, 00:17/00:23] install: memoir [68k] [37/65, 00:17/00:23] install: mptopdf.x86_64-linux [1k] [38/65, 00:18/00:25] install: mptopdf [37k] [39/65, 00:18/00:24] install: multirow [3k] [40/65, 00:18/00:24] install: opensans [1979k] [41/65, 00:20/00:24] install: pdfcol [3k] [42/65, 00:20/00:24] install: pdfescape [5k] [43/65, 00:21/00:25] install: pdftexcmds [7k] [44/65, 00:21/00:25] install: pgf [702k] [45/65, 00:22/00:26] install: polyglossia [123k] [46/65, 00:23/00:27] install: ragged2e [3k] [47/65, 00:23/00:27] install: refcount [3k] [48/65, 00:24/00:28] install: rerunfilecheck [4k] [49/65, 00:24/00:28] install: stringenc [23k] [50/65, 00:24/00:28] install: tcolorbox [230k] [51/65, 00:25/00:28] install: textcase [2k] [52/65, 00:26/00:30] install: tikzfill [5k] [53/65, 00:26/00:30] install: tipa [2809k] [54/65, 00:28/00:28] install: tools [47k] [55/65, 00:28/00:28] install: trimspaces [1k] [56/65, 00:29/00:29] install: ulem [7k] [57/65, 00:29/00:29] install: uniquecounter [3k] [58/65, 00:29/00:29] install: url [6k] [59/65, 00:30/00:30] install: varwidth [5k] [60/65, 00:30/00:30] install: xcolor [18k] [61/65, 00:30/00:30] install: xkeyval [9k] [62/65, 00:31/00:31] install: xpatch [2k] [63/65, 00:31/00:31] install: xtab [5k] [64/65, 00:32/00:32] install: xunicode [26k] [65/65, 00:32/00:32] install: zapfding [46k] running mktexlsr ... done running mktexlsr. running updmap-sys ... done running updmap-sys. regenerating fmtutil.cnf in /home/runner/texlive/texmf-dist running fmtutil-sys --byfmt mptopdf --no-error-if-no-engine=luametatex,luajithbtex,luajittex,mfluajit --status-file=/tmp/yCFX9JaktR/XWxxYEwl7V ... OK: mptopdf.fmt/pdftex tlmgr: package log updated: $TEXDIR/texmf-var/web2c/tlmgr.log tlmgr: command log updated: $TEXDIR/texmf-var/web2c/tlmgr-commands.log I tried \setmainfont[Ligatures=TeX,]{Gentium-Regular.ttf} as mentioned in another post. but did not work. I spent several days already trying to solve this problem but I miserably failed. Any

  • Multiple splits in Tikz rectangle with distinct lines
    by iago on April 29, 2026 at 9:24 am

    My goal is to get a rectangle like the one below, but with text in the nested rectangles. Line types could be for example the following: I saw tikz: Multiple splits of rectangle, but it does not answer the question on the line types. Beyond that, I am a beginner using Tikz, and I'd like the answer explained, since the linked answer is complex to understand. Thanks!

  • Unexpected spacing with negative coordinates in a command for projective coordinates using `expl3`
    by Antonio on April 29, 2026 at 6:57 am

    I have an issue with the following code, kindly provided by egreg some time ago answer by egreg. It worked well, but I recently noticed an unwanted behavior. I am not sufficiently familiar with expl3 to fix it myself, nor do I fully understand how the code works. \ExplSyntaxOn \NewDocumentCommand{\pc}{m} % projective coordinates { \seq_set_split:NVn \l_tmpa_seq \c_colon_str { #1 } ( \seq_use:Nn \l_tmpa_seq { \mspace{1\medmuskip}{:}\mspace{1\medmuskip} } ) } \ExplSyntaxOff \documentclass{article} \usepackage{amsmath} \begin{document} \[ \begin{aligned} &(a:b:c) & & (1:-1:2) & &\qquad\verb|standard|\\ &\pc{a:b:c} & & \pc{1:-1:3} & &\qquad\verb|with \pc command|\\ &(a:-b:c) & & (1:-2:3) & &\qquad\verb|standard|\\ &\pc{a:-b:c}& & \pc{1:-2:3} & &\qquad\verb|with \pc command| \end{aligned} \] \[ \pc{a,b,c,d}\quad \pc{a;b;c;d,e,f:g:h:i,l} \] \end{document} Here is the output of the minimal working example: The actual issue appears when a coordinate other than the first is negative (for example \pc{a:-b:c} or \pc{1:-2:3}), where the spacing/output differs from the standard notation. As an aside, I also do not understand why commands such as \pc{a,b,c} or \pc{a;b;c:d} produce the output they do. Could someone explain what is happening here, and how to modify the macro so that it behaves correctly in all cases?

  • pstricks:circuit diagrams, using A4 paper landscape, how do I get a nice grid?
    by tangent on April 28, 2026 at 10:57 am

    This is my current effort: \documentclass{article} \usepackage{pstricks} \usepackage{graphicx} \begin{document} \rotatebox{90}{% \begin{pspicture}(5,4) \psgrid \end{pspicture} } \end{document} How do I persuade gv (and my printer), to present it in landscape? Of course I have to play with the actual numbers. Eventually something like conventional graph paper on it's side.

  • How to tweak the exact positon in the normal direction of the path by `anchor`?
    by Explorer on April 28, 2026 at 6:28 am

    As the follow-up of my previous question, the code below comes from cfr's solution: % Source - https://tex.stackexchange.com/a/762315 % Posted by cfr % Retrieved 2026-04-28, License - CC BY-SA 4.0 \documentclass[tikz,border=5pt]{standalone} \usetikzlibrary{arrows.meta} \makeatletter \newcommand\dualharpoon{} \newcommand\dualharpoon@aux{} \newcommand\dualharpoon@noaux{} \protected\def\dualharpoon{% \@ifnextchar[\dualharpoon@aux\dualharpoon@noaux } \protected\def\dualharpoon@noaux{% \dualharpoon@aux[]% } \long\protected\def\dualharpoon@aux[#1]#2#3#4#5{% \path (#4.center); \pgfgetlastxy{\temp@ax}{\temp@ay} \path (#5.center); \pgfgetlastxy{\temp@bx}{\temp@by} \pgfmathsetmacro\temp@angle{atan2(\temp@by-\temp@ay,\temp@bx-\temp@ax)} \draw[-foo,mystyle] (#4.{\temp@angle - 10}) -- % node[ % draw=blue, % % anchor={90+\temp@angle}, % sloped,inner sep=0pt,#1 % ] {#2} node[ draw, % draw=red, anchor={90+\temp@angle},%<- sloped,inner sep=0pt,#1 ] {#2} (#5.{190 + \temp@angle}); %%%%%%%%%%%%%%%%%%%% \draw[foo-,mystyle] (#4.{\temp@angle + 10}) -- node[ draw, anchor={270+\temp@angle},%<- sloped,inner sep=0pt,#1 ] {#3} (#5.{170 + \temp@angle}); } \makeatother \begin{document} \begin{tikzpicture}[ foo/.tip={Stealth[harpoon,swap]},scale=1.5, mystyle/.style={thick, shorten >=2pt,shorten <=2pt}, ] \foreach \i in {0,20,...,340}{ \node[draw,circle,fill=teal] (In-\i) at (\i:3) {}; \node[draw,circle,fill=magenta] (Out-\i) at (\i:5) {}; \dualharpoon[scale=.8]{$\Delta$}{$\nabla$}{In-\i}{Out-\i} } \end{tikzpicture} \end{document} And I tweaked some label arguments, but I found that the label position is not exactly what I want with anchor={90+\temp@angle}, I want every angles gives the alignment with the normal direction: To show the anchor's behavior more clearly: % Source - https://tex.stackexchange.com/a/762315 % Posted by cfr % Retrieved 2026-04-28, License - CC BY-SA 4.0 \documentclass[tikz,border=5pt]{standalone} \usetikzlibrary{arrows.meta} \makeatletter \newcommand\dualharpoon{} \newcommand\dualharpoon@aux{} \newcommand\dualharpoon@noaux{} \protected\def\dualharpoon{% \@ifnextchar[\dualharpoon@aux\dualharpoon@noaux } \protected\def\dualharpoon@noaux{% \dualharpoon@aux[]% } \long\protected\def\dualharpoon@aux[#1]#2#3#4#5{% \path (#4.center); \pgfgetlastxy{\temp@ax}{\temp@ay} \path (#5.center); \pgfgetlastxy{\temp@bx}{\temp@by} \pgfmathsetmacro\temp@angle{atan2(\temp@by-\temp@ay,\temp@bx-\temp@ax)} \draw[-foo,mystyle] (#4.{\temp@angle - 10}) -- node[ draw=blue, % anchor={90+\temp@angle}, sloped,inner sep=0pt,#1 ] {#2} node[ draw=red, anchor={90+\temp@angle},%<- sloped,inner sep=0pt,#1 ] {#2} (#5.{190 + \temp@angle}); %%%%%%%%%%%%%%%%%%%% % \draw[foo-,mystyle] (#4.{\temp@angle + 10}) -- node[ % draw, % anchor={270+\temp@angle},%<- % sloped,inner sep=0pt,#1 % ] {#3} (#5.{170 + \temp@angle}); } \makeatother \begin{document} \begin{tikzpicture}[ foo/.tip={Stealth[harpoon,swap]},scale=1.5, mystyle/.style={thick, shorten >=2pt,shorten <=2pt}, ] \foreach \i in {0,20,...,340}{ \node[draw,circle,fill=teal] (In-\i) at (\i:3) {}; \node[draw,circle,fill=magenta] (Out-\i) at (\i:5) {}; \dualharpoon[scale=.8]{$\Delta$}{$\nabla$}{In-\i}{Out-\i} } \end{tikzpicture} \end{document} It also reminded me of Jasper Habicht's another solution, but..., I found it not quite easy to decide the position of the midpoint of path from A to B... Any suggestions on this?