• Three column layout with spann floats
    by GowriSaro on March 14, 2026 at 4:48 pm

    Is it possible to get three column layout in LaTeX as like as \documentclass[twocolumn]{article} I don't want to use multicols package, as it might have issues with floats. Also, please suggest that spanning of two column floats and three column floats and footnotes are possible.

  • Counting a specific token inside a token list
    by Vincent on March 14, 2026 at 4:32 pm

    The following code is meant to count the number of tokens in a token list: \documentclass{article} \ExplSyntaxOn \NewExpandableDocumentCommand{\tokencount}{o m}{ \__tokencount_count_tokens:nn{#2}{#1} } \cs_new:Npn \__tokencount_count_tokens:nn #1#2{ \int_eval:n{ 0 \tl_map_tokens:nn{#2}{\__tokencount_count_token:nn{#1}} } } \cs_new:Npn \__tokencount_count_token:nn #1#2{ \tl_map_tokens:nn{#1}{\__tokencount_count_token_compare:nn{#2}} } \cs_new:Npn \__tokencount_count_token_compare:nn #1#2{ \tl_if_eq:nnT{#1}{#2}{ +1 } } \ExplSyntaxOff \begin{document} \noindent \tokencount[-]{1-2-3}\\ % Should return 2, but returns 0 + 1 + 1 \tokencount[-,]{1-2-3,4,5,6}\\ % Should return 5, but returns 0 + 1 + 1 + 1 + 1 + 1 \tokencount[ {ab} ]{1{ab}2{ab}3}\\ % Should return 2, but returns 0 + 1 + 1 \tokencount[ {ab} - ]{1{ab}2{ab}3-4}\\ % Should return 3, but returns 0 + 1 + 1 + 1 \end{document} Three questions: Q1: How to make it work correctly? Q2: How to improve it/make it more robust if necessary while keeping it expandable? Q3: How to optimize it to minimize compile time?

  • ConTeXt: Control spacing around multiple footnote apparatuses
    by Jeff Dodson on March 14, 2026 at 4:14 pm

    My goal is to typeset a document in ConTeXt with grid/line-matching, and with two "serried" footnote apparatuses at the bottom. The top footnote apparatus I name as "marginal" with \definenote[marginal] and the lower apparatus I name as \definenote[critical]. On any given page, you might see no footnotes at all, you might see one of the apparatuses but not the other, or you might see both together. Regardless, I'd always like to see exactly one grid line of space between the last line of text from the main text body and the horizontal rule of whichever footnote apparatus appears on top. So if the "marginal" apparatus appears on a page, I'd like to see one grid line of space between its horizontal rule and the main text. However, on a page where the "marginal" apparatus doesn't appear at all, but the "critical" apparatus does appear, I'd of course like to see that one line of empty space appear between the bottom of the main text block and the horizontal rule of the "critical" apparatus. If both apparatuses appear on a page, I don't want to see any extra space between the two apparatuses themselves. In other words, in order to make this work, I need some sort of spacing that can automatically vary depending on which apparatuses appear on any given page. However, although I used to have a ConTeXt setup that seemed to accomplish this, several days ago I updated to the latest ConTeXt release, and it completely broke my entire footnote system. Specifically, strange space now appears between my two apparatuses, too much space sometimes appears between the main text body and the top apparatus, and at times the top apparatus of footnotes actually overlaps the bottom of the main text body. Note that before this most recent update, I had never seen ConTeXt cause a footnote apparatus to overlap the main text as shown here. The version of ConTeXt I'm using is "2026.02.19 11:49". I've included a minimum working example here that demonstrates the overlap I'm seeing. So I have two specific questions I'm posing here: (1) In such a simple MWE with no frills, why is ConTeXt overlapping a footnote apparatus with the main text body? and (2) Give the variable spacing requirements I listed above, can this MWE be modified to accomplish those spacing requirements? To summarize, here is what I was trying to accomplish with the two apparatuses: "marginal" apparatus on top, assuming it appears on a given page "critical" apparatus either on top or bottom (depending on whether or not the "marginal" apparatus appears on that page) All notes in paragraph, run-on (i.e., "serried") form Footnote text can be ragged-right rather than justified Whichever apparatus appears on top, I'd like to see one line of grid space between the bottom of the main text block and the horizontal rule of the top apparatus. If both apparatuses appear on a page, I'd like to see no extra space between the two apparatuses (although they would be separated by a horizontal rule). \setuppapersize [A5] \setuplayout [tight] \setuplayout [grid=yes] \setupinterlinespace [line=5ex] \definenote[marginal] \setupnote [marginal] [alternative=serried, paragraph=yes, location=page] \setupnotation [marginal] [number=no] \definenote[critical] \setupnote [critical] [alternative=serried, paragraph=yes, location=page] \setupnotation [critical] [number=no] \starttext \samplefile{knuth}\marginal{1. \samplefile{knuth}}\critical{2. Some more footnote text.}\samplefile{knuth} \samplefile{knuth}\marginal{1. \samplefile{knuth}}\critical{2. Some more footnote text.}\samplefile{knuth} \samplefile{knuth}\marginal{1. \samplefile{knuth}}\critical{2. Some more footnote text.}\samplefile{knuth} \stoptext Here is the output produced by this MWE, where you can see the two apparatuses appearing, but with the top apparatus overlapping the main text:

  • Automatically include -converted version of images in LaTeX if it exists
    by monty01 on March 14, 2026 at 1:11 pm

    I'm working on a LaTeX document where I have multiple image files, some of which have a -converted version. For example, my files might look like this: a.png b.png b-converted.png c.png c-converted.png d.png I want to include the images in my document using a command like: \includegraphics{a.png} % includes a.png \includegraphics{b.png} % include b-converted.png \includegraphics{c.png} % include c-converted.png \includegraphics{d.png} % includes d.png That is, the logic should be: If basename-converted.ext exists, include that. Otherwise, include the original file: basename.ext. MWE \documentclass{article} \usepackage{graphicx} \begin{document} \includegraphics{a.png} \includegraphics{b-converted.png} \end{document} EDIT: I should work with multiple multiple file extension, like png, jpg, pdf, svg ...

  • Drawing distorted circle
    by Miguel Forteza on March 14, 2026 at 12:14 pm

    I was trying to copy this figure (from Elementary Classic Analysis Marsden Hoffman): And I don't know how. I've already seen various posts about a distorted circles where they drawed it randomly and I tried it but the result I get it's not quite like I want. I want like it's a sketch of a set I could have drawn (like the picture), but I get a circle "that has random noise". I know that making figures can be hard (at least for me) so if someone could just give me some indications I'd be really grateful.

  • Detecting missing graphics across a large LaTeX repository
    by JeT on March 14, 2026 at 10:14 am

    is there a TeX-based solution or is external tooling required? Like many of you (I suppose), I maintain a relatively large LaTeX repository used to produce lecture slides and course material. The project has grown over several years and now contains several hundred .tex files twice as many graphics (.png, .pdf) nested directories shared figures reused across multiple documents Typical usage is simply \documentclass{article} \usepackage{graphicx} \begin{document} \includegraphics{figures/payoff_diagram.png} \end{document} As the project evolves, files are sometimes moved or renamed. When this happens, some paths referenced by \includegraphics become invalid. Maintaining a clean path becomes a nightmare... In practice this leads to two types of issues graphics referenced in .tex files that no longer exist graphics present in the repository but not used anywhere Compiling documents eventually reveals missing files, but in a large repository this becomes slow and inconvenient. So my question is essentially about project-level integrity checks. Is there a way within the TeX ecosystem to automatically audit a repository and detect files referenced by \includegraphics that do not exist graphics present in the repository but never referenced For example Does LaTeX provide tooling to inspect file dependencies across a project Are there packages or TeX utilities designed for this Or is the typical solution to rely on external tooling such as scripts or CI workflows More broadly, with the recent development of automation tools and AI-assisted repository analysis, I am also wondering whether people have started using such approaches to maintain consistency in large LaTeX projects. I would be interested in knowing what workflows people use in practice for this type of problem.

  • horizontal centering not working as expected when \newline is used
    by Solarflares on March 14, 2026 at 9:07 am

    When using \newline, the horizontal centering does not work as expected. The first line is not centered (expected: red arrow). \documentclass{standalone} \usepackage{tabularray} \begin{document} \begin{tblr}{ colspec = {|Q|Q|Q|}, rows = {2.5cm,m}, columns = {4.5cm,c} } two\newline line and some text & single line\\ \end{tblr} \end{document}

  • Any luacode regex patch method to detect greeks letters?
    by Explorer on March 14, 2026 at 7:57 am

    Learning from Mico's answer, I have the following code to add \, between number and letter automaticlly via: s:gsub ( "(%d)(%a)" , "%1\\,%2" ) Here below is the code: \documentclass{article}% lualatex required \usepackage{amsmath,amssymb} \usepackage{luacode} \begin{luacode} function digit_letter_spacer ( s ) return s:gsub ( "(%d)(%a)" , "%1\\,%2" ) end \end{luacode} \newcommand\DigitLetterSpaceOn{\directlua{luatexbase.add_to_callback ( "process_input_buffer" , digit_letter_spacer , "DigitLetterSpace" )}} \newcommand\DigitLetterSpaceOff{\directlua{luatexbase.remove_from_callback ( "process_input_buffer" , "DigitLetterSpace" )}} \AtBeginDocument{\DigitLetterSpaceOn} \begin{document} 23x $23x$ 1a2b3c $E=mc^2$ \[ 23x + 45y - 6z = 114qwq\] \begin{align*} \sum_{i=3n}^{\infty} \frac{5x}{7y} - \sqrt{100w} &\cong 3\mathbb{R} \\ 3x^2+4y^2&=5z^2 \end{align*} While the greek letter is not detected: $5\lambda+6\kappa=7\eta$ \begin{gather} 5\alpha+6\beta=7\gamma \end{gather} \end{document} However, the greek letter is not reconginzed. Any approach to regard Greeks Letter as letters in luacode?

  • Comparing scope with on background layer versus pgfonlayer
    by D G on March 14, 2026 at 5:54 am

    I don't understand why the scope with on background layer option \begin{scope}{on background layer} \clip (bb.south west) rectangle (bb.north east) {[rotate=\myrot] (P) -- (Q) -- (R) -- (S) -- cycle}; \fill[lightgray!50] (bb.south west) rectangle (bb.north east); \end{scope} produces different result compared to the pgfonlayer. \begin{pgfonlayer}{background} \clip (bb.south west) rectangle (bb.north east) {[rotate=\myrot] (P) -- (Q) -- (R) -- (S) -- cycle}; \fill[lightgray!50] (bb.south west) rectangle (bb.north east); \end{pgfonlayer} Minimal Working Example \documentclass[tikz, border=1cm]{standalone} \usetikzlibrary{backgrounds} \begin{document} \begin{tikzpicture}[line width=2pt, dot/.style 2 args={circle,fill,inner sep=1pt, label={[black,transform shape=true]#1:{$#2$}}} ] \def\myrot{-45} \begin{scope}[rotate=\myrot,local bounding box=bb] \draw (0, 0) coordinate (P) -- ++(4, 0) coordinate (Q) -- ++(0, 3) coordinate (R) -- ++(-4, 0) coordinate (S) -- cycle; \path foreach \p/\d in {P/45,Q/135,R/-135,S/-45} {(\p)coordinate[dot={\d}{\p}]}; \end{scope} \def\selector{0}% odd for scoped on background layer, otherwise for pgfonlayer. \ifodd\selector \begin{scope}{on background layer} \else \begin{pgfonlayer}{background} \fi \clip (bb.south west) rectangle (bb.north east) {[rotate=\myrot] (P) -- (Q) -- (R) -- (S) -- cycle}; \fill[lightgray!50] (bb.south west) rectangle (bb.north east); \ifodd\selector \end{scope} \else \end{pgfonlayer} \fi \draw (bb.south west) rectangle (bb.north east); \end{tikzpicture} \end{document}

  • How to number listings on the right like equations without captions and reference them?
    by SU3 on March 14, 2026 at 1:32 am

    I'm writing a technical document with many short listings, with typically fewer that 5 lines in each listing. Rather than adding captions to these short listings, I would like to number them similarly to how equations are numbered on the right and refer to them by these numbers. I would like for these numbers to appear in line with the first line of each listing. In the example below, I have partially emulated what I want to achieve. There are still two problems that I would like to solve. Can the numbers appear automatically for each instance of the lstlisting environment without typing @!\I@ on the first line of each one? How can I get correct reference numbers? Without \refstepcounter{lstlisting} in the definition of \I, I get [0] for each listing. The lstlisting environment does not appear to increment the lstlisting counter without a caption, which I'm trying to avoid. Even with my hack, \ref gives me the chapter number instead of the listing number; though with the hyperref package, clicking on the reference correctly takes me to the listing. Here is the latex code. \documentclass[11pt,letterpaper]{article} \usepackage[margin=1in]{geometry} \usepackage{indentfirst,xcolor} \usepackage[auto-lang=false]{lipsum} \usepackage{listings} \lstset{ xleftmargin=0.25in, basicstyle={\fontencoding{T1}\ttfamily}, upquote=true, showspaces=false, showstringspaces=false, escapeinside={@!}{@}, } \NewDocumentCommand{\I}{}{% \hfill {\refstepcounter{lstlisting}\color{gray}[\thelstlisting]}% } \setcounter{section}{4} \begin{document} \section{Example} \lipsum[1][1] \lstinline[language=c]{"some text"} is a string in C. \lipsum[1][2] \lstinline[language=Python]{'some text'} is a string in Python. \lipsum[1][3] \begin{lstlisting}[language=c,label={lst:c}] const char* str = "Hello"; @!\I@ \end{lstlisting} \lipsum[2][1-3] \begin{lstlisting}[language=Python,label={lst:python}] str1 = "Hello" @!\I@ str2 = 'World' \end{lstlisting} In Listing \ref{lst:c}, \lipsum[3][1] In Listing \ref{lst:python}, \lipsum[3][2] \end{document}

  • How force put \usepackage inside \begin{document} in case there is a conflict globally
    by user516076 on March 13, 2026 at 11:03 pm

    What I’m really asking is this: if a package bumps into conflicts with some macros or with another package, it can make you wonder whether you could somehow push \usepackage down until after \begin{document}. I know that sounds a bit messy, and I expect people may point me toward a cleaner setup and that the better answer may well be “don’t do that; restructure the document instead.”. But is there any tweak or workaround that would actually let you get away with that? Again, this is not the standard way to do things, and the right fix may simply be to restructure the document, but I want to know whether there is any workaround that would make delayed package loading possible. You may well ask, “Why?” At the moment, the best answer I can give is simply: why not? I realize this is unconventional, but we cannot always solve a problem by stepping around it; sometimes it is worth exploring a bolder approach. Packages that I can think of that I would use as an example are subfig and subcaption (doesn't directly mean that I talk about those two, but I have to make an MWE to demonstrate the question) Let's say main.tex: \documentclass{article} \usepackage{graphicx} \usepackage{subfig} \begin{document} Main text. \include{part} \end{document} and part.tex: \usepackage{subcaption} \begin{figure} \centering \caption{A test figure from the included file} \end{figure} I hope this is something that is not too stupid to ask about. Sorry in advance.

  • How to make \textrightarrow use the Roboto font in LaTeX?
    by monty01 on March 13, 2026 at 8:09 pm

    I am trying to use the Roboto font everywhere in my LaTeX document. I load it using the roboto package: \documentclass{article} \usepackage[sfdefault]{roboto} \begin{document} Some random text A \textrightarrow\ B Some random text \end{document} However, the arrow produced by \textrightarrow does not seem to come from the Roboto font. It looks different from the surrounding text. How can I make \textrightarrow use the Roboto so that it matches the rest of the document?

  • Page of variable length with Luatex
    by Manuel Cart on March 13, 2026 at 4:31 pm

    I have been using the following code for some time to create documents readable on a computer or phone : \documentclass{article} \usepackage{lipsum} \usepackage{geometry} \geometry{papersize={10cm,\maxdimen},vmargin=0.5cm,hmargin=0.5cm} \begin{document} \setbox0=\vbox\bgroup \lipsum[1-3] \egroup \pageheight=\dimexpr\ht0+1cm \unvbox0 \end{document} I am looking to modify it to use the book class and have each chapter be a page of variable length. Despite many attempts, I haven’t been able to make it work. I also tried with this answer, but I failed as well.

  • Overleaf editor text direction is backwards [closed]
    by logandihel on March 13, 2026 at 3:40 pm

    I accidentally pressed some keyboard shortcut in the Overleaf editor that made my text in the editor display from right to left (see the attached image below). I searched through the Overleaf keyboard shortcuts and menus, I've asked work colleagues, but still can't figure out a workaround. I believe the shortcut I pressed to get me into this mess is Ctrl+something else. How to do undo this and return to normal left to right text direction in the editor?

  • Forcing a cell of longtable to page break just like WYSIWYG does
    by user516076 on March 13, 2026 at 3:29 pm

    I want to have a long table like this: And yes, I've read some possible duplicates, and some people might make a comment such as it is impractical to have a table like this. However, I think if we have let's say 10 rows with one column fit to width table, and the 6th cell, for instance is about 2cm width long (still realistic) and there is only 1cm space before it goes to the next page, a WYSIWYG editor would give a break of that particular cell and treat them into two rows, even though essentially they are only one row. The example is the screenshot above, as you can see there, it is automatic and the cell is closed. It looks like 2 rows, but that is actually 1 row get separated by something similar to `\hrule' to close the cell. that's not a good example because I give an example with extra long cell. I'm trying this solution here and this is my best attempt so far: \documentclass[12pt]{article} \usepackage[a4paper,margin=2cm]{geometry} \usepackage{pdflscape} \usepackage{longtable} \usepackage{array} \usepackage{lipsum} \setlength{\LTleft}{0pt} \setlength{\LTright}{0pt} \newcolumntype{L}{>{\raggedright\arraybackslash}% p{\dimexpr\linewidth-2\tabcolsep-2\arrayrulewidth\relax}} \newcommand{\cellpart}[1]{#1\tabularnewline} \begin{document} \begin{landscape} \noindent \begin{longtable}{|L|} \hline \cellpart{\lipsum[1-4]} \cellpart{\lipsum[5-8]} \cellpart{\lipsum[9-12]} \cellpart{\lipsum[13-16]} \cellpart{\lipsum[17-20]} \hline \end{longtable} \end{landscape} \end{document} However, firstly, I want to close the opening cell. so that it is closed. Secondly, my code above is not automatic. I mean, I wish LaTeX break it to the next page when it reaches the last margin without slicing the row into several parts manually. How to? My problems: the page break is still manual, the cell is open. I want them closed, since it is manual, we do it by guessing (impractical), it causes not filling a page fully, implying giving a white space that is not filled up. I want it to be automatically flows to the next page if it reaches last margin. EDIT As @jlab suggested, I tried to use tcolorbox. Well, it is kind of working, however, the table looks ike have a curve vertex and it is not connecting well. It is a table, mind. not a breakable box. Latest attempt: \documentclass[a4paper]{article} \usepackage[margin=2cm]{geometry} \usepackage{lipsum} \usepackage{tcolorbox} \tcbuselibrary{breakable} \tcbset{breakable} \newtcolorbox{tablerow}{ enhanced jigsaw, breakable, skin first=enhanced, skin middle=enhanced, skin last=enhanced, colback=white, colframe=black, boxsep=0em, arc=0mm, boxrule=0pt, width=\linewidth, before skip=0pt, after skip=0pt } \newcommand{\Row}[1]{% \noindent \begin{tcolorbox} #1 \end{tcolorbox} %\vspace{-1pt} } \newcommand{\LastRow}[1]{% \noindent \begin{tcolorbox} #1 \end{tcolorbox} } \begin{document} \Row{\lipsum[1]} \Row{\lipsum[2]} \Row{\lipsum[3]} \Row{\lipsum[4-18]} % this one breaks automatically and stays closed \Row{\lipsum[19]} \LastRow{\lipsum[20]} \end{document} I believe I could change \vspace{-1pt} to make them intact, but I don't think that's a nice approach since it looks like overlapping. The vertex, though... It is not sharp like a rectangle. with adjusting \vspace{-1pt}, it is looking like overlapping round table. which is not attractive to see.

  • eps to pdf error after reinstall miktex if giving the path of eps file
    by AW_95 on March 13, 2026 at 3:04 pm

    I use TeXstudio and I had to reinstall miktex. Before that, it worked perfectly that I collected all my figure files in a folder and gave the path of them in every different tex file. This way I avoided many duplication. Since I have reinstalled miktex, the compiler fails this way, but if I copy the eps file into the same folder where the tex file is, then it works. I tried to give the full path and it fails too. Could you help me how could I include figures by giving their path again? Path of eps file is correct. Here is the includegraphics code that worked before: \includegraphics[width=0.75\textwidth]{../../Figures/FigR/FigR238.eps} The error I get: ! Package pdftex.def Error: File `../../Figures/FigR/FigR238-eps-conve rted-to.pdf' not found: using draft setting.

  • Trig label Issues on Graph
    by Nick B on March 13, 2026 at 1:07 pm

    I am trying to recreate this picture from the College Board. I am able to recreate the image with the x-axis labeled in fourths (pi). However, the original shows each label being 1/8 (pi). Each time I try to use specific xtick and xlabel, the spacing is incorrect. Is there an easier way I can do this? Here is my code: \documentclass[12pt]{article} \usepackage{fullpage,parskip,pgfplots} \pgfplotsset{compat=newest} \usetikzlibrary{arrows.meta} \begin{document} \begin{tikzpicture} \begin{axis}[ axis lines=middle, axis equal, clip=false, enlargelimits=false, xlabel={\(x\)}, ylabel={\(y\)}, title={Graph of \(f\)}, grid=major, grid style={black!75}, xmin=-2*pi/3,xmax=13*pi/6, ymin=-5,ymax=4, xtick={-0.75*pi, -0.5*pi, -0.25*pi, 0, 0.25*pi, 0.5*pi, 0.75*pi, pi, 1.25*pi, 1.5*pi, 1.75*pi, 2*pi, 2.25*pi}, xticklabels={, $-\frac{\pi}{2}$, , , , $\frac{\pi}{2}$, , $\pi$, , $\frac{3\pi}{2}$, , $2\pi$, }, ytick={-5, -4, -3, -2, -1, 0, 1, 2, 3, 4}, yticklabels={\(-5\), , \(-3\), , \(-1\), , \(1\), , \(3\)}, title style={ font=\Large, anchor=north, at={(rel axis cs: 0.5,0)}, yshift=-3mm, }, ticklabel style={fill=white}, axis line style={ thick,-{Triangle[length=3mm,width=2mm]},shorten >=-4mm,}, ticklabel style={fill=white, inner sep=1pt, font=\normalsize}, ] \addplot[samples=100,thick,domain=-2.09:6.54]{3*sin(deg(2*x-pi/2))}; \end{axis} \end{tikzpicture} \end{document} Any help would be appreciated. TYA

  • Allow column or page break after section heading
    by Dieter on March 13, 2026 at 9:48 am

    I'm still working on my dictionary and am facing a new issue. My MWE is based on the really good answer from @cabohah for my last question. In my dictionary I also have multiple entries which do not have translations into other languages, so the entries consist of just the "heading". But because these plain entries are derived from section, no column or page break is allowed to occur directly after them. This leads to a very stretched appearance of the column before the entries in question. Is there any way to allow a page or column break after a section header? % Posted by cabohah, modified by community. See post 'Timeline' for change history % Retrieved 2026-03-13, License - CC BY-SA 4.0 \documentclass{scrbook} \usepackage{scrlayer-scrpage} \usepackage{babel} \babeltags{dutch=dutch} \babeltags{dan=danish} \babeltags{swed=swedish} \babeltags{brit=british} \babeltags{fren=french} \babeltags{ital=italian} \babeltags{espan=spanish} \babeltags{port=portuguese} \babeltags{german=german} \usepackage[no-math]{fontspec} \usepackage[babel=true,nopatch=footnote,letterspace=150,]{microtype} \usepackage[colaction]{multicol} \usepackage{ragged2e} \usepackage{rotating} \usepackage{enumitem} \newlist{LanguageEntry}{itemize}{1} \setlist[LanguageEntry]{ noitemsep,% partopsep=0pt,% topsep=0pt,% parsep=0.3\baselineskip,% labelindent=2em,% labelwidth=2.8em,% align=parleft,% leftmargin=!,% } \DeclareNewSectionCommand[% style=section,% level=2,% beforeskip=4pt,% afterskip=0pt,% runin=false,% font=\normalfont\Large,% tocindent=0pt,% tocnumwidth=0pt,% ]{dictionaryentry} \RenewCommandCopy{\raggedsection}{\RaggedRight} \newcommand{\entry}[3][]{\def\thedictionaryentry{#2}\dictionaryentry[#1]{#3}} \newcommand{\entrygeneric}[3][]{% \begin{LanguageEntry}[#1] \item[\textit{#2}]{\RaggedRight #3} \end{LanguageEntry} }% \newcommand{\entrynl}[2][]{\entrygeneric[#1]{Holl.} {\begin{dutch} #2 \end{dutch}}} \newcommand{\entryda}[2][]{\entrygeneric[#1]{Dän.} {\begin{dan} #2 \end{dan}}} \newcommand{\entrysw}[2][]{\entrygeneric[#1]{Schw.} {\begin{swed} #2 \end{swed}}} \newcommand{\entryen}[2][]{\entrygeneric[#1]{Engl.} {\begin{brit} #2 \end{brit}}} \newcommand{\entryfr}[2][]{\entrygeneric[#1]{Franz.} {\begin{fren} #2 \end{fren}}} \newcommand{\entryit}[2][]{\entrygeneric[#1]{Ital.} {\begin{ital} #2 \end{ital}}} \newcommand{\entryes}[2][]{\entrygeneric[#1]{Span.} {\begin{espan} #2 \end{espan}}} \newcommand{\entrypt}[2][]{\entrygeneric[#1]{Port.} {\begin{port} #2 \end{port}}} \begin{document} \begin{multicols}{2} % AAK \entry{AKK}{Der Name eines Fahrzeugs für Rheinwein nach Holland gebracht wird.} \entrynl{Aak.} \entryda{Et Fartöj paa Rhinſtrömmen.} \entrysw{Et Farto̊g ſom nyttias på Rhinſtrömen.} \entryen{A ſort of flat bottomed lighter.} \entryfr{Aque, Acque.} \entryit{Un battello con fondo piano, di cui ſi ſervono ſopra il Reno.} \entryes{Una barca con fondo llano. ſobre el Reno.} \entrypt{Eſpecie de barca chata ſobre o Rheno.} % AAP. (Hochdeutſch Affe.) \entry{AAP.}{(Hochdeutſch Affe.)} \entrynl{Aap.} \entryda{Aben.} \entrysw{Apan.} \entryen{The mizen ſtay-ſail.} \entryfr{Voile d’etay d’artimon.} \entryit{La carbonera, o ſia la vela.} \entryes{Vela del humo, o vela.} \entrypt{Rabeca, ou vela do.} % ABAB \entry{ABAB.}{} \entrynl[beginpenalty=100000]{Een turkſch Matroos.} \entryda{En tyrkiſk Matros.} \entrysw{En tyrkiſk Matros.} \entryen{A turkiſh ſailor.} \entryfr{Un matelot turc.} \entryit{Un marinaro turco.} \entryes{Un marinero turco.} \entrypt{Hum marinheiro turco.} \entry{TEST.}{Wörterbucheintrag} \entry{TEST.}{Wörterbucheintrag} \entry{TEST.}{Wörterbucheintrag} \entry{TEST.}{Wörterbucheintrag} \entry{TEST.}{Wörterbucheintrag} \entry{TEST.}{Wörterbucheintrag} % AAPENFALL \entry{AAPENFALL.}{} \entrynl[beginpenalty=100000]{Aapenval.} \entryda{Abe-Fald.} \entrysw{Apan-eller Aben-Fall.} \entryen{The haliard of the mizen-ſtay-ſail.} \entryfr{La driſſe de la voile d’etay d’artimon.} \entryit{La drizza della carbonera.} \entryes{La driza de la vela del humo.} \entrypt{A driça da rabeca.} % ABAB \entry{ABAB.}{} \entrynl[beginpenalty=100000]{Een turkſch Matroos.} \entryda{En tyrkiſk Matros.} \entrysw{En tyrkiſk Matros.} \entryen{A turkiſh ſailor.} \entryfr{Un matelot turc.} \entryit{Un marinaro turco.} \entryes{Un marinero turco.} \entrypt{Hum marinheiro turco.} % ABANDONNEMENT \entry{ABANDONNEMENT.}{} \entrynl[beginpenalty=100000]{Het Abandoneeren van een Schip \&c. aan den Verzekeraar.} \entryda{En Afſtaaelſe og Overladelſe af Gods eller Skib til Aſſuradeuren.} \entrysw{Abandonera förſäkrade Skepp eller Gods til Aſſecuradeuren.} \entryen{The abandoning of a veſſel or goods to the inſurer for getting paid the inſured ſum.} \entryfr{Abandonnement.} \entryit{Abandonamento, ceſſione.} \entryes{Abandono.} \entrypt{Deixaçaõ, inteira ceſſaõ.} % ABANDONNEMENT \entry{ABANDONNEMENT.}{} \entrynl[beginpenalty=100000]{Het Abandoneeren van een Schip \&c. aan den Verzekeraar.} \entryda{En Afſtaaelſe og Overladelſe af Gods eller Skib til Aſſuradeuren.} \entrysw{Abandonera förſäkrade Skepp eller Gods til Aſſecuradeuren.} \entryen{The abandoning of a veſſel or goods to the inſurer for getting paid the inſured ſum.} \entryfr{Abandonnement.} \entryit{Abandonamento, ceſſione.} \entryes{Abandono.} \entrypt{Deixaçaõ, inteira ceſſaõ.} \end{multicols} \end{document}

  • Wrapfigure in two column
    by TeXnology on March 13, 2026 at 9:10 am

    How to set wrapfigure in two column as in the attached image? A minimal non-working example: \documentclass[twocolumn]{book} \usepackage{graphicx} \usepackage{lipsum} \begin{document} \begin{figure} \fbox{\hbox to 26pc{\vbox to 15pc{}}} \end{figure} \lipsum[1-6] \end{document}

  • landscape success, but page numbering and footer still in portrait mode
    by user516076 on March 13, 2026 at 1:32 am

    My wish List: I want. for footer starts from page 2 (landscape) it has : © Arrohmah Bogor 2026 (on the bottom left) aligned to margin. 0580/02/UT/2026 on the bottom centre starts from page 2 to 5, (I can change 5 to page number greater or lower than that) 0580/04/UT/2026 on the bottom centre starts from page 5 to end, (I can change 5 to page number greater or lower than that according to the previous scheme) Turn Over (on the bottom right aligned to margin. and only applies to odd pages) for header: starts from page 2 (landscape) it has: 0580/02 (on top most left aligned to margin, from page 2 to 5, (I can change 5 to page number greater or lower than that)) 0580/04 (on top most left aligned to margin, from page 5 to end, (I can change 5 to page number greater or lower than that)) Cambridge IGCSE - Mark Scheme\\textbf{UNIT TEST} (on top most centre) For examination\\From 2026 (on right most centre aligned to margin) \\ means enter newline. This code still has portrait page numbering and footer: \documentclass[12pt,twoside]{article} \usepackage[ a4paper, hmargin=2cm, vmargin=1.8cm ]{geometry} \usepackage{graphicx} \usepackage{tikz} \usepackage{enumitem} \usepackage{setspace} \usepackage[export]{adjustbox} \usepackage{fancyhdr} \usepackage{lipsum} \usepackage{array} \usepackage{amsmath} \usepackage{marginnote} \usetikzlibrary{calc} \usepackage{refcount} \usepackage{lastpage} \usepackage{pdflscape} \pagestyle{empty} \newcommand{\commandpage}{\pageref{LastPage}} %==================== PAGE STYLE FROM PAGE 2 ONWARD ==================== \fancypagestyle{mypages}{ \fancyhf{} \fancyhead[C]{\thepage} \fancyfoot[L]{\small © Arrohmah Bogor 2026} \fancyfoot[C]{\small 0580/02-04/MS/26} \fancyfoot[RO]{\small \textbf{[Turn Over]}} \renewcommand{\headrulewidth}{0pt} } \newcolumntype{L}[1]{>{\raggedright\arraybackslash}m{#1}} \newcolumntype{R}[1]{>{\raggedleft\arraybackslash}m{#1}} \begin{document} %==================== LOGOS ==================== \begingroup \setlength{\parindent}{0pt} \vspace*{-1.7cm} \begin{tabular}{@{}p{0.2\textwidth}@{}p{0.8\textwidth}@{}} \hspace*{-.25cm}\includegraphics[height=2.2cm,valign=m]{newarrohmah.png} & \hfill \includegraphics[trim=0 150 0 150,scale=.30,valign=m]{cambridge.png}\hspace*{-1cm} \end{tabular} \vspace{1cm} {\LARGE \textbf{Cambridge IGCSE\texttrademark}}% \vspace{10pt} Teacher : Mr. Shandy \vspace{0.6cm} \vspace{10pt} %==================== PAPER HEADER ==================== \hrule \begin{tabular}{@{}p{0.8\textwidth}@{}p{0.2\textwidth}@{}} \vspace*{-1mm} \textbf{MATHEMATICS} Paper 2 Non-calculator and Paper 4 Calculator (Extended) \vspace{2pt} MARK SCHEME \vspace{2pt} Maximum Mark: 100 & \raggedleft \vspace{-1mm} \textbf{0580/02} \textbf{March 2026} \textbf{2 hours} \end{tabular} \endgroup \vspace{3pt} \hrule \vspace{7in} \hrule \begin{center} This document has \textbf{\commandpage} pages. \end{center} \noindent \begin{tabular}{@{}p{0.5\textwidth}@{}p{0.5\textwidth}@{}} {\small © Arrohmah Bogor 2026} & \raggedleft {\small \textbf{[Turn Over]}} \end{tabular} \newpage %==================== PAGE 2 ONWARD LANDSCAPE ==================== \begin{landscape} \pagestyle{mypages} \lipsum \end{landscape} \end{document} Trying to implement this reference as my best attempt, ended up with this update: \documentclass[12pt,twoside]{article} \usepackage[ a4paper, hmargin=2cm, vmargin=1.8cm ]{geometry} \usepackage{graphicx} \usepackage{tikz} \usepackage{enumitem} \usepackage{setspace} \usepackage[export]{adjustbox} \usepackage{fancyhdr} \usepackage{lipsum} \usepackage{array} \usepackage{amsmath} \usepackage{marginnote} \usetikzlibrary{calc} \usepackage{refcount} \usepackage{lastpage} \usepackage{pdflscape} \usepackage{everypage} \pagestyle{empty} \newcommand{\commandpage}{\pageref{LastPage}} %==================== PAGE STYLE FROM PAGE 2 ONWARD ==================== \fancypagestyle{mypages}{ \fancyhf{} \fancyhead[C]{\thepage} \fancyfoot[L]{\small © Arrohmah Bogor 2026} \fancyfoot[C]{\small 0580/02-04/MS/26} \fancyfoot[RO]{\small \textbf{[Turn Over]}} \renewcommand{\headrulewidth}{0pt} } \newcolumntype{L}[1]{>{\raggedright\arraybackslash}m{#1}} \newcolumntype{R}[1]{>{\raggedleft\arraybackslash}m{#1}} % ---------- Rotated footer for landscape pages ---------- \newlength{\hfoot} \newlength{\vfoot} \AddEverypageHook{% \ifdim\textwidth=\linewidth\relax % portrait page -> do nothing \else % landscape page \setlength{\hfoot}{-\topmargin}% \addtolength{\hfoot}{-\headheight}% \addtolength{\hfoot}{-\headsep}% \addtolength{\hfoot}{-.5\linewidth}% \ifodd\value{page} \setlength{\vfoot}{\oddsidemargin}% \else \setlength{\vfoot}{\evensidemargin}% \fi \addtolength{\vfoot}{\textheight}% \addtolength{\vfoot}{\footskip}% \raisebox{\hfoot}[0pt][0pt]{% \rlap{% \hspace{\vfoot}% \rotatebox[origin=cB]{90}{% \makebox[\textheight][c]{% \small © Arrohmah Bogor 2026\hfill \thepage\hfill 0580/02-04/MS/26\hfill \textbf{[Turn Over]}% }% }% }% }% \fi } \begin{document} %==================== LOGOS ==================== \begingroup \setlength{\parindent}{0pt} \vspace*{-1.7cm} \begin{tabular}{@{}p{0.2\textwidth}@{}p{0.8\textwidth}@{}} \hspace*{-.25cm}\includegraphics[height=2.2cm,valign=m]{newarrohmah.png} & \hfill \includegraphics[trim=0 150 0 150,scale=.30,valign=m]{cambridge.png}\hspace*{-1cm} \end{tabular} \vspace{1cm} {\LARGE \textbf{Cambridge IGCSE\texttrademark}}% \vspace{10pt} Teacher : Mr. Shandy \vspace{0.6cm} \vspace{10pt} %==================== PAPER HEADER ==================== \hrule \begin{tabular}{@{}p{0.8\textwidth}@{}p{0.2\textwidth}@{}} \vspace*{-1mm} \textbf{MATHEMATICS} Paper 2 Non-calculator and Paper 4 Calculator (Extended) \vspace{2pt} MARK SCHEME \vspace{2pt} Maximum Mark: 100 & \raggedleft \vspace{-1mm} \textbf{0580/02} \textbf{March 2026} \textbf{2 hours} \end{tabular} \endgroup \vspace{3pt} \hrule \vspace{7in} \hrule \begin{center} This document has \textbf{\commandpage} pages. \end{center} \noindent \begin{tabular}{@{}p{0.5\textwidth}@{}p{0.5\textwidth}@{}} {\small © Arrohmah Bogor 2026} & \raggedleft {\small \textbf{[Turn Over]}} \end{tabular} \newpage %==================== PAGE 2 ONWARD LANDSCAPE ==================== \begin{landscape} \pagestyle{empty} \lipsum[1-8] \newpage \lipsum[9-16] \end{landscape} \end{document} Givng me this result: It's kind of working, but I want the Arrohmah on the left aligning the outer first margin and the Turn Over (odds only) the most right part aligning the margin from the left. The paper code on bottom most centre and the page numbering on top most centre. (Exactly just like the portrait, but this for landscape that starts from page 2 to the end). EDIT: This is the stripped version and the updated version from the suggestion by @Explorer. But still a disaster: \documentclass[12pt,twoside]{article} \usepackage[a4paper,hmargin=2cm,vmargin=1.8cm]{geometry} \usepackage{lipsum} \usepackage{lastpage} \usepackage{pdflscape} \pagestyle{empty} \newcommand{\commandpage}{\pageref{LastPage}} \newcommand{\switchpage}{5} \newcommand{\leftheadercode}{% \ifnum\value{page}<\switchpage 0580/02\else 0580/04\fi } \newcommand{\centrefootercode}{% \ifnum\value{page}<\switchpage 0580/02/UT/2026\else 0580/04/UT/2026\fi } \ExplSyntaxOn \bool_new:N \l_landscape_bool \coffin_new:N \l_footer_coffin \coffin_new:N \l_header_left_coffin \coffin_new:N \l_header_center_coffin \coffin_new:N \l_header_right_coffin \dim_new:N \g_saved_textwidth_dim \dim_new:N \g_saved_textheight_dim \hook_gput_code:nnn { begindocument/end } { . } { \dim_gset:Nn \g_saved_textwidth_dim { \textwidth } \dim_gset:Nn \g_saved_textheight_dim { \textheight } } \hook_gput_code:nnn { env/landscape/begin } { . } { \bool_set_true:N \l_landscape_bool } \hook_gput_code:nnn { env/landscape/end } { . } { \bool_set_false:N \l_landscape_bool } \hook_gput_code:nnn { shipout/background } { . } { \bool_if:NT \l_landscape_bool { \hcoffin_set:Nn \l_header_left_coffin { \small \leftheadercode } \coffin_rotate:Nn \l_header_left_coffin { 90 } \vcoffin_set:Nnn \l_header_center_coffin { 4cm } { \centering \small Cambridge IGCSE - Mark Scheme \\ \small \textbf{UNIT TEST} } \coffin_rotate:Nn \l_header_center_coffin { 90 } \vcoffin_set:Nnn \l_header_right_coffin { 3.5cm } { \raggedleft \small For examination \\ \small From 2026 } \coffin_rotate:Nn \l_header_right_coffin { 90 } \hcoffin_set:Nn \l_footer_coffin { \small © Arrohmah Bogor 2026 \hspace*{\fill} \centrefootercode \hspace*{\fill} \ifodd\value{page}\textbf{[Turn Over]}\fi } \coffin_rotate:Nn \l_footer_coffin { 90 } \put ( \dim_eval:n { \oddsidemargin + 1in - \headsep }, \dim_eval:n { -1in - \topmargin - \headheight - 8pt } ) { \coffin_typeset:Nnnnn \l_header_left_coffin { b } { hc } { 0pt } { 0pt } } \put ( \dim_eval:n { \oddsidemargin + 1in + 0.5\g_saved_textwidth_dim }, \dim_eval:n { -1in - \topmargin - \headheight - 8pt } ) { \coffin_typeset:Nnnnn \l_header_center_coffin { b } { hc } { 0pt } { 0pt } } \put ( \dim_eval:n { \oddsidemargin + 1in + \g_saved_textwidth_dim + \headsep }, \dim_eval:n { -1in - \topmargin - \headheight - 8pt } ) { \coffin_typeset:Nnnnn \l_header_right_coffin { b } { hc } { 0pt } { 0pt } } \put ( \dim_eval:n { \footskip + \oddsidemargin + 1in + \g_saved_textwidth_dim }, \dim_eval:n { -1in - \topmargin - 0.5\g_saved_textheight_dim - \headheight - \headsep } ) { \coffin_typeset:Nnnnn \l_footer_coffin { t } { hc } { 0pt } { 0pt } } } } \ExplSyntaxOff \begin{document} Page 1 \begin{center} This document has \textbf{\commandpage} pages. \end{center} \newpage \begin{landscape} \lipsum[1-8] \newpage \lipsum[9-16] \end{landscape} \end{document} Latest attempt (screenshot): Last Edit: This may be the last edit. I just can't. No matter what I've tried it never gave me success. I guess considering to use M. Word is the best idea :') \documentclass[12pt,twoside]{article} \usepackage[ a4paper, hmargin=2cm, vmargin=1.8cm, headheight=30pt ]{geometry} \usepackage{graphicx} \usepackage{tikz} \usepackage{enumitem} \usepackage{setspace} \usepackage[export]{adjustbox} \usepackage{fancyhdr} \usepackage{lipsum} \usepackage{array} \usepackage{amsmath} \usepackage{marginnote} \usetikzlibrary{calc} \usepackage{refcount} \usepackage{lastpage} \usepackage[pdftex]{lscape} \pagestyle{empty} \newcommand{\commandpage}{\pageref{LastPage}} \newcommand{\switchpage}{5} \newcommand{\leftheadercode}{% \ifnum\value{page}<\switchpage 0580/02% \else 0580/04% \fi } \newcommand{\centrefootercode}{% \ifnum\value{page}<\switchpage 0580/02/UT/2026% \else 0580/04/UT/2026% \fi } \fancypagestyle{landscapepages}{% \fancyhf{} \fancyhead[LE,LO]{\small\leftheadercode} \fancyhead[CE,CO]{\small\shortstack[c]{Cambridge IGCSE - Mark Scheme\\\textbf{UNIT TEST}}} \fancyhead[RE,RO]{\small\shortstack[r]{For examination\\From 2026}} \fancyfoot[LE,LO]{\small © Arrohmah Bogor 2026} \fancyfoot[CE,CO]{\small\centrefootercode} \fancyfoot[RE,RO]{\small\ifodd\value{page}\textbf{[Turn Over]}\fi} \renewcommand{\headrulewidth}{0pt} \renewcommand{\footrulewidth}{0pt} } \newcolumntype{L}[1]{>{\raggedright\arraybackslash}m{#1}} \newcolumntype{R}[1]{>{\raggedleft\arraybackslash}m{#1}} \newcommand{\switchtolandscape}{% \clearpage \newgeometry{ paperwidth=297mm, paperheight=210mm, left=2cm, right=2cm, top=1.8cm, bottom=1.8cm, headheight=30pt }% \pdfpagewidth=\paperwidth \pdfpageheight=\paperheight \setlength{\headwidth}{\textwidth} \pagestyle{landscapepages} } \begin{document} %==================== LOGOS ==================== \begingroup \setlength{\parindent}{0pt} \vspace*{-1.7cm} \begin{tabular}{@{}p{0.2\textwidth}@{}p{0.8\textwidth}@{}} \hspace*{-.25cm}\includegraphics[height=2.2cm,valign=m]{newarrohmah.png} & \hfill \includegraphics[trim=0 150 0 150,scale=.30,valign=m]{cambridge.png}\hspace*{-1cm} \end{tabular} \vspace{1cm} {\LARGE \textbf{Cambridge IGCSE\texttrademark}}% \vspace{10pt} Teacher : Mr. Shandy \vspace{0.6cm} \vspace{10pt} %==================== PAPER HEADER ==================== \hrule \begin{tabular}{@{}p{0.8\textwidth}@{}p{0.2\textwidth}@{}} \vspace*{-1mm} \textbf{MATHEMATICS} Paper 2 Non-calculator and Paper 4 Calculator (Extended) \vspace{2pt} MARK SCHEME \vspace{2pt} Maximum Mark: 100 & \raggedleft \vspace{-1mm} \textbf{0580/02} \textbf{March 2026} \textbf{2 hours} \end{tabular} \endgroup \vspace{3pt} \hrule \vspace{7in} \hrule \begin{center} This document has \textbf{\commandpage} pages. \end{center} \noindent \begin{tabular}{@{}p{0.5\textwidth}@{}p{0.5\textwidth}@{}} {\small © Arrohmah Bogor 2026} & \raggedleft {\small \textbf{[Turn Over]}} \end{tabular} \switchtolandscape \lipsum[1-8] \newpage \lipsum[9-16] \lipsum \lipsum[1-50] \end{document}

  • Drawing a Manifold in tikz
    by Hassium on March 12, 2026 at 8:21 pm

    I am trying to draw a manifold using tikz. The best way I can think of is to give several points and generates smooth lines connecting those points. Here is my draft: \documentclass{article} \usepackage{amsmath,amssymb,amsthm} \usepackage{tikz} \begin{document} \begin{tikzpicture} \draw[thick] plot [smooth cycle, tension=1] coordinates { (-2.5,0) (-1.6,1) (0,0.55) (1.6,1) (2.5,0) (1.6,-1) (0,-0.55) (-1.6,-1) }; \draw[thick] (-1.85, -0.05) to[out=-30, in=210] (-0.95, -0.05); \draw[thick] (-1.7, -0.1) to[out=45, in=135] (-1.1, -0.1); \end{tikzpicture} \end{document} The lines are not very smooth. Is there a way to make the lines more smooth? Or is there a better strategy to draw this? Thanks in advance.

  • Count spaces in LaTeX
    by Vincent on March 12, 2026 at 7:11 pm

    I would like to create a fast/optimized fully expandable function that counts the number of spaces in an argument: \documentclass{article} \begin{document} \countspaces{ A B } % Should return 3 (1 is ok too if leading and trailing spaces are removed) \countspaces{A \mycommand B} % Should return 2 (\mycommand is not expanded) \countspaces{A {a b c} B} % Should return 2 (spaces inside groups are not counted) \end{document} Explicit spaces should be counted too. How to achieve that?

  • Problem with multicols in tcolorbox
    by CasperYC on March 12, 2026 at 11:10 am

    \documentclass[a4paper,12pt, scheme = plain]{ctexart} \usepackage{amsmath,enumerate} \usepackage[export]{adjustbox} % uses graphicx \usepackage{graphicx} \usepackage{xcolor} \usepackage[margin = 1.5cm]{geometry} %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% \usepackage{tcolorbox} \tcbuselibrary{skins,xparse,breakable,listings} \tcbset{% colback = white, colframe = black, title filled = false, colbacktitle = white, % 框的背景 enhanced, breakable }%% %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% \NewTColorBox[ auto counter, number freestyle = {Example \,\noexpand\arabic{\tcbcounter} }, ]{question}{ O{}mo }{ fonttitle = \bfseries, title = \thetcbcounter: #2, % 显示source coltitle = black, % 标题的颜色 (默认白色背景!!!!!) before lower = {\textbf{Solution:} \par}, #1 }%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% \usepackage{multicol} % cover page multicol \setlength{\columnsep}{3cm} \setlength{\columnseprule}{1pt} \def\columnseprulecolor{\color{blue}} %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% \def\d{{\rm d}} \newcommand{\qaq}{\quad \text{and} \quad} %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% \begin{document} \begin{question}{Integrating $\sin^2(x)$ and $\cos^2(x)$} Find \[ \int \sin^2(x) \, \d x \qaq \int \cos^2(x) \, \d x \] \tcblower%% \phantom{aaa} \begin{multicols}{2} \begin{align*} \int \sin^2(x) \, \d x &= \int \frac{1}{2} - \frac{1}{2} \cos(2x) \, \d x \\ &= \frac{1}{2}x - \frac{1}{4} \sin(2x) + \text{constant} \end{align*} \begin{align*} \int \cos^2(x) \, \d x &= \int \frac{1}{2} + \frac{1}{2} \cos(2x) \, \d x \\ &= \frac{1}{2}x + \frac{1}{4} \sin(2x) + \text{constant} \end{align*} \end{multicols} \end{question} %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% \begin{enumerate} \item \phantom{aaa} \begin{question}{Integrating $\sin^2(x)$ and $\cos^2(x)$} Find \[ \int \sin^2(x) \, \d x \qaq \int \cos^2(x) \, \d x \] \tcblower%% \begin{multicols}{2} \begin{align*} \int \sin^2(x) \, \d x &= \int \frac{1}{2} - \frac{1}{2} \cos(2x) \, \d x \\ &= \frac{1}{2}x - \frac{1}{4} \sin(2x) + \text{constant} \end{align*} \begin{align*} \int \cos^2(x) \, \d x &= \int \frac{1}{2} + \frac{1}{2} \cos(2x) \, \d x \\ &= \frac{1}{2}x + \frac{1}{4} \sin(2x) + \text{constant} \end{align*} \end{multicols} \end{question} \end{enumerate} \end{document} %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% The normal case is okish, except that the margin is a bit over. And in the enumerate environment, it gets even worse. In both cases, the horizontal baselines do not seem to agree either...

  • Increase tcolorbox text width to correspond to page text width
    by Thomas on March 12, 2026 at 9:39 am

    I'm displaying some text inside a box using tcolorbox, and I'd like that the width of the text inside it to fit the size of the text width of the whole page. By default, the bex fits this size, so I'd like to increase it slightly. Here is a small example, with the package showframe loaded to display the margin of the page. \documentclass[10pt]{article} \usepackage{tcolorbox} \usepackage{lipsum} \usepackage{showframe} \begin{document} \begin{tcolorbox} \lipsum[1] \end{tcolorbox} \lipsum[2] \end{document} It produces this: And here is the results i'd like the blox to look like (I've created this image by stretching the screenshot on gimp): I tried to manually set the text width of tcolorbox to \textwidth, but the bloc is still aligned on the left of the page.

  • How to create lines perfectly lie on a circle shape with TikZ?
    by user516076 on March 12, 2026 at 6:49 am

    It's very difficult to make a perfect line that lies on exact circle. This is my full work: \documentclass[tikz,border=1pt]{standalone} \usepackage{tikz} \usepackage{calligra} \usepackage[T1]{fontenc} \begin{document} \begin{tikzpicture}[line width=1pt] \path[use as bounding box] (-5.6,-1.2) rectangle (6.4,7.2); % Circle \draw (2.6,3.0) circle (3.1); % Secant line P-T-U \draw (-5.0,0.1) -- (4.7,5.6); % Chords \draw (2.6,2.3) -- (1.2,1.7); % short chord near S \draw (1.2,1.7) -- (4.0,1.4); % S to V \draw (4.0,1.4) -- (4.7,5.6); % V to U % Angle at S \draw (1.2,1.7) ++(0.55,0) arc[start angle=0,end angle=123,radius=0.55]; % Angle at V \draw (4.0,1.4) ++(-0.55,0) arc[start angle=180,end angle=95,radius=0.55]; % Labels \node[font=\fontsize{34}{34}\selectfont] at (-5.0,-0.4) {$P$}; \node[font=\fontsize{34}{34}\selectfont] at (0.2,2.9) {$T$}; \node[font=\fontsize{34}{34}\selectfont] at (5.2,5.9) {$U$}; \node[font=\fontsize{34}{34}\selectfont] at (4.3,0.4) {$V$}; \node[font=\fontsize{34}{34}\selectfont] at (0.9,0.7) {$S$}; % Angle labels \node[font=\fontsize{28}{28}\selectfont] at (2.0,2.5) {$123^\circ$}; \node[font=\fontsize{28}{28}\selectfont] at (3.6,2.0) {$85^\circ$}; \end{tikzpicture} \end{document} and this is the result: What I want: Please along with full MWE ready to copy paste, could you explain, what the trick is and what to add and where to add, so that I can also learn? T.I.A.

  • how to trim inside TikZ?
    by user516076 on March 12, 2026 at 1:13 am

    MWE: \documentclass[tikz,border=1pt]{standalone} \usepackage{tikz} \usepackage{calligra} \usepackage[T1]{fontenc} \begin{document} \begin{tikzpicture}[line width=1pt] % \path[use as bounding box] (1,0) rectangle (12,7); % Outer rectangle \draw (0,0) rectangle (12,7); % Curvy E outside the box \node[anchor=center, font=\calligra\fontsize{38}{38}\selectfont] at (-1.5,6.75) {E}; % Left circle \draw (4.0,3.4) circle (2.75); % Right circle \draw (8.25,3.45) circle (2.2); % Labels \node[font=\fontsize{28}{28}\selectfont] at (1.8,5.8) {$P$}; \node[font=\fontsize{28}{28}\selectfont] at (9.4,5.9) {$Q$}; \end{tikzpicture} \end{document} This gives me this picture: There, you see a white space on the left that needs to be trimmed. My best knowledge is using: \path[use as bounding box] (1,0) rectangle (12,7); but it gives me: I want to control it like 1pt or 2pt or 1cm, 2cm to mean that I trim that much. How to do that? I tried to control (1,0), but it doesn't work as I expected. Also, if possible, I don't want to crop it outside, like using \includegraphs and trim it. It is saving time to trim it inside the TikZ, IMHO.

  • Counting total award points
    by user516076 on March 12, 2026 at 12:31 am

    As a teacher, you might find this question relatable should you be bothered by making sure that the sum of marks is a certain number when you make an exam. Since I believe LaTeX has control flow, I think it would be great to have a feature to count how many marks I have made so far. So, in this particular document, if it is possible, could I have a mini program that would print a number of sum of the marks? If I exceed the number of max marks, it will give a warning that been printed out below the instruction. just like if else condition. To ilustrate it, Suppose my first problem gives [3] marks, second problem has [4] marks, third problem has [1] mark and the last problem has [6] marks. I want a command to print the sum of them in a sentence like this: The total mark for this paper is \mark. Is this doable? How to? I'll just provide this MWE and let you geniuses take care of it please. T.I.A. \documentclass[12pt]{article} \usepackage[a4paper,margin=1in]{geometry} \usepackage{enumitem} \usepackage{amsmath} \begin{document} %======================== % First page %======================== \begin{center} {\Large \textbf{Sample Examination Paper}}\\[1em] {\large Mathematics}\\[2em] \end{center} \noindent \textbf{Candidate Name:} \rule{10cm}{0.4pt} \vspace{2em} \noindent \textbf{Instructions} \begin{enumerate}[leftmargin=2em] \item Write your name clearly in the space provided above. \item Answer \textbf{all five questions}. \item Write your answers in the spaces provided in this question paper. \item If you need additional space, use lined paper and attach it securely to this paper. \item You may use an HB pencil for graphs and diagrams. \item You should show all necessary working clearly. \item The total mark for this paper is \textbf{19}. \end{enumerate} \vfill \begin{center} \textit{Turn over for the first question} \end{center} \newpage %======================== % Questions %======================== \noindent \textbf{1.} Solve the equation \[ 3x - 7 = 11. \] \begin{flushright} [3] \end{flushright} \vspace{5cm} \noindent \textbf{2.} Expand and simplify \[ (x+2)(x-5). \] \begin{flushright} [4] \end{flushright} \vspace{5cm} \noindent \textbf{3.} A triangle has base $8$ cm and height $5$ cm. Calculate its area. \begin{flushright} [1] \end{flushright} \vspace{5cm} \noindent \textbf{4.} Differentiate \[ y = 4x^3 - 2x + 6. \] \begin{flushright} [5] \end{flushright} \vspace{5cm} \noindent \textbf{5.} The first three terms of a sequence are \[ 2,\ 5,\ 8,\ \dots \] Find the 10th term of the sequence. \begin{flushright} [6] \end{flushright} \vspace{5cm} \end{document} As you can see there. It is still a manual writing "19". so there, perhaps how to create command such as \mark. so it would print 19 by itself, because the LaTeX does the maths automatically. And if it exceeds 19, then print WARNING: TOTAL MARKS EXCEED 19.

  • How do I make all my tabular cells be vertically centered?
    by Draconis on March 11, 2026 at 4:08 am

    I'm working on a document that contains quite a lot of tables. In many of these tables, some columns have normal text, while other columns have other things (e.g. inline images, math formulae, etc) that are taller than a normal line of text. With a normal tabular environment, the text ends up on the same baseline as the larger things, which doesn't look good. I would prefer it be vertically centered, so that the midline of the text lines up with the midline of the larger things. I've seen the tabularray package suggested, but it looks like that uses a very different syntax from a normal tabular, and I have many tables to update and a deadline in two days. I'm open to switching if there's a straightforward way to convert tabulars into tabularrays without changing anything about the default appearance or behavior, but otherwise, I'm worried about the dimensions changing. So: is there some way to change the behavior of a tabular (a certain table, a certain column, even a certain cell if necessary) so that text in cells is vertically centered, without changing anything else about its dimensions and layout? MWE: \documentclass[12pt,letterpaper]{book} \usepackage{booktabs} \begin{document} \begin{table}[h] \centering \begin{tabular}{ccc} \toprule Normal & Bigger & Normal \\ \midrule Lorem & {\Huge XYZ} & Ipsum \\ \midrule Dolor & {\Huge ABC} & Sit \\ \midrule Consec & {\Huge JKL} & Tetur \\ \bottomrule \end{tabular} \end{table} \end{document} I would like the midline of the smaller text to line up with the midline of the huge text, while keeping everything else about the table the same. I've seen many questions about vertically centering text in table columns, but none of the answers I've seen allow keeping the rest of the table the same (they tend to involve switching to a different environment with different behavior). I've seen that a single-cell multicolumn will center things vertically, but adding those to every single cell in many separate tables is going to be a nightmare, so I'd prefer something I can use once per table instead of once per cell if possible.

  • Inline formula baseline issues of `a` with TeX Gyre Pagella Math?
    by Explorer on March 11, 2026 at 3:33 am

    Here below is the example code: \documentclass{article} \usepackage{unicode-math} \setmathfont{TeX Gyre Pagella Math} \begin{document} Inline $(\frac{1}{b} , \frac{1}{a})$ \[ (\frac{1}{b} , \frac{1}{a})\] \end{document} Noted that the baseline of a is abnormal when inline, but normal in display. Is that a bug or feature of TeX Gyre Pagella Math? That is also quite confusing for me that why inline and display behave quite different, is not the same a glyph was used? Any hot-fix to change the baseline in inline math for a here? Any tricks(maybe luatex?) are all welcome!

  • Drawing a topological surface of genus three
    by InsideOut on March 8, 2026 at 12:56 pm

    I would need your help to draw a surface of genus three like in the picture I attached. More specifically, I aim to draw a torus (surface of genus one) and below the surface of genus three realised by mean of some surgeries on the surface. I already drawn the torus by myself and I need help with the genus 3 surface. As you can see, the torus I drew is not exactly as on paper. Could help me? I also added some notes about colours of curves. Moreover, I'd like the surface is filled with the pattern [pattern=north west lines, pattern color=pallido], where pallido is just a colour I defined in RGB (it's already in the code). In the picture I do not need the names of colours, that's only for you. Thank you in advance! \documentclass[11pt,a4wide]{article} \usepackage[latin1]{inputenc} \usepackage{fancyhdr} \usepackage{indentfirst} \usepackage{graphicx} \usepackage{newlfont} \usepackage{amssymb} \usepackage{amsmath} \usepackage{latexsym} \usepackage{lscape} \usepackage{booktabs} \usepackage{amsthm} \usepackage{lscape} \usepackage{tikz} \usetikzlibrary{patterns,hobby} \usepackage{pgfplots} \pgfplotsset{compat=1.6} \usepackage{faktor} %\faktor{A}{B} %\usepackage{pictexwd,dcpic} \usepackage{pgf,tikz} \usepackage{pgfplots} \pgfplotsset{compat=1.18} \usetikzlibrary{arrows.meta} \usetikzlibrary{decorations.markings} \usetikzlibrary{bending} \usetikzlibrary{patterns} \usetikzlibrary{intersections, calc} \usetikzlibrary{decorations.pathmorphing} \usepackage{soul} \usepackage{rotating} \usepackage[margin=3cm]{geometry} \usepackage{enumitem} \usepackage{color} \usepackage{hyperref} \definecolor{smoked}{RGB}{216, 212, 204} \definecolor{mauve}{RGB}{200, 55, 171} \definecolor{apricot}{RGB}{250, 144, 4} \definecolor{sky}{RGB}{66, 169, 244} \definecolor{plum}{RGB}{76, 0, 102} \definecolor{forest}{RGB}{90,145,120} \definecolor{sand}{RGB}{180,160,120} \begin{document} \begin{figure}[h!] \centering \begin{tikzpicture}[scale=2, every node/.style={scale=0.875}] \definecolor{pallido}{RGB}{221,227,227} \pattern [pattern=north west lines, pattern color=pallido] (0,0) ellipse (3cm and 2cm); \fill [white] (0,0) ellipse (1cm and 0.66cm); \draw[thin, black] (0,0) ellipse (3cm and 2cm) (0,0) ellipse (1cm and 0.66cm); \draw[orange] (0,0) ellipse (2cm and 1.25cm); %\draw[blue] (0,0) arc (030:060:2.5cm and 1.5cm); \draw[blue] (0,0) +(30:2.4 and 1.6) arc [start angle=30, end angle=60, x radius=2.4, y radius=1.6]; \draw[blue] (0,0) +(210:2.4 and 1.6) arc [start angle=210, end angle=240, x radius=2.4, y radius=1.6]; \draw[violet] (0,0) +(120:1.2 and 0.8) arc [start angle=120, end angle=150, x radius=1.2, y radius=0.8]; \draw[violet] (0,0) +(300:1.2 and 0.8) arc [start angle=300, end angle=330, x radius=1.2, y radius=0.8]; \draw[red ] (0 ,-0.66) to[bend left ] (0,-2); \draw[sky ] (0 , 0.66) to[bend left ] (0, 2); \draw[thin, red, dashed] (0 ,-0.66) to[bend right] (0,-2); \draw[thin, sky, dashed] (0 , 0.66) to[bend right] (0, 2); \fill ( 0.2,-1.25) circle (1pt); \fill (-0.2, 1.25) circle (1pt); \fill[violet] (0,0) +(120:1.2 and 0.8) circle (0.5pt); \fill[violet] (0,0) +(150:1.2 and 0.8) circle (0.5pt); \fill[violet] (0,0) +(300:1.2 and 0.8) circle (0.5pt); \fill[violet] (0,0) +(330:1.2 and 0.8) circle (0.5pt); \fill[blue] (0,0) +(030:2.4 and 1.6) circle (0.5pt); \fill[blue] (0,0) +(060:2.4 and 1.6) circle (0.5pt); \fill[blue] (0,0) +(210:2.4 and 1.6) circle (0.5pt); \fill[blue] (0,0) +(240:2.4 and 1.6) circle (0.5pt); \draw[black, thin] (0,0) +(030:2.4 and 1.6) circle (1pt); \draw[black, thin] (0,0) +(060:2.4 and 1.6) circle (1pt); \draw[black, thin] (0,0) +(210:2.4 and 1.6) circle (1pt); \draw[black, thin] (0,0) +(240:2.4 and 1.6) circle (1pt); \draw[violet] (0,0) +(120:1.2 and 0.8) circle (1pt); \draw[violet] (0,0) +(150:1.2 and 0.8) circle (1pt); \draw[violet] (0,0) +(300:1.2 and 0.8) circle (1pt); \draw[violet] (0,0) +(330:1.2 and 0.8) circle (1pt); \node at ( 1.75 , 1.25 ) {\(e_{1,1}\)}; \node at (-1.75 ,-1.25 ) {\(e_{1,2}\)}; \node at (-1.0625, 0.625) {\(e_{2,1}\)}; \node at ( 1.0625,-0.625) {\(e_{2,2}\)}; \end{tikzpicture} \caption{} \label{fig:hypermin} \end{figure} \end{document} My current result The picture I wish to draw: