• tikzpicture placing is different as specified
    by Rup_LA on October 8, 2026 at 1:48 pm

    I am writing a document and used tikzpicture in an example. After the example, a section begins. But after compiling, I am getting the next section before the tikzpicture diagram, while my code says it to do otherwise. Why is it happening? I am sharing a fragment of the code here as the code for the whole document is too large: \begin{example} Here we give examples of two simple graphs where adding an edge results in spectral integral variation in one and two places. We also give one example where adding an edge does not result in spectral integral variation. The spectrum of each graph are written below that graph. \begin{figure}[htbp] \centering \tikzset{ vertex/.style={circle, draw=black, fill=white, inner sep=0pt, minimum size=4pt, thick} } % Left Graph \begin{tikzpicture}[baseline=(c.base), thick] % Coordinates: center and 4 cardinal directions \node[vertex] (c) at (0, 0) {}; \node[vertex] (n) at (0, 1.2) {}; \node[vertex](s) at (0, -1.2) {}; \node[vertex] (w) at (-1.2, 0) {}; \node[vertex] (e) at (1.2, 0) {}; % Edges forming the cross \draw (n) -- (c) -- (s); \draw (w) -- (c) -- (e); \node[below=1em of s] {$\{0, 1, 1, 1, 5\}$}; \end{tikzpicture} \hspace{2.5cm} % Right Graph \begin{tikzpicture}[baseline=(c.base), thick] % Coordinates \node[vertex] (c) at (0, 0) {}; \node[vertex] (n) at (0, 1.2) {}; \node[vertex] (s) at (0, -1.2) {}; \node[vertex] (w) at (-1.2, 0) {}; \node[vertex] (e) at (1.2, 0) {}; % Edges forming the cross plus the diagonal \draw (n) -- (c) -- (s); \draw (w) -- (c) -- (e); \draw[red] (s) -- (e); % Label underneath \node[below=1em of s] {$\{0, 1, 1, 3, 5\}$}; \end{tikzpicture} \\ \vspace{3em} \begin{tikzpicture}[baseline=(c.base), thick] \node[vertex] (u) at (0,0) {}; \node[vertex] (v) at (1.2,0) {}; \node[vertex] (w) at (2.4,0) {}; \draw (u) -- (v); \node[below=1em of v] {$\{ 0,0,2\}$}; \node[vertex] (p) at (5,0) {}; \node[vertex] (q) at (6.2,0) {}; \node[vertex] (r) at (7.4,0) {}; \draw (p) -- (q); \draw[red] (q) --(r); \node[below=1em of q] {$\{ 0,1,3 \}$}; \end{tikzpicture} \\ \vspace{3em} \begin{tikzpicture}[baseline=(c.base), thick] \node[vertex] (a) at (0,0) {}; \node[vertex] (b) at (1.2,0) {}; \node[vertex] (c) at (0,1.2) {}; \node[vertex] (d) at (1.2,1.2) {}; \draw (a)--(b); \draw (c)--(d); \node[draw=none] at (0.6,-1) {$\{ 0,0,2,2\}$}; \node[vertex] (p) at (4.5,0.5) {}; \node[vertex] (q) at (5.7,0.5) {}; \node[vertex] (r) at (6.9,0.5) {}; \node[vertex] (m) at (8.1,0.5) {}; \draw (p)--(q); \draw (m)--(r); \draw[red] (q)--(r); \node[draw=none] at (6.3,-1) {$\{ 0,2-\sqrt{2},2,2+\sqrt{2}\}$}; \end{tikzpicture} \end{figure} \end{example} \section{Work done} In this paper, we discuss the characterizations of simple graphs in which spectral integral variation occurs by adding an edge. We also investigate the case where (one of) the changed eigenvalue(s) is the algebraic connectivity. which gives the result as shown below: Note that I've written the section after completing the example but it is coming before the pictures and then after the pictures again continued where it left.

  • want citations appear differently depending on my text
    by Rup_LA on October 8, 2026 at 10:42 am

    I want to cite some papers as well as their authors in the document in different places. We use \cite{label} to cite a paper which appears as [#] in the document depending on the number given to it in the bibliography. Here is a sample of my Tex document code: \documentclass[a4paper,12pt]{article} \usepackage[ colorlinks=true, linkcolor=blue, citecolor=blue, urlcolor=blue ]{hyperref} \begin{document} \section*{Introduction} General Theory of Relativity \cite{ein} tells that ...\\ This theory is developed by Physicist \cite{ein} \begin{thebibliography}{33} \bibitem{ein} Einstein A., General Theory of Relativity, 2000. \end{thebibliography} \end{document} This gives the following output: I want the second [1] to be appeared as Einstein A. while the first one remains the same. Is there any way to do this?

  • How to make \autoref shows "Example" for new theorem "example"?
    by Rup_LA on October 8, 2026 at 9:43 am

    I want to link my example in text. For linking a lemma/theorem, I use \autoref which shows Theorem # in the document. But for the example environment, it is not working. What should I do? \documentclass{article} \usepackage{amsmath,amssymb,amsthm} \usepackage{hyperref} \hypersetup{ colorlinks=true, filecolor=blue, urlcolor=blue, linkcolor=blue } \newtheorem{theorem}{Theorem} \theoremstyle{definition} \newtheorem{example}{Example} \begin{document} \begin{theorem} \label{thm} Theorem. \end{theorem} \begin{example} \label{eg} Some examples. \end{example} See \autoref{thm} and \autoref{eg} \end{document} The above code gives the following output: Basically I want Example 1, not just 1. Any suggestion?

  • Avoid double spaces around macro with no output [duplicate]
    by Wrzlprmft on October 8, 2026 at 7:02 am

    I want to define a macro that – depending on its argument and external parameters – sometimes produces an output and sometimes nothing. When it produces nothing and is surrounded by spaces, it shall not yield a double space. Ideally, it applies the same behaviour to everything treated like a space such as newlines. How can I achieve this? The macro is exclusively used in regular text. Here is a minimal example: \documentclass[margin=5pt]{standalone} \usepackage{etoolbox} \newcommand{\mymacro}[1]{\ifstrempty{#1}{}{a #1 space}} \begin{document} Here \mymacro{} is \mymacro{double}. \end{document} This produces: I want to get rid of the double space without touching the document, only the macro definition. I considered the package trimspaces, but that can at best trim spaces created within the macro. xspace only adds spaces; so it’s also not what I am looking for.

  • Small gap between the overlapped Wick contract lines on the same variable
    by myhsia on October 8, 2026 at 2:41 am

    As shown in the attached picture, there are gaps in the same variable with double Wick contracted lines: especially the $\hat A$: the gap is wider. I guess it's similar to something like "letters' baseline"... but quite different. MWE: \documentclass{article} \usepackage{simplewick} \begin{document} \[ \contraction [1.6ex]{}{\hat q_j}{\,\hat q_j\,} {\hat q_j} \contraction [2.4ex]{\hat q_j\,}{\hat q_j}{\,\hat q_j\,}{\hat A} \bcontraction[.8ex] {\hat q_j\,}{\hat q_j}{\,} {\hat q_j} \bcontraction[1.6ex]{}{\hat q_j}{\,\hat q_j\,\hat q_j\,}{\hat A} \contraction [.8ex] {}{\hat q_j}{\,} {\hat q_j} \contraction [.8ex] {\hat q_j\,\hat q_j\,}{\hat q_j}{\,}{\hat q_j} \hat q_j\, \hat q_j\, \hat q_j\, \hat A \] \end{document}

  • Dictate the first page break of an environment
    by lobchi on October 7, 2026 at 11:26 pm

    Doing math homeworks, I quite like each problem on a new page \newenvironment{problem}{\newpage}{} but sometimes the problem and solution are only about a third of the page leaving a lot of white space at the end. I would like to move the next problem up (i.e. do not \newpage) if and only if I can fit the entire problem-environment on that page. But, if forgoing the \newpage would mean having to break anywhere in the environment I would like it to first break at the top (and then if it's really long, we might go on to a second or third page). I know I can use \pagebreak[3] to strongly encourage a pagebreak at the top of the environment, and this works well when the first problem was already mostly filling the page: But if the first problem is far from the page break, a break later in the problem is taken before breaking at the top, which I take to be maximally bad. Below, Problem 2 spans the first and second pages when it should get a page break at the beginning

  • scrletter: How to position enclosure next to closing?
    by lAtExFaN on October 7, 2026 at 9:57 pm

    The German standard specification for business letters (specified in DIN5008) also allows to place the enclosures' hint next to the closing, see this demo screenshot: How can this change be implemented? This is the code (MWE) I used to produce the above shown default output: \documentclass{scrartcl} \usepackage{scrletter} \usepackage[ngerman]{babel} \setkomavar{fromname}{Peter Mustermann} \setkomavar{signature}{Peter} \renewcaptionname{ngerman}{\enclname}{Anlage} \setkomavar{enclseparator}[\sffamily{\bfseries\enclname}]{} \makeatletter %DIN5008 conforming enclosure option 1 (when enough vertical space left): \renewcommand*{\encl}[1]{% \par% \ifdim\parskip=\z@% \vskip\baselineskip% \fi% \noindent% \begingroup \parbox[t]{\textwidth}{% \Ifkomavarempty*{enclseparator}% {}% {% \strut\usekomavar*{enclseparator}\usekomavar{enclseparator}\\% }% \ignorespaces #1\strut}% \parfillskip\fill\par \endgroup } \makeatother \begin{document} \begin{letter}{% Petra Ochs\\ Vor dem Berg 1\\ 12345 Musterhausen% } \opening{Liebste Petra,} bla bla \ldots{} \closing{In Liebe} \encl{2 Poster\\5 Autogrammkarten} \end{letter} \end{document}

  • How to activate ConTeXt in MiKTeX(v. 22.1)?
    by filokalos on October 7, 2026 at 2:59 pm

    ConTeXt is inactive in the menu of TeXworks(v. 0.6.6) (MacOS). How to fix it?

  • How can I depict X-ray beams as wavefronts that interfere above the sample to form a standing wave?
    by user449589 on October 7, 2026 at 7:24 am

    I'm not very skilled using TikZ but I wanted to use it for all the figures in my bachelors thesis. So far I created this TikZ-picture: \documentclass{article} \usepackage{tikz} \usetikzlibrary{patterns} \usetikzlibrary{patterns.meta} \usetikzlibrary{decorations.pathreplacing} \usetikzlibrary{decorations.pathmorphing} \usetikzlibrary{decorations.markings} \usetikzlibrary{snakes} \usetikzlibrary{arrows.meta} \usetikzlibrary{calc,patterns,angles,quotes} \usepackage[table]{xcolor} \definecolor{Minzgrün}{RGB}{0,140,79} \definecolor{Fenstergrau}{RGB}{128,128,128} \definecolor{Telegrau 4}{RGB}{230,230,230} \definecolor{Tomatenrot}{RGB}{140,28,0} \begin{document} \begin{tikzpicture} [x=0.35cm,y=0.2cm,line cap=round,line join=round] \draw[line width=1.5pt] (17.5,12.5) arc [start angle=0, end angle=180, x radius=2.5, y radius=1]; \draw [black, line width=1pt] (16,13) -- (21,14) node [align=center,right]{Detector\\window}; \draw[line width=1.5pt] (19,2) arc [start angle=0, end angle=180, x radius=4, y radius=1.5]; \draw[black,line width=1.5pt] (5,0.5) -- (25,0.5) -- (25,2) -- (5,2) -- cycle; \draw[black,line width=1.5pt] (10,25) -- (10,12.5) -- (20,12.5) -- (20,25); \draw[black,line width=1.5pt] (12.5,17.5) -- (17.5,17.5) -- (17.5,20) -- (12.5,20) -- cycle; \fill[black,pattern=crosshatch dots] (12.5,17.5) -- (17.5,17.5) -- (17.5,20) -- (12.5,20) -- cycle; \draw [black,line width=1pt] (12,20) -- (8.5,21) node[align=center,left] {Energy-dispersive\\detector}; \draw[Fenstergrau,line width=1pt,postaction={decorate,decoration={markings,mark=at position 0.15 with{\arrow{>}},mark=at position 1 with {\arrow{>}}}}] (-5,4) -- (10,2) -- (25,4); \draw[Fenstergrau,line width=1pt,postaction={decorate,decoration={markings,mark=at position 0.15 with{\arrow{>}},mark=at position 1 with {\arrow{>}}}}] (5,4) -- (20,2) -- (35,4); \node[align=center] at (0,6.5){Incident beam}; \node[align=center] at (30,6.5){Reflected beam}; \draw[black,line width=1pt] (12.5,1.25) -- (10,-2.5) node [below, align=center] {Sample carrier\\(\textit{reflector})}; \draw[black,line width=1pt] (16,2.5) -- (21,-2.5) node [below, align=center] {Sample}; \draw[Minzgrün,line width=1.25pt,->,decorate,decoration={snake,amplitude=0.1cm,segment length=0.4cm, post length=0.2cm}](15,2.5) -- (15,17); \draw [black, line width=1pt] (14,8) -- (9,12) node [align=center, left] {Fluorescence\\radiation}; \end{tikzpicture} \end{document} But I would like to include the X-ray beams as wave fronts which interfere above the sample to form a standing wave like in this image: Sadly this is beyond my TikZ-skills. Maybe somebody can help me or tell me where to look for answers. Thanks a lot!

  • How can I get underlined text in a PDF from Markdown with Pandoc?
    by lindes on October 6, 2026 at 9:13 pm

    The pandoc docs say: To underline text, use the underline class: [Underline]{.underline} And, slightly below that: This will work in all output formats that support underline. I know that LaTeX is capable of underlining text, but it doesn't work o just have the above in my markdown. A partial solution for me is to include LaTeX code directly in my markdown, e.g. with \underline{some text}... if I do that, it works fine; e.g. the following code: This text has some \underline{underlining} in it. Generates this in the PDF (which is what I'm aiming for): But... I know that at some point, I'm likely to want to do HTML exports as well, so the [text]{.underline} syntax is appealing to me. Is there some way to do this that works for both HTML and LaTeX/PDF exports? Note: I'm willing to add a Lua filter to do this, and may be able to figure that out, but I'm not super familiar with lua, or pandoc filters, so... I'm hoping that either there's some easier thing (like a variable I've failed to notice, that I could set in the YAML preamble or defaults file), or that someone knows exactly how one might write the filter to make that example from the docs do what I want it to do. Any tips or pointers would be welcome. And if I end up solving this myself, I'll post an answer to help others in the future. Edit: Given the following input, in file test.md: Will this get [underlined]{.underline}? That's the hope. ... pandoc -o test.tex test.md will generate (entire output): Will this get {underlined}? That's the hope. ... and pandoc -s -o test.tex test.md will generate: % Options for packages loaded elsewhere \PassOptionsToPackage{unicode}{hyperref} \PassOptionsToPackage{hyphens}{url} % \documentclass[ ]{article} \usepackage{lmodern} \usepackage{amssymb,amsmath} \usepackage{ifxetex,ifluatex} \ifnum 0\ifxetex 1\fi\ifluatex 1\fi=0 % if pdftex \usepackage[T1]{fontenc} \usepackage[utf8]{inputenc} \usepackage{textcomp} % provide euro and other symbols \else % if luatex or xetex \usepackage{unicode-math} \defaultfontfeatures{Scale=MatchLowercase} \defaultfontfeatures[\rmfamily]{Ligatures=TeX,Scale=1} \fi % Use upquote if available, for straight quotes in verbatim environments \IfFileExists{upquote.sty}{\usepackage{upquote}}{} \IfFileExists{microtype.sty}{% use microtype if available \usepackage[]{microtype} \UseMicrotypeSet[protrusion]{basicmath} % disable protrusion for tt fonts }{} \makeatletter \@ifundefined{KOMAClassName}{% if non-KOMA class \IfFileExists{parskip.sty}{% \usepackage{parskip} }{% else \setlength{\parindent}{0pt} \setlength{\parskip}{6pt plus 2pt minus 1pt}} }{% if KOMA class \KOMAoptions{parskip=half}} \makeatother \usepackage{xcolor} \IfFileExists{xurl.sty}{\usepackage{xurl}}{} % add URL line breaks if available \IfFileExists{bookmark.sty}{\usepackage{bookmark}}{\usepackage{hyperref}} \hypersetup{ hidelinks, pdfcreator={LaTeX via pandoc}} \urlstyle{same} % disable monospaced font for URLs \setlength{\emergencystretch}{3em} % prevent overfull lines \providecommand{\tightlist}{% \setlength{\itemsep}{0pt}\setlength{\parskip}{0pt}} \setcounter{secnumdepth}{-\maxdimen} % remove section numbering \author{} \date{} \begin{document} Will this get {underlined}? That's the hope. \end{document} So, seems like it's just wrapping the text in braces, without anything else?

  • Different math font in inline vs displayed styles doesn't work with \setmainfont and \mathrm: is the mathrm=sym unicode-math option safe?
    by Denis Bitouzé on October 6, 2026 at 9:01 am

    (This is a follow up of this Mico's answer to the quite old question Use different math font in inline-style and display-style formulas) For a LaTeX class I'm currently working on, based on a graphic designer work, I'm asked (but don't agree!) to use different fonts for the maths depending whether they are inline or displayed: Garamond Math for the inline ones, Concrete Math font for the displayed ones. The following MCE: \documentclass{article} \usepackage{unicode-math} \setmainfont{EBGaramond} % EBGaramond or anything else \setmathfont[version=Concrete]{Concrete-Math} \setmathfont[version=Garamond]{Garamond-Math} \mathversion{Garamond} \everymath{\mathversion{Garamond}} \everydisplay{\mathversion{Concrete}} \begin{document} \begin{enumerate} \item $2=\sqrt[4]{16}$ and \begin{equation} 2=\sqrt[4]{16} \end{equation} \item $1 \times 2$ and \begin{equation} 1 \times 2 \end{equation} \item $E=mc^2$, where $E$ stands for energy, and \begin{equation} E=mc^2 \end{equation} % \item $5=17 \pmod{12}$ and % \begin{equation*} % 5=17 \pmod{12} % \end{equation*} \end{enumerate} \end{document} (lualatex) compiles, not nicely (numerous warnings “LaTeX Font Warning: Command \mathversion invalid in math mode on input line…”), but compiles. But, as soon as its commented lines are uncommented, it doesn't compile any more, because of: ! LaTeX Error: Math alphabet identifier \mathrm is undefined in math version ` Garamond'. Note that it compiles again if \setmainfont{…} is commented. As a workaround, one can just load unicode-math with at least the mathrm=sym option. But is it safe?

  • How to display solutions of trigonometric equations in degrees in luacas?
    by minthao_2011 on October 6, 2026 at 8:36 am

    I am trying to solve the equation $\sin(5x)=\frac{1}{2}$, where $x$ is measured in degrees, using the luacas package. I tried: \documentclass{article} \usepackage{fourier-otf} \usepackage{luacas} \usepackage{amsthm} \theoremstyle{definition} \newtheorem{ex}{Example} \begin{document} \begin{ex} $x$ in degree \begin{CAS} vars("x", "k") u = 5*x v = 30 eq1 = Equation(u, v + 360*k):autosimplify() r1 = eq1:solvefor(x) eq2 = Equation(u, 180 - v + 360*k):autosimplify() r2 = eq2:solvefor(x) \end{CAS} \[ \sin(5x) = \frac{1}{2} \Leftrightarrow \sin\left(\print{u}\right)=\sin\left(\print{v}^\circ\right) \Leftrightarrow \left[ \begin{aligned} \print{u} &= \print{v} + 360 k\\ \print{u} &= 180-\print{v}+ 360 k \end{aligned} \right. \Leftrightarrow \left[ \begin{aligned} &\print{r1}\\ &\print{r2} \end{aligned} \right. \] How can I make the solutions produced by luacas be written in the following form? \[ \sin(5x) = \frac{1}{2} \Leftrightarrow \sin\left(\print{u}\right)=\sin\left(\print{v}^\circ\right) \Leftrightarrow \left[ \begin{aligned} \print{u} &= \print{v}^\circ + 360^\circ k\\ \print{u} &= 180^\circ-\print{v}^\circ+ 360^\circ k \end{aligned} \right. \Leftrightarrow \left[ \begin{aligned} &x = 6^\circ + 72^\circ k\\ & x = 30^\circ + 72^\circ k \end{aligned} \right. \] \end{ex} \end{document}

  • CommonMark php parsing [closed]
    by user449527 on October 6, 2026 at 1:28 am

    This code isn't working for some reason. I am using Debian linux. I get a 500 error. <?php $doc = \CommonMark\Parse("# Hello World\nThis is **Markdown**."); $html = \CommonMark\Render\HTML($doc); echo $html; ?>

  • List of Tables/Figures Page and List Enumeration
    by Ryan Murphy on October 5, 2026 at 10:32 pm

    I'm having trouble with the following output I'm using the following code that is oh so close, \addcontentsline{lot}{figure}{\protect\numberline{3}Data from CalRecycle \dotfill 15-20} from AI search it looks like. The \dotfill is what I thought would fix my problem. Well actually there are two problems. I'm trying to get the pages to read 15-20, not 1, and I'm also trying to get table 3 in row 3. The \addcontentsline appears to throw it to the top of the list. I understand I may not be able to adjust the page range, nor the row position, but I figured I'd see if somebody has a solution. Note there are two other table 3's at the bottom that I've been trying to figure this out with. As requested by cfr, pardon I'm not the best with Tex, so including packages I believe may be necessary. I ended up going with below which is not as neat as I'd like it. The \addcontentsline line went right after \listoftables. I ended up going with an approach of \label{tab:start} to \label{tab:end} to get each sheet in the List of Tables. However, now I'm trying to add another large table spanning multiple sheets and I'm losing the caption at the end of the table. Sorry another problem. \documentclass[12pt]{article} \usepackage{amsmath} \usepackage{graphicx} % For including images \usepackage{titling} % For custom title positioning \usepackage{setspace} \usepackage{caption} \usepackage{subcaption} \usepackage{float} \usepackage{lscape} \usepackage[a4paper,margin=1in]{geometry} \renewcommand{\listtablename}{List of Tables} \usepackage{tocloft} \begin{document} \listoftables \begin{landscape} \begin{table} [h!] \centering \includegraphics[scale=1]{landscape pivot table 1} \caption{Data from CalRecycle} \label{tab:start} \end{table} \begin{table} [h!] \centering \continuedfloat \includegraphics[scale=1]{landscape pivot table 2} \caption{Data from CalRecycle} \end{table} \begin{table} [h!] \centering \continuedfloat \includegraphics[scale=1]{landscape pivot table 3} \caption{Data from CalRecycle} \end{table} \begin{table} [h!] \centering \continuedfloat \includegraphics[scale=1]{landscape pivot table 4} \caption{Data from CalRecycle} \end{table} \begin{table} [h!] \centering \continuedfloat \includegraphics[scale=1]{landscape pivot table 5} \caption{Data from CalRecycle} \end{table} \begin{table} [h!] \centering \continuedfloat \includegraphics[scale=1]{landscape pivot table 6} \caption{Data from CalRecycle} \label{tab:end} \end{table} \end{landscape} \end{document} Alright so I figured out my second table, I had to crop the image of the table to fit the caption on the sheet. I forgot I had to do that for the first one. I'm including how the list looks now, do you see how it is clumsy and what I'm trying to achieve? To your off topic question cfr, My first table is 30x1157 and the other is 720x120. My first thought was to use an excel to Latex code which I did try, but I was getting an out of memory error. So I opted to images of the tables.

  • LaTeX twoside starts with margins on the wrong side
    by duruburak on October 5, 2026 at 5:44 pm

    I am writing my thesis in Overleaf using LaTeX. The front matter should use asymmetric margins, with a wider left margin than right margin. Starting from the Introduction, however, the thesis should use a twoside layout: odd-numbered pages should have the wider inner margin on the left, while even-numbered pages should have the wider inner margin on the right. The problem is that the twoside layout does not start on the expected side. Everything before the Introduction works as intended: pages i–xii have a wider left margin than right margin. However, when the Introduction begins, page 1 is formatted as an even page would be—the wider margin is on the right instead of the left. I expected page 1 to be a right-hand (odd) page, with the wider inner margin on the left. I have tried \cleardoublepage and manually enabling twoside with @twosidetrue, but neither solved the problem. I suspect that I am misunderstanding how twoside, geometry, and page numbering interact. Does anyone know what is causing page 1 to start with the wrong margin configuration, and what would be the correct way to make the Introduction start on an odd/right-hand page? All in one main.tex MWE file [Compiler must be XeLaTeX!]: \documentclass[a4paper, 11pt]{article} % MACROS \newcommand{\ikiSatir}{\\ [2em]} % CONDITIONAL \usepackage{etoolbox} \usepackage{ifthen} % FONT \usepackage[T1]{fontenc} \usepackage[turkish]{babel} \usepackage{fontspec} \setmainfont{Times New Roman} \usepackage{lipsum} %\usepackage{mathptmx} % LAYOUT \usepackage{geometry} \geometry{top=3cm, bottom=3cm, left=4cm, right=2cm} % LINE SPACING \usepackage{setspace} \spacing{1.5} \renewcommand{\arraystretch}{1.5} % PARAGRAPH INDENTATION \setlength{\parindent}{0pt} % SECTION TITLES \usepackage{titlesec} \newbool{centeredsections} \setbool{centeredsections}{true} \newcommand{\setsectionalignment}[1]{ \ifstrequal{#1}{center}{\setbool{centeredsections}{true}}{} \ifstrequal{#1}{left}{\setbool{centeredsections}{false}}{} } \titleformat{\section}{\normalfont\Large\bfseries\ifbool{centeredsections}{\centering}{}}{\thesection.}{1em}{} \titlespacing*{\section}{0pt}{0pt}{2em} \titlespacing*{\subsection}{0pt}{0pt}{2em} \titlespacing{\subsubsection}{0pt}{0pt}{2em} % UNDERLINE \usepackage[normalem]{ulem} \usepackage{ragged2e} % \usepackage{fancyhdr} % \usepackage{array} % SECTIONS \usepackage{tocloft} \makeatletter \renewcommand{\cftsecaftersnum}{. \hskip 1em} \renewcommand{\cftsubsecaftersnum}{ \hskip 1em} \renewcommand{\cftsubsubsecaftersnum}{ \hskip 1em} %\renewcommand{\numberline}[1]{#1.\hskip 1em} \makeatother \renewcommand{\cftdot}{.} \renewcommand{\cftdotsep}{1.5} \renewcommand{\cftsecfont}{\bfseries} \renewcommand{\cftsubsecfont}{\bfseries} \renewcommand{\cftsubsubsecfont}{\bfseries} \renewcommand{\cftsecpagefont}{\bfseries} \renewcommand{\cftsubsecpagefont}{\bfseries} \renewcommand{\cftsubsubsecpagefont}{\bfseries} \renewcommand{\cftsecleader}{\cftdotfill{\cftdotsep}} \setlength{\cftbeforesecskip}{0em} %içindekiler linehegiht \setlength{\cftbeforesubsecskip}{0em} \setlength{\cftsubsecindent}{0pt} \setlength{\cftsubsubsecindent}{0pt} % IMAGES AND DESCRIPTIONS \usepackage{graphicx} \usepackage{caption} \captionsetup[figure]{labelsep=space} \captionsetup[table]{labelsep=space} \captionsetup{justification=raggedright, singlelinecheck=true} \usepackage{chngcntr} \counterwithin{figure}{section} \counterwithin{table}{section} \usepackage{float} \begin{document} \pagenumbering{gobble} \label{cover} \spacing{1} \begin{center} \Large\textbf{XXXXXXXXXXXXX XXXXX (thesis name) } \\ \vspace*{\fill} \Large\textbf{A THESIS SUBMITTED TO} \\ \Large\textbf{THE GRADUATE SCHOOL OF xxx} \Large\textbf{OF} \\ \Large\textbf{ANKARA UNIVERSITY} \vspace{\fill} \Large\textbf{by} \\[5em] \Large\textbf{Xxxx Xxxx XXXXX (name surname) } \\[5em] \Large\textbf{IN PARTIAL FULFILMENT OF THE REQUIREMENTS} \\ \Large\textbf{FOR THE DEGREE OF} \\ \Large\textbf{MASTER OF SCIENCE IN} \\ \large\textbf{Xxxxx Xxxxx (department) }\\[5em] \textbf{\uline{ANKARA}} \\ \textbf{2024} \end{center} \begin{center} \textbf{All rights reserved} \end{center} \newpage \pagenumbering{roman} \spacing{1} \section*{SYMBOLS AND ABBREVIATIONS} \addcontentsline{toc}{section}{SYMBOLS AND ABBREVIATIONS} \begin{flushleft} \begin{tabular}{@{}ll@{}} AHP & Analytical Hierarchy Process \\ \textdegree C & Degree Celsius \\ \% & Percentage \\ $\Sigma$ & The summation symbol \\ \end{tabular} \end{flushleft} \newpage \section*{LIST OF FIGURES} \renewcommand{\figurename}{Figure} \renewcommand{\listfigurename}{} \addcontentsline{toc}{section}{LIST OF FIGURES} \listoffigures \newpage \section*{LIST OF TABLES} \renewcommand{\tablename}{Table} \renewcommand{\listtablename}{} \addcontentsline{toc}{section}{LIST OF TABLES} \listoftables \newpage \newgeometry{twoside, inner=4cm, outer=2cm, top=3cm, bottom=3cm} \spacing{1.5} \pagenumbering{arabic} \setsectionalignment{left} \section{INTRODUCTION} \lipsum[2-3] \begin{figure}[!h] \centering \includegraphics[]{} \caption{Aaaaaaaaaaaaaaa bbbbbbbbbbbbbb} \label{fig:bbb} \end{figure} \begin{table}[!h] \centering \caption{Bbbbbbbbbbbbbbb aaaaaaaaaaaaaa} \begin{tabular}{ll} A & B \\ C & D \\ \end{tabular} \label{ciz:3.1} \end{table} \lipsum[1-2]. \ikiSatir \lipsum[3-5] \ikiSatir \lipsum[6-9] \ikiSatir \end{document} The main question is: How should I correctly switch from the front-matter layout to a twoside layout so that the Introduction starts on page 1 as an odd/right-hand page with the correct inner/outer margins? I changed the values between inner and outer margins, it still doesn't work. The Introduction page (Page 1) still begins left-hand page. I change \pagenumbering mid-document right at the Introduction section, maybe it has something to do with it?

  • Minor issues with brace and alignment in table
    by Svend Tveskæg on October 5, 2026 at 4:32 pm

    The is a follow-up question to Fit side-by-side tables to page width. Explorer came up with a very nice solution to my problem of having two tables side-by-side. However, as can be seen below, when I compile the following code, I have a few minor issues: The smallest braces inside the table are a bit too large and the biggest braces are a bit too small. The Met is a bit too low compared to AUG. I can manually fix this by using \raisebox{0.3ex}{Met}. Code and output % lualatex test.tex \documentclass[ a4paper, 12pt ]{article} \usepackage{fontspec} \setmainfont[ NFSSFamily = tgp, Extension = .otf, UprightFont = *-Regular, BoldFont = *-Bold, ItalicFont = *-Italic, BoldItalicFont = *-BoldItalic, Ligatures = { TeX, CommonOff } ]{texgyrepagella} \usepackage[ math-style = TeX ]{unicode-math} \setmathfont{texgyrepagella-math.otf} \usepackage[ hmargin = 2.4cm, vmargin = 3cm ]{geometry} \usepackage{nicematrix} \usepackage{tabularray} \UseTblrLibrary{tikz} \usepackage{tikz} \usetikzlibrary{calc} \usepackage{hyperref} \newcommand{\skrstr}[1]{\fontsize{#1pt}{\fpeval{1.2*#1}pt}\selectfont} \newcommand{\navn}[1]{\textbf{#1}} \newcommand{\essentiel}[1]{\textcolor{red}{#1}} \newcommand{\PanelWidth}{65pt} \newcommand{\CellGap}{6pt} \newcommand{\CellPadding}{3pt} \newcommand{\ContentPadding}{2pt} \newlength{\CodonLineHeight} \setlength{\CodonLineHeight}{14pt} \newcommand{\GroupLabel}[2]{% \hspace{1pt}% \parbox[c][\dimexpr#1\CodonLineHeight\relax][c]{26pt}{% \raggedright\small\navn{#2}% }% } \newcommand{\ChartCell}[3][\dimexpr4\CodonLineHeight+16pt\relax]{% \parbox[c][\dimexpr#1+\CellGap\relax][c]{\dimexpr#2+\CellGap+\CellPadding*2+\ContentPadding*2\relax}{% \centering \parbox[c][#1][c]{\dimexpr#2+\ContentPadding*2\relax}{\centering#3}% }% } \newcommand{\CodonLines}[1]{% \begingroup \setlength{\tabcolsep}{0pt}% \begin{tabular}{@{}>{\rule[-0.3\CodonLineHeight]{0pt}{\CodonLineHeight}}c@{}}% #1 \end{tabular}% \endgroup } \newcommand{\BraceGroup}[2]{% \hbox{\parbox[c][\dimexpr#1\CodonLineHeight\relax][c]{10pt}{% \centering \raisebox{-2pt}[0pt][0pt]{% \(\nulldelimiterspace = 0pt \smash{\left.\vcenter{\hbox{% \rule{0pt}{\dimexpr#1\CodonLineHeight-3pt\relax}% }}\right\}}% \)% }% }\GroupLabel{#1}{#2}}% } \newcommand{\BraceBlank}[2]{% \hbox{% \parbox[c][\dimexpr#1\CodonLineHeight\relax][c]{10pt}{\mbox{}}% \GroupLabel{#1}{#2}% }% } \newcommand{\CodonPanel}[2]{% \ChartCell{\PanelWidth}{% \CodonLines{#1}\hspace{2pt}% \parbox[c][\dimexpr4\CodonLineHeight\relax][c]{37pt}{% \offinterlineskip#2% }% }% } \newcommand{\RowIndex}[1]{{% \renewcommand{\CellPadding}{0pt}% \ChartCell{18pt}{#1}% }} \newcommand{\ColumnIndex}[1]{\ChartCell[18pt]{\PanelWidth}{#1}} \newcommand{\ThirdIndex}[1]{\RowIndex{\CodonLines{#1}}} \begin{document} \begin{table} \small \centering \begin{tabular}{c@{\qquad}|@{\quad}c}% \scalebox{0.72}{\Large\bfseries 2.~base} & \scalebox{0.72}{\Large\bfseries Forkortelser}\\ \hspace*{10pt}%<-- add left bounding box \begingroup \setlength{\tabcolsep}{0pt} \setlength{\extrarowheight}{0pt} \scalebox{0.72}{\begin{NiceTabular}{@{}cccccc@{}}[corners, cell-space-limits = 0pt] \CodeBefore \TikzEveryCell{offset = \dimexpr\CellGap/2\relax, fill = teal!60} \begin{tikzpicture} \foreach \r/\rn in {2/3,3/4,4/5,5/6} \foreach \c/\cn in {2/3,3/4,4/5,5/6} \fill[yellow!35] ([xshift = \dimexpr\CellGap/2\relax, yshift = -\dimexpr\CellGap/2\relax]\r-|\c) rectangle ([xshift = -\dimexpr\CellGap/2\relax, yshift = \dimexpr\CellGap/2\relax]\rn-|\cn); \end{tikzpicture} \Body & \ColumnIndex{U} & \ColumnIndex{C} & \ColumnIndex{A} & \ColumnIndex{G} \\ \RowIndex{U} & \CodonPanel{UUU\\UUC\\UUA\\UUG}{\BraceGroup{2}{Phe}\BraceGroup{2}{Leu}} & \CodonPanel{UCU\\UCC\\UCA\\UCG}{\BraceGroup{4}{Ser}} & \CodonPanel{UAU\\UAC\\UAA\\UAG}{\BraceGroup{2}{Tyr}\BraceBlank{1}{\skrstr{9.3}\textcolor{red!70!black}{STOP}}\BraceBlank{1}{\skrstr{9.3}\textcolor{red!70!black}{STOP}}} & \CodonPanel{UGU\\UGC\\UGA\\UGG}{\BraceGroup{2}{Cys}\BraceBlank{1}{\skrstr{9.3}\textcolor{red!70!black}{STOP}}\BraceBlank{1}{Trp}} & \ThirdIndex{U\\C\\A\\G} \\ \RowIndex{C} & \CodonPanel{CUU\\CUC\\CUA\\CUG}{\BraceGroup{4}{Leu}} & \CodonPanel{CCU\\CCC\\CCA\\CCG}{\BraceGroup{4}{Pro}} & \CodonPanel{CAU\\CAC\\CAA\\CAG}{\BraceGroup{2}{His}\BraceGroup{2}{Gln}} & \CodonPanel{CGU\\CGC\\CGA\\CGG}{\BraceGroup{4}{Arg}} & \ThirdIndex{U\\C\\A\\G} \\ \RowIndex{A} & \CodonPanel{AUU\\AUC\\AUA\\AUG}{\BraceGroup{3}{Ile}\BraceBlank{1}{Met}} & \CodonPanel{ACU\\ACC\\ACA\\ACG}{\BraceGroup{4}{Thr}} & \CodonPanel{AAU\\AAC\\AAA\\AAG}{\BraceGroup{2}{Asn}\BraceGroup{2}{Lys}} & \CodonPanel{AGU\\AGC\\AGA\\AGG}{\BraceGroup{2}{Ser}\BraceGroup{2}{Arg}} & \ThirdIndex{U\\C\\A\\G} \\ \RowIndex{G} & \CodonPanel{GUU\\GUC\\GUA\\GUG}{\BraceGroup{4}{Val}} & \CodonPanel{GCU\\GCC\\GCA\\GCG}{\BraceGroup{4}{Ala}} & \CodonPanel{GAU\\GAC\\GAA\\GAG}{\BraceGroup{2}{Asp}\BraceGroup{2}{Glu}} & \CodonPanel{GGU\\GGC\\GGA\\GGG}{\BraceGroup{4}{Gly}} & \ThirdIndex{U\\C\\A\\G} \\ \CodeAfter \TikzEveryCell{offset = \dimexpr\CellGap/2\relax, draw} \begin{tikzpicture} % \node[font = \Large\bfseries, anchor = south] % at ([yshift = +8pt]$(1-|2)!0.5!(1-|6)$) {2.~base}; \node[font = \Large\bfseries, rotate = 90, anchor = south] at ([xshift = -2pt]$(2-|1)!0.5!(6-|1)$) {1.~base}; \node[font = \Large\bfseries, rotate = -90, anchor = south] at ([xshift=+2pt]$(2-|7)!0.5!(6-|7)$) {3.~base}; \end{tikzpicture} \end{NiceTabular}} \endgroup% \hspace*{10pt}%<-- add right bounding box &% {\def\mlr{2} \scriptsize \begin{tabular}{ l @{\;=\;} l } \multicolumn{2}{c}{} \\ \navn{Ala} & Alanin~(\navn{A}) \\[\mlr pt] \navn{Arg} & Arginin~(\navn{R}) \\[\mlr pt] \navn{Asn} & Asparagin~(\navn{N}) \\[\mlr pt] \navn{Asp} & Aspartat~(\navn{D}) \\[\mlr pt] \navn{Cys} & Cystein~(\navn{C}) \\[\mlr pt] \navn{Gln} & Glutamin~(\navn{Q}) \\[\mlr pt] \navn{Glu} & Glutamat~(\navn{E}) \\[\mlr pt] \navn{Gly} & Glycin~(\navn{G}) \\[\mlr pt] \navn{His} & \essentiel{Histidin}~(\navn{H}) \\[\mlr pt] \navn{Ile} & \essentiel{Isoleucin}~(\navn{I}) \\[\mlr pt] \navn{Leu} & \essentiel{Leucin}~(\navn{L}) \\[\mlr pt] \navn{Lys} & \essentiel{Lysin}~(\navn{K}) \\[\mlr pt] \navn{Met} & \essentiel{Methionin}~(\navn{M}) \\[\mlr pt] \navn{Phe} & \essentiel{Phenylalanin}~(\navn{F})\\[\mlr pt] \navn{Pro} & Prolin~(\navn{P}) \\[\mlr pt] \navn{Ser} & Serin~(\navn{S}) \\[\mlr pt] \navn{Thr} & \essentiel{Threonin}~(\navn{T}) \\[\mlr pt] \navn{Trp} & \essentiel{Tryptofan}~(\navn{W}) \\[\mlr pt] \navn{Tyr} & Tyrosin~(\navn{Y}) \\[\mlr pt] \navn{Val} & \essentiel{Valin}~(\navn{V}) \\ \end{tabular}} \end{tabular} \end{table} \end{document} Questions How can the braces be adjusted automatically? (I don't see this issue in Explorer's answer which confuses me a bit.) How can the alignment be done automatically? (I do see this issue in Explorer's answer.)

  • Using \multicolumn inside align
    by schtandard on October 5, 2026 at 3:43 pm

    I have a block of equations that I want to align (and number) with a final equation that should just be centered. Since align is essentially a table, my first attempt to realize this was to just use \multicolumn, but this shifts the equation number into the margin. \documentclass{article} \usepackage{array} \usepackage{amsmath} \begin{document} \begin{align} a_1 &= b_1 & a_2 &= b_2 \\ c_1 &= -d_1 & c_2 &= -d_2 \\ \multicolumn{4}{c}{$e = f$} \end{align} \end{document} How can I achieve the same alignment effect without shifting the equation number?

  • Compilation error if listing contains either | or $
    by Marek Stepanek on October 5, 2026 at 9:18 am

    How to print out a Makefile into \usepackage{listings} Here a mwe which I cut were the compiling stops. (l. 43) Choosing CMake as language does not help. \documentclass{scrreprt} \usepackage{listings} \lstset{escapeinside=||} % this is trying to read in the code from an external file \newcommand{\snip}[2][]{% \IfFileExists{snips/snips/#2} {\lstinputlisting[style=texcode, #1]{snips/snips/#2}} {\lstinputlisting[style=texcode, #1]{snips/#2}}% } \begin{document} \begin{lstlisting}[language=make, title=Makefile Original, mathescape] # NOTE: every recipe line below must start with a real TAB, not spaces. # --- what to build (values only; comments go above, never on the same line) -- MAIN ?= foo_headers SRCDIR ?= foo_dialogs BUILDDIR ?= _build # Sanitised copies of everything above. The recipes use only these, so a stray # space from the environment -- or a command line like `make BUILDDIR='_build '` # -- can never reach a filename. MAINBASE := $(strip $(MAIN)) CHAPDIR := $(strip $(SRCDIR)) OUTDIR := $(strip $(BUILDDIR)) # Tools. VIEWER is overridable and its call is prefixed with '-' in the # recipe, so a machine without Preview (Linux, CI) still gets a clean build: # `make VIEWER=true` or `make VIEWER=:`. LATEXMK ?= latexmk LATEXMKFLG ?= -lualatex -bibtex VIEWER ?= open -a Preview # Which chapter gets compiled? # default : whatever the master pulls in at the moment (auto-detected from # the first \input{...} or \include{...} naming the chapter dir) # override: make compile CH=chapters/networking_new02_day60-64.tex # Both mechanisms only *name* the job; the master decides the content -- see # the note at the bottom of this file. CH ?= $(shell sed -nE 's@.*\\(input|include)[{]([^}]*$(CHAPDIR)/[^}]*)[}].*@\2@p' $(MAINBASE).tex 2>/dev/null | head -n 1) \end{listings}

  • Building a dependency graph based on proofs of results referencing other lemmas and theorems
    by One_Cable5781 on October 5, 2026 at 6:40 am

    Consider \begin{lemma}\label{lma:firstlemma} All men are mortal. \end{lemma} %say above gets typeset as Lemma 1 \begin{thm}\label{th:firsttheorem} Socrates is mortal. \end{thm} %say above gets typeset as Theorem 1. \begin{proof} We know from Lemma \ref{lma:firstlemma} that all men are mortal.... \end{proof} Like the above, I have a large number of theorems in my study notes which reference previous results, etc. Is there a way to build a visually perceivable dependency graph wherein there is a node labelled L1 which stands for Lemma 1 and another node labelled T1 which stands for Theorem 1 and there is a directed arc leading from L1 to T1? Giving this task by uploading the typeset pdf to ChatGPT is one way but it is static. Is there an inbuilt way, which can dynamically change the graph node labelling if a new theorem is added in the middle thereby changing the numbering of subsequent theorems? The way should accept .tex files and not the compiled .pdf output. ----xposted to /r/latex as well---- Edited to add: I was made aware of a package by a user over at /r/learnmath which approximately does what I asked for in this OP. https://github.com/PierreSenellart/proofgraph [I have no connection with that author] So, please consider this thread as answered.

  • The water level and the principle of communicating vessels
    by Sebastiano on October 4, 2026 at 7:49 pm

    I would like to create a water level, i.e. a transparent flexible tube filled with water, so that the principle of communicating vessels is clearly illustrated. How can I represent the flexible tube, keeping it along the horizontal surface and making it run up the two vertical sides, so that the configuration is similar to the one shown in the image? Here my 1st MWE: \documentclass{article} \usepackage{tikz} \usepackage{tikzphysics} \begin{document} \begin{tikzpicture}[ line cap=round, line join=round ] \node[ ground, ground width=8.6cm, ground depth=3mm ] (G) at (0,0) {}; \node[ ground, ground width=3.2cm, ground depth=3mm, rotate=90 ] (GL) at (-3.5,1.6) {}; \node[ ground, ground width=3.2cm, ground depth=3mm, rotate=90 ] (GR) at (3.5,1.6) {}; \draw[dashed, thick] (-3.9,2.8) -- (4.2,2.8); \draw[thin] (-3.9,0) -- (-3.7,0); \node[left] at (-3.7,3.1) {\small 100.0}; \draw[thin] (-3.2,0) -- (-3.2,3.1); \draw[thin] (3.8,0) -- (3.8,3.1); \draw[thin] (3.7,0) -- (3.9,0); \node[right] at (3.9,3.1) {\small 100.0}; \draw[thin] (-4.3,0) -- (-3.8,0); \node[left] at (-4.3,0.08) {\small 0.00}; \end{tikzpicture} \end{document} Now with Mathcha I have created the flexible tube, \documentclass{article} \usepackage[margin=0.5in]{geometry} \usepackage{tikz} \usepackage{tikzphysics} \definecolor{water}{RGB}{73,194,221} \pagestyle{empty} \begin{document} \centering \begin{tikzpicture}[x=1cm,y=1cm] \node[ ground, ground width=8.6cm, ground depth=3mm ] (G) at (0,0) {}; \node[ ground, ground width=3.2cm, ground depth=3mm, rotate=90 ] (GL) at (-3.5,1.6) {}; \node[ ground, ground width=3.2cm, ground depth=3mm, rotate=90 ] (GR) at (3.5,1.6) {}; \draw[dashed, thick] (-3.9,2.5) -- (4.2,2.5); \draw[thin] (-3.9,0) -- (-3.7,0); \node[left] at (-3.7,3.1) {\small 100.0}; \draw[thin] (-3.2,0) -- (-3.2,3.1); \draw[thin] (3.8,0) -- (3.8,3.1); \draw[thin] (3.7,0) -- (3.9,0); \node[right] at (3.9,3.1) {\small 100.0}; \draw[thin] (-4.3,0) -- (-3.8,0); \node[left] at (-4.3,0.08) {\small 0.00}; \begin{scope}[shift={(-6cm,-.9cm)}] \draw[gray!70,line width=7pt] (3.48,4.32) .. controls (3.48,3.98) and (3.71,3.58) .. (3.72,3.21) .. controls (3.73,2.85) and (3.50,2.35) .. (3.84,1.74) .. controls (4.10,1.23) and (4.46,1.03) .. (4.97,1.03) .. controls (6.20,1.03) and (7.68,0.99) .. (8.36,1.59) .. controls (8.96,2.09) and (8.90,3.16) .. (8.90,4.23); \draw[gray!20,line width=4.5pt] (3.48,4.32) .. controls (3.48,3.98) and (3.71,3.58) .. (3.72,3.21) .. controls (3.73,2.85) and (3.50,2.35) .. (3.84,1.74) .. controls (4.10,1.23) and (4.46,1.03) .. (4.97,1.03) .. controls (6.20,1.03) and (7.68,0.99) .. (8.36,1.59) .. controls (8.96,2.09) and (8.90,3.16) .. (8.90,4.23); \draw[water,line width=4.5pt] (3.69,3.42) .. controls (3.81,3.02) and (3.49,2.39) .. (3.84,1.74) .. controls (4.10,1.23) and (4.46,1.03) .. (4.97,1.03) .. controls (6.20,1.03) and (7.68,0.99) .. (8.36,1.59) .. controls (8.82,1.98) and (8.92,2.72) .. (8.90,3.42); \end{scope} \end{tikzpicture} \end{document} but the tube is not filled correctly.

  • How to name a string variable inside a \foreach loop using the loop variable
    by Plum Rapson on October 4, 2026 at 3:42 pm

    I am trying to simplify my document typing for schoolwork. For ODEs, we are asked to show multiple possible solutions for a given differential equation. I have been using TikZ, pgfplots, and a dash of audacity to place multiple functions on the same graph, changing either the value of y_0 or C or both to show different function outcomes. However, this takes up a lot of space and time, so I am hoping that I could define a new command to repeatedly \addplot with slightly different functions. Here's what I have so far, including the page setup and relevant preamble for a sanity check: \documentclass[12pt]{article} \usepackage{geometry} %I have my page set to weird sizes and small margins \usepackage{pgfplots} \usepackage{tikz} \usetikzlibrary{shapes.geometric,arrows.meta,calc,pgfplots.external} \pgfplotsset{compat=1.18} \usepackage{xstring} \newcommand{\addmultiplot}[3][2]{ %{sample}{variable}{equation} where sample is a number %determined by my own organization, variable is %the character variable to be changed, equation is %formatted exactly as it would in \addplot \IfEqCase{#1}{ {0.1}{ \def\a{-0.9} \def\b{-0.1} \def\c{0.1} \def\d{0.4} \def\e{0.75} \foreach \x in {\a, \b, \c, \d}{ \StrSubstitute{#3}{#2}{\x}[\NAME] \def\nums{\a, \b, \c, \d, \e} %%%% Haven't been able to test, want this to give me \nums = {-0.9, -0.1, 0.1, 0.4, 0.75} } } {2}{ \def\a{-10} \def\b{-5} \def\c{2} \def\d{5} \def\e{10} \foreach ... } } . . . [] }; \foreach \v in {\nums} {\addplot{\NAME}};} \begin{document} \begin{tikzpicture} \begin{axis}[xticks =\empty, yticks= \empty] \addmultiplot{2}{C}{3*(C)/((C) + exp(3*x^2)*(3 - (C)))}; \end{axis} \end{tikzpicture} \end{document} What I am struggling with is [\NAME], Where I would want something like eq\x so that the last line of the command sees nums as {-0.9, -0.1, 0.1, 0.4, 0.75} and outputs \addplot{eq-0.9}; \addplot{-0.1}; etc. Maybe trying to have the negative sign be a part of it would be a problem, but I haven't even gotten there yet. At first I had [eq\x], but it gave me a \def issue "please don't put \def cs {...} use \def\cs{...}" on the line where I called \addmultiplot, and after trimming things down and making sure all the numbers were going into clearly defined variables, I'm left with assuming it involves the names of my equations, but surely [\eq\x] would not result in the first string later being referred to by "eq-0.9" so that when the final \foreach looks at \nums and pulls -0.9, \addplot can receive the equation that has C replaced with -0.9.

  • Defining a point on a plane using Asymptote
    by Fabrice on October 4, 2026 at 12:19 pm

    The idea is to reproduce the figure using the Asymptote software for the first time. The code could likely be improved, given that I determined the points on the plane using the Cartesian equation 25x + 14y - 35 = 0. Is there a better way to define the points on the plane ? import three; import math; size(8cm); defaultpen(fontsize(9pt)); currentprojection=orthographic ( camera=(8,5,4), up=(0,0,1), target=(2,2,2), zoom=1 ); pen style1 = linetype("4 4"); real h = 1; triple A = (1.4*h,0,0), B = (1.4*h,2.5*h,0), C = (0,2.5*h,0), D = (0,0,0), Ep = (1.4*h,0,1.3*h), F = (1.4*h,2.5*h,1.3*h), G = (0,2.5*h,1.3*h), H = (0,0,1.3*h); path3 p = A--C--G--Ep--cycle; draw(surface(p),lightgray+opacity(0.5)); draw(A--B--F--Ep--cycle^^B--F--G--C--cycle^^G--H--Ep); draw(A--D--C^^D--H,dashed); triple I = (0.728,1.2,0.55); triple J = (1.232,0.3,0.3); triple K = (1.036,0.65,0.75); triple S = interp(J,I,1.3); triple Np = interp(J,K,1.3); triple M = shift(Np-J)*S; dot(I);dot(J);dot(K);dot(S);dot(Np);dot(M); draw(interp(J,I,-0.1)--interp(J,I,1.6),style1); draw(interp(J,K,-0.2)--interp(J,K,1.6),style1); draw(S--M,style1); draw(Np--M,style1); draw(J--M,style1); draw(A--C,style1); draw(Ep--G); label("$A$",J, align=NW); label("$B$",I, align=SE); label("$C$",K, align=NW); label("$S$",S, align=SE); label("$N$",Np, align=NW); label("$M$",M, align=SE);

  • Linguistic examples in gb4e: formatting the preamble (NOT the gloss lines)
    by Robert on October 4, 2026 at 9:50 am

    I'm writing a book with a lot of linguistic examples and had to switch from expex to gb4e due to publisher requirements. Most of my examples have three lines, an orthographic representation that is not aligned with the others and two more for interlinear glosses (morphemes and labels). For example: \ea Huŋkhi cektake pho. \\ \gll hun -khiʔ cekt -a -k -e pho \\ MED -MOD say -PST -IPFV -IND.PST[.3sg.S] REP \\ \glt ‘I heard he was saying that.’ \z I know how to format the two interlinear lines using \leteachwordone and \leteachwordtwo. However, my question is about the first line (in the example, Huŋkhi cektake pho.). In expex this would have been called the preamble and I could have modified it using everyglpreamble=\itshape (italicizing this line is my ultimate goal). What is this line called in gb4e and how can I modify it centrally? There is no \leteachwordzero, so I'm at a loss. Edit: My question has been answered, I'm just adding a minimal working example below as requested, maybe others can use it this way, too. I also get the problem with the italicized subexamples when I use the original gb4e but I'm using the modified package langsci-gb4e and there it doesn't occur. I'm combining Marijn's suggestion (\AddToHook) with the etoolbox package to overrun some class defaults for formatting examples. Also note I'm using XeLaTeX. \documentclass{langscibook} \usepackage{etoolbox} % modify commands such that additional code is run each time they are called \usepackage{langsci-gb4e} \AddToHook{cmd/ex/after}{\itshape} % line 1 (= orthographic representation) in italics \AddToHook{cmd/gll/before}{\normalfont} % back to normal font after that (otherwise all following lines are in italics) \pretocmd{\gll}{\def\eachwordone{\normalfont}}{}{} % line 2 (= segments) in normal font \pretocmd{\gll}{\def\eachwordtwo{\small}}{}{} % line 3 (= glosses) in smaller font \pretocmd{\glll}{\def\eachwordtwo{\small}\def\eachwordthree{\small}}{}{} % same in occasional examples with additional gloss line 4 \begin{document} \begin{exe} \ex Sattekha gone, o baba! Lu, abo tupla basaiʔko ubheĩbe. \\ \gll satte =kha gonei o baba la abo tupla ba -sa -iʔ =go u- bheĩ -beʔ \\ truth =NMLZ₂ ATTN oh lord okay now {banana\textunderscore leaf} PROX -OBL -LOC₁ =NMLZ₁ 3SG.POSS- {place\textunderscore below} -LOC₂ \\ \glt ‘It is the truth indeed, oh Father! Okay, now [put] the banana leaf below this thing here.’ \end{exe} \begin{exe} \ex \begin{xlist} \ex Huŋgo haniwahum koptubidaʔ. \\ \gll hun =go hani- wahum kopt -u -pid -a \\ MED NMLZ₁ 2PL.POSS- calabash {pick\textunderscore up\textunderscore for} -3[sg].P -BEN -IMP[.2SG.A] \\ \glt ‘Pick up that calabash of yours for him.’ \ex Achetta pati garikana, soloĩwa khukmari garikana... \\ \gll acheta pati gar -ikana soloĩwa khukmari gar -ikana \\ {consecrated\ rice} leaf do -CVB calabash trident do -CVB \\ \glt ‘Having [here before me] consecrated rice, having calabashes and a trident...’ \end{xlist} \end{exe} \end{document}

  • Custom font sizes like Word Office [duplicate]
    by Sebastiano on October 4, 2026 at 8:42 am

    I am using the extarticle document class because I need larger font sizes than those provided by the standard article class. My document currently starts with: \documentclass[leqno,14pt]{extarticle} As far as I understand, extarticle provides the following font sizes: 8pt, 9pt, 10pt, 11pt, 12pt, 14pt, 17pt, and 20pt. However, I would like to use intermediate font sizes such as 11.5pt or 11.758653pt, 12.54525pt, 13pt, or 15pt, similar to what is possible in Microsoft Word. Is there a proper way to define or use arbitrary base font sizes to have the same size like Microsoft Word (example: 12.58217582pt)? I am preparing a multiple-choice test with 10 questions and want to typeset it on an A3 page, so being able to fine-tune the font size would be very useful. Related: How to put centered figures in \question{} using TikZ and \includegraphics without mistakes

  • Apparent conflict between \xelatex and \Longrightarrow
    by Leo on October 4, 2026 at 8:34 am

    The command \Longrightarrow gives a broken arrow if I compile using xelatex and a regular (long) arrow if I compile using pdflatex. Here is MWE: \documentclass[11pt,b5paper]{book} \usepackage{amsmath, mathrsfs} %\usepackage[T1]{fontenc} % %\usepackage{fontspec} % %\setmainfont{Tinos} % \usepackage{polyglossia} % \setdefaultlanguage{french} % \setotherlanguages{hebrew, greek} % \newfontfamily\hebrewfont[Script=Hebrew]{Tinos} % \newfontfamily\greekfont[Script=Greek]{Linux Libertine O} % \newfontfamily\greekfontsf[Script=Greek]{Linux Libertine O} \begin{document} $$ A \Longrightarrow B$$ \end{document} This works correctly as it is (with pdflatex). If one includes the commented out (%) code (and compiles with xelatex), the arrow is broken. Is it a known conflict of packages?

  • How to add \tags to multi-line equations in Lyx?
    by Penelope on October 3, 2026 at 11:46 pm

    I am trying to add text using \tag in a multi-line equation in Lyx. Here is how I do it in mathjax for the web. \begin{align} a \alpha \beta + b \beta^2 N^2 & = \beta \\ \\ b (\beta^2 N^2 - \alpha^2) & = \beta  \tag{using (ii)} \\ \\ \beta ( \alpha^2 - \beta^2 N^2) & = \beta \tag{using (iv)}\\ \\ \alpha^2 - \beta^2 N^2 & = 1 \end{align} And the result seems to work: But I can't find any way to do this in the Lyx gui. Perhaps I shouldn't be trying to add tag, and there is a more canonical way to do it? Ultimately I want to express short explainers with each line of a multi-line equation.

  • \autoref does not work for my exercise environment. What should I use?
    by Sourav on October 3, 2026 at 9:51 pm

    I want to link my exercise later in the document such that the text "Exercise #" is (colored and) hyperlinked. For doing the same with the theorem environment, \autoref can be used, but it doesn't work with my exercise environment. How can I make it work ? Here is what I tried : \documentclass{article} \usepackage{amsmath,amsfonts,amssymb,amsthm} \usepackage{hyperref} \hypersetup{ colorlinks=true, filecolor=red, urlcolor=red, linkcolor=red } \newtheorem{theorem}{Theorem} \theoremstyle{definition} \newtheorem{exercise}{Exercise} \begin{document} \begin{theorem} \label{th} A theorem. \end{theorem} \begin{exercise} \label{ex} Some exercise. \end{exercise} See \ref{th} and \ref{ex}. \\ See \autoref{th} and \autoref{ex} \end{document} Output : In particular, I want the second 1 in the second line to be written as Exercise 1, instead of just the number 1.

  • Want an environment titled "Solution of Exercise #"
    by Sourav on October 3, 2026 at 10:26 am

    I am in need of an environment of the following name : Solution of Exercise #, where # is the required exercise number. I know that I can do this in case of a proof : \documentclass{article} \usepackage{amsmath,amsfonts,amssymb,amsthm} \usepackage{hyperref} \hypersetup{ colorlinks=true, filecolor=red, urlcolor=red, linkcolor=red } \newtheorem{theorem}{Theorem} \theoremstyle{definition} \newtheorem{exercise}{Exercise} \theoremstyle{remark} \newtheorem*{solution}{Solution} \begin{document} \begin{theorem} \label{th} Theorem. \end{theorem} Some content in between. \begin{proof}[Proof of \ref{th}] Proof. \end{proof} \end{document} The above gives the following output : How can I do the same for a solution ?

  • Is there any method to invert the even odd rule?
    by D G on October 1, 2026 at 8:37 am

    I want to get rather than Appending (0,0) circle (3.5) is fine but I am wondering whether there are any nicer approaches. odd even rule does not exist too. \documentclass[tikz,border=1cm,12pt]{standalone} \begin{document} \begin{tikzpicture}[ultra thick] \filldraw[fill=red,even odd rule] \foreach \i in {0,0.5,...,3.5}{(0,0) circle (\i)} (0,0) circle (3.5) % just a hack to invert the even odd rule ; \end{tikzpicture} \end{document}

  • Table of amino acids
    by Svend Tveskæg on September 30, 2026 at 9:12 am

    The following code is nothing more than a possible very early starting point for a document for amino acids. \DocumentMetadata{tagging = off} \documentclass{article} \usepackage{graphicx} \usepackage{chemfig} \usepackage{tabularray} % maybe use this package for the table \begin{document} \setchemfig{atom sep = 2em} \chemfig{H_2N-CH(-[6,,,,red]{\color{red}H})-C(=[2]O)-OH} \end{document} How do I produce the following table? I would like to also have a table boundary. I hope that I can create all of the 20 drawings myself so I would appreciate some help with the construction of the table and the placement of the name of the amino acid in the top left corner of the first cell.