• background color of 2 columns
    by JamesDoe on December 30, 2025 at 6:42 am

    How can I split my document in two (using paracol I think), such that the left part of the document occupies 30% of the page, and the right part occupies 70%, and set the background color of the left part to gray ? The whole left part needs to be gray, whether there is text or not, and with no margin. There is a header on top that is not part of this two column layout, which is set using tikz. My current text, for reference : \documentclass{article} \usepackage{expkv-cs} \usepackage{fontawesome} \usepackage[T1]{fontenc} % required ? \usepackage[margin=1cm, a4paper]{geometry} % required ? \usepackage[utf8]{inputenc} % required ? \usepackage{tikz} \usepackage{paracol} \usepackage{xcolor} \usepackage{lipsum} \setlength{\parindent}{0cm} % required ? \ekvcSplit\header { textColor={}, backgroundColor={}, firstName={}, lastName={}, occupation={}, leftContent={}, rightContent={} } { \tikz[remember picture, overlay, every node/.style={text=#1}] { \node[rectangle, fill=#2, anchor=north, minimum width=\paperwidth, minimum height=3cm](header) at (current page.north){}; \node[anchor=center](name) at (header.center) {\Huge #3 \bfseries\MakeUppercase{#4}}; \node[below](occupation) at (name.south) {#5}; \node[align=left, anchor=west](leftContent) at (header.west) [xshift=0.5cm] {#6}; \node[align=left, anchor=east](rightContent) at (header.east) [xshift=-0.5cm] {#7}; } } \begin{document} \header{ textColor={white}, backgroundColor={darkgray}, firstName={Jack}, lastName={Sparrow}, occupation={Pirate}, leftContent={ \faGlobe\; English\\ \faBirthdayCake\; 1690\\ \faCar\; Licence }, rightContent={ \faEnvelope\; jack@sparrow.com\\ \faPhone\; 333 5647380\\ \faMapMarker\; On a ship } } \vspace{5cm} % how to set to header size ? \begin{paracol}{2} \lipsum[1] \switchcolumn \lipsum[1] \end{paracol} \end{document}

  • How to reproduce `listings` style features (right-side numbers, stepnumber) in `piton`?
    by d7ek on December 30, 2025 at 5:21 am

    In the listings package, \lstset{numbers=right,stepnumber=3,numberfirstline} gives right-aligned line numbers and numbering every third line. I would like to achieve the same behavior using the piton package instead of listings, but I can’t find equivalent options in the documentation. \documentclass{article} \usepackage{piton,xcolor} \PitonOptions{line-numbers,} %\usepackage{listings} %\lstset{ % numbers=right, % stepnumber=3, % numberfirstline %} \begin{document} %\begin{lstlisting}%[firstnumber=2] \begin{Piton} print("Hello world") x = 1 + 1 print(x) x = 1 + 2 print(x) x = 2 + 2 print(x) \end{Piton} %\end{lstlisting} \end{document}

  • Is it possible to create a circular document?
    by Brendan Langfield on December 30, 2025 at 3:11 am

    I recently learned that it's possible to set fully custom page dimensions using geometry. However as far as I can tell, you can only do rectangular document shapes. Is it possible to use the geometry package or some other method to make the document itself circular?

  • True-false with `enumext` package
    by Sebastiano on December 29, 2025 at 10:39 pm

    I know very little about the enumext package. My intention is customize block true-false where I can choose the number of columns and create a structure similar to this one. I currently use two macros \newcommand{\truefalse}{\hfill\framebox[1.25em][c]{V}\quad\framebox[1.25em][c]{F}} \newcommand{\squarecap}[1]{\fbox{\makebox[\height]{#1}}} outside the enumext package with enumitem. Here a MWE: \documentclass[a4paper,12pt]{article} \usepackage{mathtools,amssymb} \usepackage{enumext} \usepackage{enumitem} \newcommand{\truefalse}{\hfill\framebox[1.25em][c]{V}\quad\framebox[1.25em][c]{F}} \newcommand{\squarecap}[1]{\fbox{\makebox[\height]{#1}}} \begin{document} \begin{enumext}[label=\textbf{Domanda} \arabic*.,wrap-label=\textbf{#1},list-indent=0pt, save-ans=test] \item My coat is \begin{keyans*}[columns=2,label=\Alph*,wrap-label=\squarecap{#1},labelwidth=1.5em] \item blue. \item green. \item lemon. \item magenta. \end{keyans*} \end{enumext} \textbf{Vero o falso?} \begin{enumerate} \item Se $f(x)=x^2-1$ allora $f(0)=0$\truefalse; \item La funzione $y=3x-2$ passa per l'origine degli assi cartesiani \truefalse; \item $|x+2|+|x-2|=0$ non ha soluzioni\truefalse; \item $2|x-1|<0$ per ogni $x\in\mathbb{R}$, $x\neq 1$\truefalse. \end{enumerate} \end{document}

  • How can I place a mercator map on an overlay tikzpicture?
    by TobiBS on December 29, 2025 at 9:54 pm

    I want to precisely place a mercatormap on my page and hence use the remember picture,overlay options. But I find no way to e.g. put the top left corner of my map to the center of the page. Here is my MWE: \def\mrcpkgprefix{} \documentclass{scrartcl} \usepackage{mercatormap} \begin{document} \begin{tikzpicture}[remember picture, overlay] \node at (current page.center) {E.g. left Corner of the map here?}; \mrcdefinemap{west=9.1,east=9.45,south=48.7,north=48.95,tile size=1cm,zoom=14} \path[draw,fill=green!10] (mrcmap.south west) rectangle (mrcmap.north east); \mrcdrawnetwork \coordinate (Stuttgart) at (mrcq cs:48.775556:9.182778); \node at (Stuttgart) {Stuttgart}; \end{tikzpicture} \end{document} Any idea which option or trick can help to do what I want to achieve?

  • tex4ebook and package adforn do not communicate with each other and give an error
    by Thomkrates on December 29, 2025 at 7:30 pm

    I would like to use the package adforn for decorative purposes. But with tex4ebook I get an error message. Here is a MWE: \documentclass{article} \usepackage{tex4ebook} % for LuaLaTeX font setting \usepackage{unicode-math} \usepackage{ebgaramond} \setmathfont{Garamond-Math} \usepackage{fontspec} \usepackage{adforn} \begin{document} The package adforn with \scalebox{2}[2]{\adfflatleafoutlineright} gives an error when compling with tex4ebook \end{document} The error message is tex4ht warning: package fontspec was prevented from loading ) (c:/texlive/2025/texmf-dist/tex/latex/adforn/adforn.sty (c:/texlive/2025/texmf-dist/tex/latex/svn-prov/svn-prov.sty) ! LaTeX Error: Missing \begin{document}. See the LaTeX manual or LaTeX Companion for explanation. Type H <return> for immediate help. ... l.318 } The package fontspec I need for other purposes. Is there a possibility to adjust tex4ebook to the package adforn?

  • How to adjust spacing for flalign* environment
    by Artic on December 29, 2025 at 6:00 pm

    The code \begin{flalign*} x^2-3x+2&>0&&\\ (x-1)(x-2)&>0&& \end{flalign*} \begin{flalign*} &x-1=0 & x-2=0&&\\ &x_1=1 & x_2=2&& \end{flalign*} resulting as in the image. How can I adjust the spacing in areas 1 and 2 as in the image?

  • Using LuaTex for IPA characters of phonetic alphabet gives unusual and incorrect results
    by Thomkrates on December 29, 2025 at 5:06 pm

    I have translated two words of a German name with two special phonetic translators and get phonetic characters that do not show correctly with LuaTeX. And additionally I would need the correct setting also in the epub with tex4ebook. Here is the MWE: \documentclass{article} \usepackage{tex4ebook} % LuaLaTeX \usepackage{unicode-math} \usepackage{ebgaramond} \setmathfont{Garamond-Math} \usepackage{fontspec} \begin{document} [ɛˈk ɔ̃ˈsɑ̃ː] \end{document} See the image below for the result out of LuaTeX: The next image is the correct displaying in the epub with tex4ebook: EDIT 1: When using \usepackage{newunicodechar} and the lines: \newunicodechar{ɑ̃}{\textasciitilde{ɑ}} \newunicodechar{ɔ̃}{\textasciitilde{ɔ}} or the lines \newunicodechar{ɑ̃}{\~{ɑ}} \newunicodechar{ɔ̃}{\~{ɔ}} I get the following error message: ! Package newunicodechar Error: Invalid argument. See the newunicodechar package documentation for explanation. Type H <return> for immediate help. ... l.22 \newunicodechar{ɑ̃}{\textasciitilde{ɑ}} The first argument to \newunicodechar is either too long or an invalid sequence of bytes Invalid sequence of bytes?

  • How to make gibberish text in METAFONT [closed]
    by Grzegorz Brzczyszczykiewicz on December 29, 2025 at 5:06 pm

    I want to make a meaningless gibberish character in METAFONT that I will use in gibberish text, and does not mean anything. The character should resemble a vertical line that is thick at the top and thin at the bottom, and smoothly transitions thick to thin. The ends of the stroke should be rounded. It should be mapped to the "A" glyph slot in the font. It should be made with a single pen stroke, not faked by overlapping different strokes.

  • testing a token's status, if active or not
    by Frigeri on December 29, 2025 at 4:10 pm

    In expl one can test if a token is active or not (just using \token_if_active:) well, I wanted to test if a given token was already active before making it active with my own definition (to, perhaps, reduce the odds of a conflict with others packages). But I ran into the following problem: \documentclass{article} \ExplSyntaxOn \tl_const:Nn \c__pack_exc_tl {!} \cs_new:Npn \pack_test_activ: { \token_if_active:NTF ! {\par \c__pack_exc_tl{}~is~activ\par} {\par \c__pack_exc_tl{}~isn't~activ\par} } \begin{document} as~expected: \token_if_active:NTF ! {\par \c__pack_exc_tl{}~is~activ\par} {\par \c__pack_exc_tl{}~isn't~activ\par} \char_set_catcode_active:N ! still~ok: \cs_set:Npn ! {Hi,} \token_if_active:NTF ! {\par \c__pack_exc_tl{}~is~activ\par} {\par \c__pack_exc_tl{}~isn't~activ\par} but: \pack_test_activ: \end{document} \ExplSyntaxOff I mean, there is a way to make the test in \pack_test_activ in which I can test the current status of the toke ! (better said, at execution time, and not with its value at definition time? EDIT Of course, rescan: \documentclass{article} \ExplSyntaxOn \tl_const:Nn \c__pack_exc_tl {!} \cs_new:Npn \pack_test_activ: { \tl_set_rescan:Nnn \l__pack_tmp_tl {} {!} \exp_args:NV \token_if_active:NTF \l__pack_tmp_tl {\par \c__pack_exc_tl{}~is~activ\par} {\par \c__pack_exc_tl{}~isn't~activ\par} } \begin{document} as~expected: \token_if_active:NTF ! {\par \c__pack_exc_tl{}~is~activ\par} {\par \c__pack_exc_tl{}~isn't~activ\par} \char_set_catcode_active:N ! still~ok: \cs_set:Npn ! {Hi,} \token_if_active:NTF ! {\par \c__pack_exc_tl{}~is~activ\par} {\par \c__pack_exc_tl{}~isn't~activ\par} (now ok:) \pack_test_activ: \end{document} \ExplSyntaxOff There is another way, or this is it?

  • Use some characters from the text font instead of the corresponding ones from mtpro2
    by ncant on December 29, 2025 at 2:10 pm

    I'm typesetting my math document in Times New Roman using XeLaTeX and the fontspec package. I'm using mtpro2 as the math font, but I've noticed that certain letters, such as u, v and w, look quite different from their TNR italic counterparts (maybe because it's advertised as a Times-compatible font). Considering I'm already using the fontspec package, I tried ditching mtpro2 entirely and using other math fonts. I consulted the LaTeX Stack Exchange master list of maths fonts and tried XITS Math, TeX Gyre Termes Math and STIX Two Math. However, these fonts lack some features that I really like about mtpro2, such as round brackets (especially for matrices) and the letter z identical to the letter z in TNR. mtpro2 is here to stay. Next, I found the 'mathastext' package, which enables alphanumeric glyphs from the text font to be used in maths environments. For example, \usepackage[basic, italic]{mathastext} replaces all the alphanumeric characters in the maths font with the corresponding characters in the text font. However, this approach led me to another issue: the spacing between letters is awful, especially the subscripted ones. Since my only issue is with the letters u, v, and w, is there a way to just replace those three and use the rest of the mtpro2 glyphs? The code I'm using for my document is really bog standard: \documentclass{memoir} % Throw an error if this is not XeLaTeX. \usepackage{ifxetex} \RequireXeTeX \usepackage[lite]{mtpro2} \usepackage[no-math]{fontspec} \setmainfont{Times New Roman} \begin{document} \end{document} Any help would be appreciated.

  • Multiple footnotes in a figure caption with hyperref in LaTeX
    by taiwan12 on December 29, 2025 at 12:53 pm

    Multiple Footnotes in the same caption/figure/table/equation with hyperref I have a problem with it, when I remove the \begin{table}[htb]...\end{table}, the footnote disappear \documentclass[12pt]{report} % solution-related packages \usepackage{hyperref,tablefootnote,footnotehyper} \hypersetup{colorlinks} % formatting stuff \renewcommand{\baselinestretch}{1.24} \usepackage{amsmath,booktabs,mwe,pdflscape} \begin{document} \begin{figure}[htb] \centering \includegraphics[width=0.3\textwidth]{example-image} \caption[123]{Figure caption with notes: A\tablefootnote{\label{fig-note}figure note labeled} X\tablefootnote{figure note a} Y\tablefootnote{figure note b}} \end{figure} \begin{table}[htb] \centering \caption[123]{Table caption with notes: A\tablefootnote{\label{tab-note}table note labeled} X\tablefootnote{table note a} Y\tablefootnote{table note b}} \begin{tabular}{cccccc}\toprule A & B & C & D & E & E \\\midrule 1 & 1 & 2 & 3 & 5 & 8 \\\bottomrule \end{tabular} \end{table} \end{document} \documentclass[12pt]{report} % solution-related packages \usepackage{hyperref,tablefootnote,footnotehyper} \hypersetup{colorlinks} % formatting stuff \renewcommand{\baselinestretch}{1.24} \usepackage{amsmath,booktabs,mwe,pdflscape} \begin{document} \begin{figure}[htb] \centering \includegraphics[width=0.3\textwidth]{example-image} \caption[123]{Figure caption with notes: A\tablefootnote{\label{fig-note}figure note labeled} X\tablefootnote{figure note a} Y\tablefootnote{figure note b}} \end{figure} \end{document} Update Here the hyperref in the caption is not working properly, it is directs me to the wrong place. \documentclass[12pt]{report} \usepackage{graphicx} \usepackage{float} \usepackage{hyperref} \hypersetup{colorlinks} \usepackage{lipsum} \begin{document} Some text \footnote{footnote I} Some text \footnote{footnote II} \lipsum[1] \begin{figure}[H] \centering \includegraphics[scale=0.3]{example-image} \caption[AAA, BBB, CCC]{AAA\protect\footnotemark, BBB\protect\footnotemark, CCC\protect\footnotemark} \label{fig:A} \end{figure} \footnotetext{figure caption footnote I} \footnotetext{figure caption footnote II} \footnotetext{figure caption footnote III} Some text \footnote{footnote III} Some text \footnote{footnote IV} \begin{figure}[H] \centering \includegraphics[scale=0.3]{example-image} \caption[DDD,EEE]{DDD\protect\footnotemark, EEE\protect\footnotemark} \label{fig:B} \end{figure} \footnotetext{figure caption footnote IV} \footnotetext{figure caption footnote V} \footnotetext{figure caption footnote VI} \lipsum[1] \end{document}

  • circuitikz: European Amplifier (en amp) without pins or with absolut valued pin length
    by cis on December 29, 2025 at 12:10 pm

    I want to create an en amp with a pin length of 0 - alternatively: a pin length with a clearly defined value, for example 5mm. I tried to transfer the "trick" \ctikzset{tripoles/en amp/port width=1, tripoles/en amp/width=1.19, % = 1.7*0.7 } from 4.20.2.2 "Input and output pins symbols"; but this only works with op amp. What do I have to do? \documentclass[margin=5pt, multi=circuitikz]{standalone} \usepackage{circuitikz} \begin{document} \begin{circuitikz}[] \ctikzset{tripoles/en amp/port width=1, tripoles/en amp/width=1.19, % = 1.7*0.7 } \node[en amp, en amp text={No pins}, label={[yshift=-12mm]below:works not} ] (A){please!}; %% --> Trick from 4.20.2.2 "Input and output pins symbols" \ctikzset{tripoles/op amp/port width=1, tripoles/op amp/width=1.19, % 1.7*0.7 } \draw (3,0) node[op amp, color=blue, label={[yshift=-12mm]below:works} ]{}; \end{circuitikz} \end{document}

  • Pythonimmediate and updates: newcommand cannot be imported
    by Damien Gredat on December 29, 2025 at 12:05 pm

    I am working with pythonimmediate under MiKTeX (with the --naive-flush option), but I had to update, for other purposes, my entire Anaconda/Python distribution. I have thus obtained a more recent version of Python and installed, via pip, packages related to pythonimmediate. I am now facing the following error: from pythonimmediate import newcommand, renewcommand, peek_next_char, get_next_char, get_arg_str, get_verb_arg ImportError: cannot import name 'newcommand' from 'pythonimmediate' (C:\Users\damie\anaconda3\Lib\site-packages\pythonimmediate_init_.py) I don't know how to fix this problem. It seems that the "simple" module is not being imported. I have updated the pythonimmediate LaTeX package, but the problem persists. Do you have any idea what is happening?

  • tex4ebook - Special character does not show correct in ebook
    by Thomkrates on December 29, 2025 at 10:44 am

    The following special charakter z with dot under the character does not show correct in epub: MWE: \documentclass{article} \usepackage{tex4ebook} \begin{document} Hafis (\d{H}\={a}fe\d{z}) (um 1320 -- 1388) \end{document} See the picture of display in the epub below:

  • an error with using a variable defined by pgfmathsetmacro in "let...in..."
    by Khánh Bùi on December 29, 2025 at 10:30 am

    An error occurs when I try to create the point C1. How can I fix this? \documentclass[12pt,a4paper]{book} \usepackage[left=1cm, right=1cm, top=2cm, bottom=2cm]{geometry} \usepackage{mathtools, amssymb, amsthm, amsmath} \usepackage{tikz} \usetikzlibrary{intersections,calc} \begin{document} \begin{tikzpicture} \path (2,5) coordinate (B) (4,0) coordinate (C) ($(B)!1/3!(C)$) coordinate (L) ; % CALCULATE BL and CL and assign them to \bl and \cl respectively \path let \p1 = (B), \p2 = (C), \p3 = (L), \n1 = {veclen(\x1-\x3,\y1-\y3)}, \n2 = {veclen(\x2-\x3,\y2-\y3)} in \pgfextra{ \pgfmathsetmacro{\bl}{\n1} \pgfmathsetmacro{\cl}{\n2} } ; \path ($(C) + (30:\cl)$) coordinate (C1) ; \draw[fill=red] (C1) circle (2pt); \end{tikzpicture} \end{document} after compiling, it said : test.tex: error: 32: Undefined control sequence. ($(C) + (30:\cl) test.tex: error: 32: Missing number, treated as zero. ($(C) + (30:\cl) test.tex: error: 32: Undefined control sequence. ($(C) + (30:\cl) test.tex: error: 32: Argument of \pgfmath@@onquick has an extra }. ($(C) + (30:\cl) test.tex: error: 32: Paragraph ended before \pgfmath@@onquick was complete. ($(C) + (30:\cl)

  • How to get a vertically centered horizontal line within text, like a custom emdash?
    by Gary on December 29, 2025 at 4:45 am

    I'm very likely overlooking the obvious, of course, and was hesitant to ask such a basic question; but would you please direct me to a command(s) that can generate a horizontal line, as in this hackish example. Previously I used \rule[0.5ex]{10pt}{0.8pt} in LaTeX; but couldn't get that to work in ConTeXt. I've been through many of the rule and bar commands in ConTeXt but cannot locate something like this. All I've managed thus far is to add a thick overstrike on top of some emdashes. If a reason why is important, I'm trying to match some old texts that use longer and thicker lines (relative to emdash) in outline headings. Thank you. \setupbar[overstrikes][color=blue,rulethickness=2pt,continue=yes,unit=pt,offset=4] \define[1]\HBar { \overstrikes{--- --- ---} } \starttext This is a hacked \HBar{} blue line, sort of centered vertically. \stoptext

  • Footnote overlaps last line when the next page starts with a theorem under certain conditions
    by Utkan Gezer on December 29, 2025 at 4:34 am

    For some reason, if the next page begins with a theorem and thmtools (with amsthm) is used or the theorem has a label that is given right at the beginning of the theorem the space between the footnote and the last line on this page gets smaller (and even negative) with increasing \parskip. This continues, until the \parskip gets too large, in which case the space just becomes normal. When \baselinestretch (or \setstretch) is used, the effects get so accentuated that the footnote starts to overlap the page contents. Adding 12pt option to \documentclass also seems to increase the allowance on how much \parskip can be increased, which further worsens the situation. Here is an example: \documentclass{article} \usepackage{lipsum} \usepackage{amsthm} \usepackage{setspace} % \renewcommand{\baselinestretch}{1.5} \setstretch{1.5} \setlength{\parskip}{21pt} \newtheorem{theorem}{Theorem} \begin{document} \lipsum[1] \lipsum[1]\footnote{\lipsum[1][1]} \lipsum[1][1-10] \begin{theorem}\label{thm:A} \lipsum[1][1-4] \end{theorem} \end{document} Putting the \label to the end of theorem is not a great workaround, since that, for some reason, adds extra space after the theorem if the contents of the theorem is only a display math (which is the situation in my case). See MWE: \documentclass{article} \usepackage{lipsum} \usepackage{amsthm} \usepackage{setspace} % \renewcommand{\baselinestretch}{1.5} \setstretch{1.5} \setlength{\parskip}{21pt} \newtheorem{theorem}{Theorem} \begin{document} \lipsum[1] \lipsum[1]\footnote{\lipsum[1][1]} \lipsum[1][1-10] \begin{theorem} $$TEST$$ \label{thm:A} % Move this line above the display math and the huge space below shrinks \end{theorem} \lipsum[1] \end{document} Adding a non-breaking space (~) in front of the \label fixes the issue. I can do away with this workaround, but my question is: Why is the overlap happening? How can the overlap be fixed properly (with something in the preamble)?

  • Unexpected conflict between `polyglossia` and `ctex`-bundles?
    by Explorer on December 29, 2025 at 2:21 am

    This question is the successor of this, which I mentioned: However, polyglossia is a little bit conflict with ctex(That maybe my another question or issues). In the first example, without polyglossia: \documentclass[fontset=fandol,openany]{ctexbook} \usepackage[paperheight=13cm]{geometry} \ctexset{ chapter/name={第,章}, section/name={第,节} } \begin{document} \tableofcontents \chapter{开始123} \section{测试456} \chapter{开始123} \section{测试456} \end{document} However, for the second case: \documentclass[fontset=fandol,openany]{ctexbook} \usepackage[paperheight=13cm]{geometry} \usepackage{polyglossia}%<- % \setmainlanguage{chinese} \ctexset{ chapter/name={第,章}, section/name={第,节} } \begin{document} % \renewcommand{\contentsname}{目录} \tableofcontents \chapter{开始123} \section{测试456} \chapter{开始123} \section{测试456} \end{document} Noted that ctex-kit is nearly the most CJK-friendly package, which consider: linespread indentfirst character kerning ... I don't want the polyglossia package, which is used for more languages support, to change the default behaviour of ctex. It could be fixed by \renewcommand{\contentsname}{目录}, but I was not sure how many ctex's config is changed by polyglossia unexpectedly, and may be I need much more than just: \renewcommand{\baselinestretch}{1.3} \renewcommand{\contentsname}{目录} \renewcommand{\figurename}{图} \renewcommand{\tablename}{表} \renewcommand{\partname}{\color{structurecolor}} \renewcommand{\thepart}{第\zhnumber{\arabic{part}}部分} \renewcommand{\listfigurename}{插图目录} \renewcommand{\listtablename}{表格目录} \renewcommand{\bibname}{参考文献} \renewcommand{\appendixname}{附录} \renewcommand{\appendixtocname}{附录} \renewcommand{\indexname}{索\hspace{2em}引} Is that possible to ease the strange conflict between polyglossia and ctex package elegantly? (BTW, babel looks good with ctex😊) Edited: Since cabohah has pointed out a quite similar case at here. With \let\chinese\relax, it really solve the name conflict, but the \chapter control by \ctexset still behave incorrect. See the following example: \documentclass[fontset=fandol,openany]{ctexbook} \usepackage[paperheight=12cm]{geometry} \ctexset{ chapter/name={第,章}, section/name={第,节} } \usepackage{polyglossia} \let\chinese\relax \setdefaultlanguage{chinese} \setmainfont{FandolSong} \begin{document} \tableofcontents \chapter{开始123} \section{测试456} \chapter{开始123} \section{测试456} \end{document} With the snippet of the terminal output: This is LuaHBTeX, Version 1.22.0 (TeX Live 2025) restricted system commands enabled. (./mwee.tex LaTeX2e <2025-11-01> L3 programming layer <2025-11-14> (c:/texlive/2025/texmf-dist/tex/latex/ctex/ctexbook.cls (c:/texlive/2025/texmf-dist/tex/latex/ctex/config/ctexbackend.cfg) (c:/texlive/2025/texmf-dist/tex/latex/l3kernel/expl3.sty (c:/texlive/2025/texmf-dist/tex/latex/l3backend/l3backend-luatex.def)) Document Class: ctexbook 2022/07/14 v2.5.10 Chinese adapter for class book (CTE X) (c:/texlive/2025/texmf-dist/tex/latex/ctex/ctexhook.sty) (c:/texlive/2025/texmf-dist/tex/latex/ctex/ctexpatch.sty) (c:/texlive/2025/texmf-dist/tex/latex/base/fix-cm.sty (c:/texlive/2025/texmf-dist/tex/latex/base/ts1enc.def)) (c:/texlive/2025/texmf-dist/tex/latex/ctex/config/ctexopts.cfg) (c:/texlive/2025/texmf-dist/tex/latex/base/book.cls Document Class: book 2025/01/22 v1.4n Standard LaTeX document class (c:/texlive/2025/texmf-dist/tex/latex/base/bk10.clo)) (c:/texlive/2025/texmf-dist/tex/latex/ctex/engine/ctex-engine-luatex.def (c:/texlive/2025/texmf-dist/tex/luatex/luatexja/luatexja.sty (c:/texlive/2025/texmf-dist/tex/luatex/luatexja/luatexja-core.sty (c:/texlive/2025/texmf-dist/tex/generic/infwarerr/infwarerr.sty) (c:/texlive/2025/texmf-dist/tex/luatex/luatexbase/luatexbase.sty (c:/texlive/2025/texmf-dist/tex/luatex/ctablestack/ctablestack.sty)) (c:/texlive/2025/texmf-dist/tex/generic/ltxcmds/ltxcmds.sty) (c:/texlive/2025/texmf-dist/tex/generic/pdftexcmds/pdftexcmds.sty (c:/texlive/2025/texmf-dist/tex/generic/iftex/iftex.sty)) (c:/texlive/2025/texmf-dist/tex/latex/xkeyval/xkeyval.sty (c:/texlive/2025/texmf-dist/tex/generic/xkeyval/xkeyval.tex (c:/texlive/2025/texmf-dist/tex/generic/xkeyval/xkvutils.tex (c:/texlive/2025/texmf-dist/tex/generic/xkeyval/keyval.tex)))) (c:/texlive/2025/texmf-dist/tex/latex/etoolbox/etoolbox.sty) (c:/texlive/2025/texmf-dist/tex/latex/everyhook/everyhook.sty (c:/texlive/2025/texmf-dist/tex/latex/svn-prov/svn-prov.sty)) (c:/texlive/2025/texmf-dist/tex/luatex/luatexja/ltj-base.sty)) (c:/texlive/2025/texmf-dist/tex/luatex/luatexja/luatexja-compat.sty)) (c:/texlive/2025/texmf-dist/tex/latex/fontspec/fontspec.sty (c:/texlive/2025/texmf-dist/tex/latex/l3packages/xparse/xparse.sty) (c:/texlive/2025/texmf-dist/tex/latex/fontspec/fontspec-luatex.sty (c:/texlive/2025/texmf-dist/tex/latex/base/fontenc.sty) (c:/texlive/2025/texmf-dist/tex/latex/fontspec/fontspec.cfg))) (c:/texlive/2025/texmf-dist/tex/latex/base/tuenc.def) (c:/texlive/2025/texmf-dist/tex/luatex/chinese-jfm/jfm-zh_CN.lua)) (c:/texlive/2025/texmf-dist/tex/latex/zhnumber/zhnumber.sty (c:/texlive/2025/texmf-dist/tex/latex/zhnumber/zhnumber-utf8.cfg)) (c:/texlive/2025/texmf-dist/tex/latex/ctex/scheme/ctex-scheme-chinese-book.def (c:/texlive/2025/texmf-dist/tex/latex/ctex/config/ctex-name-utf8.cfg)) (c:/texlive/2025/texmf-dist/tex/latex/ctex/ctex-c5size.clo) (c:/texlive/2025/texmf-dist/tex/latex/ctex/fontset/ctex-fontset-fandol.def)) (c:/texlive/2025/texmf-dist/tex/latex/ctex/config/ctex.cfg) (c:/texlive/2025/texmf-dist/tex/latex/geometry/geometry.sty (c:/texlive/2025/texmf-dist/tex/generic/iftex/ifvtex.sty)) (c:/texlive/2025/texmf-dist/tex/latex/polyglossia/polyglossia.sty (c:/texlive/2025/texmf-dist/tex/latex/polyglossia/gloss-latex.ldf)) (c:/texlive/2025/texmf-dist/tex/latex/polyglossia/gloss-chinese.ldf) (./mwee.aux) *geometry* driver: auto-detecting *geometry* detected driver: luatex (./mwee.toc) [1{c:/Users/Kasmir/.texlive2025/texmf-var/fonts/map/pdftex/updmap/ pdftex.map}] 第\chinese {chapter}章 [2] 第\chinese {chapter}章 [3] (./mwee.aux)) 583 words of node memory still in use: 4 hlist, 1 vlist, 1 rule, 2 glue, 3 kern, 1 glyph, 59 attribute, 52 glue_spe c, 11 attribute_list, 1 write, 6 user_defined nodes avail lists: 1:3,2:2778,3:78,4:53,5:37,6:10,7:286,8:1,9:96,10:6,12:1 <c:/texlive/2025/texmf-dist/fonts/opentype/public/fandol/FandolSong-Regular.otf ><c:/texlive/2025/texmf-dist/fonts/opentype/public/fandol/FandolSong-Regular.ot f><c:/texlive/2025/texmf-dist/fonts/opentype/public/fandol/FandolSong-Bold.otf> <c:/texlive/2025/texmf-dist/fonts/opentype/public/fandol/FandolSong-Bold.otf> Output written on mwee.pdf (3 pages, 14153 bytes). Transcript written on mwee.log. To control the format of \chapter, ctex needs \chinese command to transform the counter. Maybe I need to recover the definition of \chinese here? But I was afraid that polyglossia need \chinese all the time... The output is incorrect:

  • lua file in the local folder is not enabled after texhash
    by Jinwen on December 29, 2025 at 2:05 am

    I am trying to add the pre-release version of lua-widow-control to my local TeX directory. In the local folder, I created a new folder lua-widow-control and placed the files lua-widow-control.sty, lua-widow-control.opm and lua-widow-control.lua inside. However, after running sudo texhash, I am getting: $ kpsewhich lua-widow-control.sty /usr/local/texlive/texmf-local/tex/latex/local/lua-widow-control/lua-widow-control.sty $ kpsewhich lua-widow-control.lua /usr/local/texlive/2025/texmf-dist/tex/luatex/lua-widow-control/lua-widow-control.lua $ kpsewhich lua-widow-control.opm /usr/local/texlive/texmf-local/tex/latex/local/lua-widow-control/lua-widow-control.opm Thus somehow only the .lua file is still using the installed version, not the local version. How should I change this? (Actually more importantly, is my method of installation correct? What is the correct method?) Edit: If I put the files in /usr/local/texlive/texmf-local/tex/luatex/local/lua-widow-control/, then upon running sudo texhash, I could see with kpsewhich that the paths are indeed pointing to the local versions and not the installed versions. However, if I try to compile a document, there would still be multiple incorrect index specification for tex.gettoks() errors, thus something is still wrong, since these errors won't occur if I simply put the .sty, .lua and .opm files in the same folder as the .tex document. Even if I keep both /usr/local/texlive/texmf-local/tex/latex/local/lua-widow-control/ and /usr/local/texlive/texmf-local/tex/luatex/local/lua-widow-control/, where now the paths become: $ kpsewhich lua-widow-control.sty /usr/local/texlive/texmf-local/tex/latex/local/lua-widow-control/lua-widow-control.sty $ kpsewhich lua-widow-control.lua /usr/local/texlive/texmf-local/tex/luatex/local/lua-widow-control/lua-widow-control.opm $ kpsewhich lua-widow-control.opm /usr/local/texlive/texmf-local/tex/latex/local/lua-widow-control/lua-widow-control.opm There would still be errors incorrect index specification for tex.gettoks(). Here is a MWE: \documentclass{article} \usepackage{lua-widow-control} \begin{document} Text. \end{document} Here is the log: This is LuaHBTeX, Version 1.22.0 (TeX Live 2025) (format=lualatex 2025.10.22) 29 DEC 2025 11:15 restricted system commands enabled. file:line:error style messages enabled. **/var/folders/5g/f7_0g42j7q54f5hx_6zq91z80000gn/T/lua-widow-control-installation-test.tex (/var/folders/5g/f7_0g42j7q54f5hx_6zq91z80000gn/T/lua-widow-control-installation-test.tex LaTeX2e <2025-06-01> patch level 1 L3 programming layer <2025-09-02> Lua module: luaotfload 2024-12-03 v3.29 Lua based OpenType font support Lua module: lualibs 2023-07-13 v2.76 ConTeXt Lua standard libraries. Lua module: lualibs-extended 2023-07-13 v2.76 ConTeXt Lua libraries -- extended collection. luaotfload | conf : Root cache directory is "/Users/xujinwen/Library/texlive/2025/texmf-var/luatex-cache/generic/names". luaotfload | init : Loading fontloader "fontloader-2023-12-28.lua" from kpse-resolved path "/usr/local/texlive/2025/texmf-dist/tex/luatex/luaotfload/fontloader-2023-12-28.lua". Lua-only attribute luaotfload@noligature = 1 luaotfload | init : Context OpenType loader version 3.134 Inserting `luaotfload.node_processor' in `pre_linebreak_filter'. Inserting `luaotfload.node_processor' in `hpack_filter'. Inserting `luaotfload.glyph_stream' in `glyph_stream_provider'. Inserting `luaotfload.define_font' in `define_font'. Lua-only attribute luaotfload_color_attribute = 2 luaotfload | conf : Root cache directory is "/Users/xujinwen/Library/texlive/2025/texmf-var/luatex-cache/generic/names". Inserting `luaotfload.harf.strip_prefix' in `find_opentype_file'. Inserting `luaotfload.harf.strip_prefix' in `find_truetype_file'. Removing `luaotfload.glyph_stream' from `glyph_stream_provider'. Inserting `luaotfload.harf.glyphstream' in `glyph_stream_provider'. Inserting `luaotfload.harf.finalize_vlist' in `post_linebreak_filter'. Inserting `luaotfload.harf.finalize_hlist' in `hpack_filter'. Inserting `luaotfload.cleanup_files' in `wrapup_run'. Inserting `luaotfload.harf.finalize_unicode' in `finish_pdffile'. Inserting `luaotfload.glyphinfo' in `glyph_info'. Lua-only attribute luaotfload.letterspace_done = 3 Inserting `luaotfload.aux.set_sscale_dimens' in `luaotfload.patch_font'. Inserting `luaotfload.aux.set_font_index' in `luaotfload.patch_font'. Inserting `luaotfload.aux.patch_cambria_domh' in `luaotfload.patch_font'. Inserting `luaotfload.aux.fixup_fontdata' in `luaotfload.patch_font_unsafe'. Inserting `luaotfload.aux.set_capheight' in `luaotfload.patch_font'. Inserting `luaotfload.aux.set_xheight' in `luaotfload.patch_font'. Inserting `luaotfload.rewrite_fontname' in `luaotfload.patch_font'. Inserting `tracingstacklevels' in `input_level_string'. (/usr/local/texlive/2025/texmf-dist/tex/latex/base/article.cls Document Class: article 2025/01/22 v1.4n Standard LaTeX document class (/usr/local/texlive/2025/texmf-dist/tex/latex/base/size10.clo File: size10.clo 2025/01/22 v1.4n Standard LaTeX file (size option) luaotfload | db : Font names database loaded from /Users/xujinwen/Library/texlive/2025/texmf-var/luatex-cache/generic/names/luaotfload-names.luc.gz) \c@part=\count273 \c@section=\count274 \c@subsection=\count275 \c@subsubsection=\count276 \c@paragraph=\count277 \c@subparagraph=\count278 \c@figure=\count279 \c@table=\count280 \abovecaptionskip=\skip49 \belowcaptionskip=\skip50 \bibindent=\dimen147 ) (/usr/local/texlive/2025/texmf-dist/tex/lualatex/lua-widow-control/lua-widow-control.sty Package: lua-widow-control 2024/03/11 v3.0.1 Use Lua to remove widows and orphans \g__lwc_emergencystretch_dim=\dimen148 \g__lwc_draftoffset_dim=\dimen149 \g__lwc_maxcost_int=\count281 Lua module: lua-widow-control 2024/03/11 v3.0.1 This module provides a LuaTeX-based solution to prevent widows and orphans from appearing in a document. It does so by increasing or decreasing the lengths of previous paragraphs. Lua-only attribute lua-widow-control_paragraph = 4 Custom whatsit lua-widow-control_mark = 1 Lua function __lwc_if_enabled: = 31 Lua function __lwc_enable: = 32 Lua function __lwc_disable: = 33 Lua function __lwc_nobreak:n = 34 Lua function __lwc_debug:n = 35 Lua function __lwc_show_costs:n = 36 Lua function __lwc_show_colours:n = 37 Lua function __lwc_pre_shipout:n = 38 Inserting `trigger_special_output' in `buildpage_filter'. Inserting `remove_widows' in `pre_output_filter'. Inserting `show_costs' in `pre_shipout_filter'. \g__lwc_disable_int=\count282 Inserting `save_paragraphs' in `pre_linebreak_filter'. Inserting `mark_paragraphs' in `post_linebreak_filter'. Module lua-widow-control Warning: nobreak is not deprecated on input line 296 ) (/usr/local/texlive/2025/texmf-dist/tex/latex/microtype/microtype.sty Package: microtype 2025/07/09 v3.2b Micro-typographical refinements (RS) (/usr/local/texlive/2025/texmf-dist/tex/latex/graphics/keyval.sty Package: keyval 2022/05/29 v1.15 key=value parser (DPC) \KV@toks@=\toks17 ) (/usr/local/texlive/2025/texmf-dist/tex/latex/etoolbox/etoolbox.sty Package: etoolbox 2025/10/02 v2.5m e-TeX tools for LaTeX (JAW) \etb@tempcnta=\count283 ) \MT@toks=\toks18 \MT@tempbox=\box53 \MT@count=\count284 LaTeX Info: Redefining \noprotrusionifhmode on input line 1087. LaTeX Info: Redefining \leftprotrusion on input line 1088. \MT@prot@toks=\toks19 LaTeX Info: Redefining \rightprotrusion on input line 1107. LaTeX Info: Redefining \textls on input line 1449. \MT@outer@kern=\dimen150 LaTeX Info: Redefining \microtypecontext on input line 2053. LaTeX Info: Redefining \textmicrotypecontext on input line 2070. \MT@listname@count=\count285 (/usr/local/texlive/2025/texmf-dist/tex/latex/microtype/microtype-luatex.def File: microtype-luatex.def 2025/07/09 v3.2b Definitions specific to luatex (RS) Lua module: microtype 2025/07/09 v3.2b microtype module. Module microtype Info: overwriting function `keepligature' on input line 63 LaTeX Info: Redefining \lsstyle on input line 779. LaTeX Info: Redefining \lslig on input line 779. \MT@outer@space=\skip51 ) Package microtype Info: Loading configuration file microtype.cfg. (/usr/local/texlive/2025/texmf-dist/tex/latex/microtype/microtype.cfg File: microtype.cfg 2025/07/09 v3.2b microtype main configuration file (RS) ) LaTeX Info: Redefining \microtypesetup on input line 3065. ) (/usr/local/texlive/2025/texmf-dist/tex/latex/l3backend/l3backend-luatex.def File: l3backend-luatex.def 2025-06-09 L3 backend support: PDF output (LuaTeX) \l__color_backend_stack_int=\count286 Inserting `l3color' in `luaotfload.parse_color'.) (./lua-widow-control-installation-test.aux) \openout1 = lua-widow-control-installation-test.aux LaTeX Font Info: Checking defaults for OML/cmm/m/it on input line 3. LaTeX Font Info: ... okay on input line 3. LaTeX Font Info: Checking defaults for OMS/cmsy/m/n on input line 3. LaTeX Font Info: ... okay on input line 3. LaTeX Font Info: Checking defaults for OT1/cmr/m/n on input line 3. LaTeX Font Info: ... okay on input line 3. LaTeX Font Info: Checking defaults for T1/cmr/m/n on input line 3. LaTeX Font Info: ... okay on input line 3. LaTeX Font Info: Checking defaults for TS1/cmr/m/n on input line 3. LaTeX Font Info: ... okay on input line 3. LaTeX Font Info: Checking defaults for TU/lmr/m/n on input line 3. LaTeX Font Info: ... okay on input line 3. LaTeX Font Info: Checking defaults for OMX/cmex/m/n on input line 3. LaTeX Font Info: ... okay on input line 3. LaTeX Font Info: Checking defaults for U/cmr/m/n on input line 3. LaTeX Font Info: ... okay on input line 3. LaTeX Info: Redefining \microtypecontext on input line 3. Package microtype Info: Applying patch `item' on input line 3. Package microtype Info: Applying patch `toc' on input line 3. Package microtype Info: Applying patch `eqnum' on input line 3. Package microtype Info: Applying patch `footnote' on input line 3. Package microtype Info: Applying patch `verbatim' on input line 3. LaTeX Info: Redefining \microtypesetup on input line 3. Package microtype Info: Generating PDF output. Package microtype Info: Character protrusion enabled (level 2). Package microtype Info: Using default protrusion set `alltext'. Package microtype Info: Automatic font expansion enabled (level 2), (microtype) stretch: 20, shrink: 20, step: 1, non-selected. Package microtype Info: Using default expansion set `alltext-nott'. Package microtype Info: Patching command `\showhyphens'. Package microtype Info: No adjustment of tracking. Package microtype Info: No adjustment of spacing. Package microtype Info: No adjustment of kerning. (/usr/local/texlive/2025/texmf-dist/tex/latex/microtype/mt-LatinModernRoman.cfg File: mt-LatinModernRoman.cfg 2021/02/21 v1.1 microtype config. file: Latin Modern Roman (RS) ) Inserting `disable_box_warnings' in `hpack_quality'. Removing `disable_box_warnings' from `hpack_quality'. warning (vpack filter): error: .../tex/latex/local/lua-widow-control/lua-widow-control.lua:1158: incorrect index specification for tex.gettoks() . \newpage ...erypar {}\fi \par \vfil \penalty -\@M l.5 \end{document} The lua interpreter ran into a problem, so the remainder of this lua chunk will be ignored. [1 {/usr/local/texlive/2025/texmf-var/fonts/map/pdftex/updmap/pdftex.map}] warning (node filter): error: .../tex/latex/local/lua-widow-control/lua-widow-control.lua:1078: incorrect index specification for tex.gettoks() . \newpage ...erypar {}\fi \par \vfil \penalty -\@M l.5 \end{document} The lua interpreter ran into a problem, so the remainder of this lua chunk will be ignored. warning (vpack filter): error: .../tex/latex/local/lua-widow-control/lua-widow-control.lua:1158: incorrect index specification for tex.gettoks() . \clearpage ...rite \m@ne {}\vbox {}\penalty -\@Mi l.5 \end{document} The lua interpreter ran into a problem, so the remainder of this lua chunk will be ignored. warning (node filter): error: .../tex/latex/local/lua-widow-control/lua-widow-control.lua:1078: incorrect index specification for tex.gettoks() . \clearpage ...rite \m@ne {}\vbox {}\penalty -\@Mi l.5 \end{document} The lua interpreter ran into a problem, so the remainder of this lua chunk will be ignored. (./lua-widow-control-installation-test.aux) *********** LaTeX2e <2025-06-01> patch level 1 L3 programming layer <2025-09-02> *********** warning (node filter): error: .../tex/latex/local/lua-widow-control/lua-widow-control.lua:1078: incorrect index specification for tex.gettoks() . <to be read again> \@@end l.5 \end{document} The lua interpreter ran into a problem, so the remainder of this lua chunk will be ignored. ) Here is how much of LuaTeX's memory you used: 2900 strings out of 476291 125236,552014 words of node,token memory allocated 523 words of node memory still in use: 5 hlist, 1 vlist, 1 rule, 1 local_par, 5 glue, 4 kern, 1 penalty, 1 margin_kern, 7 glyph, 9 attribute, 48 glue_spec, 8 attribute_list, 1 write nodes avail lists: 1:1,2:26,3:5,4:2,5:24,6:4,7:40,9:18 25181 multiletter control sequences out of 65536+600000 15 fonts using 723367 bytes 44i,5n,53p,1080b,144s stack positions out of 10000i,1000n,20000p,200000b,200000s </usr/local/texlive/2025/texmf-dist/fonts/opentype/public/lm/lmroman10-regular.otf> Output written on lua-widow-control-installation-test.pdf (1 page, 3035 bytes). PDF statistics: 15 PDF objects out of 1000 (max. 8388607) 8 compressed objects within 1 object stream 0 named destinations out of 1000 (max. 131072) 1 words of extra memory for PDF output out of 10000 (max. 100000000)

  • Automatically add Previous/Next section links in the footer
    by taiwan12 on December 28, 2025 at 11:14 pm

    I am creating a PDF in LaTeX with multiple sections, and I want to have “Previous Section” and “Next Section” links in the footer that automatically point to the previous and next sections. \documentclass[11pt]{article} \usepackage{lipsum} \usepackage{hyperref} \hypersetup{colorlinks=true} \usepackage{fancyhdr} \pagestyle{fancy} \fancyhf{} \fancyhead[R]{\textbf{Name}} \fancyfoot[C]{\thepage} \renewcommand{\headrulewidth}{0pt} \renewcommand{\footrulewidth}{0pt} \begin{document} % ---------- First Section ---------- \fancyfoot[L]{ } \fancyfoot[R]{\hyperref[sec:second]{Next Section}} \section*{First}\label{sec:first} \lipsum[1-5] \newpage % ---------- Second Section ---------- \fancyfoot[L]{\hyperref[sec:first]{Previous Section}} \fancyfoot[R]{\hyperref[sec:third]{Next Section}} \section*{Second}\label{sec:second} \lipsum[1-5] \newpage % ---------- Third Section ---------- \fancyfoot[L]{\hyperref[sec:second]{Previous Section}} \fancyfoot[R]{ } \section*{Third}\label{sec:third} \lipsum[1-5] \newpage \end{document} But this requires me to manually update the footer for every section. I would like a solution that: Automatically detects the current section on each page. Generates the previous/next section links dynamically. Works even if sections span multiple pages. Does not require manually specifying labels or updating footers for every section.

  • Custom list not incrementing properly
    by azetina on December 28, 2025 at 7:11 pm

    Consider the following MWE: \documentclass{article} \usepackage{amsmath} \usepackage{enumitem} \usepackage{ragged2e} \usepackage{array,booktabs} %----------------------------------------------------------------------------------------------------------------------------- % Create new list environment %----------------------------------------------------------------------------------------------------------------------------- \newlist{csecmoduleso}{enumerate}{2} % Only 2 level needed \newcounter{csecmodulesocounter}[table] % Format the item label \renewcommand{\thecsecmodulesocounter}{\thesubsection.\arabic{csecmodulesocounter}} \setlist[csecmoduleso,1]{ label=\thecsecmodulesocounter, % Produces 1.1.1., 1.1.2., etc. ref=\thecsecmodulesocounter, % For referencing leftmargin=*, align=left, labelwidth=3em, labelsep=0.5em, noitemsep, before={\refstepcounter{csecmodulesocounter}\begin{minipage}[t]{\hsize}\RaggedRight}, after={\end{minipage}}, %resume } \begin{document} \section{test} \subsection{subtest} \begin{tabular}{@{}p{\dimexpr0.5\textwidth-\tabcolsep\relax}p{\dimexpr0.5\textwidth-\tabcolsep\relax}@{}} \begin{csecmoduleso} \item Test \item My name \item My name \item My name \item My name \end{csecmoduleso} & b\\ %\addlinespace[2ex] This is needed as text overlaps \begin{csecmoduleso} \item Test \end{csecmoduleso} & b\\ \begin{csecmoduleso} \item Test \end{csecmoduleso} & b\\ \end{tabular} \end{document} I am currently getting: 1.2.1 Test 1.2.1 My name 1.2.1 My name 1.2.1 My name 1.2.1 My name 1.2.2 Test 1.2.3 Test Why isnt the counter increasing after the first item 1.2.1?

  • In tufte-book class there is no white space before the first section title
    by Máté Wierdl on December 28, 2025 at 6:02 pm

    In the tufte-book class there is no extra empty line(s) before the first section title in each chapter, while there is one before subsequent section titles under the same chapter. I certainly can include extra empty lines by hand, but is there a better (more automatic) fix? There is no such problem with tufte-handout. \documentclass{tufte-book} \begin{document} \chapter{Chapter} Why isn't there some space after this for the first section title? \section{Section 1} There is space after this for the second section. \section{Section 2} \end{document}

  • Three fonts supports for polyglossia package?
    by Explorer on December 28, 2025 at 5:32 pm

    The code is partially taken from egreg's this answer. I want to typeset the following three languages with three fonts: English: EB Garamond Chinese: FandolSong Greek: Old Standard Noted that I want to write an "English and Chinese" mixed article(which means that it need to switch frequently) to introduced the third language——Greek. As below: \documentclass{book} \usepackage{fontspec} \usepackage{polyglossia} \setmainlanguage{english} \setmainfont{EB Garamond}% English \newfontfamily{\chinesefont}{FandolSong}% Chinese \setotherlanguage{greek} \newfontfamily{\greekfont}{Old Standard}% Greek \begin{document} I want to typeset an article, whose main text is the combination of English, Chinese, which is used to introduced the Greek letters. I want three fonts for them. So, I want to use English and Chinese, switching frequently. And use Greek fonts in whole paragraph. \bigskip English: English Saṃskṛtāvāk Chinese: {\chinesefont 英语、中文 01234 这是一个测试} Greek: {\greekfont τὸν πόλεμον τῶν Ἀθηναῖος} It works well. However, what I want in the real case, is as follows: \bigskip An paragraph of English and Chinese, which shifts frequently. 我是英语 English 和中文 Chinese 混排。我是英语 English 和中文 Chinese 混排。我是英语 English 和中文 Chinese 混排。我是英语 English 和中文 Chinese 混排。我是英语 English 和中文 Chinese 混排。我是英语 English 和中文 Chinese 混排。 {\chinesefont 我是英语} English {\chinesefont 和中文} Chinese {\chinesefont 混排。} is okay, but extremely difficult to switch... Then a paragraph of Greek letters. \textgreek{Θουκυδίδης Ἀθηναῖος ξυνέγραψε τὸν πόλεμον τῶν Πελοποννησίων καὶ Ἀθηναίων, ὡς ἐπολέμησαν πρὸς ἀλλήλους, ἀρξάμενος εὐθὺς καθισταμένου καὶ ἐλπίσας μέγαν τε ἔσεσθαι καὶ ἀξιολογώτατον τῶν προγεγενημένων, τεκμαιρόμενος ὅτι ἀκμάζοντές τε ᾖσαν ἐς αὐτὸν ἀμφότεροι παρασκευῇ τῇ πάσῃ καὶ τὸ ἄλλο Ἑλληνικὸν ὁρῶν ξυνιστάμενον πρὸς ἑκατέρους, τὸ μὲν εὐθύς, τὸ δὲ καὶ διανοούμενον.} It's hard for \texttt{polyglossia} to support an English font together another Chinese font. Is that any ideas? \end{document} I can't set Chinese and English fonts seperately, so frequently switch is quite difficult. I have also tried Fallback, but it doesn't work: \setmainfont[Fallback=FandolSong]{EB Garamond} If somebody get familiar with ctex-bundle, to set Chinese fonts and English fonts seperately, we could use: \usepackage{ctex} \setmainfont{EB Garamond} \setCJKmainfont{FandolSong} However, polyglossia is a little bit conflict with ctex(That maybe my another question or issues). So, this post, I was only after for a ployglossia(or babel) solution.

  • With mini frames, beamer content too far down
    by scottkosty on December 28, 2025 at 5:11 pm

    The content in some of my frames extends too far down, even when there is vertical space above that could be used. Here is an example. I would prefer for it to use the vertical space at the top before extending off the page. Is there a clean way to accomplish (at least part) this without doing a manual negative vspace? \documentclass{beamer} \useoutertheme{smoothbars} \begin{document} \section{Summation operator and the mean} \begin{frame} \begin{theorem} Is the following equality necessarily true? \[ \sum^{n}_{i=1}\left(ax_{i}+by_{i}\right)=a\sum^{n}_{i=1}x_{i}+b\sum^{n}_{i=1}y_{i} \] \end{theorem} % \begin{theorem} Yes, it is true. But what's the intuition for it? \end{theorem} \begin{itemize} \item Whenever you're stuck proving a general statement, it's often useful to try a special case. For example, what if $n$ equals 2? \begin{block}{} Then the question reduces to the following: \begin{align} \left(ax_{1}+by_{1}\right)+\left(ax_{2}+by_{2}\right) & \,\,\,=\,\,\,a(x_{1}+x_{2})+b(y_{1}+y_{2})\\ & \Longleftrightarrow\\ \left(ax_{1}+ax_{2}\right)+\left(by_{1}+by_{2}\right) & \,\,\,=\,\,\,a(x_{1}+x_{2})+b(y_{1}+y_{2}) \end{align} \end{block} \item We're summing the same numbers, just in a different order! \end{itemize} \end{frame} \end{document} Here is the result that I get: I understand there is no so much vertical space at the top, but I would still rather have the "Theorem" text start just after the mini frames, rather than content go off the page. Maybe what I'm asking for is "vfill" behavior, where it stretches or squeezes depending on the situation?

  • How to make a command "eat" a space? [duplicate]
    by user424920 on December 28, 2025 at 11:03 am

    I searched for something similar, but I didn't find anything. \documentclass{report} \usepackage{amsmath} \usepackage{mathtools} \DeclareMathOperator{\diff}{d} \begin{document} \[\int x\diff x\] \end{document} I want to get "dx" and not "d x". I was looking at ways to eat spaces after the command, but nothing, I would like to avoid adding the "x" as a parameter to the \diff operator. I would like you know if there is a way.

  • Why does \textstyle not work in \smashoperator?
    by John Lee on December 28, 2025 at 3:23 am

    In the following code, the \sum in \smashoperator appears too big. But if I put \textstyle\sum in \smashoperator, then it gives the error "*.tex: error: 290: Limit controls must follow a math operator. ...extstyle\sum_{\alpha\in D_{1}\cup D_{2}}}". I don't know what to do and need help. The MWE LaTeX code is as below: \documentclass[11pt,twoside]{article}% \usepackage{amssymb} \usepackage{amsmath} \usepackage{amsfonts} \usepackage{mathtools} \usepackage[title,titletoc,header]{appendix} \usepackage{geometry} \usepackage{graphicx} \usepackage{indentfirst} \usepackage{mathrsfs} \usepackage{nopageno} \usepackage{setspace} \usepackage{remreset} \newtheorem{theorem}{Theorem}[section] \newtheorem{definition}[theorem]{Definition} \begin{document} \begin{enumerate} \item $\smashoperator{\sum_{\alpha\in D_{1}\cup D_{2}}}\,x_{\alpha}\,=\underset{\alpha\in D_{1}}{\textstyle\sum}x_{\alpha} \,+\underset{\alpha\in D_{2}}{\textstyle\sum}x_{\alpha}$ \end{enumerate} \end{document}

  • Weird Overleaf error
    by DavidIsDumb on December 28, 2025 at 2:31 am

    I'm writing some math stuff using overleaf but it broke mysteriously. I wrote: \documentclass[11pt]{scrartcl} \usepackage[dvipsnames,svgnames]{xcolor} \usepackage[shortlabels]{enumitem} \usepackage[framemethod=TikZ]{mdframed} \usepackage{amsmath,amssymb,amsthm} \usepackage{epigraph} \usepackage[colorlinks]{hyperref} \usepackage{microtype} \usepackage{mathtools} \usepackage[headsepline]{scrlayer-scrpage} \usepackage{thmtools} \usepackage{listings} \usepackage{derivative} \renewcommand{\epigraphsize}{\scriptsize} \renewcommand{\epigraphwidth}{60ex} \ihead{\footnotesize\textbf{Some text here}} \ohead{\footnotesize Some text here} \providecommand{\re}{\text{Re}} \providecommand{\im}{\text{Im}} \providecommand{\ol}{\overline} \providecommand{\eps}{\varepsilon} \providecommand{\half}{\frac{1}{2}} \providecommand{\dang}{\measuredangle} \providecommand{\CC}{\mathbb C} \providecommand{\FF}{\mathbb F} \providecommand{\NN}{\mathbb N} \providecommand{\QQ}{\mathbb Q} \providecommand{\RR}{\mathbb R} \providecommand{\ZZ}{\mathbb Z} \providecommand{\dg}{^\circ} \providecommand{\ii}{\item} \providecommand{\alert}{\textbf} \providecommand{\opname}{\operatorname} \providecommand{\ts}{\textsuperscript} \DeclareMathOperator{\sign}{sign} \providecommand{\tarc}{\mbox{\large$\frown$}} \providecommand{\arc}[1]{\stackrel{\tarc}{#1}} \reversemarginpar \providecommand{\printpuid}[1]{\marginpar{\href{https://otis.evanchen.cc/arch/#1}{\ttfamily\footnotesize\color{green!40!black}#1}}} \mdfdefinestyle{mdgreenbox}{linecolor=ForestGreen,backgroundcolor=ForestGreen!5, linewidth=2pt,rightline=false,leftline=true,topline=false,bottomline=false,} \declaretheoremstyle[headfont=\bfseries\sffamily\color{ForestGreen!70!black}, mdframed={style=mdgreenbox},headpunct={.},]{thmgreenbox} \mdfdefinestyle{mdredbox}{frametitlefont=\bfseries,innerbottommargin=8pt, nobreak=true,backgroundcolor=Salmon!5,linecolor=RawSienna,} \declaretheoremstyle[headfont=\bfseries\color{RawSienna}, mdframed={style=mdredbox},headpunct={\\[3pt]},postheadspace=0pt,]{thmredbox} \mdfdefinestyle{mdblackbox}{linecolor=black,backgroundcolor=RedViolet!5!gray!5, linewidth=3pt,nobreak=true,rightline=false,leftline=true,topline=false,bottomline=false,} \declaretheoremstyle[mdframed={style=mdblackbox}]{thmblackbox} \declaretheorem[style=thmredbox,name=Problem]{problem} \declaretheorem[style=thmblackbox,name=Outline,numbered=no]{sol} \declaretheorem[style=thmgreenbox,name=Claim,numbered=no]{claim*} \usepackage{asymptote} \begin{asydef} size(8cm); // set a reasonable default usepackage("amsmath"); usepackage("amssymb"); settings.tex="pdflatex"; settings.outformat="pdf"; import geometry; void filldraw(picture pic = currentpicture, conic g, pen fillpen=defaultpen, pen drawpen=defaultpen) { filldraw(pic, (path) g, fillpen, drawpen); } void fill(picture pic = currentpicture, conic g, pen p=defaultpen) { filldraw(pic, (path) g, p); } pair foot(pair P, pair A, pair B) { return foot(triangle(A,B,P).VC); } pair centroid(pair A, pair B, pair C) { return (A+B+C)/3; } \end{asydef} \begin{document} \title{Some text here} \subtitle{Some text here} \author{Some text here} \date{\today} \maketitle \begin{problem}[some text here] Fix an integer $n \ge 1$. Tom has a scientific calculator. Unfortunately, all keys are broken except for one row: \verb$1$, \verb$2$, \verb$3$, \verb$+$ and \verb$-$. Tom presses a sequence of $n$ random keystrokes; at each stroke, each key is equally likely to be pressed. The calculator then evaluates the entire expression, yielding a result of $E$. Find the expected value of $E$, in terms of $n$. (Negative numbers are permitted, so \verb$13-22$ gives $E = -9$. Any excess operators are parsed as signs, so \verb$-2-+3$ gives $E=-5$ and \verb$-+-31$ gives $E = 31$. Trailing operators are discarded, so \verb$2++-+$ gives $E=2$. A string consisting only of operators, such as \verb$-++-+$, gives $E=0$.) \end{problem} \end{document} When I compile there is no error message, but the last line has a red circle saying "unexpected \end{problem} after $" and the line before that says "unclosed $ found at \end{problem}". All the other probs with this format didn't break, so there's probably no problem with the \end. However, I found that if I type \begin{problem}[some text here] Tom presses a sequence of $n$ random keystrokes; at each stroke, each key is equally likely to be pressed. The calculator then evaluates the entire expression, yielding a result of $E$. Find the expected value of $E$, in terms of $n$. (Negative numbers are permitted, so \verb$13-22$ gives $E = -9$. Any excess operators are parsed as signs, so \verb$-2-+3$ gives $E=-5$ and \verb$-+-31$ gives $E = 31$. Trailing operators are discarded, so \verb$2++-+$ gives $E=2$. A string consisting only of operators, such as \verb$-++-+$, gives $E=0$.) \end{problem} instead for the problem part nothing happens! No error if I delete like half a paragraph. Can somebody explain what is happening? Edit: Also in the first case autocompile doesn't work, saying that my code has errors that must be fixed first before that can run, but for the second case autocompile works. I also found out that autocompile works when I type: \begin{problem}[some text here] Fix an integer $n \ge 1$. Tom has a scientific calculator. Unfortunately, all keys are broken except for one row: \verb$1$, \verb$2$, \verb$3$, \verb$+$ and \verb$-$. Tom presses a sequence of $n$ random keystrokes; at each stroke, each key is equally likely to be pressed. The calculator then evaluates the entire expression, yielding a result of $E$. Find the expected value of $E$, in terms of $n$. (Negative numbers are permitted, so \verb$13-22$ gives $E = -9$. Any excess operators are parsed as signs, so \verb$-2-+3$ gives $E=-5$ and \verb$-+-31$ gives $E = 31$. Trailing operators are discarded, so \verb$2++-+$ gives $E=2$. A string consisting only of operators, such as \verb$-++-+$, gives $E=0.) \end{problem} for the problem, but the last line has the following error message: LaTeX Error: Command \end{mdframed} invalid in math mode. \ (button saying suggest fix using AI) \ Missing $ inserted. \ Missing } inserted. \ Extra }, or forgotten \endgroup.

  • DNA helix and chromosome symbols built in tikz-pgf
    by Sebastiano on December 27, 2025 at 10:22 pm

    I'm wondering if there are predefined symbols chromosomes-dna in pdfLaTeX or done in TikZ similar to those used in biology textbooks. Here two examples: What libraries can I use to create the envelope curves in blue for the "X"? (For the 2-nd figure, credit from wikipedia https://en.wikipedia.org/wiki/Chromosome#/media/File:Chromosome.svg)

  • Using \ProcessList and \SplitArgument with \IfBoolean
    by sgmoye on December 27, 2025 at 7:30 pm

    I need to use \ProcessList and \SplitArgument with \IfBoolean. Using only \ProcessList does work, but I need to get at the arguments before and after the / -- thus the need for \SplitArgument. The asterisk seems inextricably attached to the second argument in \fooauxai and I cannot seem to pry it loose. As indicated, I've tried some \expandafter experiments. Suggestions? \documentclass{article} \usepackage[papersize={5.5in,8.5in},margin=0.6in]{geometry} \usepackage{xparse}%% for <u> %% |=====8><-----| %% %% This works \NewDocumentCommand{\test}{ >{\SplitList{;}}m }{\ProcessList{#1}{\fooaux}} \NewDocumentCommand{\fooaux}{ m }{\fooauxa#1|} \NewDocumentCommand{\fooauxa}{ s u{|} }{% \def not possible due to need for boolean \IfBooleanTF{#1}{\textcolor{red}{#2}}{#2} } %% |=====8><-----| %% %% This does not work \NewDocumentCommand{\testi}{>{ \SplitList{;}}m } {\ProcessList{#1}{\fooauxi}} %% Tried this but to no avail: %% \NewDocumentCommand{\fooauxi}{ >{\SplitArgument{1}{/}}m } {\expandafter\fooauxai#1|} \NewDocumentCommand{\fooauxi}{ >{\SplitArgument{1}{/}}m } {\fooauxai#1} \NewDocumentCommand{\fooauxai}{ s m m }{% \IfBooleanTF{#1}{\textcolor{red}{(#2)}}{(#2)}-(#3) } %% |=====8><-----| %% \begin{document} \thispagestyle{empty} \begin{tabular}{lll} 1& From \verb+\test+& \test{a/1;*b/2;c/3}\\ 2& From \verb+\testi+& \testi{a/1;*b/2;c/3}\\ 3& Desired& (a)-(1) \textcolor{red}{(b)}-(2) (c)-(3) \end{tabular} \end{document}