Hot
- longtable: gap below first subtableby cis on February 28, 2026 at 1:21 pm
The following longtable always starts at the top of the text-body. I've noticed that the very first subtable in the following longtable has one less row than the other (page-height) subtables - even though the content is almost identical. In individual cases, this can be fixed by adding \hrule height0pt\vskip-22pt before the table - determined by eye. However, this generally doesn't help if the fontsize or page geometry (height) is changed. The question is: How can this be professionally fixed? That is, all subtables (except the last one) should have the same distance from the bottom of the text-body (perhaps this distance is zero), regardless of page height or font size. \documentclass[a5paper]{article} \usepackage[margin=12mm, %paperheight=150mm,% optional 1/3 showframe=true, ]{geometry} \usepackage{pgffor} \usepackage{longtable} \def\OutFilename{\jobname-tabledata.tex} \newwrite\MyFile \immediate\openout\MyFile=\OutFilename \def\Rows{140} \foreach \n in {1,...,\Rows}{%% \ifnum\n=\Rows % \immediate\write\MyFile{\n & 0.1 & 0.2 & 0.3}% \else% \immediate\write\MyFile{\n & 0.1 & 0.2 & 0.3 \\}% \fi% }%% \immediate\closeout\MyFile \begin{document} %\footnotesize% optional 2/3 %\Large% optional 3/3 \begin{longtable}{| c c c c | } %% Very first Header ======================== \hline n & p1 & p2 & p3 \\ \hline \endfirsthead %% Header for subsequent pages ================ \hline n & p1 & p2 & p3 \\ \hline \endhead% %% Footer for all pages except last ================ \hline n & q1 & q2 & q3 \\ \hline \endfoot %% Footer for the very last page ================ \hline n & q1 & q2 & q3 \\ \hline \endlastfoot \input{\OutFilename} \end{longtable} \end{document}
- Extra horizontal white space appearing, when declaring floats in text using the apa7 document class in student modeby Treachable on February 28, 2026 at 10:10 am
Declaring floats in the middle of a paragraph causes extra white space to appear at that point. Declaring between paragraphs solves the problem but adding % symbols does not. It also does not happen in the article class. The white space also disappears when changing to document class article or even document class apa7 without student mode. So why does this happen? Is there a way to avoid the white space while still declaring the float within the paragraph? Below is a minimal working example. \documentclass[stu]{apa7} \usepackage{graphicx} \title{Assignment Title} \begin{document} \maketitle While I write I describe a table. I then embed the table in the tex-document. This results in mystery white space appearing at the end of this sentence. \begin{table} \caption{small table} \begin{tabular}{lcccc} \hline &A1&A2&A3&A4\\ \hline B1&1&2&3&4\\ B2&5&6&7&8\\ \hline \end{tabular} \end{table} I can of course make sure I am declaring my floats between paragraphs, but I was used to doing it this way because in other document classes this could result in the table being placed right at that spot, when typesetting allowed. And I find that good for readability. Placing some \% symbols at the end of all of the lines reduces the white space somewhat.% \begin{table}% \caption{small table}% \begin{tabular}{lcccc}% \hline% &A1&A2&A3&A4\\% \hline% B1&1&2&3&4\\% B2&5&6&7&8\\% \hline% \end{tabular}% \end{table}% But as you can see it does not disappear. The same happens for figures. \begin{figure} \caption{a figure} \includegraphics{example-image} \end{figure} As seen here. \end{document}
- Placement of see and see alsoby Lata Deokar on February 28, 2026 at 8:10 am
I am preparing an Index in Marathi. There are several entries in which either "see" or "see also" is required. I have gone through the discussion on this platform. But I cannot find a solution as to how to get see also entries at the end rather than at the beginning of sub-entries. \documentclass[12pt]{memoir} \usepackage{polyglossia} \setmainlanguage{marathi} \setmainfont[ Script=Devanagari, Mapping=devanagarinumerals ]{Noto Serif Devanagari} \usepackage{imakeidx} \makeindex % Source - https://tex.stackexchange.com/a/270982 % Posted by matsch, modified by community. See post 'Timeline' for change history % Retrieved 2026-02-28, License - CC BY-SA 3.0 % Source - https://tex.stackexchange.com/a/86910 % Posted by barbara beeton % Retrieved 2026-02-28, License - CC BY-SA 3.0 \providecommand{\indexalso}[3]{% \index{#1!zzzzz@\emph{\alsoname} {#2}}} \begin{document} तिबेटबद्दल बोलणं म्हणजे सुद्धा गोष्टी बाळबोध करणं आहे - \index{तिबेट!राजकीय आणि वांशिक}राजकीय आणि वांशिक तिबेट यामध्ये फरक करणं हेच मुळात गोष्टी अत्यंत बाळबोध करणं आहे. पूर्वेकडील खम आणि \index{आम्दो!आणि प्रादेशिक अस्मिता}आम्दो या भागातले लोक नेहमी स्वतःला तिबेटी म्हणवून घेण्याऐवजी \index{खम!आणि प्रादेशिक अस्मिता}खम्पा आणि आम्दोवा म्हणत आले आहेत. कित्येकदा त्यांची मध्य तिबेटऐवजी चिनी शेजाऱ्यांशी अधिक जवळीक होती. विसाव्या शतकापर्यंत हे स्थानिक बंध बृहत्तर तिबेटच्या कुठल्याही कल्पनेपेक्षा अधिक दृढ होते. व्यापक तिबेटी अस्मिता निर्माण करण्याच्या आधुनिक प्रयत्नांना हे बंध आजही धोका निर्माण करत आहेत. तसंच, बौद्ध धर्मानुयायी असणं हा समान धागा विशिष्ट पंथ किंवा विहारांशी वैयक्तिक निष्ठा ठेवण्याच्या आड येत नव्हता. त्यांचं बौद्धधर्मीय असणंसुद्धा {बौद्ध धर्म!विहारांदरम्यानचे संघर्ष}विहारांदरम्यान होणाऱ्या - काही प्रसंगी \index[words]{विहार!-मधील हिंसा}हिंस्र - संघर्षांना थोपवू शकत नव्हतं. \indexalso{आम्दो}{च़ोङ्खा शहर} \printindex \end{document}
- How do I use Tikz to create new text characters with serifs?by ItsErtHere on February 27, 2026 at 8:59 pm
I would like to create "half letters" that attach to the left side of letters in a math formula. This would not only allow for the Latin AE character, but also characters like AD, OP, TB, and so on. When using regular Tikz lines, the attachment to the left side of the main letter does not appear to have the same font as the right side. For example, I will merge A and P together: \begin{tikzpicture} \draw[x=1pt,y=1pt,xshift=1.2] (5.3,3.6) node[node font=\itshape] {P}; \draw[x=1pt,y=1pt] (0.3,0) -- (6,7); \draw[x=1pt,y=1pt] (3.1,3.5) -- (6.3,3.5); \draw[x=1pt,y=1pt] (0,0.25) -- (1,0.25); \end{tikzpicture} The result (on Overleaf): The AP merged letter, possibly useful to represent pressure in physics when P is already used for power. We see, when attaching the half-A with the P, the font does not match, and the "serif" that I attached does not match the font. How do I add a serif to the end of the diagonal line on the left half of the character that makes the attachment look like a part of the character? Preferably, I'd like a custom line style to lessen the amount of commands I have to do for each half-letter or a specific command to create a serif to be in line with the math font? Or, in this case, is it easier to just create a font? (I'm doing this for all uppercase Latin and lowercase Greek letters for completeness, so that could become quite tedious). I may also have to consider variable line thickness on the left half of the letters too, as seen on the right-side P. In summary, here are the criteria I'm considering in this project: The general shape of a serif when attached to a line at any angle (strait P versus a diagonal V). The variation of width in some lines, such as the curves on B, D and P. Intersections of lines. Advantages and disadvantages of creating a custom font (.sty), creating a serif shape in Tikz, or creating a custom line style for Tikz. This helps decide what the best option is for this project. The application I'm hoping this is useful for is to allow more characters in formulas for math, physics, and other sciences whose design could hint at what the characters mean. For example, in physics, consider the notation for volume and voltage (both are represented by V). If both volume and voltage are in one calculation, what other symbols can we use to represent either one in order to avoid confusion that still show what those symbols represent? In this case, voltage can be VT, and volume can be VU. (The choice is up to the writer, this is just an example). I plan to write a paper over this topic once I get the attachments created. While this is meant for use in physics, I see this having applications in other areas of science and mathematics as well. Thus, which option would be the best for this project, and how do I get started with it? The TIKZ site is helpful, but I did not find anything that looked immediately useful specifically for creation of Serif fonts. Any help would be appreciated!
- How can I calculate or approximate the intersection(s) or lack thereof of a line and an exponential curve using Lua?by Jasper on February 27, 2026 at 5:58 pm
How can I calculate or approximate the intersection(s) or lack thereof of a line and an exponential curve. My goal is to avoid using an approach which first tessellates curves into line segments, and tests each line segment pair. That is O(n^2). I want something which can scale. I think Lua is appropriate for this, based on evidence in the comments. \documentclass[tikz,border=1cm]{standalone} \begin{document} \begin{tikzpicture} \draw[->] (-2,0) -- (2,0); \draw[->] (0,-2) -- (0,e^2); \draw[domain=-2:2] plot (\x,e^\x); \draw[domain=-2:2] plot (\x,\x+1.5); % two intersections \draw[domain=-2:2] plot (\x,\x+1); % one intersection \draw[domain=-2:2] plot (\x,-\x+4.5); % one intersection \draw[domain=-2:2] plot (\x,\x); % zero intersections % My goal is to use pgfmath to calculate, or if % necessary iteratively approximate, the intersections % of these lines with the exponential curve. % If it is not easy in pgfmath, then I want a Lua-based solution. \end{tikzpicture} \end{document}
- Problem (warning message) with Calculator packageby ViToni on February 27, 2026 at 4:03 pm
This rather small document \documentclass{article} \usepackage{calculator} \newcommand{\myPerCent}[2]{% \DIVIDE{#1}{#2}{\sol}% \MULTIPLY{\sol}{100}{\sol}% \ROUND{\sol}{\sol}% \sol% } \begin{document} Computed \myPerCent{2441}{8667}.\par \end{document} produces this warning (I guess it's a warning and not an error as the PDF is finally built): (\end occurred when \ifdim on line 13 was incomplete) I have no clue how to solve the issue as the code looks ok at first glance, but it seems something is off here. How can I use the package in a proper way? (I'm quite happy I was able to identify the source for the warnings at least as the original document is rather large and I started looking into things like How to diagnose unclosed (incomplete) \iftrue or \ifnum? but somehow I didn't get me anywhere and I don't seem to know anything more than before...)
- Redefine \gg in ‘unicode-math’by mvs on February 27, 2026 at 2:41 pm
I have: \documentclass{article} \usepackage{fontspec} \usepackage{unicode-math} \setmainfont{STIX Two Text}[Ligatures=TeX] \setmathfont{STIX Two Math} \usepackage{amsmath} % need a suitable redefinition of ‘\gg’ \begin{document} $\gg$ \end{document} with Lualatex but I want to redefine \gg to print a boldface g (such as \symbf{g}). I even asked ChatGPT but it could not find any solution which would work. Is there any? (of course I know that I could use a different command....)
- Align the enumerate item number with the top edge of a tcolorbox?by oooh GYC on February 27, 2026 at 2:22 pm
I am using a custom tcolorbox inside an enumerate environment. By default, the item number aligns with the baseline of the box (the bottom). I want the item number to be aligned with the top edge of the colored background. I have tried setting baseline=\ht\strutbox, but the number only moves up to the baseline of the first line of text, which still leaves a gap between the number and the top edge of the box. Here is my current code and the resulting output: \documentclass{article} \usepackage[most]{tcolorbox} \usepackage{enumitem} \newtcolorbox{bluebox}{ nobeforeafter, % baseline=\ht\strutbox % I tried this, but it is not perfectly aligned to the top } \begin{document} \begin{enumerate} \item \begin{bluebox} This is the first line of the box contents.\\ This is the second line. \end{bluebox} \end{enumerate} \end{document} As, the image shows, the item number (e.g., "1.") sits lower than the top of the blue background. Is there a way to force the baseline of the tcolorbox to be its physical top, or a specific offset that accounts for the font height? I have tried: baseline=\dimexpr\ht\strutbox-\tcbheight\relax baseline=\tcbheight
- Need a new Latex command for square bracketsby Ilia on February 27, 2026 at 1:38 pm
I've already encountered in this site complaints that in the standard font, the horizontal lines (serifs) in the image of square brackets are too short and difficult to visually distinguish. As a workaround, some suggest using overlapping "ceil" and "floor" symbols instead of square brackets. However, this results in unacceptably long serifs. I need a new command for something intermediate and very limited in use. I don't intend to use it for matrices or any other multi-line environment. Just one short text string between brackets. Unable to find a suitable ready-made solution, I decided to write such a command myself. After all, it's just one vertical bar and two horizontal serifs. This is what I got so far. \documentclass[12pt,a4paper,notitlepage]{report} \usepackage[cp1251]{inputenc} \usepackage[T1,T2A]{fontenc} \usepackage[russian]{babel} \usepackage{amsmath, amssymb} \usepackage{mathrsfs} \usepackage{enumitem} \usepackage{relsize} \usepackage{exscale} \usepackage{perpage} \usepackage{nicefrac} \usepackage[all,cmtip]{xy} \MakePerPage{footnote} \newcommand{\LBR}{ \hspace{0.2em}\rule[0.75em]{0.2em}{0.05em}% top serif \hspace{-0.2em}\rule[-0.2em]{0.2em}{0.05em}% bottom serif \hspace{-0.3em}\rule[-0.2em]{0.1em}{1.0em}% vertical bar \hspace{0.2em} } \newcommand{\RBR}{ \hspace{0.1em}\rule[0.75em]{0.2em}{0.05em}% top serif \hspace{-0.2em}\rule[-0.2em]{0.2em}{0.05em}% bottom serif \rule[-0.2em]{0.1em}{1.0em}% vertical bar \hspace{0.2em} } \newcommand{\opni}[1] {{\RBR #1 \LBR}} \newcommand{\opcli}[1]{{\RBR #1 \RBR}} \newcommand{\clopi}[1]{{\LBR #1 \LBR}} \newcommand{\clsi}[1] {{\LBR #1 \RBR}} \begin{document} \[ \begin{array}{ll} \opni{a, b} &=\ \{x\in A: a < x < b\},\\ \opcli{a, b} &=\ \{x\in A: a < x\leqslant b\},\\ \clopi{a, b} &=\ \{x\in A: a\leqslant x < b\},\\ \clsi{a, b} &=\ \{x\in A: a\leqslant x\leqslant b\},\\ \opni{{\gets},a} &=\ \{x\in A: x < a\},\\ \opcli{{\gets},a} &=\ \{x\in A: x\leqslant a\},\\ \opni{a,{\to}} &=\ \{x\in A: a < x\},\\ \clopi{a,{\to}} &=\ \{x\in A: a\leqslant x\}. \end{array} \] $\mathbb{R}^\clsi{a,b}$ \end{document} Although not very pretty, this solution is more or less satisfactory - except for two problems. First, in some random cases the vertical bar and one of serifs are too thick. Second and more important, the brackets are not scaled inside superscript, for example, in an expression like $\mathbb{R}^\clsi{a,b}$. The reason for the first problem I don't understand. The reason for the second I understand, but have no idea what to do about it. Any help is appreciated.
- How to map characters to a different text when copied? [duplicate]by Mauricio on February 27, 2026 at 11:51 am
Some PDF have a layer of protection so that when a text is copied and pasted a lot of scrambled text is provided instead of the original text. It makes also pdf unsearchable. What is this called and is there a way to replicate it with latex?
- How to define the tagging logic for a command as the same tagging logic of another command?by lucianos on February 27, 2026 at 10:22 am
I have a custom command for typesetting an expression, and I would like to make the tagging logic treat it as another command, so that the visual pdf output uses my custom command, but in the tags, mathml, etc., it gets treated as if it were the other command instead. The reason is that this way I can define my command using, say, low level TeX commands and/or features that do not have tagging/mathml support. Minimal example: \DocumentMetadata{ tagging = on, pdfversion = 2.0, pdfstandard = A-4, pdfstandard = UA-2 } \tagpdfsetup{math/setup=mathml-SE} \documentclass{article} \newcommand{\mycommand}[2]{#1 / #2} % Map \mycommand to \frac so that tags, mathml, alt-text, etc. treat it as if I had defined it as: % \newcommand{\mycommand}[2]{\frac{1}{2}} \begin{document} These expressions should be different in the pdf, but should be identical in tags, mathml, etc. Original: \[ \mycommand{a}{b} \] Alternate: \[ \frac{a}{b} \] \end{document} An example with a definition that doesn't work well with MathML and tagging (uses scalebox in math environment): \DocumentMetadata{ lang = en, tagging = on, pdfversion = 2.0, pdfstandard = A-4, pdfstandard = UA-2 } \tagpdfsetup{math/setup=mathml-SE} \documentclass{article} \usepackage{unicode-math} \usepackage{graphicx} \newcommand{\myfrac}[3][0.8]{ \scalebox{#1}{\ensuremath{\displaystyle{\frac{#2}{#3}}}} } \begin{document} Standard: \[ \frac{\frac{a + b}{c + d} + 1 + \frac{e}{f}} {\frac{g}{h} - 1} \] Custom: % I want this to be the same as 'Standard' in MathML and tags \[ \frac{\myfrac{a + b}{c + d} + 1 + \myfrac{e}{f}} {\myfrac{g}{h} - 1} \] \end{document} I wasn't able to determine how to achieve this; the closest thing I found is latex-lab-math alt text and \displaystyle?, but I wasn't able to find documentation on that. Is anyone able to point me to the correct documentation or to relevant source code?
- Problem with rendering combining diacritics in LuaLaTeXby Guilherme on February 27, 2026 at 7:08 am
I want to use the characters ἄ̱ a̱ typed with "combining macron bellow" ◌̱ (U 0331), but I do not get the correct rendering. I am using EB Garamond here, and this font support both glyphs, as I can see in the font preview software Typeface: When I compile with LuaLaTeX, I get the following result: It works for latin glyphs, but not greek ones. But, when I use other font with support for this (the free avaiable Brill font) the macron get correctly put, as you can see here: Now I am really in doubt if this is a problem on the side of the font, or a problem on the side of LuaLaTeX. Or even if I am missing some option or configuration in fontspec. Here is the minimal document to reproduce this. \documentclass{article} \usepackage{fontspec} \usepackage{babel} \babelprovide{english} % You can test each font. % \setmainfont[Kerning=On, Ligatures=Common]{EB Garamond} % \setmainfont[Kerning=On, Ligatures=Common]{Brill} \begin{document} a̱ ἄ̱ \end{document} My Version of LuaLaTeX: This is LuaHBTeX, Version 1.21.0 (TeX Live 2025) Development id: 7667
- Adjusting space between the last paragraph and the footnote bar in the page [duplicate]by hisacro on February 27, 2026 at 12:46 am
I wanted to increase the spacing after the last paragraph in the page where the footnote bar starts, The above image shows the case. I'm using scrartcl as my document class.
- Replace outside framebox by xy axisby Leoborges on February 26, 2026 at 8:31 pm
In this MWE, how can I replace the outside framebox by ordinary xy axis? \documentclass{article} \usepackage{luamplib} \begin{document} \begin{mplibcode} input graph beginfig(0); draw begingraph(4cm,5cm); setrange(-1,0,2,4); gdraw (-1,1) for x=-0.9 step 0.1 until 2: .. (x,x**2) endfor withpen pencircle scaled 1pt withcolor blue; endgraph; endfig; \end{mplibcode} \end{document}
- Using a range from TeX Gyre Termes Math causes arithmetic overflowby murray on February 26, 2026 at 6:29 pm
The following source produces the expected output. % !TEX program = lualatex \NeedsTeXFormat{LaTeX2e}[2025-11-01] \documentclass{article} \usepackage[russian,english]{babel} \babeltags{russian=russian} \usepackage{fontspec} \usepackage{lua-unicode-math} \defaultfontfeatures{Scale=MatchLowercase, Ligatures=TeX} \setmathfont{STIX Two Math}[Scale=MatchUppercase,math-style=ISO] %\setmathfont{TeX Gyre Termes Math}[Scale=MatchUppercase,math-style=ISO,range={\bigcup,\bigcap}] \ExpandArgs{c}\def{ver@unicode-math.sty}{} \babelfont{rm}[Scale=1.0]{TeXGyreTermesX} \babelfont[russian]{rm}{tempora} \usepackage{newunicodechar} \newunicodechar{♢}{\mdlgwhtdiamond} \usepackage{scalerel} \DeclareRobustCommand\myDiamond{\scalerel*{\mdlgwhtdiamond}{X}} \usepackage[thmtools-compat]{keytheorems} \DeclareRobustCommand{\qed}{% run-in QED: \ifmmode \mathqed \else \leavevmode\unskip\penalty9999 \hbox{}\nobreak%\hfill \quad\hbox{\qedsymbol}% \fi } \newkeytheoremstyle{exstyle}{} \newkeytheorem{example}[name=Example, style=exstyle, qed=$\myDiamond$] \begin{document} \begin{example} $3^{2} + 4^{2} = 5^{2}$. \end{example} \noindent We have $\bigcup_{i \in I} A_{i} = \bigcap_{j \in J} B_{j}$. \end{document} I want to pull the \bigcap and \bigcup symbols not from STIX Two Math but instead from TeX Gyre Termes Math (because in the latter they are lighter weight). However, if the commented-out line \setmathfont{TeX Gyre Termes Math...[...range=...] is uncommented then I get an arithmetic overflow when the qed-like diamond symbol is to appear. But why is the diamond symbol being selected from TeX Gyre Termes Math now, when apparently it was not before? Missing character: There is no ◇ (U+25C7) in font "name:TeX Gyre Termes Math:m ode=base;script=math;language=dflt;+tlig;"! ./clash.tex:39: Arithmetic overflow. <recently read> \calc@denominator l.39 \end{example} I can't carry out that multiplication or division, since the result is out of range.
- Creating Boxplot from precomputed value for each line in tableby skanarr on February 26, 2026 at 4:53 pm
I am using the box plot prepared method from here: Read boxplot prepared values from a table. My problem is the following: I have multiple rows in that csv and I want a box plot for each of these rows. How can I loop over all rows and create those? Added bonus: Some of my table columns are shorter than others, some have only enough data for 2 box plots, some have enough data for 10 box plots. % 1: extra for box plot, % 2: Identifier % 3: table, % 4: row \newcommandx{\TimeBoxPlot}[4][1={}]{ \addplot+[#2, #1, fill, boxplot prepared from table={ table=#3, row=#4, lower whisker= #2-time-min, lower quartile= #2-time-1, median= #2-time-med, upper quartile= #2-time-q3, upper whisker= #2-time-max, sample size = #2-sample-size, draw position = edge_count, }, boxplot prepared, ] coordinates {}; } % draw % Identifier % Table \newcommandx{\PlotPoint}[3][1={}]{ \pgfplotstablegetrowsof{#3} \pgfmathtruncatemacro{\numrows}{\pgfplotsretval-1} \pgfplotsinvokeforeach{0,...,\numrows}{ \TimeBoxPlot[#1]{#2}{#3}{##1} } } The identifier Mentioned is just a string-prefix for the columns in question and also a style I defined, so they are colored and drawn correctly. Though every Identifier has unbounded coords=discard set thats about the similarities. The implementation of \PlotPoint does not work. It is the macro that should go through all the lines (at least those with values).
- Hide synctex file -- TeXstudio, Windows 11by Dave on February 26, 2026 at 2:42 pm
I use TeXstudio (currently 4.9.2) with MikTeX (currently 4.12) in Windows 11, and I have things set up so that auxillary files are automatically dumped into a "TeX_Aux" folder, which is nice for me. My question is about the synctex file (or zip folder). I know that it needs to be in the same directory as the pdf, but if possible I would at least like to do the following: When compiling a .tex file in TeXstudio, is there a way to automatically have the synctex file/folder become hidden in the Windows 11 File Explorer (i.e. the hidden attribute just from a Windows 11 OS perspective)? This is similar to the question here: Hide .synctex files, but it is not for TeXstudio and I'm not tech-savvy enough to really understand what it's doing. In case it helps, I currently have the following in my "Configure TeXstudio"->"Commands" for PdfLaTeX: pdflatex.exe -synctex=1 -interaction=nonstopmode -aux-directory=TeX_Aux %.tex
- FiraSans and math font in Beamerby Dimitrios ANAGNOSTOU on February 26, 2026 at 2:21 pm
I am using Moloch theme and FiraSans font. When choosing the font for the math text, how to be sure which fonts are compatible with respect to sizes? As an example of comparison: % ============================================================ % CLASSE ET THÈME % ============================================================ \documentclass[10pt]{beamer} \usetheme{moloch} % Thème moloch % ============================================================ % ENCODAGE ET LANGUE % ============================================================ \usepackage[T1]{fontenc} \usepackage[french]{babel} \usepackage[semibold,light]{FiraSans} \usepackage{FiraMono} \usepackage{mathpazo} %\usepackage{newtxmath} \usefonttheme[onlymath]{serif} \begin{document} \begin{frame} Soit $E$ un espace vectoriel réel de dimension finie. On considère une application linéaire $T : E \to E$ telle que \[ T(\alpha x + \beta y) = \alpha T(x) + \beta T(y). \] On suppose que la matrice associée à $T$ dans une base donnée est \[ A = \begin{pmatrix} a_{11} & a_{12} & \cdots & a_{1n} \\ \vdots & \ddots & & \vdots \\ a_{n1} & \cdots & & a_{nn} \end{pmatrix}. \] Le déterminant $\det(A)$ permet de caractériser l'inversibilité de $T$. En particulier, \[ \det(A) \neq 0 \Longleftrightarrow T \text{ est bijective}. \] On en déduit que le système linéaire $Ax = b$ admet une solution unique si et seulement si le rang de $A$ est égal à $n$. \end{frame} \end{document} With mathpazo With newtxmath Default
- Building table lines via conditionalby daleif on February 26, 2026 at 12:50 pm
For a book project we're experimenting with configuring glossary. In our case we'd like to use xltabular. But sometimes the term in the first column is a bit wide, in that case we'd like to use \multicolumn and typeset the description on the row below. The naïve approch of course does not work (MWE below). Since we're using this for glossary entrys we can only use a single macro. Anyone have a good approach on how to do this? I'm assuming it is down to what is "allowed" at the start of a table row. Edit, version 2: This at least gets around the incomplete \ifdim error. But if we use the \multicolumn line, we instead get a Misplaced \omit. \multispan ->\omit \@multispan l.31 \Foo{AAAAAAAAAAAAAAAAAA}{BBB} error. One can get around this by starting the entry by \tabularnewline, but then we have an extra blank linie, that we'd need to back track \documentclass[a4paper]{article} \usepackage{array,booktabs} \begin{document} \makeatletter % if #1 is too long, typeset it in \multicolumn, and move description % to next line \NewDocumentCommand\Foo{mm}{ \settowidth\@tempdima{#1} \ifdim\@tempdima> 0.2\textwidth\relax \FooLong{#1}{#2} \else \FooShort{#1}{#2} \fi } \NewDocumentCommand\FooLong{mm}{ % \multicolumn{2}{l}{#1} #1 \tabularnewline & #2 \tabularnewline } \NewDocumentCommand\FooShort{mm}{ #1 & #2 \tabularnewline } \makeatother \noindent \begin{tabular}{@{}l l@{}} \Foo{AAA}{BBB} \Foo{AAAAAAAAAAAAAAAAAA}{BBB} \end{tabular} \end{document} Version 1: \documentclass[a4paper]{article} \usepackage{xltabular} \begin{document} \makeatletter % if #1 is too long, typeset it in \multicolumn, and move description % to next line \NewDocumentCommand\Foo{mm}{ \settowidth\@tempdima{#1} \ifdim\@tempdima> 0.2\textwidth\relax \multicolumn{2}{l}{#1} \tabularnewline & #2 \tabularnewline \else #1 & #2 \tabularnewline \fi } \makeatother \noindent \begin{xltabular}{\textwidth}{@{}l X@{}} \Foo{AAA}{BBB} \Foo{AAAAAAAAAAAAAAAAAA}{BBB} \end{xltabular} \end{document}
- What's the best way to compile or view a really long latex expression?by uggupuggu on February 26, 2026 at 11:22 am
I have a latex expression that is 635k characters long. What is the most feasible way of viewing it in its entirety? I want to be able to scroll through the entire expression longitudinally. Online LaTeX viewers don't cut it, and the ones downloaded like Texstudio hang. Any python code I try to use to view it also hangs. The expression in question goes like this: X = ... where ... is a long nested radical expression that evaluates to a real number. (something like $3 = \sqrt{1+2\sqrt{1+3\sqrt{1+4...}$) Edit: It need not be viewed longitudinally, instead it can be viewed across multiple pages in a pdf.
- Alternative to allowframbreaks and framebreakby Dimitrios ANAGNOSTOU on February 26, 2026 at 11:20 am
I know that there is allowframebreaks and framebreak and I have read a manual (of beamer?) that suggests to avoid using them. Nevertheless, when preparing course notes sometimes I need to split to several slides of similar content. I am asking if it is possible to do automatically the numbering 1/n, 2/n, 3/, etc. As an example: \documentclass[10pt]{beamer} \usetheme{moloch} \usepackage{babel} \title{Algèbre linéaire} \author{DA} \date{} \begin{document} \maketitle \section{Introduction} %-------------------------------------- \begin{frame}{De la structure à la représentation (1/3)} \begin{block}{Objets essentiels} \begin{itemize} \item \ldots \end{itemize} \end{block} \end{frame} %-------------------------------------- \begin{frame}{De la structure à la représentation (2/3)} \begin{block}{Concepts clés} \begin{itemize} \item \ldots \end{itemize} \end{block} \end{frame} %-------------------------------------- \begin{frame}{De la structure à la représentation (3/3)} \begin{alertblock}{Idée centrale : diagonalisation} blabla \end{alertblock} \end{frame} \end{document}
- How to zoom in on an image? [duplicate]by Kong on February 26, 2026 at 10:15 am
How can I crop an image and then keep its aspect ratio automatically resized and keep its resolution the same as what it originally us ? Basically I want to like zoom in on an image. For example, I want to zoom in such that the A fills the top and bottom of the image. Here is a MWE but you dont have to stick to it. I dont know what I am doing at all. \documentclass[twocolumn]{article} \usepackage{graphicx} \usepackage{subcaption} % <-- correct package \usepackage{booktabs} \usepackage[colorlinks]{hyperref} \usepackage{nicematrix} \usepackage[export]{adjustbox} % <-- provides \adjincludegraphics and cropping+scaling tools [1](https://tex.stackexchange.com/questions/57418/crop-an-inserted-image)[2](https://ctan.org/pkg/adjustbox) \begin{document} % ---- Tight frame: no padding between border and content ---- \setlength{\fboxsep}{0pt} \setlength{\fboxrule}{0.4pt} % ---- Cell geometry (ONE truth for all subfigures) ---- \newlength{\cellw} \newlength{\cellh} \setlength{\cellw}{0.23\textwidth} \setlength{\cellh}{0.17\textwidth} % choose the height you want (tweak once, applies everywhere) % ---- Image cell: crop (trim+clip) THEN scale to EXACT cell size ---- % The key trick is using BOTH width and height; adjustbox handles the crop+resize pipeline. [1](https://tex.stackexchange.com/questions/57418/crop-an-inserted-image)[2](https://ctan.org/pkg/adjustbox) \newcommand{\imgcell}[2][]{% \fbox{% \adjincludegraphics[ width=\cellw, height=\cellh, keepaspectratio, clip, #1 ]{#2}% }% } % ---- Text cell: EXACT same outer size; text centered both ways ---- \newcommand{\textcell}[1]{% \fbox{% \parbox[c][\cellh][c]{\cellw}{% \centering\small #1% }% }% } \begin{figure*}[htbp] \centering % --- Row 1 --- \subfloat{% % trim order: left bottom right top (graphicx/adjustbox convention) [1](https://tex.stackexchange.com/questions/57418/crop-an-inserted-image) \imgcell{example-image-a}% }\hfill \subfloat{% \imgcell{example-image-a}% }\hfill \subfloat{% \imgcell{example-image-a}% }\hfill \subfloat{% \imgcell{example-image-a}% } \vspace{0cm} % --- Row 2 --- \subfloat[Text Box]{% \textcell{% This is your\\ custom text\\ for the\\ bottom-left cell.% }% }\hfill \subfloat[Caption 2b]{% \imgcell{example-image-a}% }\hfill \subfloat[Caption 2c]{% \imgcell{example-image-a}% }\hfill \subfloat[Caption 2d]{% \imgcell{example-image-a}% } \caption{Overall figure caption} \label{fig:grid} \end{figure*} \end{document} Here is an example of what happens when I zoom in by cropping. It fails. If the dimensions on paper is 1337x137, then after zooming in via cropping it must still be 1337x137. I dont know how else to say it other than i just want to zoom in on an image. EDIT: Crop certain percent from each side of the figure not the same because cropping a % from 1 side distorts the human in the figure above. I need to crop with correct set of numbers. Alternatively, is there a [zoom] function that I can use ?
- 'pdfsavepos' / 'ypos' of the last line of a pageby cis on February 26, 2026 at 6:44 am
I want to determine, save, and later use the pdfsavepos / ypos value of the last line of a page. \def\getposition#1{% \pdfsavepos\RecordProperties{#1}{xpos,ypos}} \newcommand\Ypos[1]{\RefProperty{#1}{ypos}}% To reach the last line, I could use \vfill, but this affects the following text. I created a scrlayer for this purpose. However, this not that good (e.g., Ypos(end) is now measured on every page, resulting in a LaTeX Warning: Label 'end' multiply defined.). Therefore, the question is: Is there an easier way to determine the pdfsavepos / ypos value of the last line? \documentclass{article} \usepackage[margin=7mm, paperheight=88mm, paperwidth=77mm, showframe=true, ]{geometry} \usepackage{xcolor} \usepackage{scrlayer-scrpage} %% Ypos{<pos>} - pdfsavepos ================== \def\getposition#1{% \pdfsavepos\RecordProperties{#1}{xpos,ypos}} \newcommand\Ypos[1]{\RefProperty{#1}{ypos}}% \DeclareNewLayer[ foreground, %hoffset=.0\paperwidth, voffset=0.5\textheight-1.0\baselineskip, contents={% \parbox[c][\layerheight][c]{\layerwidth}{% \centering\footnotesize \getposition{end}% \color{red}\rule[0.5ex]{0.5\textwidth}{0.4pt} Ypos(end)=\Ypos{end}% }}% ]{lastline} \AddLayersToPageStyle{scrheadings}{lastline} \begin{document} \section{Test} text text text \getposition{test} Ypos(test) = \Ypos{test}sp %\vfill x % moves resttesxt too 🙁 resttext resttext resttext \newpage \section{One Time Readout of Ypos(end) is enough!} \end{document}
- quotchap with LuaLaTeX and fontsetupby user20478285 on February 25, 2026 at 11:41 pm
How can I have the quotchap package use the utopia font (only for the chapter number) with lualatex and fontsetup, like it does when using pdflatex? \documentclass{book} \usepackage{ifluatex} \ifluatex \usepackage{fontsetup} \else \usepackage[utf8]{inputenc} \usepackage[T1]{fontenc} \usepackage{lmodern} \fi \usepackage[grey, utopia]{quotchap} \begin{document} \chapter{Foo} \end{document} Result with pdflatex: Result with lualatex:
- I am plotting a family of parabolas in TikZ, and there is a stray parabola. I'm confusedby Jasper on February 25, 2026 at 7:14 pm
I am plotting a family of parabolas in TikZ, and there is a stray parabola. I'm confused. \documentclass[tikz,border=1cm]{standalone} \begin{document} \begin{tikzpicture} \pgfmathsetmacro{\SIGMALstart}{-3} \pgfmathsetmacro{\SIGMALstop}{3} \pgfmathsetmacro{\SIGMALsamples}{50} \pgfmathsetmacro{\SIGMALstep}{(\SIGMALstop-\SIGMALstart)/(\SIGMALsamples-1)} \foreach \SIGMAL[parse=true] in {\SIGMALstart,\SIGMALstart+\SIGMALstep,...,\SIGMALstop} { \draw[ variable=\TAUL, domain=-3:3 ] plot ( {\SIGMAL*\TAUL}, {((\TAUL)^2-(\SIGMAL)^2)/2} ); } \end{tikzpicture} \end{document}
- enumerate with right-aligned labels, the widest is flush-left to left edge of text area without setting widest=by tsj on February 25, 2026 at 6:40 pm
I want the following simple layout with enumitem: Blah blah noindent I. Foo II. Bar blah blah long line paragraph wrapping continues here III. Baz Blah blah noindent non-enumerate text Labels are right aligned, \labelsep can be fixed (e.g. 0.5em), and text continues from the same horizonal position on the next line in the case of a longer paragraph (I think this means \itemsep should be zero). enumitem apparently has the capacity to calculate the width of the widest label and set \labelwidth accordingly, though I can't determine under what circumstances that happens after reading the documentation. I can set widest=<whatever> to achieve the output I want, but I'd like to know if I can achieve the same by setting one or more parameters to ! or *, i.e. computing the parameters automatically. MWE and output are below, basically I just want the widest label (maybe VI or III or IV) label to be left-aligned with the left edge of the VVVVV (the left edge of the text area), everything else the same. \documentclass{article} \usepackage{enumitem} \begin{document} \begin{enumerate}[label=\Roman*.,nosep,align=right, leftmargin=*, labelindent=0pt, labelsep=0.5em, itemsep=0pt, % widest=VI, % I don't want to use this! ] \item Alpha. \item Lorem ipsum dolor sit amet, consectetuer adipiscing elit. Etiam lobortis facilisis sem. Nullam nec mi et neque pharetra sollicitudin. \item Gamma \item Delta \item Epsilon \item Zeta \end{enumerate} VVVVV \end{document}
- Retrieve the value of a variable earlier in the documentby Subhajit Paul on February 25, 2026 at 5:54 pm
I am preparing the schedule for a conference and using a time counter controlled by the macro \Next. By default, \Next advances the time by 15 minutes, but it can also accept an optional argument to specify a different increment. The definition of \Next is not perfect; a full discussion appears in this question. However, for convenience, I am using the version shown below. My preamble is: \documentclass{article} \usepackage{calc} \def\kntime{45} \def\pttime{35} \def\qatime{5} \def\kntottime{\kntime+\qatime} \def\pttottime{\pttime+\qatime} % % \newcounter{hour} \newcounter{minute} \newcounter{flag} \newcommand{\Time}[2]{% \setcounter{flag}{0}% \setcounter{hour}{#1}% \setcounter{minute}{#2}% } \newcommand*{\Next}[1][15]{% \addtocounter{minute}{#1}% \ifnum\value{minute}>59% \stepcounter{hour}% \addtocounter{minute}{-60}% \fi% \ifnum\value{hour}>11% \stepcounter{flag}% \ifnum\value{hour}>12 \addtocounter{hour}{-12}% \fi \fi% % \ifnum\value{hour}<10 0\fi% \thehour% :% \ifnum\value{minute}<10 0\fi\theminute% \ifnum\value{flag}<1\ am\fi% \ifnum\value{flag}>0\ pm\fi% } % \newcounter{tsession} \renewcommand{\thetsession}{\Roman{tsession}} \newcommand{\tsession}{% \stepcounter{tsession}% Technical Session -- \thetsession% } I would like to display the total runtime of each session in the table header (masthead). Specifically, I want a macro \endtsession{\thetsession} that can be used as follows: \begin{document} \Time{8}{10} \begin{tabular}{ll} \multicolumn{2}{c}{\tsession: \Next[0] -- \value{\endsession{\thetsession}}}\\\hline \Next[\kntime] & Keynote Speaker\\ \Next[\qatime] & Q\&A\\ \Next[\pttime] & Plenary Speaker\\ \Next[\qatime] & Q\&A\\ \Next[0] & Speaker 1\\ \Next\endsession{\thetsession} & Speaker 2 \end{tabular} \end{document} The macro \endtsession should return the final time of the session in the same format produced by \Next. Any assistance would be appreciated.
- How to write at an angle along a straight lineby rpapa on February 24, 2026 at 8:33 pm
Using "sloped" I know how to write text parallel to a line, but how do I make the text also at an angle in the second case? \documentclass{article} \usepackage{tikz} \usetikzlibrary{positioning,matrix,calc} \begin{document} \begin{tikzpicture} \draw [red,ultra thick] (0,0)coordinate(A1)-- (3,5)coordinate(A2); \path (A1) -- (A2) node[sloped,pos=0.3,draw,fill=white]{aa}; \draw [blue,ultra thick] (1,0)coordinate(A3)-- (4,5)coordinate(A4); \foreach \i in {1,...,5} \node [sloped,draw,fill=white] at ($(A3)!{\i*10mm}!(A4)$) {\i}; \end{tikzpicture} \end{document} To be clear, the nodes must have a set distance between them. I am proposing my solution, adapted from your responses. \documentclass{article} \usepackage{tikz} \usetikzlibrary{positioning,matrix,calc} \begin{document} \begin{tikzpicture} \draw [red,ultra thick] (0,0)coordinate(A1)-- (3,5)coordinate(A2); \path (A1) -- (A2) node[sloped,pos=0.3,draw,fill=white]{aa}; \draw [blue,ultra thick] (1,0)coordinate(A3)-- (4,5)coordinate(A4); \foreach \i in {1,...,5} \node [sloped,draw,fill=white] at ($(A3)!{\i*10mm}!(A4)$) {\i}; \draw [blue,ultra thick] (2,0)coordinate(A3)-- (5,5)coordinate(A4); \pgfmathanglebetweenpoints{\pgfpointanchor{A3}{center}}{\pgfpointanchor{A4}{center}} \edef\angleAB{\pgfmathresult} \foreach \i in {1,...,5} \node [rotate=\angleAB,draw,fill=blue,minimum height=2mm,minimum width=8mm,text=yellow] at ($(A3)!{\i*10mm-10mm}!(A4)$) {\i}; \newcommand{\tracepark}[4]{ \draw (#1) -- (#2); \pgfmathanglebetweenpoints{\pgfpointanchor{#1}{center}}{\pgfpointanchor{#2}{center}} \edef\angleAB{\pgfmathresult} \foreach \i in {#3,...,#4} \node [rotate=\angleAB,draw,fill=blue,minimum height=2mm,minimum width=8mm,text=yellow] at ($(#1)!{\i*10mm-#3*10mm}!(#2)$) {\i}; } \coordinate(A5) at (-3,4); \coordinate(A6) at (3,-8); \tracepark{A5}{A6}{5}{10} \end{tikzpicture} \end{document}
- Formatting a sequence of items with comma and ending with 'and' or 'respectively'by mf67 on February 23, 2026 at 10:02 pm
Can someone help me create a macro like \MyList{A;B;C;D;E;F} which returns “A, B, C, D, E[,] respectively F" independently on how many ”arguments” (2+) that are specified and also support math, e.g. \MyList{\(A\);\(B\);\(C\);\(D\);\(E\);\(F\)} ? (I used the [,] notation since I’m not sure if the Oxford comma is used today.) If the number of arguments is two; \MyList{A;B} I would like it to return “A respectively B”. Edit: I tried using sinuitx but it might not be suitable for this task as it mainly(?) handles numbers. Here is a test \documentclass{article} \usepackage{siunitx} \begin{document} \numlist[parse-numbers=false]{A;2;3} \numlist[parse-numbers=false]{\text{A};2;3} \numlist[parse-numbers=false]{\(A+B\);2;3} \end{document} but it gives an error on the last line and I would like to have ”roman letters” if no ”math mode” is used, and avoid using \text{}.
- tabular: add lines until the end of the text body is reachedby cis on February 23, 2026 at 12:56 pm
Can I configure this loop, or a similar loop, to add rows until the end of the text body is reached? A small gap at the end will probably be unavoidable. Could this be achieved with \pdfpos? \documentclass[a5paper]{article} \usepackage[margin=14mm, showframe=true, paperheight=126mm, ]{geometry} \newcounter{mycount} \setcounter{mycount}{0} \def\mylines{}% \loop\ifnum\themycount<7% \addtocounter{mycount}{1} \expandafter\def\expandafter\mylines\expandafter{% \mylines & & \themycount \\ }% \repeat% \begin{document} \section{Table} \begin{tabular}{| c c | c|} \hline \multicolumn{3}{|c|}{Something} \\ \hline A & B & (My Head) \\ \hline a & b & n\\ a & b & n\\ a & b & n\\ \mylines \hline A & B & (My Foot)\\ \hline \end{tabular} \end{document}