Hot
- Subscripts with capital lettersby Guran Semiotovic on April 24, 2026 at 9:46 am
I'm aware that similar questions are addressed elsewhere, but I have not found the answer that I am looking for. I am in a situation where: Even though this is not a choice I enjoy, I must use a capital J as a subscript. Expressions such as $u_J$, $P_J$, $\mu_{J+1}$, $\lambda_{J+1}$ are present in many parts of the paper I am writing, hence in most symbols J appears as a subscript of a lowercase letter. Other subscripts are with lower case letters, so I will also have $u_J(t_n)$, $K_m$, etc. I am looking for good practices to make the document look decent, and to do that consistently, possibly with one or more macros, if that is necessary. As I said, I would rather not take this path, but the compromises above are unavoidable. I have read in several posts about: using scriptsize changing default size for all subscripts keeping things as they are using a ghost superscript such as $u^{}_J$. Would you be up for going again through these choices with me, and expose pros and cons of them, and perhaps proposing alternatives? I can not cope well with how ugly $u_J$, $\mu_{J + 1}$ look. I know that some of these are a matter of taste, but I'm trying to find a decent solution that will make my subscripts look harmonious. You can use this minimal document if you want \documentclass{article} \begin{document} \[ u_J, u_{J+1} \qquad u_J(t_n), \qquad u_{J,M}(t_n) \qquad, P_J, \qquad P_{J, M} \] \end{document}
- European Computer Modern-like font that allows for bold italic smallcaps (textsc)?by canIchangethis on April 24, 2026 at 8:40 am
I would love to have bold, italicised small caps in my LaTeX document, using T1 encoding and, ideally, a font as close as possible to European Computer Modern. And I would like to only redefine \textbf{\textit{\textsc{}}} so that I can use smallcaps in italic and bold from another font. Related, I found this older question: https://tex.stackexchange.com/a/746482/114622 Thus, this is my MWE, which doesn't work, as in, it produces the warning: Font shape `T1/cmr/bx/scit' undefined \documentclass{article} \usepackage[T1]{fontenc} begin{document} \begin{center} \textbf{\textit{\textsc{my text}}} \end{center} \end{document}
- Why the note is wrongly placed?by iago on April 24, 2026 at 8:00 am
Why the F note is wrongly placed, taking into account as documentation specifies? My code (removing spaces after ovbkt and wh, or including 6 in {} does not changes the output): \documentclass[a4paper]{article} \usepackage[utf8]{inputenc} \usepackage[left=2.5cm, right=2.5cm]{geometry} \usepackage[english]{babel} \usepackage{musixtex} \def\nnotes{\vnotes1.6\elemskip} \begin{document} \begin{music} \parindent10mm% \instrumentnumber{1}% \setstaffs1{1}% \setclef1{60}% \nobarnumbers% \startextract% \nnotes\ovbkt {{'E}}{1}6\cchar{-5}{$F2$}\wh {F}\en% \zendextract \end{music} \end{document} And the output: But, I would expect the note an octave below, the same as where F is placed in page 148 of https://mirrors.ctan.org/macros/generic/musixtex/doc/musixdoc.pdf, If I use L instead of 'E for the overline, it compiles as it is expected. But I understand both are interchangeable.
- How to define new babel strings for a custom document class, if I can't load babel twice?by Alessandro Bertulli on April 24, 2026 at 7:40 am
I thought this would be trivial but apparently I can't find the idiomatic answer. I am writing a custom class using modern LuaLaTeX, and searching online and on the babel manual I understood that the "modern" way that babel uses to define new captions is something like: \StartBabelCommands*{english}{captions} \SetString{\attachmentsname}{Attachments} \SetString{\changesname}{List of changes} \StartBabelCommands*{italian}{captions} \SetString{\attachmentsname}{Allegati} \SetString{\changesname}{Lista di modifiche} \EndBabelCommands However, I couldn't find online how to let the user use it: if I don't load \RequirePackage{babel} in the .cls file, the command \StartBabelCommands is not defined if I do load it, then the \usepackage[english]{babel} in the .tex file triggers an error LaTeX Error: Option clash for package babel. So I am stuck: how should I allow both the .cls and the .tex file load babel? And more generally, is this the correct, modern and idiomatic way to provide localization for a new LaTeX class/package?
- coding a book cover color and titleby Nate on April 24, 2026 at 2:45 am
I am planning to write a book (using the book class) that has both a physical and digital version. In the physical version I am planning to use the bookcover package to create the following: while having the front cover as the first page of the pdf: What is the best way to code this flexibly so it can be adapted to both versions? (I used Word to create these examples.)
- pgf-PeriodicTable: produce a gap at La and Acby cis on April 24, 2026 at 1:36 am
How could I create a gap here (as seen sometimes)? \documentclass[landscape]{article} \usepackage[margin=11mm]{geometry} \usepackage{pgf-PeriodicTable} \tikzset{every picture/.append style={remember picture}} \begin{document} \pgfPT[ show title=false, show legend=false, IUPAC=false,% puts La and Ac above ] % Test \begin{tikzpicture}[remember picture, overlay] \node[fill, inner sep=0pt, minimum size=2mm, cyan, text=red] at (3.center) {UL}; \end{tikzpicture} \end{document}
- Is \textit now long, instead of short?by rallg on April 24, 2026 at 1:25 am
In the past, something such as \textit{this\par that} would throw an error, because the \textit command was "short" (it could not span paragraphs). But I now see (TeXlive 2026) that is is "long" (can span paragraphs). This is verified by inspecting code in file latex.ltx even though that file is not necessarily loaded. Even AI did not know that! Or did I hack something, and forgot about it?
- Next odd-numbered physical pageby Elayson Abreu on April 23, 2026 at 7:19 pm
I need to create a page break command called \nextoddphysicalpage that moves the current point to the next odd-numbered page, considering the physical numbering of the document, not the logical numbering. My near-solution was based on the \checkoddpage command, but it takes into account the logical numbering, not the physical one: \documentclass{article} \usepackage[strict]{changepage} \def\checkifodd{\checkoddpage \ifoddpage Odd\else Even\fi} \addtocounter{page}{1} \begin{document} Logical page: \checkifodd. \end{document}
- Interaction (?) of AtBeginDocument hooksby campa on April 23, 2026 at 6:55 pm
In trying to boil down my problem to a MWE, I came to the following code: \begin{filecontents}[overwrite]{foo.cls} \ProvidesClass{foo} \LoadClass{article} \AtBeginDocument{\relax}% <-- comment this line out \RequirePackage{icomma} \AtBeginDocument{\show\mathcomma} \end{filecontents} \documentclass{foo} \begin{document} Hello world! \end{document} Running pdftex on this yields > \mathcomma=undefined. \__hook begindocument ->\relax \show \mathcomma \mathchardef \mathcomma \mat... l.9 \begin{document} while commenting out the first \AtBeginDocument one gets (./mwe.aux) > \mathcomma=\mathchar"613B. \__hook begindocument ...,="8000 \show \mathcomma \__hook_toplevel begindocu... l.9 \begin{document} Background (in case it matters) After loading icomma I'd like to calculate the math code of a \mathord comma, something along the lines of \RequirePackage{icomma}% this defines \mathcomma \AtBeginDocument \AtBeginDocument{\edef\ordcomma{\the\numexpr\mathcomma-4096*(\mathcomma/4096)\relax}} and this kept failing until I found out something seems to interact with the hook used before loading icomma.
- LaTeX economics draft for test [closed]by Evaggelia Lanaridy on April 23, 2026 at 3:07 pm
\begin{tikzpicture} % Άξονες \draw[->, thick] (0,0) -- (5,0) node[right] {Q (Ποσότητα)}; \draw[->, thick] (0,0) -- (0,5) node[above] {P (Τιμή)}; % Αρχική Καμπύλη Ζήτησης D1 \draw[thick, blue] (0.5,4) -- (4,0.5) node[right] {$D$}; % Νέα Καμπύλη Ζήτησης D2 (Μετατόπιση δεξιά) \draw[thick, red] (1.5,4.5) -- (5,1) node[right] {$D_1$}; % Σταθερή Τιμή P1 \draw[dashed] (0,2.5) node[left] {$P_1$} -- (3.75,2.5); % Σημεία και Ποσότητες \draw[dashed] (2,2.5) -- (2,0) node[below] {$Q_1$}; \draw[dashed] (3.75,2.5) -- (3.75,0) node[below] {$Q_2$}; % Βέλος μετατόπισης \draw[->, bend left, thick] (2.2,3) -- (3.3,3.4) node[midway, above] {$\Delta\epsilon\xi\iota\alpha$}; \end{tikzpicture}
- how to embed a domain curve in a parametric surface using luaby Jasper on April 23, 2026 at 12:07 pm
Here's what I'm thinking. Let's take a rectangular parameter domain, and embed a curve in it. Then, let's break it apart into triangles, and keep the subpaths inside each triangle, relative to it's affine coordinate system. Then, after partitioning and occlusion sorting, we can draw each triangle, and then it's embedded path(s). This technique would make the following diagram more beautiful. I'm open to alternative approaches too, as I'm aware that it's possible in other ways (see Howard Anton's calculus). I believe this should be achievable in TeX, using Lua. Look how improperly occluded the following diagram is in this regard: Notice: I wrote this package \documentclass[tikz,border=1cm]{standalone} \usepackage{lua-tikz3dtools} % https://github.com/Pseudonym321/TikZ-Animations/tree/master1/TikZ/lua-tikz3dtools \begin{document} \begin{tikzpicture} \setobject[ name = view, object = {Matrix.zyzrotation3(pi/2, pi/3, pi/6)} ] \appendlight[ v = {return Vector:new{1, 1, 1, 1}} ] \foreach \i in {0,1} { \appendsurface[ ustart = 0, ustop = tau, vstart = -tau, vstop = tau, usamples = 30, vsamples = 10, v = {return Vector:new{cos(u), sin(u), v, 1}:multiply(Matrix.zyzrotation3(0,\i*pi/2,0))}, transformation = {view}, fill options = {fill = white!50!ltdtbrightness} ] \appendcurve[ ustart = 0, ustop = tau, usamples = 100, transformation = view, v = {return Vector:new{cos(3*u), sin(3*u), 2*u - tau, 1}:multiply(Matrix.zyzrotation3(0,\i*pi/2,0))}, draw options = { line join = round, line cap = round, line width = 2pt, draw = red } ]} \displaysimplices \end{tikzpicture} \end{document} edit: I would like to embed line segments in triangles, causing the machine to output something like this: \documentclass[tikz,border=1cm]{standalone} \begin{document} \begin{tikzpicture}[scale = 5] % magnification to see better % I want to start with a triangle \filldraw[ fill = red, line width = 5pt, line join = round ] (0,0) -- (1,0) -- (1,1) -- cycle; % then dray sub-paths in it, cleanly \draw[ line width = 3pt, line cap = round ] (0.5,0) -- (0.75,0.6) (0.75,0.6) -- (1,0.5) ; \end{tikzpicture} \end{document}
- Footnotes in longtblr with rows generated by macroby mw2015 on April 23, 2026 at 10:56 am
I used longtblr tables from tabularray package. Rows are generated using a macro mentioned in expand option in outer specifications of the table. I would like to use footnotes in such table. Notes from tabularray package (note option and \TblrNote command) are not adequate bacause: inside the macro generating the row it is unknown note's number, note options should be placed inside outer specification part, so they cannot be generated by the macro. Therefore I would like to use footnotes, described in Tabularray with footnotes. There is example code: \documentclass[a4paper]{article} \usepackage[margin=2cm]{geometry} \usepackage{tabularray} \UseTblrLibrary{counter} \UseTblrLibrary{functional} \makeatletter \IgnoreSpacesOn \tlNew \gFootNoteTl \intNew \gFootNoteInt \prgNewFunction \footNote {m} { \tlPutRight \gFootNoteTl { \stepcounter{footnote} \footnotetext{#1} } \prgReturn {\footnotemark{}} } \AddToHook{env/longtblr/before}{ \intSetEq \gFootNoteInt \c@footnote \tlClear \gFootNoteTl } \AddToHook{env/longtblr/after}{ \intSetEq \c@footnote \gFootNoteInt \tlUse \gFootNoteTl } \IgnoreSpacesOff \makeatother \usepackage{ipsum} \newcommand{\tablerow}[2]{#1 & #2 \\} \begin{document} \ipsum<Type=sent>[1-4]\footnote{Note before table} \begin{longtblr}[ caption=Long table, evaluate=\footNote, expand=\tablerow, ]{ colspec={lX}, width=\linewidth,row{1}={font=\bf} } Item & Description \\ item 1\footNote{First note from table body} & \ipsum[1] \\ item 2\footNote{Second note from table body} & \ipsum[2] \\ item 3 & \ipsum<Type=sent>[3] \\ \tablerow{item 4\footNote{First note from macro}}{\ipsum[4]} \tablerow{item 5\footNote{Second note from macro}}{\ipsum[5]} \end{longtblr} \ipsum<Type=sent>[1-5]\footnote{Note after table} \end{document} Result is as follows: Unfortunately, this solution works fine when footnote is placed directly in table body (footnotes with text First note from table body and Second note from table body) but not together with macro generating rows (footnotes with text First note from macro and Second note from macro), which are shown multiple times. I tryed to fix the problem using approach described in The footnote text is repeated several times at the bottom of the page, but after definition of function \footNote as follows \prgNewFunction \footNote {m} { \IfBooleanF { \lTblrMeasuringBool } { \tlPutRight \gFootNoteTl { \stepcounter{footnote} \footnotetext{#1} } \prgReturn {\footnotemark{}} } } the results are also wrong.
- package ebproof, left label usageby Jasper on April 23, 2026 at 10:46 am
I am trying to typeset the forall introduction rule using ebproof, as suggested here: https://tex.stackexchange.com/a/762165/319072. I am reading the manual, but the left label key is not producing the expected result. I am getting this: and what I expect is this (credit Constructivism in Mathematics): \documentclass[letterpaper]{article} \usepackage{microtype} \usepackage{mathtools} \usepackage{unicode-math} \usepackage{ebproof} \begin{document} \[ \begin{prooftree} \hypo[left label=\forall I]{\overset{D_1}{A}} \infer1{\forall yA[x/y]} \end{prooftree} \] \end{document}
- I want to set up the schematic of a modus ponens deduction which uses elimination and implicationby Jasper on April 23, 2026 at 6:48 am
I want to set up the schematic of a modus ponens deduction which uses elimination and implication. I don't think I can get \frac to behave for this Source: Constructivism in Mathematics by A. S. Troelstra and D. van Dalen. \documentclass[letterpaper]{article} \usepackage{microtype} \usepackage{mathtools} \usepackage{unicode-math} \title{Quack} \author{Jasper} \date{\today} \begin{document} \[ \frac{B\to C\ \frac{A\to B\ A}{B}\to E} {C}\to E \] \end{document}
- calculating tangent vectors with partial derivativesby Jasper on April 23, 2026 at 1:57 am
I wanted to try calculating some tangent vectors for a picture, just for fun. This requires taking partial derivatives. It will be some time before I can automate partial derivatives algebraically for illustrations, even though it is a long term goal of mine. In the meantime, I want to see how people would suggest I approximate them. \documentclass[tikz,border=3.14mm]{standalone} \usepackage[3d]{luadraw}%https://github.com/pfradin/luadraw \begin{document} \begin{luadraw}{name=tangent} local g = graph3d:new{viewdir={30,60}, window={-4,4,-3,7}, size={12,12}, bbox=false} local f = function(u, v) return M( 3*math.cos(u)+math.cos(u)*math.sin(v), 3*math.sin(u)+math.sin(u)*math.sin(v), u+math.cos(v)) end -- local dfdu = ??? -- local dfdv = ??? local S = surface(f, 0, 2*math.pi, 0, 2*math.pi) g:Dfacet(S, {mode=mShadedOnly,color="blue"}) g:Show() \end{luadraw} \end{document}
- Hyperref footnote and label in math modelby Darsen on April 23, 2026 at 12:27 am
For relevance, I am using hyperref and footnotebackref in my preamble. I'm trying to use \label and \footnotemark both in the same equation, but I rightfully get an error message saying that there are multiple \label's in the environment. Is there a workaround for this? Tbh, I'm not very proficient with LaTeX but I can (to a degree) tweak already-existing code for my personal use. Any help will be appreciated! I think this is a general issue with footnotemark and label, but in case my preamble is the problem: \documentclass[]{article} \usepackage[margin=2.5cm]{geometry} \usepackage[english]{babel} \usepackage{amssymb} \usepackage{mathtools} \usepackage{amsthm} \usepackage{fnpct}% fix multiple footnotes separator \usepackage[colorlinks=true]{hyperref}% hyperlinks to footnotes \hypersetup{allcolors=blue} \usepackage{footnotebackref} \makeatletter \LetLtxMacro{\BHFN@Old@footnotemark}{\@footnotemark} \renewcommand*{\@footnotemark}{% \refstepcounter{BackrefHyperFootnoteCounter}% \xdef\BackrefFootnoteTag{bhfn:\theBackrefHyperFootnoteCounter}% \label{\BackrefFootnoteTag}% \BHFN@Old@footnotemark } \makeatother \makeatletter \renewcommand\@makefntext[1]{% \renewcommand\@makefnmark{% \mbox{{\normalfont% \hyperref[\BackrefFootnoteTag]{\@thefnmark}}}.}% \BHFN@OldMakefntext{#1}}% \makeatother
- Separate cases for real part and imaginary part [closed]by Tom Huntington on April 22, 2026 at 11:38 pm
I am trying to recreate I want it working in github markdown, but github markdown doesn't support this trick Missing or unrecognized delimiter for \right \left. aaaa \right\} Edit Github requires you to use \lbrace and \rbrace \left. aaaa \right\rbrace
- Help matching a Garamond math fontby Jean Dubois on April 22, 2026 at 10:17 pm
I am trying to match the style of a document (a French math exam, see the first image below). While I have identified the main text font as EB Garamond, I am struggling to reproduce the mathematical rendering (my current attempt is the second image). I am interested in knowing the name of the math font used in the document, as I do not think Garamond-Math is used (the symbols are different). I have also noticed that the original uses ligatures for internal "s" characters in italic (for example, "question" on the second line or "descente" on the third one), which I haven't been able to replicate. The reference (original): My current attempt (using EB Garamond and Garamond-Math): My code (I downloaded EB Garamond and Garamond-Math in the font folder), intended to work with XeLaTeX. \documentclass{article} \usepackage[fontsize=13pt]{scrextend} \usepackage[a4paper, margin=3.5cm]{geometry} \usepackage[french]{babel} \usepackage{fontspec} \setmainfont{EBGaramond}[ Path=./font/, Extension=.otf, UprightFont=*12-Regular, ItalicFont=*12-Italic, RawFeature={ +cv06, % narrow guillemets +calt, % Contextual alternates +clig, % Final s +liga, % f+letter, and Q, j in italic +dlig, % T+h +lnum % Numbers }, ItalicFeatures={ RawFeature={ +hlig, % st, ct, sp, sk +lnum % Numbers } } ] \usepackage[math-style=ISO, bold-style=ISO]{unicode-math} \setmathfont{Garamond-Math.otf}[Path=./font/,StylisticSet={ 1, % \mathbb 2, % \partial 9 % \tilde }] \begin{document} \frenchspacing \noindent\textit{Cette partie porte sur les fonctions convexes dont les gradients sont lipschitziens, établit le théorème de Baillon-Haddad à la question 21), lequel permet enfin d’étudier la convergence de la descente de gradient en l’interprétant comme une itération de Krasnoselskii-Mann.} \medskip Soit $f: \mathbb R^{n} \longrightarrow \mathbb R$ une fonction de classe $\mathscr C^{1}$. On note $\nabla f : \mathbb R^{n} \longrightarrow \mathbb R^{n}$ la fonction gradient qui a $x \in \mathbb R^{n}$ associe le vecteur $$ \nabla f (x) = \begin{pmatrix} \frac{\partial f}{\partial x_{i}}(x) \end{pmatrix}_{1 \leqslant i \leqslant n}. $$ \end{document} The full document is available here. Thank you for your help!
- Known unicode-math backwards compatibility issuesby wsmith on April 22, 2026 at 8:04 pm
I was wondering what common backwards-compatibility issues I should have on my radar when is comes to loading unicode-math? As the package's CTAN page says itself: "[w]hile backwards compatibility is strived for, there are some differences between the legacy mathematical definitions in latex and amsmath, and the Unicode mathematics definitions." I am currently writing a (thesis) template and insist on the user using modern features of latex such as unicode-math; however, I have found in practice that users will paste their existing (perhaps poorly archaically written) code into this template, and it will either not compile or will not look as expected. I would like to put together a list of things to look out for, since I am certainly missing some myself. I will start with a few simple examples which I have seen myself. Both are issues that have appeared previously in this forum many years ago; however, I think it would be of some use to have these compiled together in a centralized location. If there is already some reference of this sort, please let me know.
- Q: LaTeX / psnup / psbook to generate a small lookup bookletby Christof Bodner on April 22, 2026 at 2:40 pm
I am using LaTeX since decades, but now I am facing a request, I cannot answer out-of-the-box. I would have to dive into the psnup/booklet stuff in order to fulfill it. I thought, I'll ask the experts in order to speed up things. (AI does NOT help in this case - as usual ;-)) What's the problem? (similar but not the same as How to automatically output page order to print 8 pages of a booklet on a single sheet of Letter paper?) I have a PDF generated with XeLaTeX and would like to make hand-outs in a very compact format. The target is to cut an A4 page (landscape) in 4 pieces (columns) and put the parts together like a booklet. So I get an A7 sized small book with the shrinked A4 pages on it and I can read through the booklet by flipping over. This is a really handy format! As I also need a lot of these hand-outs, maybe it's possible to have all 4 columns the same, so cutting and puttiong together is much simpler. Basically it's the same as in "booklet", but resulting in a 4x smaller booklet. Any ideas how to do this? As I said, I tried it by myself with psbook and psnup, but did not get the correct output, the page numbers were not correct. Many thanks in advance for any hints! Ch.
- LaTeX: How do I read in a UTF-8 text file replacing formfeeds with \newpage?by hackerb9 on April 22, 2026 at 12:44 pm
I have text files which I'd like to show in a paraphrased, not-quite-verbatim way. The most important transformation needed is replacing the formfeed character with \newpage. I tried several packages (fancyvrb, verbatim, minted) and listings nearly worked as it allowed me to specify \lstset{formfeed={\newpage}}. I especially appreciated the ability of listings to easily transform the text with simple styling. For example, I was able to display words in [square brackets] with \strong and words in <angle brackets> with \emph. However, the documentation for listings neglected to mention that it is unsuitable for modern work as its handling of Unicode characters is buggy, placing them on the wrong lines. I've seen various workarounds but they seem to require that one knows in advance which Unicode characters are going to be in the file. Is there a package which lets me read in a file, automatically perform basic transformations (like search and replace of formfeed), and display the result in a verbatim-esque environment? Edit: Add example text file. Note there is an invisible formfeed (^L) embedded in the following text, causing it to cover two pages. QUICK REFERENCE ▒ ▄▄▒ ▒▒▒ ▄▄▒ ▒ ▒ ▄▄▒ ▄▄▒ ▄ ▒ ▒ ▒ ▒ ▒▒▒ ▒▒▒ ▄▄▒ ▒ ▒▄▄ ▒ ▄▄▒ ▄ ▒ ▒ ▒ ▒▄▄▄▒▄▄▄▒▄▄▄▒▄▄▄▒▄▄▄▒▄▄▄▒▄▒▄▒▄▄▄▒ CLEUSEAU TEXT QUICK REFERENCE Moving ------ ←.......Move left one char SHIFT←..Move to start of word (left) CTRL_A CTRL←...Move to end of line (left) CTRL_Q BASIC INSPECTOR QUICK REFERENCE Editing ------- .RENUM <range>[TO<num>][STEP<num>]... Renumber range of lines. .MOVE <range>[TO<num>][STEP<num>]... Move the range of lines. Output desired:
- Vertical Space in a Beamer Presentationby jeroen2009 on April 22, 2026 at 11:11 am
In a beamer presentation, in order to start the upper bullet point at the top of each page and not at the vertical center of the page, I use the t option as shown below. How can I achieve to start the upper bullet point at each page for example 1 inch from the top and not entirely at the top margin \documentclass[t]{beamer}
- Append command to all superscripts and subscriptsby MarcRdC on April 22, 2026 at 12:33 am
I am using LuaHBTeX (TeX Live 2026) and would like to automatically append a command (say \mycmd, for example a sequence of characters) to all mathematical superscripts and subscripts, without making ^ and _ active — and without using some custom commands to write the said superscripts and subscripts. Could some lua code achieve that? Unlike gsub, it should also apply when symbols ^ and _ are not directly used in the body of the document. For instance, in math mode, a_{b}, a_{b^{c}} and \mytest, where \mytest is defined as a^{b}, should be respectively replaced with a_{b\mycmd}, a_{b^{c\mycmd}\mycmd} and a^{b\mycmd}. \documentclass{article} \def\mycmd{!} \def\mytest{a^{b}} \begin{document} % \verb+\( a_{b} \quad a_{b^{c}} \quad \mytest \)+ should give \( a_{b!} \quad a_{b^{c!}!} \quad a^{b!} \). \verb+\verb!a_b a^b!+ should give \texttt{a\_b a\textasciicircum b}. % \end{document}
- Aligning text within a table cell so that it is centered horizontally and verticallyby NotMyRealName on April 21, 2026 at 11:20 pm
I have been googling for a while and have seen quite a few posts on this, but none of them seem to work. I would like to horizontally and vertically align the below table so that the text appears in the center of the column and the center of the row. I tried this with [b]{|c|}, hoping that this would align the text to the bottom (I also attempted this with [c]{|c|} and got no change. The reason that I use the m/p/b parameters is because I also need the columns to be a set width, I even made sure to include the array package. I had hoped that the b parameter would align the text to the bottom, and the m would align it to the middle, but again, none of them change anything. \documentclass[]{subfiles} \usepackage{array} \begin{document} \begin{table} \begin{center} \begin{tabular}{|m{2.1cm}|m{1.9cm}|m{1.9cm}|b{1.9cm}|m{1.9cm}|p{1.9cm}|b{1.9cm}|} \hline & \multicolumn{2}{c|}{Initial volume ($V_i$)} & \multicolumn{2}{c|}{Final volume ($V_f$)} & \multicolumn{2}{c|}{$\Delta V=V_{object}$} \\[20pt] \hline & [ml] or [cm$^3$] & [m$^3$] & [ml] or [cm$^3$] & [m$^3$] & [ml] or [cm$^3$] & [m$^3$] \\[20pt] \hline Lab Partner 1 & & & & & & \\[20pt] \hline Lab Partner 2 & & & & & & \\[20pt] \hline Lab Partner 3 & & & & & & \\[20pt] \hline & \multicolumn{2}{c|}{} & \multicolumn{2}{c|}{} & \multicolumn{2}{l|}{$\Delta V_{average}=$} \\[20pt] \hline \end{tabular} \end{center} \end{table} \end{document} Here is the output of the above (you'll notice that the m/b/p parameters all give the exact same result). How can I adjust this code to force the text to be both horizontally and vertically center aligned while maintaining the column widths?
- Aligning TikZ grids between tcolorbox overlays and page backgroundby Christopher Madec on April 21, 2026 at 9:13 pm
I am working on a layout where I draw a grid in two different contexts: Inside tcolorbox environments (using an overlay) In the page margin using \AddToShipoutPicture Here is a minimal example: \documentclass[11pt,a4paper,svgnames]{book} \RequirePackage[top=2cm, bottom=2cm, left=3.9cm, right=1cm]{geometry} \usepackage[most]{tcolorbox} \newcommand{\myoverlay}{ \begin{tcbclipinterior}%[remember picture,overlay] \draw[%shift=(current page.north west), step=0.524cm,white!70!gray,very thin] (interior.north west) grid (interior.south east); \end{tcbclipinterior} } \newtcolorbox{Box4}[1][ bicolor, colback=white!05,grow to left by=2.5cm,colbacklower=black, boxrule=0.5pt,overlay=\myoverlay]{#1} \newtcolorbox{Box4bis}[1][ bicolor,colback=white,colbacklower=black, grow to left by=0cm,grow to right by=0cm, boxrule=0pt, overlay=\myoverlay] {#1} \usepackage{lipsum} \usepackage[]{eso-pic} \begin{document} \AddToShipoutPicture{% \begin{tikzpicture} \draw[shift=(current page.north west),step=5.24mm, lightgray, very thin, opacity=0.5] ([xshift=0cm,yshift=0cm]current page.south west) grid ([xshift=3.7cm,yshift=0cm]current page.north west); \draw[black, very thick, opacity=0.3] ([xshift=3.7cm]current page.south west) -- ([xshift=3.7cm]current page.north west); \end{tikzpicture}% } \begin{Box4bis} \lipsum[1] \end{Box4bis} \begin{Box4} \lipsum[2] \end{Box4} \lipsum[3] \begin{Box4} \lipsum[4] \end{Box4} \begin{Box4bis} \lipsum[5] \end{Box4bis} \end{document} The code gives this: Goal I would like the grids drawn: inside the tcolorbox environments in the page margin (via shipout) to be perfectly aligned, so that the grid appears continuous across the whole page. What I have tried Using current page coordinates inside the tcolorbox overlay Adding remember picture, overlay and current page.north page and retrieve absolute positions (see tikz: How can I find the value of `current page.north west`?) Trying to manually shift grids to match visually (impossible) However, I could not find a reliable way to make both grids share the same reference system.
- Drawing card rows by using JeuxCartesby ryuk on April 21, 2026 at 9:10 pm
Good evening, I've drawn 52 cards using the "JeuxCartes" package. I'd like to arrange the cards in 4 rows (one row per suit), but I can't. Could someone please help me? I would also like to introduce a little bit of space horizontally and vertically between one card and another. Thank you very much. \documentclass{standalone} \usepackage{amsmath,amssymb} \usepackage{pgfplots} \usepackage{JeuxCartes} \usepackage{eurosym} \begin{document} \\ \AffCartesJeu[Hauteur=2,StyleJeu=v3]{AT § 2T § 3T § 4T § 5T § 6T § 7T § 8T § 9T § 10T § VT § DT § RT} \\ \\ \\ \AffCartesJeu[Hauteur=2,StyleJeu=v3]{AK § 2K § 3K § 4K § 5K § 6K § 7K § 8K § 9K § 10K § VK § DK § RK} \\ \\ \\ \AffCartesJeu[Hauteur=2,StyleJeu=v1]{AC § 2C § 3C § 4C § 5C § 6C § 7C § 8C § 9C § 10C § VC § DC § RC} \\ \\ \\ \AffCartesJeu[Hauteur=2,StyleJeu=v2]{AP § 2P § 3P § 4P § 5P § 6P § 7P § 8P § 9P § 10P § VP § DP § RP} \\ \\ \end{document}
- Number shows up in worldflagby Erwann on April 21, 2026 at 5:21 am
autoWorldFlag applies a scale factor to \f@size; I guess the dimension is poorly specified for the number .88 to show up in the output for \Huge. How then should it be set? \documentclass{article} \usepackage{worldflags} \usepackage{xparse} \ExplSyntaxOn % helper dimension \dim_new:N \l__flag_length_dim \makeatletter \NewDocumentCommand{\autoWorldFlag}{m} { \dim_set:Nn \l_tmpa_dim { 0.9pt * \f@size } \worldflag[ length = \dim_use:N\l_tmpa_dim , width = 0pt ]{#1} } \makeatother \ExplSyntaxOff \begin{document} \normalsize Document bilingue \autoWorldFlag{FR} \bigskip \large Document bilingue \autoWorldFlag{FR} \bigskip \Huge Document bilingue \autoWorldFlag{FR} \end{document}
- Plot a domain in 3D with TikZ for a triple integralby Sebastiano on April 20, 2026 at 9:59 pm
I have to solve this triple integral ∭ x y|z|³/(1+ (x²+y²)⁴) dx dy dz, with a domain T={(x, y, z) ∈ ℝ³: x ≤ 0, y ≥ 0, z² ≤ x²+y² ≤ 1}. Plotting with DESMOS 3D I see this: Actually I am not able to visualise this domain in my mind. It should be a cylinder enclosed by a double-sloped cone, but I can’t quite get the x ≤ 0, y ≥ 0 parameters right. I’ve created something but I would like my drawing (or a new one) to be intuitive with TikZ3D so that I can correctly draw this integral. My MWE: \documentclass[12pt]{article} \usepackage{tikz} \usepackage{tikz-3dplot} \tdplotsetmaincoords{60}{130} \begin{document} \begin{tikzpicture}[tdplot_main_coords, scale=3] % assi \draw[->] (0,0,0) -- (1.3,0,0) node[right]{$x$}; \draw[->] (0,0,0) -- (0,1.3,0) node[left]{$y$}; \draw[->] (0,0,0) -- (0,0,1.3) node[above]{$z$}; \foreach \t in {0,1,...,359}{ \pgfmathsetmacro{\ct}{cos(\t)} \pgfmathsetmacro{\st}{sin(\t)} \draw[blue!60, opacity=0.75] (0,0,0) -- plot[domain=0:1, samples=40] ({\x*\ct},{\x*\st},{\x}); \draw[red!60, opacity=0.75] (0,0,0) -- plot[domain=0:1, samples=40] ({\x*\ct},{\x*\st},{-\x}); } \draw[thick] plot[domain=0:360, samples=200] ({cos(\x)},{sin(\x)},1); \draw[thick] plot[domain=0:360, samples=200] ({cos(\x)},{sin(\x)},-1); \end{tikzpicture} \end{document}
- expl3 e vs x function variantsby karlh on April 20, 2026 at 8:06 pm
In the LaTeX3 kernel documentation (interface3), it used to state, "The e specifier is in many respects identical to x, but with a very different implementation. Functions which feature an e-type argument may be expandable. The drawback is that e is extremely slow (often more than 200 times slower) in older engines, more precisely in non-LuaTeX engines older than 2019." I say "used to" because the current version changed the wording somewhat: "The e specifier is in many respects identical to x, but uses [the] \expanded primitive. [The] parameter character (usually #) in the argument need not be doubled. Functions which feature an e-type argument may be expandable." My question: other than the argument being allowed to be expandable in the e-form, is there a reason to prefer e over x or vice-versa, or do they do essentially the same thing? In particular, some functions (e.g., \iow_now:Nn) had x-variants in TeXLIVE 2023 but have e-variants now (the implication being that e is preferred, I would guess?), and I am wondering whether it makes any difference in terms of backward or forward compatibility of code I might write in the future.
- add a grid background only inside a tabular columnby Christopher Madec on April 19, 2026 at 5:19 pm
I am trying to create a worksheet layout in LaTeX where one column of a table contains a writing area with a grid (like squared paper), while the other column contains several questions (Here is an example with just one question). \documentclass{article} \usepackage{array} \usepackage{xcolor} \usepackage{geometry} % \usepackage{arydshln} \usepackage{lipsum} \geometry{a4paper, left=0.35in, right=-0.1in, top=0.6in, bottom=0.4in} \definecolor{burgundy}{HTML}{8B2252} \usepackage{scrlayer-scrpage} \usepackage{tikz} \newcommand*\Circled[1]{\tikz[baseline=(char.base)]{\textcolor{burgundy}{\node[shape=circle,draw,inner sep=2pt] (char) {#1};}}} \usepackage{tikzducks} \usetikzlibrary{calc} \newcommand{\pageframe}{% \begin{tikzpicture}[remember picture, overlay] \fill [burgundy!80!white] (current page.north west) rectangle (current page.south east); \fill [white, rounded corners=1cm] ($(current page.north west)+(0.5cm,-1cm)$) rectangle ($(current page.south east)+(-0.5cm,1cm)$); \node [align=center] at ($(current page.north)+(0,-0.6cm)$) {$\color{white}\mathrm{Chapitre \ 2 - Diffusion \ thermique}$}; \node [align=center] at ($(current page.south)+(0,1.9cm)$) {\centering\begin{tikzpicture}[scale=0.5] \shuffleducks \duck[\randomhead,\randomaccessories, /tikz/nodes={scale/.evaluated={\value{page}>99?0.4:0.6},font=\bfseries}, signpost=\scalebox{1.6}{ \parbox{6cm}{\hspace{-0.4em}\color{black} \centering\thepage}}, signback =white] \end{tikzpicture}}; %%% Background grid \draw[step=5mm, gray!30, very thin] ($(current page.north west)+(7cm,-1.5cm)$) grid ($(current page.south east)+(-1cm,5cm)$); \end{tikzpicture} } \cehead[\pageframe]{\pageframe} \cohead[\pageframe]{\pageframe} \pagestyle{scrheadings} % Another try \usepackage{makecell} \newcommand{\gridcell}[1][4cm]{% \begin{tikzpicture} \draw[step=5mm, gray!40, very thin] (0,-0.2) grid (\linewidth, #1); \end{tikzpicture}% } \begin{document} \renewcommand{\arraystretch}{6} \begin{tabular}{>{\centering\raggedright}m{0.25\textwidth}||>{\centering\arraybackslash}m{0.60\textwidth}} \Circled{1} \'Enoncer le théorème de Green-Ostrograski & \\ \hline \end{tabular} \end{document} Goal I would like the second column of the table to contain a grid background (like graph paper) so that students can write their answers. I want to find the best way to create a grid (squared background) that is confined to a specific table column, and that does not overflow outside the table. What I tried so far Using a page-wide background grid, but it overflows outside the table and does not align with the table structure \draw[step=5mm, gray!30, very thin] ($(current page.north west)+(7cm,-1.5cm)$) grid ($(current page.south east)+(-1cm,5cm)$); \end{tikzpicture} The code looks like this: Drawing a grid with TikZ inside a cell → does not scale correctly with row height \newcommand{\gridcell}[1][4cm]{% \begin{tikzpicture} \draw[step=5mm, gray!40, very thin] (0,-0.2) grid (\linewidth, #1); \end{tikzpicture}% }