parent_url
stringlengths
41
46
parent_score
stringlengths
1
4
parent_body
stringlengths
25
35.5k
parent_user
stringlengths
37
42
parent_title
stringlengths
12
150
accepted
bool
2 classes
body
stringlengths
4
36.7k
score
stringlengths
1
4
user
stringlengths
37
42
answer_id
stringlengths
1
6
__index_level_0__
int64
0
322k
https://tex.stackexchange.com/questions/694176
0
For some reason, I need to ref to the name declared in `\bibitem{name}` directly by some command, not by `\cite`. It appears to be possible by label`\b@name` (surrounded by`\makeaatletter` and `\makeatother`). However, it does not work when `name` contains some special characters like `_`, which are allowed in bibitem names and can be reffered by `\cite`. Here is a little example. ``` \documentclass{book} \begin{document} \makeatletter[\b@Name,\b@NameOne,\b@NameTwo]\makeatother %works \cite{Name_} %works \makeatletter[\b@Name_]\makeatother %does not work \begin{thebibliography}{1} \bibitem{Name} \bibitem{Name_} \bibitem{NameOne} \bibitem{NameTwo} \end{thebibliography} \end{document} ``` I am almost sure that LaTeX produces for `Name_` the command more complicated than `\b@Name_`, because `_` has special meaning (subindex in math mode). I tried to guess the command for `Name_`, also used 'tracingmacros', but without success. So, the question is: how to determ command like `\b@Name` for the name with underbar `_`? Thanks in advance
https://tex.stackexchange.com/users/95707
Ref to bibitem by direct command, not by \cite
false
Besides making `at` a `letter`, you need to do the same with `_`: ``` \catcode`\_11 ``` Full example (where I am using `{`group`}` to restore `_`): ``` \documentclass{book} %\documentclass{article} \begin{document} \makeatletter[\b@Name,\b@NameOne,\b@NameTwo]\makeatother %works cite: \cite{Name_} %works The solution: {\makeatletter\catcode`\_11 [\b@Name_]}% precent here kills the space, do you want a space here? \begin{thebibliography}{1} \bibitem{Name} \bibitem{Name_} \bibitem{NameOne} \bibitem{NameTwo} \end{thebibliography} \end{document} ```
1
https://tex.stackexchange.com/users/302342
694183
322,055
https://tex.stackexchange.com/questions/694126
0
Everything seems to be on the title. Here is my MWE: ``` \documentclass{article} \begin{document} \tableofcontents \section{Section 1} Content of section 1. \section{Section 2} Content of section 2. \addcontentsline{toc}{subsection}{Non indexed subsection} Content of non indexed sub-section. \section{Section 3} Content of section 3. \end{document} ``` The goal is pretty simple to explain: getting the “Non indexed subsection” printed in the TOC but not appearing in the PDF index when opened with a PDF reader. How to get this behavior?
https://tex.stackexchange.com/users/30933
How to declare section who appear on the printed TOC but not on the PDF’s index
true
you can locally change the bookmarks depth to exclude some levels: ``` \documentclass{article} \usepackage{hyperref} \begin{document} \tableofcontents \section{Section 1} Content of section 1. \section{Section 2} Content of section 2. \hypersetup{bookmarksdepth=0} \addcontentsline{toc}{subsection}{Non indexed subsection} Content of non indexed sub-section. \hypersetup{bookmarksdepth=3} \section{Section 3} Content of section 3. \subsection{indexed} \end{document} ```
1
https://tex.stackexchange.com/users/2388
694185
322,056
https://tex.stackexchange.com/questions/694176
0
For some reason, I need to ref to the name declared in `\bibitem{name}` directly by some command, not by `\cite`. It appears to be possible by label`\b@name` (surrounded by`\makeaatletter` and `\makeatother`). However, it does not work when `name` contains some special characters like `_`, which are allowed in bibitem names and can be reffered by `\cite`. Here is a little example. ``` \documentclass{book} \begin{document} \makeatletter[\b@Name,\b@NameOne,\b@NameTwo]\makeatother %works \cite{Name_} %works \makeatletter[\b@Name_]\makeatother %does not work \begin{thebibliography}{1} \bibitem{Name} \bibitem{Name_} \bibitem{NameOne} \bibitem{NameTwo} \end{thebibliography} \end{document} ``` I am almost sure that LaTeX produces for `Name_` the command more complicated than `\b@Name_`, because `_` has special meaning (subindex in math mode). I tried to guess the command for `Name_`, also used 'tracingmacros', but without success. So, the question is: how to determ command like `\b@Name` for the name with underbar `_`? Thanks in advance
https://tex.stackexchange.com/users/95707
Ref to bibitem by direct command, not by \cite
true
This will also work at the first compilation (when the commands are not yet in the aux and so not defined. `\UseName` requires a rather current LaTeX. In older systems you can use `\csname b@Name\endcsname`. ``` \documentclass{book} \begin{document} \UseName{b@Name}, \UseName{b@NameOne}, \UseName{b@NameTwo}, \UseName{b@Name_} \begin{thebibliography}{1} \bibitem{Name} \bibitem{Name_} \bibitem{NameOne} \bibitem{NameTwo} \end{thebibliography} \end{document} ```
3
https://tex.stackexchange.com/users/2388
694186
322,057
https://tex.stackexchange.com/questions/694190
1
I would like to generate the table contents with pure latex. My draft is as follows: ``` \documentclass{article} \usepackage{expl3} \usepackage{colortbl} \definecolor{lightgray}{gray}{0.9} \ExplSyntaxOn \seq_new:N \l_my_projects_seq \NewDocumentCommand \addproject { m } { \seq_put_right:Nn \l_my_projects_seq { #1 } } \NewDocumentCommand \printprojects {} { \begin{tabular}{lc} Project & Content \\ \seq_map_indexed_inline:Nn \l_my_projects_seq { \ifodd ##1 \else \rowcolor{lightgray} \fi \textsf{##2} & ...\\ } \end{tabular} } \ExplSyntaxOff \begin{document} \addproject{A} \addproject{B} \printprojects \end{document} ``` The error is ``` ! Misplaced \noalign. \rowcolor ->\noalign {\ifnum 0=`}\fi \global \let \CT@do@color \CT@@do@color... ``` In case I disable `\rowcolor...`, the PDF is generated. In case I put `\rowcolor...` before `\seq_map...`, the PDF is generated, too. --- In case, I should switch from expl3 to lualatex, it is also OK for me. This is an exercise for me to learn something of [expl3](https://www.ctan.org/pkg/l3kernel).
https://tex.stackexchange.com/users/9075
Iterate on set and use \rowcolor
false
TeX is in a very delicate state at the start of a cell, looking for spaning entries or (here) `\noalign`. Pretty much anything such as `\relax` or a `\protected` macro will stop the scan and start the cell content. ``` \documentclass{article} \usepackage{colortbl} \begin{document} \begin{tabular}{ll} 11&22\\ \rowcolor{blue} 33&44 \end{tabular} \def\foo{\rowcolor{blue}} \begin{tabular}{ll} 11&22\\ \foo 33&44 \end{tabular} \ExplSyntaxOn \show\seq_map_indexed_inline:Nn \ExplSyntaxOff \protected\def\blub{\rowcolor{blue}} \begin{tabular}{ll} 11&22\\ \blub 33&44 \end{tabular} \end{document} ``` Note `\seq_map_indexed_inline:Nn` is `\protected` and `\foo` works but `\blub` does not.
1
https://tex.stackexchange.com/users/1090
694195
322,063
https://tex.stackexchange.com/questions/694196
0
Following the recommendation of the kind user in this post: [PDFLaTeX and Arabic, Farsi and other scripts](https://tex.stackexchange.com/questions/694093/pdflatex-and-arabic-farsi-and-other-scripts) I switched compilers, from Pdftex to Luatex in order to be able to print non-Latin alphabets, which works. What doesn't work is my shell script to automatically convert from markdown, via pandoc, to a .tex file, to a PDF via Latexmk. I had this working perfectly, but I don't know how to do it for Luatex. This was the script: ``` mkdir -p /home/Docs/Notes/{{title}} pandoc -r markdown-auto_identifiers -w latex {{file_path:absolute}} -o /home/Docs/Notes/{{title}}/{{title}}.tex --template="/home/Docs/LaTeX/My Templates/Notes/Notes.tex" --lua-filter=/home/Docs/LaTeX/Filters/highlight.lua --lua-filter=/home/Docs/LaTeX/Filters/highlight-period.lua --lua-filter=/home/Docs/LaTeX/Filters/Span.lua --lua-filter=/home/Docs/LaTeX/Filters/Span-period.lua gnome-terminal -- bash -c "cd /home/Docs/Notes/{{title}} && latexmk -pvc -pdf < /dev/null && latexmk -c && cp {{title}}.pdf /home/Docs/Notes/ && exit; exec bash" ``` I run this from a plugin in Obsidian.md (a markdown editor) that can replace the `{{title}}` variables with the current note, i.e. file, name. With the above script, I get told: ``` ! Package babel Error: The bidi method 'basic' is available only in (babel) luatex. I'll continue with 'bidi=default', so (babel) expect wrong results. ``` I believe only the part after `gnome-terminal` is relevant, and I tried switching the latexmk command to this: `latexmk -pdflatex=lualatex -pdf {{title}}.tex` With this it compiles a little further, but still get an error, and no PDF is produced. ``` === TeX engine is 'pdfTeX' Latexmk: Found input bbl file '2023-07-24.bbl' Latexmk: Log file says output to '2023-07-24.pdf' Biber warning: [177] Biber.pm:130> WARN - The file '2023-07-24.bcf' does not contain any citations! Latexmk: Found biber source file(s) [2023-07-24.bcf] Latexmk: All targets (2023-07-24.pdf) are up-to-date Rc files read: /etc/LatexMk Latexmk: This is Latexmk, John Collins, 20 November 2021, version: 4.76. cp: cannot create regular file '/home/Docs/Notes/': Not a directory ``` My MWE LaTeX Document from the other thread: ``` \documentclass[a4paper, 12pt, oneside]{article} \usepackage[bidi=basic]{babel} \babelprovide[main, import]{english} \babelprovide[onchar = ids fonts]{arabic} \babelfont[arabic]{rm}[Renderer = HarfBuzz, Scale = MatchLowercase]{Amiri} \begin{document} Giaurs - From Persian فروشگاه‎ (gâvor) \end{document} ``` How can I adapt this script to automate the process once again. Thanks!
https://tex.stackexchange.com/users/289942
Problem "converting" from PDFtex to Luatex, using Latexmk
true
`latexmk` will use pdflatex by default (or explicitly via the `-pdf` option on the commandline). You can replace that by `-pdflua` or equivalently `-lualatex`
2
https://tex.stackexchange.com/users/1090
694198
322,064
https://tex.stackexchange.com/questions/569933
2
I'm trying to balance the last page of my paper. It contains only references formatted with the new `acmart.cls` format, and takes up about 1/4 of the left column. I've already tried a few methods: ``` \usepackage{balance} \balance ``` and ``` \usepackage{flushend} ``` and ``` \usepackage{multicol} \begin{multicols}{x} ``` None of these are working. The first two produce no change, and the last one completely destroys the formatting.
https://tex.stackexchange.com/users/228462
How to balance references in new acmart.cls format?
false
I had the same problem and found a quick and dirty fix: Insert a `\newpage` in your `.bbl` to split the last part of your references in two columns....
1
https://tex.stackexchange.com/users/302903
694200
322,065
https://tex.stackexchange.com/questions/694149
1
Please see the MWE. I would like the page numbers aligned with the entire block of text (text + margin note) like in page 3. I know it is possible because it is used in the documentation of Notes Tex (<https://ctan.math.washington.edu/tex-archive/macros/latex/contrib/notestex/doc/NotesTeX.pdf>) but cannot find a way! ``` \documentclass[10pt]{book} \usepackage{lipsum} \usepackage{marginnote} \renewcommand*{\marginfont}{\scriptsize \sffamily} \renewcommand\raggedrightmarginnote{} \renewcommand\raggedleftmarginnote{} \usepackage[ paperwidth=160mm, paperheight=240mm, textheight=18cm, textwidth=8cm, inner=2cm, marginparwidth=2.5cm, marginparsep=0.5cm] {geometry} \usepackage{wrapfig} \usepackage{fontspec} \begin{document} %\sloppy \newpage \paragraph{First} \begin{wrapfigure}{i}{0.64\textwidth}% \vspace{5pt} \noindent {\fontsize{46pt}{46pt}\selectfont \hspace{-5pt} Big} \end{wrapfigure} This\marginnote{I want this to be aligned. \lipsum[1]} is a paragraph. \lipsum[1] \newpage \paragraph{First} \begin{wrapfigure}{i}{0.64\textwidth}% \vspace{5pt} \noindent {\fontsize{46pt}{46pt}\selectfont \hspace{-5pt} Big} \end{wrapfigure} This\marginnote{I want this to be aligned. \lipsum[1]} is a paragraph. \lipsum[1] \newgeometry{ textwidth=11cm} \lipsum[1] \restoregeometry \end{document} ```
https://tex.stackexchange.com/users/254618
Page number alignment when using \marginnote
true
This uses `\AddToHook` to implement the page number. ``` \documentclass[10pt]{book} \usepackage{lipsum} \usepackage{marginnote} \renewcommand*{\marginfont}{\scriptsize \sffamily} \renewcommand\raggedrightmarginnote{} \renewcommand\raggedleftmarginnote{} \usepackage[ paperwidth=160mm, paperheight=240mm, textheight=18cm, textwidth=8cm, inner=2cm, marginparwidth=2.5cm, marginparsep=0.5cm, showframe] {geometry} \pagestyle{empty} \AddToHook{shipout/background}{\ifodd\value{page} \put (\dimexpr 1in+\oddsidemargin+\textwidth+\marginparsep+\marginparwidth\relax, \dimexpr -1in-\topmargin-\headheight\relax) {\llap{\thepage}}% right justified \else \put (\dimexpr 1in+\evensidemargin-\marginparsep-\marginparwidth\relax, \dimexpr -1in-\topmargin-\headheight\relax) {\thepage} \fi} \usepackage{wrapfig} \usepackage{fontspec} \begin{document} \newpage \paragraph{First} \begin{wrapfigure}{i}{0.64\textwidth}% \vspace{5pt} \noindent {\fontsize{46pt}{46pt}\selectfont \hspace{-5pt} Big} \end{wrapfigure} This\marginnote{I want this to be aligned. \lipsum[1]} is a paragraph. \lipsum[1] \newpage \paragraph{First} \begin{wrapfigure}{i}{0.64\textwidth}% \vspace{5pt} \noindent {\fontsize{46pt}{46pt}\selectfont \hspace{-5pt} Big} \end{wrapfigure} This\marginnote{I want this to be aligned. \lipsum[1]} is a paragraph. \lipsum[1] \newgeometry{marginparsep=0pt, marginparwidth=0pt, textwidth=11cm} \lipsum[1] \restoregeometry \end{document} ``` --- This modifies `\pagestyle{headings}`, which *should* be the default style for book class. ``` \documentclass[10pt]{book} \usepackage{lipsum} \usepackage{marginnote} \renewcommand*{\marginfont}{\scriptsize \sffamily} \renewcommand\raggedrightmarginnote{} \renewcommand\raggedleftmarginnote{} \usepackage[ paperwidth=160mm, paperheight=240mm, textheight=18cm, textwidth=8cm, inner=2cm, marginparwidth=2.5cm, marginparsep=0.5cm, showframe] {geometry} \makeatletter \def\ps@headings{% \let\@oddfoot\@empty\let\@evenfoot\@empty \def\@evenhead{\hskip\dimexpr -\marginparsep-\marginparwidth\relax \thepage\hfil\slshape\leftmark}% \def\@oddhead{{\slshape\rightmark}\hfil\thepage\hskip\dimexpr -\marginparsep-\marginparwidth\relax}% \let\@mkboth\markboth \def\chaptermark##1{% \markboth {\MakeUppercase{% \ifnum \c@secnumdepth >\m@ne \if@mainmatter \@chapapp\ \thechapter. \ % \fi \fi ##1}}{}}% \def\sectionmark##1{% \markright {\MakeUppercase{% \ifnum \c@secnumdepth >\z@ \thesection. \ % \fi ##1}}}} \makeatother \pagestyle{headings} \usepackage{wrapfig} \usepackage{fontspec} \begin{document} \newpage \paragraph{First} \begin{wrapfigure}{i}{0.64\textwidth}% \vspace{5pt} \noindent {\fontsize{46pt}{46pt}\selectfont \hspace{-5pt} Big} \end{wrapfigure} This\marginnote{I want this to be aligned. \lipsum[1]} is a paragraph. \lipsum[1] \newpage \paragraph{First} \begin{wrapfigure}{i}{0.64\textwidth}% \vspace{5pt} \noindent {\fontsize{46pt}{46pt}\selectfont \hspace{-5pt} Big} \end{wrapfigure} This\marginnote{I want this to be aligned. \lipsum[1]} is a paragraph. \lipsum[1] \newgeometry{marginparsep=0pt, marginparwidth=0pt,textwidth=11cm} \lipsum[1] \restoregeometry \end{document} ```
1
https://tex.stackexchange.com/users/34505
694203
322,067
https://tex.stackexchange.com/questions/10706
106
I'm using a custom class file. My main file looks like this: ``` \documentclass[12pt,a4paper]{thesis} \begin{document} \frontmatter \pagenumbering{alph} \pagenumbering{roman} \clearpage \cleardoublepage \tableofcontents \clearpage \listoffigures \clearpage \listoftables \mainmatter \part{test} \input{test} \end{document} ``` If I put this in my `test.tex` it does work: ``` \chapter{test} \label{chapter:test} test ``` When it becomes more text (lets say 40x the word "test") I get the error stated in my question title. To test it I brought my class file down to this: ``` \ProvidesClass{thesis} \NeedsTeXFormat{LaTeX2e} % Based on the memoir class \DeclareOption*{\PassOptionsToClass{\CurrentOption}{memoir}} \ProcessOptions \LoadClass{memoir} ``` I'm totally confused what is causing my error now. This is the complete error: ``` ! pdfTeX error (font expansion): auto expansion is only possible with scalable fonts. \AtBegShi@Output ...ipout \box \AtBeginShipoutBox \fi \fi ```
https://tex.stackexchange.com/users/3338
pdfTeX error (font expansion): auto expansion is only possible with scalable
false
On Ubuntu, I added `texlive-fonts-extra`: ``` sudo apt install texlive-fonts-extra ``` And, it worked. I didn't make any changes to the `tex` files.
0
https://tex.stackexchange.com/users/2319
694204
322,068
https://tex.stackexchange.com/questions/694180
0
I want to use [fizzed](http://fizzed.com/oss/font-mfizz) icons on my overleaf page. I [downloaded](https://www.cdnpkg.com/font-mfizz/file/font-mfizz.ttf/) version 2.4.1 and uploaded it to overleaf. but how can I use icons? here my code: ``` \documentclass{article} \usepackage{graphicx} % Required for inserting images \usepackage{fontawesome5} \usepackage{fontspec} \begin{document} \faGithub\\ \faBootstrap\\ \faGit\\ \faDocker\\ \end{document} ```
https://tex.stackexchange.com/users/72677
Use mfizz icons in overleaf
true
``` \documentclass{article} \usepackage{fontspec} \newfontface\mfz{font-mfizz.ttf} \def\setfizz#1#2{\expandafter\def\csname fizz #1\endcsname{{\mfz#2}}} \def\usefizz#1{\csname fizz #1\endcsname} \setfizz{3dprint}{^^^^f100} \setfizz{alpinelinux}{^^^^f101} \setfizz{angular}{^^^^f102} \setfizz{angular-alt}{^^^^f103} \setfizz{antenna}{^^^^f104} \setfizz{apache}{^^^^f105} \setfizz{archlinux}{^^^^f106} \setfizz{aws}{^^^^f107} \setfizz{azure}{^^^^f108} \setfizz{backbone}{^^^^f109} \setfizz{blackberry}{^^^^f10a} \setfizz{bomb}{^^^^f10b} \setfizz{bootstrap}{^^^^f10c} \setfizz{c}{^^^^f10d} \setfizz{cassandra}{^^^^f10e} \setfizz{centos}{^^^^f10f} \setfizz{clojure}{^^^^f110} \setfizz{codeigniter}{^^^^f111} \setfizz{codepen}{^^^^f112} \setfizz{coffee-bean}{^^^^f113} \setfizz{cplusplus}{^^^^f114} \setfizz{csharp}{^^^^f115} \setfizz{css}{^^^^f116} \setfizz{css3}{^^^^f117} \setfizz{css3-alt}{^^^^f118} \setfizz{d3}{^^^^f119} \setfizz{database}{^^^^f11a} \setfizz{database-alt}{^^^^f11b} \setfizz{database-alt2}{^^^^f11c} \setfizz{debian}{^^^^f11d} \setfizz{docker}{^^^^f11e} \setfizz{dreamhost}{^^^^f11f} \setfizz{elixir}{^^^^f120} \setfizz{elm}{^^^^f121} \setfizz{erlang}{^^^^f122} \setfizz{exherbo}{^^^^f123} \setfizz{fedora}{^^^^f124} \setfizz{fire-alt}{^^^^f125} \setfizz{freebsd}{^^^^f126} \setfizz{freecodecamp}{^^^^f127} \setfizz{gentoo}{^^^^f128} \setfizz{ghost}{^^^^f129} \setfizz{git}{^^^^f12a} \setfizz{gnome}{^^^^f12b} \setfizz{go}{^^^^f12c} \setfizz{go-alt}{^^^^f12d} \setfizz{google}{^^^^f12e} \setfizz{google-alt}{^^^^f12f} \setfizz{google-code}{^^^^f130} \setfizz{google-developers}{^^^^f131} \setfizz{gradle}{^^^^f132} \setfizz{grails}{^^^^f133} \setfizz{grails-alt}{^^^^f134} \setfizz{grunt}{^^^^f135} \setfizz{gulp}{^^^^f136} \setfizz{gulp-alt}{^^^^f137} \setfizz{hadoop}{^^^^f138} \setfizz{haskell}{^^^^f139} \setfizz{heroku}{^^^^f13a} \setfizz{html}{^^^^f13b} \setfizz{html5}{^^^^f13c} \setfizz{html5-alt}{^^^^f13d} \setfizz{iphone}{^^^^f13e} \setfizz{java}{^^^^f13f} \setfizz{java-bold}{^^^^f140} \setfizz{java-duke}{^^^^f141} \setfizz{javascript}{^^^^f142} \setfizz{javascript-alt}{^^^^f143} \setfizz{jetty}{^^^^f144} \setfizz{jquery}{^^^^f145} \setfizz{kde}{^^^^f146} \setfizz{laravel}{^^^^f147} \setfizz{line-graph}{^^^^f148} \setfizz{linux-mint}{^^^^f149} \setfizz{looking}{^^^^f14a} \setfizz{magento}{^^^^f14b} \setfizz{mariadb}{^^^^f14c} \setfizz{maven}{^^^^f14d} \setfizz{microscope}{^^^^f14e} \setfizz{mobile-device}{^^^^f14f} \setfizz{mobile-phone-alt}{^^^^f150} \setfizz{mobile-phone-broadcast}{^^^^f151} \setfizz{mongodb}{^^^^f152} \setfizz{mssql}{^^^^f153} \setfizz{mysql}{^^^^f154} \setfizz{mysql-alt}{^^^^f155} \setfizz{netbsd}{^^^^f156} \setfizz{nginx}{^^^^f157} \setfizz{nginx-alt}{^^^^f158} \setfizz{nginx-alt2}{^^^^f159} \setfizz{nodejs}{^^^^f15a} \setfizz{npm}{^^^^f15b} \setfizz{objc}{^^^^f15c} \setfizz{openshift}{^^^^f15d} \setfizz{oracle}{^^^^f15e} \setfizz{oracle-alt}{^^^^f15f} \setfizz{osx}{^^^^f160} \setfizz{perl}{^^^^f161} \setfizz{phone-alt}{^^^^f162} \setfizz{phone-gap}{^^^^f163} \setfizz{phone-retro}{^^^^f164} \setfizz{php}{^^^^f165} \setfizz{php-alt}{^^^^f166} \setfizz{playframework}{^^^^f167} \setfizz{playframework-alt}{^^^^f168} \setfizz{plone}{^^^^f169} \setfizz{postgres}{^^^^f16a} \setfizz{postgres-alt}{^^^^f16b} \setfizz{python}{^^^^f16c} \setfizz{raspberrypi}{^^^^f16d} \setfizz{reactjs}{^^^^f16e} \setfizz{redhat}{^^^^f16f} \setfizz{redis}{^^^^f170} \setfizz{ruby}{^^^^f171} \setfizz{ruby-on-rails}{^^^^f172} \setfizz{ruby-on-rails-alt}{^^^^f173} \setfizz{rust}{^^^^f174} \setfizz{sass}{^^^^f175} \setfizz{satellite}{^^^^f176} \setfizz{scala}{^^^^f177} \setfizz{scala-alt}{^^^^f178} \setfizz{script}{^^^^f179} \setfizz{script-alt}{^^^^f17a} \setfizz{shell}{^^^^f17b} \setfizz{sitefinity}{^^^^f17c} \setfizz{solaris}{^^^^f17d} \setfizz{splatter}{^^^^f17e} \setfizz{spring}{^^^^f17f} \setfizz{suse}{^^^^f180} \setfizz{svg}{^^^^f181} \setfizz{symfony}{^^^^f182} \setfizz{tomcat}{^^^^f183} \setfizz{ubuntu}{^^^^f184} \setfizz{unity}{^^^^f185} \setfizz{wireless}{^^^^f186} \setfizz{wordpress}{^^^^f187} \setfizz{x11}{^^^^f188} \begin{document} \usefizz{python} + \usefizz{x11} {\Huge \usefizz{python} + \usefizz{x11}} \end{document} ```
2
https://tex.stackexchange.com/users/1090
694206
322,069
https://tex.stackexchange.com/questions/510279
2
I want to do a package that handles the automatic tagging of pdf documents. I try to solve the problem of taggings paragraphs with chapters, sections, subsections, subsubsections, ..., sub..sections and paragraphs with subparagraphs. I read the example of tagpdf package that performs tagging of chapters, sections, sub..sections etc., but first it only works for the names of those parts of the document and the text of the document that are not displayed in pdf, and secondly it only works for the scrbook class, but I want, if it is possible, that it works for any class of documents (I do not know if it is possible to check the class of the document via latex/lualatex). I tried to use `\everypar` commands, but as I understood, reading my log, it seems that this command is called only n+1 times, where n is the number of sections and sub...sections. My document now only needs to be compiled in lualatex. Thanks very much everybody for the help. test\_tagging\_of\_pars.tex ``` \documentclass[12pt]{scrbook} \usepackage{tagpdf} \tagpdfsetup{interwordspace=true,activate-all,uncompress} \usepackage{amsmath,amssymb} \title{test document} \author{AlexanderKozlovskiy} \date{\today} %\maketitle (why this not works?) %Marking the toc entries %around the whole entry so only structure: \newcommand\tagscrtocentry[1]{\tagstructbegin{tag=TOCI}#1\tagstructend} %leaf so structure and mc: \newcommand\tagscrtocpagenumber[1]{% \tagstructbegin{tag=Reference}% \tagmcbegin{tag=Reference}% #1% \tagmcend \tagstructend} \DeclareTOCStyleEntry[ entryformat=\tagscrtocentry, pagenumberformat=\tagscrtocpagenumber]{tocline}{chapter} \DeclareTOCStyleEntry[ entryformat=\tagscrtocentry, pagenumberformat=\tagscrtocpagenumber]{tocline}{section} \DeclareTOCStyleEntry[ entryformat=\tagscrtocentry, pagenumberformat=\tagscrtocpagenumber]{tocline}{subsection} \DeclareTOCStyleEntry[ entryformat=\tagscrtocentry, pagenumberformat=\tagscrtocpagenumber]{tocline}{subsubsection} \DeclareTOCStyleEntry[ entryformat=\tagscrtocentry, pagenumberformat=\tagscrtocpagenumber]{tocline}{paragraph} \renewcommand{\addtocentrydefault}[3]{% \ifstr{#3}{}{} {%\ \ifstr{#2}{} {% \addcontentsline{toc}{#1} {% \protect\nonumberline \tagstructbegin{tag=P}% \tagmcbegin{tag=P}% #3% \tagmcend \tagstructend }% }% {% \addcontentsline{toc}{#1}{% \tagstructbegin{tag=Lbl}% \tagmcbegin{tag=Lbl}% \protect\numberline{#2}% \tagmcend\tagstructend \tagstructbegin{tag=P}% \tagmcbegin{tag=P}% #3% \tagmcend \tagstructend }% }% }}% % the dots must be marked too \makeatletter \renewcommand*{\TOCLineLeaderFill}[1][.]{% \leaders\hbox{$\m@th \mkern \@dotsep mu\hbox{\tagmcbegin{artifact}#1\tagmcend}\mkern \@dotsep mu$}\hfill } %%%%%%%%% % Sectioning commands %%%%%%%% \ExplSyntaxOn \prop_new:N \g_tag_section_level_prop \prop_gput:Nnn \g_tag_section_level_prop {chapter}{H1} \prop_gput:Nnn \g_tag_section_level_prop {section}{H2} \prop_gput:Nnn \g_tag_section_level_prop {subsection}{H3} \prop_gput:Nnn \g_tag_section_level_prop {subsubsection}{H4} \prop_gput:Nnn \g_tag_section_level_prop {paragraph}{H5} %new 0.6, as attributes are local we have to put \tagmcbegin everywhere. \renewcommand{\chapterlinesformat}[3] { \@hangfrom { \tagstructbegin{tag=\prop_item:Nn\g_tag_section_level_prop{chapter}} \tl_if_empty:nF{#2} { \tagmcbegin {tag=\prop_item:Nn\g_tag_section_level_prop{chapter}} #2 \tagmcend } } {\tagmcbegin {tag=\prop_item:Nn\g_tag_section_level_prop{chapter}} #3\tagmcend\tagstructend}% } %unnumbered sections level give an empty mc, need to think about it. \renewcommand{\sectionlinesformat}[4] { \@hangfrom {\hskip #2 \tagstructbegin{tag=\prop_item:Nn\g_tag_section_level_prop{#1}} \tl_if_empty:nF{#3} { \tagmcbegin {tag=\prop_item:Nn\g_tag_section_level_prop{#1}} #3 \tagmcend } } {\tagmcbegin {tag=\prop_item:Nn\g_tag_section_level_prop{#1}} #4 \tagmcend\tagstructend}% } \ExplSyntaxOff \AfterTOCHead{\tagstructbegin{tag=TOC}} \AfterStartingTOC{\tagstructend} %end TOC \begin{document} \tagstructbegin{tag=Document} %do tagging of paragraphs \ExplSyntaxOn \everypar{ \message{the_size_of_stack_of_structure_elements_is_\seq_count:N \g__uftag_struct_stack_seq} %i dont know,why spaces ignore when i try input something in log,so i use _ instead of space character. \int_case:nn {\seq_count:N \g__uftag_struct_stack_seq} { {2}{\tagstructbegin{tag=P}\tagmcbegin{tag=P}} {4}{\tagstructend \tagstructbegin{tag=P}\tagmcbegin{tag=P}}}} \ExplSyntaxOff \begin{centering} test tagging of parts of documents\\ \end{centering} \newpage \tableofcontents \newpage \chapter{first chapter} start testing of tagging of paragraphs \section{test of section} {\tiny this is test document,which allow to do tests of tagging sections and paragraphs \subsection{subsection 1} test again test \begin{description} \item[1] lemon \item[2] orange again testing of tagging parts of document \item[3] red \item[4] green \end{description}} \newpage \subsection{new test} end of test of tagging of document. \ExplSyntaxOn \int_step_inline:nnn{2}{\seq_count:N \g__uftag_struct_stack_seq } {\tagstructend} \ExplSyntaxOff \end{document} ```
https://tex.stackexchange.com/users/182671
How to automatically tag chapters,sections,sub..sections and paragraphs?
false
Recently, this feature was added in the 2023-06-01 release of TeXLive. See <https://www.latex-project.org/news/2023/06/10/issue37-of-latex2e-released/>. It is relatively minimal in scope (only allows for 3 document types and does basic section/subsection/figures/some amsmath equations), but this is, as I understand it, a significant step in the right direction. The contributors also indicate that they are working to expand the scope of automatic tagging in subsequent releases.
0
https://tex.stackexchange.com/users/208525
694210
322,072
https://tex.stackexchange.com/questions/694214
0
I am working on the critical edition of an poem written in "ottava rima" (each stanza has 8 lines), and I am using the package **reledmac**. I need both the stanza number and the line number to be printed in the apparatus below the text, next to the lemma. E.g. the word *hello* in line 7 of stanza 15 should be printed in the apparatus as: **15**.7 hello] etc. I have managed to print the line number, but I could not find a way to have the stanza number also appear. I am conscious of the banality of my question, but: does anyone have a solution?
https://tex.stackexchange.com/users/302912
Printing both stanza and line numbers in the critical apparatus of a poem (reledmac)
true
As always, it is a bit difficult without an example to test it, yet the manual suggests the command `\Xstanza[<s>]` (chapter 7.4.9, "printing stanza number") for that purpose.
0
https://tex.stackexchange.com/users/216203
694215
322,073
https://tex.stackexchange.com/questions/694170
0
I am using the following line of (Xe)TeX code to include the TeX Gyre Schola font: ``` \input cs-schola ``` It works well with the \bf, \it, etc. commands but none of \ninerm, \small and \footnotesize are defined. How can I access other font sizes? Should I define the fonts myself?
https://tex.stackexchange.com/users/nan
How do I access more sizes of TeX Gyre Schola in Plain TeX?
true
Because `cs-schola` file does `\input ff-mac` and `\input csfontsm` and this macro-file defines `\resizefont` macro, you can simply use `\resizefont`. The syntax is `\resizefont\fontswitch` where `\fontswitch` is a font selector defined by `\font` primitive. The `\fontswitch` is (locally) changed when `\resizefont` is applied by following rule: The font is kept the same. Its size is changed due to the actual value of the `\sizespec` macro. This macro can include `at dimen` or `scaled number`. Example. When `\input cs-schola` is done, then `\tenrm` is font selector for roman variant of the Schola family. You can do: ``` \input cs-schola {\def\sizespec{at15pt} % size declaration \resizefont\tenrm % \resizefont application \tenrm Text is printed at 15 pt. % re-sized \tenrm is used. } now, the text is at 10pt. % because \resizefont works locally. \bye ``` More information about `\resizefont` is in the file `csfontsm.tex`.
2
https://tex.stackexchange.com/users/51799
694219
322,074
https://tex.stackexchange.com/questions/694217
1
I am trying to make it so I can, at any point in the body of my document, include a reference that becomes part of an annex. I have based it loosely on this: [Auto order appendices](https://tex.stackexchange.com/questions/452596/auto-order-appendices) ``` \newcounter{annexes} \newcommand{\annexRef}[1]{\hyperref[#1]{annex~\ref*{#1}} % \stepcounter{annexes}% \expandafter\xdef\csname annexpath.\arabic{annexes}\endcsname{#1}% } \newcommand{\printAnnexes}{ \appendix \setcounter{secnumdepth}{0} \begin{appendices} \count1=0 \loop\ifnum\count1 < \value{annexes}\relax \advance\count1 by 1\relax { \count2=1 \relax \count3=0 \relax \loop\ifnum\count2 < \count1 \relax \expandafter\ifx\csname annexpath.\number\count1\endcsname = \csname annexpath.\number\count2\endcsname \advance\count3 by 1 \relax \fi \advance\count2 by 1 \relax \repeat \ifnum\count3 < 1 \relax \input{\csname annexpath.\number\count1\endcsname} \fi } \repeat \end{appendices} } ``` So, anywhere in my document, I can write `\annexRef{path/to/file.latex}` and it creates a reference and includes it in the annex section. It currently inputs the annex file correctly, however the inner loop and subsequent `\ifnum` is supposed to make the file is only input once. I.e., if the same file is referenced twice, it is currently being input twice, I only want it to be input once. Thanks in advance for any help
https://tex.stackexchange.com/users/302913
Making an ordered appendix
true
With `expl3` it's not difficult. The idea is to store the list of references in a sequence, but only if the item is not yet in. At the end we can map the sequence and create the appendices. Here I use `filecontents` and `\jobname` just to make the example self-contained. ``` \begin{filecontents}{\jobname-annex-1} This is annex 1 \end{filecontents} \begin{filecontents}{\jobname-annex-2} This is annex 2 \end{filecontents} \begin{filecontents}{\jobname-annex-3} This is annex 3 \end{filecontents} \documentclass{article} \usepackage{hyperref} \ExplSyntaxOn \NewDocumentCommand{\annexRef}{m} { \joanthan_annex_ref:n { #1 } } \NewDocumentCommand{\printAnnexes}{} { \joanthan_annex_print: } \seq_new:N \g_joanthan_annex_list_seq \cs_new_protected:Nn \joanthan_annex_ref:n { \hyperref[#1]{annex\nobreakspace\ref*{#1}} \seq_if_in:NnF \g_joanthan_annex_list_seq { #1 } { \seq_gput_right:Nn \g_joanthan_annex_list_seq { #1 } } } \cs_new_protected:Nn \joanthan_annex_print: { \appendix \seq_map_inline:Nn \g_joanthan_annex_list_seq { \section{Annex~\ref*{##1}\label{##1}} \input{##1} } } \ExplSyntaxOff \begin{document} \section{First} Some text \annexRef{\jobname-annex-1} Some text \annexRef{\jobname-annex-3} \section{Second} Some text \annexRef{\jobname-annex-1} Some text \annexRef{\jobname-annex-2} \printAnnexes \end{document} ```
1
https://tex.stackexchange.com/users/4427
694223
322,077
https://tex.stackexchange.com/questions/694084
0
I want to create a table of contents for my book. Therefore I put some chapters and sections into the text with \chapter and \section commands. That causes changes the display of the text. Is there a way for no changes into the original form and work ToC as well? Edit: I'm looking for two things: 1. To have different names of chapters into the text and the contents. 2. The \chapter and \section commands not to change the original form of the text. Just to stay exactly as it appears in the first code that I posted. ``` \documentclass[a4paper,11pt]{book} \usepackage{tcolorbox} \begin{document} \tableofcontents \begin{center} \begin{Large} \begin{tcolorbox}[colbacktitle=red,colback=white!80!black , text width=10cm, title=\begin{center} Chapter 1 \end{center}] \begin{LARGE}\begin{center} \textbf{ Section 1.1 } \end{center} \end{LARGE}\end{tcolorbox} \end{Large} \end{center} \begin{center} \begin{Large} \begin{tcolorbox}[colbacktitle=red,colback=white!80!black , text width=10cm, title=\begin{center} \chapter{Chapter 1} \end{center}] \begin{LARGE}\begin{center} \section{\textbf{ Section 1.1 }} \end{center} \end{LARGE}\end{tcolorbox} \end{Large} \end{center} \end{document} ```
https://tex.stackexchange.com/users/285949
\chapter and \section change the appearence of text
false
According to the discussion: Actually `\addcontentsline` was the solution to the main problem and `tocloft` for the rest!
0
https://tex.stackexchange.com/users/302342
694226
322,078
https://tex.stackexchange.com/questions/680493
3
For the development of a class file I am trying to perform some basic checking on strings (which can contain latex commands). For this I use the **tokcycle** package. When I pass a string directly everything works as expected. For various reasons (we store arguments using **pgfkeys** and later retireve these values if they exist) I need to process the *content* of a macro. How to pass the content of a macro to a command? Or get **tokcycle** to work on the content of the macro without expending the macro since we want to detect macro's in the input string (such as "Test\test"). Example: ``` \documentclass{article} \usepackage{tokcycle} \newcommand\checkstring[1]{% \typeout{CHECKING ----------- #1}% \tokcycle{\typeout{CHARACTER: ##1}}% {\typeout{GROUP: ##1}}% {\typeout{MACRO: \string##1}}% {\typeout{SPACE: ##1}}% {#1}% } \newcommand\good[1]{% \checkstring{#1}% } \newcommand\problem[1]{% \def\tmp{#1}% \checkstring{\tmp}% } \begin{document} \good{Test.} \problem{Test.} \end{document} ``` This gives: ``` CHECKING ----------- Test. CHARACTER: T CHARACTER: e CHARACTER: s CHARACTER: t CHARACTER: . CHECKING ----------- Test. MACRO: \tmp ``` I would like to have the output identical in both cases.
https://tex.stackexchange.com/users/293508
How to pass the content of a macro to a command?
false
A comment rightfully suggested an approach employing `\expandafter`. However, that approach cannot be used blindly, as it won't work properly if the argument contains more than a single token, the first of which is a macro (e.g. `\expandafter\checkstring\expandafter{\today ABC}`). Here, the `\checkstring` macro will test whether the argument is a single token (e.g., a macro) and if so, expand it before processing. ``` \documentclass{article} \usepackage{tokcycle} \def\ckstringtest{\relax} \def\checkstringaux{% \tokcycle{\typeout{CHARACTER: ##1}}% {\typeout{GROUP: ##1}}% {\typeout{MACRO: \string##1}}% {\typeout{SPACE: ##1}}% } \makeatletter \newcommand\checkstring[1]{% \typeout{CHECKING ----------- #1}% % \expandafter\ifx\expandafter\ckstringtest\@gobble#1\ckstringtest \expandafter\checkstringaux\expandafter{#1}% \else \checkstringaux{#1}% \fi } \makeatother \begin{document} \checkstring{Test.\today} \def\tmp{Test.\today} \checkstring{\tmp} Done. \end{document} ``` The contents of the log file include: ``` CHECKING ----------- Test.August 23, 2023 CHARACTER: T CHARACTER: e CHARACTER: s CHARACTER: t CHARACTER: . MACRO: \today CHECKING ----------- Test.August 23, 2023 CHARACTER: T CHARACTER: e CHARACTER: s CHARACTER: t CHARACTER: . MACRO: \today ```
0
https://tex.stackexchange.com/users/25858
694228
322,080
https://tex.stackexchange.com/questions/694231
2
LaTeX apparently has registers for 13 tab stops. A workaround that was published in about 2009 suggested ``` \makeatletter \countdef\@maxtab=30 \makeatother ``` This steps on registers beyond the 13 allocated within LaTeX for tab stops. It worked for a while, but now it doesn't, so I guess the registers it now steps on are more important than the ones used now. Can the number of registers for tab stops be increased in some other way? I have a document that needs 15 tab stops. It used to work but as of texlive/2022 it doesn't. texlive/2022 is what's distributed with Debian 10. I haven't tried downloading a newer texlive from ctan (is there one?) and I'm not ready to upgrade to Debian 12.
https://tex.stackexchange.com/users/168286
Tab overflow work-around no longer works
false
that was never close to safe it tramples on internal registers used by tabbing, tabular, array, ... I've used latex for over 30 years but never found a use for `tabbing` but if you want to extend it, just copy the original code, but with more. That loses the currently allocated ones, but as there are 32 thousand dimen registers now, that's not the issue it was. ``` \makeatletter \chardef\@firsttab=\the\allocationnumber %13 \newdimen\@gtempa\newdimen\@gtempa\newdimen\@gtempa\newdimen\@gtempa \newdimen\@gtempa\newdimen\@gtempa\newdimen\@gtempa\newdimen\@gtempa \newdimen\@gtempa\newdimen\@gtempa\newdimen\@gtempa\newdimen\@gtempa \newdimen\@gtempa %26 \newdimen\@gtempa\newdimen\@gtempa\newdimen\@gtempa\newdimen\@gtempa \newdimen\@gtempa\newdimen\@gtempa\newdimen\@gtempa\newdimen\@gtempa \newdimen\@gtempa\newdimen\@gtempa\newdimen\@gtempa\newdimen\@gtempa \newdimen\@gtempa %39 \newdimen\@gtempa\newdimen\@gtempa\newdimen\@gtempa\newdimen\@gtempa \newdimen\@gtempa\newdimen\@gtempa\newdimen\@gtempa\newdimen\@gtempa \newdimen\@gtempa\newdimen\@gtempa\newdimen\@gtempa\newdimen\@gtempa \newdimen\@gtempa % ..... \chardef\@maxtab=\the\allocationnumber \dimen\@firsttab=0pt \makeatletter ``` actually you need to check they are contiguous, so all less than 256 or all greater. An alternative scheme, assuming you never allocate 2000 dimen would be to use the register in that range ``` \makeatletter \chardef\@firsttab=2000 \chardef\@maxtab=2040 % or however many you need. \dimen\@firsttab=0pt \makeatletter ```
2
https://tex.stackexchange.com/users/1090
694232
322,082
https://tex.stackexchange.com/questions/427614
8
I recently discovered the `pdfcomment` package to annotate my latex-generated PDF files. Here is a minimum working example of what I have been doing: ``` \documentclass{article} \usepackage[utf8]{inputenc} \usepackage[T1]{fontenc} \usepackage{lmodern} \usepackage[rgb]{xcolor} \usepackage{pdfcomment} \begin{document} A comment appears here: \pdfcomment[icon=Insert,color=red,author={author1}]{comment1_text} \end{document} ``` Now the following question arose: I would like to include the comment of someone else and provide an answer to it, which is appearing under the same icon. Much like I could do in Adobe Acrobat: I can add a note, write some text and then hit the reply button to type an answer. I would like to achieve the same, but in latex. Something along the lines of (in pseudo-code) ``` \begin{document} A comment appears here: \pdfcomment[icon=Insert,color=red,author={author1}]{comment1_text}[author={author2}]{reply_author2} \end{document} ``` where now the `reply_author2` appears as a reply under the same note. Is something like this possible? --- To provide some additional input. When I generate a very simple PDF with: ``` \documentclass{article} \usepackage[utf8]{inputenc} \usepackage[T1]{fontenc} \usepackage{lmodern} \begin{document} This is a test document to show annotation in LaTeX vs Adobe Acrobat. The goal is to have the same sort of reply ability as is in Adobe which is very important for collaboration on LaTeX generated documents with people who do not use LaTeX. \end{document} ``` I can then open the PDF in Adobe sw and add annotation (insert text type). Then I use this `python` code: ``` from PyPDF2 import PdfFileReader reader = PdfFileReader("test-ad.pdf") for page in reader.pages: try : for annot in page["/Annots"] : print (annot.getObject()) # (1) print ("") except : # there are no annotations on this page pass ``` to extract annotations directly from the PDF, I get: ``` {'/AP': {'/N': IndirectObject(10, 0, 139968916562832)}, '/C': [0, 0, 1], '/Contents': 'insert some text', '/CreationDate': "D:20230828101145-04'00'", '/F': 4, '/M': "D:20230828101153-04'00'", '/NM': '436dc8e6-1207-4d79-91be-a5432a1ce7b9', '/P': IndirectObject(9, 0, 139968916562832), '/Popup': IndirectObject(18, 0, 139968916562832), '/RC': '<?xml version="1.0"?><body xmlns="http://www.w3.org/1999/xhtml" xmlns:xfa="http://www.xfa.org/schema/xfa-data/1.0/" xfa:APIVersion="Acrobat:22.1.0" xfa:spec="2.0.2" ><p dir="ltr"><span dir="ltr" style="font-size:9.9pt;text-align:left;color:#000000;font-weight:normal;font-style:normal">insert some text</span></p></body>', '/RD': [0.781097, 0.781067, 0.781097, 0.781128], '/Rect': [253.424, 703.434, 264.928, 712.807], '/Subj': 'Inserted Text', '/Subtype': '/Caret', '/T': 'me', '/Type': '/Annot'} {'/F': 28, '/Open': False, '/Parent': IndirectObject(17, 0, 139968916562832), '/Rect': [595.276, 598.026, 799.276, 712.026], '/Subtype': '/Popup', '/Type': '/Annot'} ``` When I open the file again and add reply to that annotation comment and again extract the annotations with `python`, I get: ``` {'/AP': {'/N': IndirectObject(10, 0, 139968905121360)}, '/C': [0, 0, 1], '/Contents': 'insert some text', '/CreationDate': "D:20230828101145-04'00'", '/F': 4, '/M': "D:20230828101153-04'00'", '/NM': '436dc8e6-1207-4d79-91be-a5432a1ce7b9', '/P': IndirectObject(9, 0, 139968905121360), '/Popup': IndirectObject(18, 0, 139968905121360), '/RC': '<?xml version="1.0"?><body xmlns="http://www.w3.org/1999/xhtml" xmlns:xfa="http://www.xfa.org/schema/xfa-data/1.0/" xfa:APIVersion="Acrobat:22.1.0" xfa:spec="2.0.2" ><p dir="ltr"><span dir="ltr" style="font-size:9.9pt;text-align:left;color:#000000;font-weight:normal;font-style:normal">insert some text</span></p></body>', '/RD': [0.781097, 0.781067, 0.781097, 0.781128], '/Rect': [253.424, 703.434, 264.928, 712.807], '/Subj': 'Inserted Text', '/Subtype': '/Caret', '/T': 'me', '/Type': '/Annot'} {'/F': 28, '/Open': False, '/Parent': IndirectObject(17, 0, 139968905121360), '/Rect': [595.276, 598.026, 799.276, 712.026], '/Subtype': '/Popup', '/Type': '/Annot'} {'/AP': {'/N': IndirectObject(28, 0, 139968905121360), '/R': IndirectObject(29, 0, 139968905121360)}, '/C': [1, 0.819611, 0], '/Contents': 'reply to the comment', '/CreationDate': "D:20230828101251-04'00'", '/F': 28, '/IRT': IndirectObject(17, 0, 139968905121360), '/M': "D:20230828101251-04'00'", '/NM': 'dfc46577-b2cb-4666-a159-31fc4cbef078', '/Name': '/Comment', '/P': IndirectObject(9, 0, 139968905121360), '/Popup': IndirectObject(27, 0, 139968905121360), '/RC': '<?xml version="1.0"?><body xmlns="http://www.w3.org/1999/xhtml" xmlns:xfa="http://www.xfa.org/schema/xfa-data/1.0/" xfa:APIVersion="Acrobat:22.1.0" xfa:spec="2.0.2" ><p dir="ltr"><span dir="ltr" style="font-size:9.8pt;text-align:left;font-weight:normal;font-style:normal">reply to the comment</span></p></body>', '/Rect': [253.424, 688.807, 277.424, 712.807], '/Subj': 'Sticky Note', '/Subtype': '/Text', '/T': 'me', '/Type': '/Annot'} {'/F': 28, '/Open': False, '/Parent': IndirectObject(26, 0, 139968905121360), '/Rect': [595.276, 598.807, 799.276, 712.807], '/Subtype': '/Popup', '/Type': '/Annot'} ``` One thing I noticed is that the original comment has tag `/C` but the comment has in addition also `/R`. If that is all that is needed or there are some other details, I do not know. I guess one would need to understand the PDF specification.
https://tex.stackexchange.com/users/159420
Adding reply to annotation using pdfcomment
false
While the ORIGINAL ANSWER below may serve for some users, the OP indicated an ongoing desire to have all of the conversation contained in a single comment. Therefore, I have added this **ALTERNATIVE ANSWER** With this answer, the complete conversation occurs within the argument of the original `\pdfcomment`. Replies within the comment are accomplished with ``` \addreply{<style-name>} ... ``` where the style-name *can be* predefined, to include the `author=` field. In this example, styles `Jim` and `Sue` have been predefined and thus, when used as the argument to `\addreply`, the full `author` name ("Jim Jones" or "Sue Smith") is used. If the style is undefined, the style name itself is used as the author. ``` \documentclass{article} \usepackage[utf8]{inputenc} \usepackage[T1]{fontenc} \usepackage{lmodern} \usepackage[rgb]{xcolor} \usepackage{pdfcomment} \usepackage{listofitems} \let\svdefinestyle\definestyle \renewcommand\definestyle[2]{% \defineauthor{#1}{#2}% \svdefinestyle{#1}{#2}% } \def\authorstring{author} \newcommand\defineauthor[2]{% \setsepchar{,/=}% \readlist*\styleoption{#2}% \foreachitem\z\in\styleoption[]{% \itemtomacro\styleoption[\zcnt,1]\ztmp \ifx\ztmp\authorstring \expandafter\xdef\csname author#1\endcsname {\styleoption[\zcnt,2]}% \fi }% } \newcommand\theauthor[1]{\ifcsname author#1\endcsname \csname author#1\endcsname\else#1\fi} \newcommand\addreply[1]{\textCR\textLF\textCR\textLF Reply \theauthor{#1}:\textCR\textLF\ignorespaces} \definestyle{Jim}{color=red,author={Jim Jones}} \definestyle{Sue}{color=blue,author={Sue Smith}} \begin{document} Jim's comment appears here:\pdfcomment[style=Jim]{% Do I really need a comment here? \addreply{Sue} Yes, Jim, I think you do. \addreply{Jim} Very well, I guess I will leave it here. } An now for Sue's turn.\pdfcomment[style=Sue]{% Jim, can you hear me now? \addreply{Jim} I sure can. \addreply{Sam} Hey, I'm just interloping into this conversation } \end{document} ``` As can be seen in the following image, the complete conversation now occurs in the context of a single comment. Each reply is prepended on its own line with "Reply author-name:". If a reply style is not associated with an `author=` field, the style name itself is used as the author, as in the case of `Sam` in the second conversation. **ORIGINAL ANSWER** This uses a series of horizontally connected `\pdfsquarecomment`s to denote a comment/reply chain. The initial call is made with ``` \startcomment[<defaults for comment/reply chain>][<comment options>]{comment} ``` with subsequent replies, located sequentially in the source code, as ``` \addreply[<comment options>]{comment} ``` Here is the MWE, in which the `style`s `Jim` and `Sue` have been defined. Note that `\addreply` options can override the comment/reply-chain defaults. The size/shift of the comment boxes is defined by `\mycommentsize`, which here is set to `.8\baselineskip`. The header `Reply:` is added to the reply header by way of the author field, as in `author={\commentmode Jim Jones}` ``` \documentclass{article} \usepackage[utf8]{inputenc} \usepackage[T1]{fontenc} \usepackage{lmodern} \usepackage[rgb]{xcolor} \usepackage{pdfcomment} \newlength\myhoffset \def\mycommentsize{.8\baselineskip}% <--Can be changed \newcommand\startcomment[1][]{% \catcode`_=12 \gdef\commentdefault{#1}% \gdef\commentmode{}% \setlength\myhoffset{0pt}% \makecommentnext} \newcommand\addreply{% \catcode`_=12 \gdef\commentmode{Reply: }% \addtolength\myhoffset{\mycommentsize}% \makecommentnext} \newcommand\makecommentnext[2][]{% \expandafter\pdfsquarecomment\expandafter [\commentdefault,hoffset=\myhoffset, open=true,opacity=.4, height=\mycommentsize,width=\mycommentsize,#1]{#2}% \catcode`_=8 } \definestyle{Jim}{color=red,author={\commentmode Jim Jones}} \definestyle{Sue}{color=blue,author={\commentmode Sue Smith}} \begin{document}A comment appears here: \startcomment [borderstyle=dashed]% Global option for comment/reply chain [style={Jim}] {Does this require comment?} \addreply [style={Sue},borderstyle=solid]% Can override global default {Yes, I think it does.} \addreply [style={Jim}] {OK, I will leave it} And we can contine the line since the comments will appear with opacity so that the underlying text can be read. $a_b$ shows underscore is restored. \end{document} ```
7
https://tex.stackexchange.com/users/25858
694233
322,083
https://tex.stackexchange.com/questions/694240
2
The `standalone` documentation claims: > > If [the `multi`] option is activated multiple pages are supported. Each page will be cropped to its content plus the selected border (as long either `preview` or `crop` are enabled). > > > But the following MCE: ``` \documentclass[multi,crop]{standalone} \begin{document} Test \end{document} ``` leads to a full A4 page. What's going on?
https://tex.stackexchange.com/users/18401
standalone's multi option doesn't crop page's content
true
You have to declare and wrap the desired code within a `\standaloneenv`: ``` \documentclass[multi,crop]{standalone} \standaloneenv{multipage} \begin{document} \begin{multipage} Test \end{multipage} \begin{multipage} Test \end{multipage} \begin{multipage} Test \end{multipage} \end{document} ```
3
https://tex.stackexchange.com/users/273733
694242
322,088
https://tex.stackexchange.com/questions/694230
-2
For a new book I am writing with two friends, I like to include three biographies (mine as well as the other two friends) after the preface. Ideally, we like to keep three photos (A.jpg, B.jpg and C.jpg) on the left and our biographies on the right.. The book is in single column format, and I don't know how this biographies page can be done in double column format. Also, the biographies need to be aligned with our photos. We are OK with any format or style in a professional way as long as we can post our biographies along with the photos. Your suggestions are most welcome. Thank you.
https://tex.stackexchange.com/users/251241
How to insert 3 biographies with 3 photos stacked on the left in a LaTeX Book Environment?
true
Like this: Code: ``` \documentclass{article} \usepackage{graphicx,lipsum} \usepackage[export]{adjustbox} \begin{document} \begin{tabular}{p{3cm}p{12cm}} \includegraphics[valign=t,width=2.8cm]{example-image-a} \rotatebox[origin=l]{0}{Rossi Giacomo} & \lipsum[1]\\[1ex] \includegraphics[valign=t,width=2.8cm]{example-image-b} \rotatebox[origin=l]{0}{Bianchi Giovanni} & \lipsum[1]\\[1ex] \includegraphics[valign=t,width=2.8cm]{example-image-c} \rotatebox[origin=l]{0}{Verdi Alberti} & \lipsum[1]\\[1ex] \end{tabular} \end{document} ```
2
https://tex.stackexchange.com/users/24644
694243
322,089
https://tex.stackexchange.com/questions/649717
5
I had a working LaTeX file with `biblatex` referencing but after an update of the packages on July 3, 2022, including a package called `biblatex-chicago` my LaTeX code that worked yesterday produces the following 2 errors (from the log file): > > > ``` > ! Package biblatex Error: Patching \MakeLowercase failed. > See the biblatex package documentation for explanation. > Type H <return> for immediate help. > ... > l.212 \begin{document} > This is an internal issue typically caused by a conflict > between biblatex and some other package. Modifying > the package loading order may fix the problem. > > ``` > > There's another error that regarding `\MakeLowercase`. I've tried going through the biblatex manual but can't find any `\MakeUppercase` or `\MakeLowercase` reference relevant to this error. Any help appreciated as I am completely at loss
https://tex.stackexchange.com/users/273782
!Package biblatex Error: Patching \MakeLowercase failed
false
If it is 2023 and the answer of @moewe is not applicable. The error may be due to old biblatex config / style files in the local directory which apparently are no longer compatible with the current version of LaTeX.
0
https://tex.stackexchange.com/users/9122
694246
322,090
https://tex.stackexchange.com/questions/694230
-2
For a new book I am writing with two friends, I like to include three biographies (mine as well as the other two friends) after the preface. Ideally, we like to keep three photos (A.jpg, B.jpg and C.jpg) on the left and our biographies on the right.. The book is in single column format, and I don't know how this biographies page can be done in double column format. Also, the biographies need to be aligned with our photos. We are OK with any format or style in a professional way as long as we can post our biographies along with the photos. Your suggestions are most welcome. Thank you.
https://tex.stackexchange.com/users/251241
How to insert 3 biographies with 3 photos stacked on the left in a LaTeX Book Environment?
false
Very similar to nice @Raffaele Santoro answer (+1). Differences: * use is `tabularx` table * figure are included by `adjincludegraphics` of `adjustbox` package * defined common style with `\adjustboxset` * for authors names is used `\captionof*{figure}{<name>}`: ``` \documentclass{article} %--------------- show page layout. don't use in a real document! \usepackage{showframe} \renewcommand\ShowFrameLinethickness{0.15pt} \renewcommand*\ShowFrameColor{\color{red}} % \usepackage{lipsum} % for dummy text %---------------------------------------------------------------% \usepackage[export]{adjustbox} \usepackage{caption} \usepackage{tabularx} \begin{document} \begingroup \captionsetup{skip=3pt} \adjustboxset{width=\linewidth, keepaspectratio, valign=t, } \noindent\begin{tabularx}{\linewidth}{@{} p{30mm}X @{}} \adjincludegraphics{example-image-duck} \captionof*{figure}{Rossi Giacomo} & \lipsum[66] \\ \adjincludegraphics{example-image-duck} \captionof*{figure}{Rossi Giacomo} & \lipsum[66] \\ \adjincludegraphics{example-image-duck} \captionof*{figure}{Rossi Giacomo} & \lipsum[66] \\ \end{tabularx} \endgroup \end{document} ``` (red lines indicate text block border}
1
https://tex.stackexchange.com/users/18189
694250
322,092
https://tex.stackexchange.com/questions/694251
1
How to add text over icon (stacked on top of each other towards reader). Basically LaTeX equivalent of that html question: <https://stackoverflow.com/questions/22644741/how-to-position-text-over-font-awesome-icon> and that answer: ``` <span class="fa-stack fa-3x"> <i class="fa fa-trophy fa-stack-2x"></i> <span class="fa fa-stack-1x" style="color:red;"> <span style="font-size:35px; margin-top:-20px; display:block;"> #1 </span> </span> </span> ```
https://tex.stackexchange.com/users/302941
Text over icon (stacked on top of each other towards reader)
true
Something like this? ``` \documentclass[border=0.5cm]{standalone} \usepackage{xcolor} \usepackage{fontawesome5} \begin{document} \faIcon{trophy}\kern-7.25pt\relax \raisebox{4.5pt}{\textcolor{white}{\tiny 1}} \end{document} ```
1
https://tex.stackexchange.com/users/174620
694255
322,095
https://tex.stackexchange.com/questions/689723
3
Is there a ready-made LaTeX package that produces a calendar in a format known as *Familienplaner* in German speaking countries: Each month is set as a table on one sheet of paper. There is one row per day, and there are additional empty columns to be filled in (between one and five, typically). Sundays are specially marked (e.g., by red colour of the date, or by a grey row instead of a white one). Nice-to-have features: German language support for day-of-week and month names, week numbers, German holidays. P.S. Searching the net for "Familienplaner" results in a lot of free pdf offers for such calendars. P.P.S. The *Familienplaner* layout is different from the monthly calendar layout of this question: [Calendar in LaTeX](https://tex.stackexchange.com/q/170462/50351)
https://tex.stackexchange.com/users/50351
Calendar in "Familienplaner" format?
false
Depending on what you really want, you can follow the suggestion of @Qrrbrbirlbel in the comment above to your question, and reach quite fast something that could be used. Of course, having the benefits of a completely defined package is a different kind of thing. ``` \documentclass[fontsize=14pt, paper=a3, pagesize, DIV=calc]{scrartcl} \usepackage[utf8]{inputenc} \usepackage[a4paper,margin=2cm,left=1cm]{geometry} \usepackage[german]{babel} \usepackage[german]{translator} \usepackage{tikz} \usetikzlibrary{calendar} \def\defyear{2023} \def\deffamilysize{4} \def\boxsize{\dimexpr(\linewidth-3cm)/\deffamilysize} \begin{document} \foreach \m in {1,...,12}{ \pagestyle{empty} \noindent\hspace*{2.98cm}\begin{tikzpicture} \foreach \person [count=\personcount] in {Paula, John, Peter, Jackie}{ %%% ENTER NAMES \node[xshift=3cm, draw=black,anchor=west,minimum width=\boxsize,minimum height=1.6em,xshift=\boxsize*(\personcount-1),align=center] {\person}; } \end{tikzpicture} \noindent\begin{tikzpicture} \calendar [% dates=\defyear-\m-01 to \defyear-\m-last,% day list downward,% day yshift=1.6em,% month label left vertical,% every month/.append style={yshift=1em},% day code={% \node[anchor = east] {\pgfcalendarweekdayshortname{\pgfcalendarcurrentweekday}}; \node[anchor = east, xshift=1.5em] {\tikzdaytext}; \foreach \i [count=\icount] in {1,...,\deffamilysize}{ \node[xshift=2em, anchor=west,draw=black,minimum width=\boxsize,minimum height=1.6em,xshift=\boxsize*(\icount-1)] {};} } ] if (Sunday) [red!75!black]; \end{tikzpicture} \newpage } \end{document} ```
2
https://tex.stackexchange.com/users/17360
694257
322,097
https://tex.stackexchange.com/questions/694217
1
I am trying to make it so I can, at any point in the body of my document, include a reference that becomes part of an annex. I have based it loosely on this: [Auto order appendices](https://tex.stackexchange.com/questions/452596/auto-order-appendices) ``` \newcounter{annexes} \newcommand{\annexRef}[1]{\hyperref[#1]{annex~\ref*{#1}} % \stepcounter{annexes}% \expandafter\xdef\csname annexpath.\arabic{annexes}\endcsname{#1}% } \newcommand{\printAnnexes}{ \appendix \setcounter{secnumdepth}{0} \begin{appendices} \count1=0 \loop\ifnum\count1 < \value{annexes}\relax \advance\count1 by 1\relax { \count2=1 \relax \count3=0 \relax \loop\ifnum\count2 < \count1 \relax \expandafter\ifx\csname annexpath.\number\count1\endcsname = \csname annexpath.\number\count2\endcsname \advance\count3 by 1 \relax \fi \advance\count2 by 1 \relax \repeat \ifnum\count3 < 1 \relax \input{\csname annexpath.\number\count1\endcsname} \fi } \repeat \end{appendices} } ``` So, anywhere in my document, I can write `\annexRef{path/to/file.latex}` and it creates a reference and includes it in the annex section. It currently inputs the annex file correctly, however the inner loop and subsequent `\ifnum` is supposed to make the file is only input once. I.e., if the same file is referenced twice, it is currently being input twice, I only want it to be input once. Thanks in advance for any help
https://tex.stackexchange.com/users/302913
Making an ordered appendix
false
In order to make your original code work, replace the outer loop with this one: ``` \count1=0 \loop\ifnum\count1 < \value{annexes}\relax \advance\count1 by 1\relax % only input the annex if it is known \ifcsname we have already seen \csname annexpath.\the\count1\endcsname\endcsname \else \input{\csname annexpath.\the\count1\endcsname}\fi % the line below leaves the csname defined (and equivalent to \relax) \csname we have already seen \csname annexpath.\the\count1\endcsname\endcsname \repeat ``` Here is the why and how: * TeX programming that involves counters is awkward and verbose, hard to read and hard to write. So while in other programming languages, numeric variables may be the first thing you reach for, you should try and avoid them in TeX. * A wonderful and idiomatic tool, on the other hand, is defining macros. Effectively, macro definition can give you associative arrays – and maybe you should indeed think of macros as arrays instead of procedures. + As you already know, any character can be part of a macro name by means of `\csname ... \endcsname`. + The existence of a macro can be tested with `\ifdefined` or with `\ifcsname ... \endcsname`. + A simple `\csname ... \endcsname` statement will give a non-existing macro the meaning of `\relax`. * So if you simply define a macro for every file you have already read (that is: add its filename as a key to the array `we have already seen`), you only need check its presence in that array (that is: existence as a macro) before reading. In fact, you can simplify your code even further and use no counter at all: ``` \newtoks\annexToks \def\annexRef#1{% % store the file names in a list \global\annexToks = \expandafter{\the\annexToks{#1}}% \hyperref[#1]{annex-\ref*{#1}}} \def\printAnnexes{% \appendix % terminate the list with the command that iterates over the list \expandafter\doPrintAnnexes \the\annexToks{\doPrintAnnexes}} \def\doPrintAnnexes#1{% \ifx\doPrintAnnexes#1 \expandafter\gobble % eats the continuing \doPrintAnnexes \else \ifcsname we have seen #1\endcsname \else \section {Annex #1} \label {#1} \input {#1} \fi \csname we have seen #1\endcsname \fi \doPrintAnnexes} \def\gobble#1{} % you could also use \@gobble if the at is a letter ``` Here, you store the files you (might) want to read in a list, as `{}`-surrounded groups in the token register `\annexToks`. The construction with `\doPrintAnnexes` gives you the easiest way of looping through such a list.
0
https://tex.stackexchange.com/users/258593
694258
322,098
https://tex.stackexchange.com/questions/694254
2
I am currently using: ``` \setuphead[section] [style=\tfb\bf, color=titlegrey, align=right] ``` How can this be modified to include an underline (or underbar)?
https://tex.stackexchange.com/users/302942
How can I include an underline in a ConTeXt \setuphead
true
Maybe something like this? ``` \setuphead [section] [style=\tfb\bf, deeptextcommand=\underbar, color=titlegrey, align=right] \definehead [mysection] [section] [deeptextcommand=\underbars] \starttext \section[title={This is supposed to be underlined, and it is. Or is it?}] \samplefile{ward} \mysection[title={This is supposed to be underlined, and it is. Or is it?}] \samplefile{ward} \stoptext ```
2
https://tex.stackexchange.com/users/52406
694259
322,099
https://tex.stackexchange.com/questions/290745
1
I would like to nest two boxes in my table. It looks like this: ``` content content content content content +----------------------+ content | content content | content content |+--------------------+| content ||content content|| content content |+--------------------+| content | content content | content content +----------------------+ content content content content content ``` I looked at [Framing cells in a table](https://tex.stackexchange.com/questions/4676/framing-cells-in-a-table) which provides a good solution, but the main issue is that I can't set the length of the horizontal line in the inner box. `\cline{2-3}` always produces the same width. It would produce something that looks like this: ``` content content content content content +----------------------+ content | content content | content content ++--------------------++ content ||content content|| content content ++--------------------++ content | content content | content content +----------------------+ content content content content content ``` But I would like to avoid the inner box from intersecting with / joining the outer box.
https://tex.stackexchange.com/users/97343
Nested boxes around cells in a table
false
Here is a solution with `{NiceTabular}` of `nicematrix`. That environment is similar to the classical environment `{tabular}` (as provided by `array`) but creates PGF/TikZ nodes under the cells, rows and columns. Then it's possible to use these nodes with TikZ to draw whatever rule you want. ``` \documentclass{article} \usepackage{nicematrix,tikz} \begin{document} \begin{NiceTabular}{ccccc} content & content & content & content & content \\ content & content & content & content & content \\ content & content & content & content & content \\ content & content & content & content & content \\ content & content & content & content & content \\ \CodeAfter \tikz \draw (1-|1) rectangle (last-|last) (2-|2) rectangle (5-|4) ([xshift=2pt]3-|2) rectangle ([xshift=-2pt]4-|4) ; \end{NiceTabular} \end{document} ```
3
https://tex.stackexchange.com/users/163000
694263
322,101
https://tex.stackexchange.com/questions/652396
1
This is my code : ``` \documentclass[11pt,twoside]{report} \usepackage{amsmath} \usepackage{tabularx} \usepackage{multicol} \usepackage{array} \usepackage{longtable} \begin{document} \begin{longtable}[c]{|m{0.3\linewidth}|m{0.7\linewidth} |} \hline \textbf{Symbol} & \textbf{Definition} \\\hline \endfirsthead \hline % \textbf{Symbol} & \textbf{Definition} % \\\hline % \endhead $X$ & Unwatermarked dataset \\ $X^{\prime}$ & A watermarked dataset \\ $\overline{X}$ & The mean of the dataset $X$ \\ $\overline{X^{\prime}}$ & The mean of the dataset $X^{\prime}$ \\ $G$ & Pseudorandom number generator \\ $K$ & The watermark \\ $n$ & The length of the dataset, and the watermark sequence \\ $SH_{key}$ & A secret key used to shuffle the data \\ $S$ & The sequence generated via the pseudorandom number generator \\ $\hat{X}$ & A copy of the data expected to be watermarked \\ $S_{X}^{2}$ & Variance for the dataset $X$ \\ $S_{X^{\prime}}^{2}$ & Variance for the dataset $X^{\prime}$ \\ $s_{i}$ & Individual element in the sequence $S$ at the position $i$ \\ $P$ & The probability for a variable \\ $T$ & Sequence follows a Gaussian $N(0,1)$ distribution \\ $t_{i}$ & Individual element in the sequence $T$ at the position $i$ \\ $M$ & A secret value kept with the watermarker in the watermarking algorithm 2 \\ $\epsilon$ & Determines the error in the results of the watermarked dataset $X^{\prime}$ \\ a, b, $\lambda$ & Parameters used to watermark the dataset $X$ using the watermarking algorithm 2 \\ $x_{i}$ & Individual element in the sequence $X$ at the position $i$ \\ $x_{i}^{\prime}$ & Individual element in the sequence $X'$ at the position $i$ \\ $\left|t_{i}\right|$ & Absolute value of $t_{i}$ \\ $\hat{M}$ & The verified secret value in the watermarked data $\hat{X}$ \\ $E(.)$ & Encryption function \\ %$\mathcal{O}$ & Time complexity \\ $\overline{n}$ & Represents the RLWE dimension \\ $q$ & The ciphertext modulus \\ $X^{\prime\prime}$ & Watermarked and obfuscated dataset \\ $Obf_{key}$ & Secret key used to obfuscate and deobfuscate data \\ $\hat{x}_{i}$ & Individual element in the sequence $\hat{X}$ at the position $i$ \\ $C$ & A column of data \\%delete it? because it conflicts with... $r$ & The number of ones in a binary sequence \\ $Bob_{RK}$ & Bob's repacking key \\ $Bob_{SwK}$ & Bob's key for the key-switch function \\ $Bob_{pk}$ & Bob's public key \\ $Bob_{EK}$ & Bob's evaluation key \\ $Bob_{RotK}$ & Bob's rotation key \\ $Bob_{RelK}$ & Bob's relinearization key \\ $Bob_{s}$ & Bob's secret key \\ $\textbf{g}_{digit}$ & The digit decomposition gadget \\ $\textbf{g}_{rns}$ & The RNS decomposition gadget \\ $\Delta$ & The scaling factor \\ $\underline{n}$ & Represents the LWE dimension for the input into the look-up table \\ $n^\prime$ & Represents the LWE dimension for the output of the look-up table \\ $\Delta$ & The scaling factor \\ $B_{ks}$ & The digit decomposition base \\ $h$ & The hamming weight \\ $msg$ & Indicates the message interval that the look-up table can process \\ $S2C$ & Slot to coefficient function \\ $moduli$ & Represents the multiplicative depth for a ciphertext \\ $\mu$s & Microseconds \\\hline \end{longtable} \end{document} ``` The problem is that it's not centered in the second page and the distance between lines is small ! Any help is highly appreciated !
https://tex.stackexchange.com/users/270503
centering longtable and changing distance between lines
false
After one year (I didn't notice this question before ...) * For table I would use `longtblr` of `tabularray` package with libraries `amsmath`, `booktabs` and `siunitx`. * Additionally is used `mathtools` package for defining delimiters * In preamble are defined math operators, which are used at variable labels or names: ``` \documentclass[11pt,twoside]{report} %--------------- show page layout. don't use in a real document! \usepackage{showframe} \renewcommand\ShowFrameLinethickness{0.15pt} \renewcommand*\ShowFrameColor{\color{red}} % \usepackage{lipsum} % for dummy text \usepackage[latin]{babel} %---------------------------------------------------------------% \usepackage{tabularray} \UseTblrLibrary{amsmath, booktabs, siunitx} \DeclareMathOperator{\key}{key} \DeclareMathOperator{\bob}{Bob} \DeclareMathOperator{\rk}{RK} \DeclareMathOperator{\swk}{SwK} \DeclareMathOperator{\pk}{pk} \DeclareMathOperator{\ek}{ek} \DeclareMathOperator{\rotk}{RotK} \DeclareMathOperator{\relk}{RelK} \DeclareMathOperator{\digit}{digit} \DeclareMathOperator{\rns}{rns} \DeclareMathOperator{\s2c}{S2C} \DeclareMathOperator{\msg}{msg} \DeclareMathOperator{\moduli}{moduli} % \usepackage{mathtools} \DeclarePairedDelimiter\abs{\lvert}{\rvert} \begin{document} \lipsum[11] \begingroup \DefTblrTemplate{capcont}{default}{} \SetTblrStyle{contfoot}{font=\small\sffamily\itshape} \begin{longtblr}[ entry=none, % <--- label=none ] {vlines, colspec = { Q[l, mode=math] X[l] }, row{1} = {font=\bfseries, mode=text}, rowsep = 1pt, rowhead = 1 } \toprule Symbol & Definition \\ \midrule X & Unwatermarked dataset \\ X' & A watermarked dataset \\ \overline{X} & The mean of the dataset $X$ \\ \overline{X'} & The mean of the dataset $X'$ \\ G & Pseudorandom number generator \\ K & The watermark \\ n & The length of the dataset, and the watermark sequence \\ SH_{key} & A secret key used to shuffle the data \\ S & The sequence generated via the pseudorandom number generator \\ \hat{X} & A copy of the data expected to be watermarked \\ S_{X}^{2} & Variance for the dataset $X$ \\ S_{X'}^{2} & Variance for the dataset $X$ \\ s_{i} & Individual element in the sequence $S$ at the position $i$ \\ P & The probability for a variable \\ T & Sequence follows a Gaussian $N(0,1)$ distribution \\ t_{i} & Individual element in the sequence $T$ at the position $i$ \\ M & A secret value kept with the watermarker in the watermarking algorithm 2 \\ \epsilon & Determines the error in the results of the watermarked dataset $X'$ \\ a, b, \lambda & Parameters used to watermark the dataset $X$ using the watermarking algorithm 2 \\ x_{i} & Individual element in the sequence $X$ at the position i \\ x_{i}' & Individual element in the sequence $X'$ at the position i \\ \abs{t_{i}} & Absolute value of $t_{i}$ \\ \hat{M} & The verified secret value in the watermarked data $\hat{X}$ \\ E(\cdot) & Encryption function \\ %\mathcal{O} & Time complexity \\ \overline{n} & Represents the RLWE dimension \\ q & The ciphertext modulus \\ X'' & Watermarked and obfuscated dataset \\ \obf_{\key} & Secret key used to obfuscate and deobfuscate data \\ \widehat{x}_{i} & Individual element in the sequence $\widehat{X}$ at the position $i$ \\ C & A column of data \\ r & The number of ones in a binary sequence \\ \bob_{\rk} & Bob's repacking key \\ \bob_{SwK} & Bob's key for the key-switch function \\ \bob_{pk} & Bob's public key \\ \bob_{EK} & Bob's evaluation key \\ \bob_{RotK} & Bob's rotation key \\ \bob_{RelK} & Bob's relinearization key \\ \bob_{s} & Bob's secret key \\ \mathbf{g}_{\digit} & The digit decomposition gadget \\ \mathbf{g}_{\rns} & The RNS decomposition gadget \\ \Delta & The scaling factor \\ \underline{n} & Represents the LWE dimension for the input into the look-up table \\ n' & Represents the LWE dimension for the output of the look-up table \\ \Delta & The scaling factor \\ B_{ks} & The digit decomposition base \\ h & The hamming weight \\ \msg & Indicates the message interval that the look-up table can process \\ \s2c & Slot to coefficient function \\ \moduli & Represents the multiplicative depth for a ciphertext \\ \unit{\micro\second} & Microseconds \\ \bottomrule \end{longtblr} \end{document} ```
1
https://tex.stackexchange.com/users/18189
694265
322,103
https://tex.stackexchange.com/questions/694251
1
How to add text over icon (stacked on top of each other towards reader). Basically LaTeX equivalent of that html question: <https://stackoverflow.com/questions/22644741/how-to-position-text-over-font-awesome-icon> and that answer: ``` <span class="fa-stack fa-3x"> <i class="fa fa-trophy fa-stack-2x"></i> <span class="fa fa-stack-1x" style="color:red;"> <span style="font-size:35px; margin-top:-20px; display:block;"> #1 </span> </span> </span> ```
https://tex.stackexchange.com/users/302941
Text over icon (stacked on top of each other towards reader)
false
Use a `\stackinset`. Here, the inset `1` is stacked .05pt to the right of and 1.7pt above center. ``` \documentclass[border=0.5cm]{standalone} \usepackage{xcolor} \usepackage{fontawesome5} \usepackage{stackengine} \begin{document} \stackinset{c}{.05pt}{c}{1.7pt}{\textcolor{white}{\tiny 1}}{\faIcon{trophy}} \end{document} ```
0
https://tex.stackexchange.com/users/25858
694270
322,105
https://tex.stackexchange.com/questions/694234
2
What does it mean to "type `2' " to undo an automatic unwanted correction? where am I supposed to type this? This dialogue comes up when I try to execute code for which it says a curly bracket { has been inserted BUT I AM SURE IT IS NOT NEEDED, and it says if i type `2' then the insertion will be eliminated and compiling will continue. But I don't know where I am supposed to type this! Argh! Thanks for any help.
https://tex.stackexchange.com/users/97129
What does it mean to "type `2' " to undo an automatic unwanted correction? where am I supposed to type this?
false
The original (and still the best in my opinion!) way to compile a document using `tex` (or a descendant such as `pdftex`) is to call it from the command line. Thus, you prepare a file called `whatever.tex`, and in the command terminal type ``` tex whatever.tex ``` or perhaps ``` latex whatever.tex ``` The engine then attempts to process your file and produces a dvi or pdf file if it succeeds. If it runs into trouble, the engine might produce an error, or it might prompt the user for further input. The option to type 2 is one case of this. Here is an example showing `pdflatex` running from the command line. The code I used for this as follows. ``` \documentclass{article} \begin{document} \( {abc \) \end{document} ``` Many modern tex editors put a layer of obfuscation over this, so you press a button to invoke the engine (which actually just executes a command similar to the above behind the scenes), and the editor intercepts the engine output. Most will display some or all of it, though sometimes important information is lost. I don't know if any of them allow you to further interact with the engine, as you could if running from the command line. However, in this case it doesn't matter. The best thing to do is stop the compilation process and fix the error before compiling again.
3
https://tex.stackexchange.com/users/2417
694276
322,108
https://tex.stackexchange.com/questions/694035
0
In July the typesetting of my very large file was perfect. In August, after some updates, I got many errors. I corrected most of them, but the last one is still alive: the bibliography is missing. Even when running a very simple MWE, the bibliography is missing. ``` \documentclass[12pt]{memoir} \usepackage[% bibstyle=authortitle, citestyle=authortitle, backend=biber, ] {biblatex} \addbibresource{mybib.bib} \begin{filecontents}{mybib.bib} @book{dictre,title = {Dictionnaire de Trévoux},subtitle = {Dictionnaire universel françois et latin, dit de Trévoux. Édition lorraine, 1738-1742},url = {http://www.cnrtl.fr/dictionnaires/anciens/trevoux/menu1.php},urldate = {2019},language= {},location = {},year = {},publisher = {ATILF - CNRS, Université de Nancy},} @book{dmf,title = {Dictionnaire du Moyen Français},year = {},subtitle = {1330 - 1500},url = {http://www.atilf.fr/dmf},publisher = {ATILF - CNRS, Université de Nancy},urldate = {2019},language= {},} \end{filecontents} \begin{document} \cite{dictre} \cite{dmf} \printbibliography \end{document} ```
https://tex.stackexchange.com/users/37566
Bibliography missing
false
Problems fixed. All due to updates and eventually also the operating system. Ventura 13.5.1 is running well.
0
https://tex.stackexchange.com/users/37566
694282
322,110
https://tex.stackexchange.com/questions/694279
0
This works as expected: ``` \documentclass{minimal} \ExplSyntaxOn % USE X instead of \space for a space. \catcode`\X=\active \defX{\space } % \mycheck:nnn <regex> <string to test against regex> <end of error message> \cs_set:Npn \mycheck:nnn #1#2#3 { \regex_match:nnTF {#1} {#2} { \typeout{Match.} } { \typeout{NoXmatch.} \typeout{ItXshouldXbeX#3.} } } \mycheck:nnn {\A(true|false)\Z} {true} {`true'XorX`false'} \mycheck:nnn {\A(true|false)\Z} {false} {`true'XorX`false'} \mycheck:nnn {\A(true|false)\Z} {neither} {`true'XorX`false'} \ExplSyntaxOff \begin{document} \end{document} ``` I would like to use something where I can call it with, for example, ``` \def\cs{true} % or false or something else \newcheck {\A(true|false)\Z} {cs} {`true'XorX`false'} ``` and the value of \cs is checked. I want to use cs name and the value of \cs in an improved error message. In practice the regex, cs, and the end of the error message will all change. Sometimes the regex will not check for one of several values.
https://tex.stackexchange.com/users/32050
having trouble calling \regex_match
true
If you want to pass as second argument a csname, you need a variant. ``` \documentclass{article} \ExplSyntaxOn % \mycheck:nnn <regex> <string to test against regex> <end of error message> \cs_new_protected:Nn \mycheck:nnn { \regex_match:nnTF {#1} {#2} { \typeout{Match.} } { \typeout{No~match.} \typeout{It~should~be~#3.} } } \mycheck:nnn {\A(true|false)\Z} {true} {`true'~or~`false'} \mycheck:nnn {\A(true|false)\Z} {false} {`true'~or~`false'} \mycheck:nnn {\A(true|false)\Z} {neither} {`true'~or~`false'} \cs_generate_variant:Nn \mycheck:nnn { nv } \def\cs{true} \mycheck:nvn {\A(true|false)\Z} {cs} {`true'~or~`false'} \ExplSyntaxOff \stop ``` The relevant console output is ``` Match. Match. No match. It should be `true' or `false'. Match. ``` The `X` part is definitely to be avoided: in order to get a space you type `~` as in the code above.
0
https://tex.stackexchange.com/users/4427
694287
322,112
https://tex.stackexchange.com/questions/694271
1
LyX automatically writes `\usepackage{nomencl}` to a .tex document if a nomenclature is inserted via Insert → List/ToC → Nomenclature. Fine. Now I'd like to add a corresponding entry to my table of contents. The LyX user guide advises to add the `intoc` option to the "comma-separated document class options list in the Document → Settings dialog". In the exported .tex file, however, only `\usepackage{nomencl}` would appear instead of `\usepackage[intoc]{nomencl}`. How do I effectively pass this option? The wiki (<https://wiki.lyx.org/Tips/Nomenclature>) does not mention this either.
https://tex.stackexchange.com/users/302219
How to pass options to nomencl package in LyX?
true
Document >Settings… >Local layout. Add `PackageOptions nomencl intoc` Press Validate. Apply. View >Code Preview Pane and you'll see ``` \PassOptionsToPackage{intoc}{nomencl} \usepackage{nomencl} ```
2
https://tex.stackexchange.com/users/65222
694293
322,114
https://tex.stackexchange.com/questions/694284
0
Two years ago user egreg posted a nice solution, [enumitem: turn on and off label setting locally using a variable?](https://tex.stackexchange.com/questions/620595/enumitem-turn-on-and-off-label-setting-locally-using-a-variable/620622?noredirect=1#comment1723114_620622) which looks like this ``` \usepackage{enumitem} \makeatletter \newenvironment{lamport}{% \setenumerate{ label=$\langle$\the\@enumdepth$\rangle$\arabic*., ref=$\langle$\the\@enumdepth$\rangle$\arabic*, nosep } }{} \makeatother ``` that allows to mimic Lamports proof style <https://lamport.azurewebsites.net/pubs/proof.pdf> <http://lamport.azurewebsites.net/latex/pf2.pdf> <http://lamport.azurewebsites.net/latex/latex.html> However it only allows 4 nesting level (which is the LaTeX default) so the following example would not work: ``` \begin{lamport} \begin{enumerate} \item \label{item:nest2:1} The theorem follows from Lemma 1\\ \textsc{Proof of Lemma 1:} \begin{enumerate} \item \label{item:nest2:2} Lemma 1 follows from Lemma 2\\ \textsc{Proof of Lemma 2:} \begin{enumerate} \item \label{item:nest2:4} Lemma 2 follows from Lemma 3\\ \textsc{Proof of Lemma 3:} \begin{enumerate} \item \label{item:nest2:5} Lemma 3 follows from Lemma 4\\ \textsc{Proof of Lemma 4} \begin{enumerate} \item \label{item:nest2:6} Lemma 4 follows from Lemma 5 \end{enumerate} \end{enumerate} \end{enumerate} \end{enumerate} \end{enumerate} \end{lamport} ``` so in short how could the nesting level enhanced say to at least 10 levels (whether this is a good idea, is another matter, but I rather would prefer to have the possiblity and if needed not use it thanks Uwe Brauer
https://tex.stackexchange.com/users/167362
Lamport proof style, enumitem, enhance nesting level
false
Just add `\renewlist{enumerate}{enumerate}{<depth>}` to the definition. Here I chose 9. Also, note that `\setenumerate` (and `\setitemize` and `\setdescription`) have been deprecated in favor of `\setlist[<envname>]`. ``` \documentclass{article} \usepackage{enumitem} \makeatletter \newenvironment{lamport}{% \renewlist{enumerate}{enumerate}{9} \setlist[enumerate]{ label=$\langle$\the\@enumdepth$\rangle$\arabic*., ref=$\langle$\the\@enumdepth$\rangle$\arabic*, nosep } }{} \makeatother \begin{document} \begin{lamport} \begin{enumerate} \item \label{item:nest2:1} The theorem follows from Lemma 1\\ \textsc{Proof of Lemma 1:} \begin{enumerate} \item \label{item:nest2:2} Lemma 1 follows from Lemma 2\\ \textsc{Proof of Lemma 2:} \begin{enumerate} \item \label{item:nest2:4} Lemma 2 follows from Lemma 3\\ \textsc{Proof of Lemma 3:} \begin{enumerate} \item \label{item:nest2:5} Lemma 3 follows from Lemma 4\\ \textsc{Proof of Lemma 4:} \begin{enumerate} \item \label{item:nest2:6} Lemma 4 follows from Lemma 5\\ \textsc{Proof of Lemma 5:} \begin{enumerate} \item \label{item:nest2:7} Lemma 5 follows from Lemma 6\\ \textsc{Proof of Lemma 6:} \end{enumerate} \end{enumerate} \end{enumerate} \end{enumerate} \end{enumerate} \end{enumerate} \end{lamport} \end{document} ```
1
https://tex.stackexchange.com/users/208544
694299
322,116
https://tex.stackexchange.com/questions/694290
1
``` \begin{table}[ht] \centering \caption{Mapping of kinetic models proposed in the literature for the enzymatic hydrolysis process.} \begin{tabularx}{\textwidth}{l|l|l|l|c} \toprule \textbf{Objective} & \textbf{Model Description} & \textbf{Feedstock} & \textbf{Results} & \textbf{Reference}\\ \midrule \makecell[l]{Describe the yield of fermentable sugars, glucose and\\ xylose in the enzymatic hydrolysis step.} & \makecell[l]{They developed a kinetic model based on the Michaelis-Menten theory\\ and an enzymatic deactivation model. \\Then, they determined empirical equations for the conversion\\ of glucan to glucose and conversion of xylan to xylose.} & \makecell[l]{Bagasse pre-treated with hot water,\\hydrochloric acid (HCl) and sodium hydroxide (NaOH).} & \makecell[l]{They concluded that the combination of models \\allowed a high precision of fit to the experimental data,\\ for enzymatic hydrolysis by different compositions\\ of pre-treated bagasse, in addition to providing\\ the analysis of the yield in the pre-treatment step.} & \citeonline{ZHANG2021c} \\ \makecell[l]{Describe the enzymatic hydrolysis rate, analyzing\\ the nature and intensity of two pretreatments.} & \makecell{They proposed a kinetic model to analyze the nature\\ and intensity of two pretreatments. Thus,\\ they defined the equation for reaction rate and apparent\\ kinetic constant. Those equation were composed\\ by factors of intensity of pretreatment,\\ the accessibility of the enzyme to the substrate and reactivity.} & \makecell[l]{Wheat straw, corn husk and thistle stalks.\\ These biomasses were pretreated with dilute\\ sulfuric acid and ethanol-water.} & \makecell[l]{They concluded that the kinetic model describes \\the experimental results obtained in the enzymatic hydrolysis\\ for the three raw materials used in the study,\\ in different operating conditions.\\ In addition, wheat straw was the most reactive\\ and thistle stalk the most recalcitrance.} & \citeonline{WOJTUSIK2020} \\ \makecell[l]{They developed a kinetic model for\\ the enzymatic hydrolysis reaction in a reactor,\\ considering the fluid dynamics and \\the transport of solids and dissolved species.} & \makecell[l]{Implementation of equations for fluid transport (substrate and enzyme),\\ equation to determine the substrate concentration;\\ enzyme concentration, taking into account \\the adsorption of the enzyme to cellulose.} & Cellulose substrate. & \makecell[l]{They concluded that the proposed model\\ perfectly predicted the conversion mechanisms \\that occur in enzymatic hydrolysis.\\ In addition, the model provided fidelity\\ to capture the substrate gradients within the reactor.} & \citeonline{SITARAMAN2019c} \\ \makecell[l]{Describe the process of fed-batch hydrolysis\\ for a wide range of solids content.\\ In addition, optimization to determine the\\ operating conditions in the fed-batch \\enzymatic hydrolysis step.} & \makecell[l]{They proposed a kinetic model composed\\ by empirical equations to determine\\ the modified inhibition constant, reaction rate\\ (involves Michaelis-Menten model with product inhibition)\\ and developed mass balances for\\ the concentration of cellulose and glucose.} & \makecell[l]{Hydrothermally pre-treated bagasse (HB)\\ and bagasse pre-treated with \\diluted and delignified acid (ADB).} & \makecell[l]{They observed that the kinetic model fits\\ the experimental data, mainly for the loading\\ of solids 5, 15 and $20\%$ $w.v^{-1}$.\\ Furthermore, it was possible to achieve high sugar\\ levels for both substrates, at 131.24 $g.L^{-1}$ \\for HB and 131.46 $g.L^{-1}$ ADB. \\They also noticed that the reaction yield for the HB substrate\\ decreased from $67.56\%$ to $65-63\%$, \\due to the inhibition of the product.\\ As for the ADB substrate, the yield \\reduced from $66.16\%$ to $55-52\%$.} & \citeonline{GODOY2019} \\ \makecell[l]{Analyzing the saccharification of cellulose\\ to glucose concentration in a novel \\fed-batch horizontal bioreactor.} & \makecell[l]{They used the kinetic model proposed by \citeonline{ZHANG2010},\\ to describe glucose production. Thus, \\they considered in the model cellulase deactivation\\ as first and second order reaction.} & Hydrothermally pre-treated agave bagasse. & \makecell[l]{The model presented a good fit to the experimental data,\\ for a horizontal bioreactor operating in fed-batch.\\ For the experimental test and simulation,\\ the best glucose concentration obtained was the solids load\\ at $25\%$having 195.60 $g.L^{-1}$ of glucose.\\ Working in fed batch, $30\%$ solids load for a horizontal bioreactor,\\ glucose concentrations of approximately\\ 120 $g.L^{-1}$ can be reached.} & \citeonline{PINO2019} \\ \makecell[l]{Show a model applicable for fed-batch hydrolysis,\\ aiming at high substrate concentration.} & \makecell[l]{ It was developed two models, one simplified\\ and one complete model. The simplified\\ model includes only the enzymatic adsorption and \\the first-order reaction of the enzyme-substrate complex.\\ The complete model involves competitive glucose\\ inhibition and decreasing rate factors related \\to substrate and enzyme behavior.} & Filter paper. &\makecell[l]{ The solids concentration ranged from 5 to 50 $g.L^{-1}$. \\In experimental tests, they obtained glucose concentration\\s up to 100 $g.L^{-1}$. On the other hand,\\ for the complete model that presented the best fit,\\ they found results below 40 g.L-1,\\ for an initial solids concentration of 30 $g.L^{-1}$}. & \citeonline{TERVASMAKI2017} \\ \makecell[l]{Describe the enzymatic hydrolysis\\ in high solid concentration.} & \makecell[l]{They used kinetic model by \citeonline{KADAM2004}.\\ The proposed model is based on the biochemistry\\ of enzymatic hydrolysis and includes enzymatic adsorption,\\ product inhibition, substrate reactivity and \\conversion of hemicellulose to xylose. However, it neglects\\ thermal and mechanical enzymatic inactivation.} & \makecell[l]{Sugarcane straw \\pre-treated with hot water.} &\makecell[l]{The model presented a reasonable fit to\\ the experimental data with solids load of $10-20\%$,\\ enzyme feed between (5-60 $FPU.g^{-1}$),\\ being possible to obtain glucose concentrations up to\\ approximately 110 $g.L^{-1}$.} & \citeonline{ANGARITA2015} \\ \makecell[l]{They developed a dynamic model for the simultaneous\\ feeding of substrate and enzyme, with the purpose of \\reaching high concentrations of glucose, in the process of \\enzymatic hydrolysis in a reactor operating in fed batch.} &\makecell[l]{They determined the mass balances for volume,\\ substrate and product. In addition, they\\ considered the equation for the reaction rate,\\ from the Michaelis-Menten equation with inhibition\\ by the product (glucose). They proposed\\ an equation for substrate and enzyme feeding.} &\makecell{Bagasse pre-treated by steam explosion \\and delignified with $4\%$ NaOH.} & \makecell[l]{ From the simulation, it was noticed\\ that it was necessary to feed in three pulses\\ of enzyme for the analyzed system.\\ Furthermore, it was possible to reach\\ glucose concentrations of 160 $g.L^{-1}$ and,\\ in the experimental tests for model validation,\\ product concentration of 200 $g.L^{-1}$.} & \citeonline{CAVALCANTI-MONTAÑO2013} \\ \bottomrule \end{tabularx} \end{table}% ``` --- I need to place a table in order to divide two columns into pages, so that it can appear whole.
https://tex.stackexchange.com/users/188085
long and wide LaTeX table
false
My main recommendation would be to typeset the table in landscape mode. Second, do employ an [xltabular](https://www.ctan.org/pkg/xltabular) environment, which combines the capabilities of the [tabularx](https://www.ctan.org/pkg/tabularx) (to allow automatic line breaking and an overall target width) and [longtable](https://www.ctan.org/pkg/longtable) environments (which can span more than one page); this will also let you get rid of all `\makecell` "wrappers". Third, do also get rid of all vertical lines and most horizontal lines; whitespace can be just as effective as black lines can be for the purpose of generating visual separators. These suggestions are pursued in the code posted below. Assuming the document employs margins that are 1 inch wide, it's possible to typeset the full table across just 2 pages. An explanation of `L{0.7} L{1.3} L{0.5} L{1.5}` in the line ``` \begin{xltabular}{9in}{@{} L{0.7} L{1.3} L{0.5} L{1.5} c @{}} ``` may be in order. First, the `L` column type is defined in the preamble as a variant of the `X` column type which (a) doesn't impose full justification and (b) allows to variable widths (using the syntax provided by the `tabularx` package, which is carried over to the `xltabular` package). Second, the numbers 0.7, 1.3, 0.5, and 1.5 denote a relative measure of the usable widths of the four columns; it's "relative" in the sense that the numbers sum to 4, which is the number of X-type columns. As a result, the usable width of column 4 is three times that of column 3. I arrived at these (relative) width by trial and error or, if you prefer, by casual empiricism. :-) ``` \documentclass{article} \usepackage[T1]{fontenc} \usepackage[english]{babel} \usepackage[letterpaper,margin=1in]{geometry} % set page parameters as needed \usepackage{pdflscape,xltabular,ragged2e,booktabs} \newcolumntype{L}[1]{>{\RaggedRight\hsize=#1\hsize}X} % variable-width X-type col. \usepackage{siunitx} % for \unit and \qty macros \usepackage{mhchem} % for \ce macro \providecommand\citeonline[1]{xyz} % no idea how this macro should be defined \begin{document} \begin{landscape} \setlength\tabcolsep{4pt} % default: 6pt \setlength\LTcapwidth{9in} % How to obtain the width of the text block (cf 1st arg. of 'xltabular' env.) % - Letter paper, margins 1in: 11in - 2*1in = 9in (228.6mm) % - A4 paper, margins 2.5cm: 297mm - 2*25mm = 247mm \begin{xltabular}{9in}{@{} L{0.7} L{1.3} L{0.5} L{1.5} c @{}} \caption{Mapping of kinetic models proposed in the literature for the enzymatic hydrolysis process.} \label{tab:mappings}\\ \toprule Objective & Model Description & Feedstock & Results & Ref. \\ \midrule \endfirsthead \multicolumn{5}{@{}l}{Table \thetable, continued.}\\[1ex] \toprule Objective & Model Description & Feedstock & Results & Ref. \\ \midrule \endhead \midrule \multicolumn{5}{r@{}}{\footnotesize (continued on next page)}\\ \endfoot \bottomrule \endlastfoot Describe the yield of fermentable sugars, glucose and xylose in the enzymatic hydrolysis step. & They developed a kinetic model based on the Michaelis-Menten theory and an enzymatic deactivation model. Then, they determined empirical equations for the conversion of glucan to glucose and conversion of xylan to xylose. & Bagasse pre-treated with hot water,hydrochloric acid (\ce{HCl}) and sodium hydroxide (\ce{NaOH}). & They concluded that the combination of models allowed a high precision of fit to the experimental data, for enzymatic hydrolysis by different compositions of pre-treated bagasse, in addition to providing the analysis of the yield in the pre-treatment step. & \citeonline{ZHANG2021c} \\ \addlinespace Describe the enzymatic hydrolysis rate, analyzing the nature and intensity of two pretreatments. & They proposed a kinetic model to analyze the nature and intensity of two pretreatments. Thus, they defined the equation for reaction rate and apparent kinetic constant. Those equation were composed by factors of intensity of pretreatment, the accessibility of the enzyme to the substrate and reactivity. & Wheat straw, corn husk and thistle stalks. These biomasses were pretreated with dilute sulfuric acid and ethanol-water. & They concluded that the kinetic model describes the experimental results obtained in the enzymatic hydrolysis for the three raw materials used in the study, in different operating conditions. In addition, wheat straw was the most reactive and thistle stalk the most recalcitrance. & \citeonline{WOJTUSIK2020} \\ \addlinespace They developed a kinetic model for the enzymatic hydrolysis reaction in a reactor, considering the fluid dynamics and the transport of solids and dissolved species. & Implementation of equations for fluid transport (substrate and enzyme), equation to determine the substrate concentration; enzyme concentration, taking into account the adsorption of the enzyme to cellulose. & Cellulose substrate. & They concluded that the proposed model perfectly predicted the conversion mechanisms that occur in enzymatic hydrolysis. In addition, the model provided fidelity to capture the substrate gradients within the reactor. & \citeonline{SITARAMAN2019c} \\ \addlinespace Describe the process of fed-batch hydrolysis for a wide range of solids content. In addition, optimization to determine the operating conditions in the fed-batch enzymatic hydrolysis step. & They proposed a kinetic model composed by empirical equations to determine the modified inhibition constant, reaction rate (involves Michaelis-Menten model with product inhibition) and developed mass balances for the concentration of cellulose and glucose. & Hydrothermally pre-treated bagasse (HB) and bagasse pre-treated with diluted and delignified acid (ADB). & They observed that the kinetic model fits the experimental data, mainly for the loading of solids 5, 15 and 20\% $w\cdot v^{-1}$. Furthermore, it was possible to achieve high sugar levels for both substrates, at \qty{131.24}{\gram\per\litre} for HB and \qty{131.46}{\gram\per\litre} ADB. They also noticed that the reaction yield for the HB substrate decreased from 67.56\% to 65--63\%, due to the inhibition of the product. As for the ADB substrate, the yield reduced from 66.16\% to 55--52\%. & \citeonline{GODOY2019} \\ %\addlinespace Analyzing the saccharification of cellulose to glucose concentration in a novel fed-batch horizontal bioreactor. & They used the kinetic model proposed by \citeonline{ZHANG2010}, to describe glucose production. Thus, they considered in the model cellulase deactivation as first and second order reaction. & Hydrothermally pre-treated agave bagasse. & The model presented a good fit to the experimental data, for a horizontal bioreactor operating in fed-batch. For the experimental test and simulation, the best glucose concentration obtained was the solids load at 25\% having \qty{195.60}{\gram\per\litre} of glucose. Working in fed batch, 30\% solids load for a horizontal bioreactor, glucose concentrations of approximately \qty{120}{\gram\per\litre} can be reached. & \citeonline{PINO2019} \\ \addlinespace Show a model applicable for fed-batch hydrolysis, aiming at high substrate concentration. & It was developed two models, one simplified and one complete model. The simplified model includes only the enzymatic adsorption and the first-order reaction of the enzyme-substrate complex. The complete model involves competitive glucose inhibition and decreasing rate factors related to substrate and enzyme behavior. & Filter paper. & The solids concentration ranged from 5 to 50 \unit{\gram\per\litre}. In experimental tests, they obtained glucose concentrations up to \qty{100}{\gram\per\litre}. On the other hand, for the complete model that presented the best fit, they found results below \qty{40}{\gram\per\litre}, for an initial solids concentration of \qty{30}{\gram\per\litre}. & \citeonline{TERVASMAKI2017} \\ \addlinespace Describe the enzymatic hydrolysis in high solid concentration. & They used kinetic model by \citeonline{KADAM2004}. The proposed model is based on the biochemistry of enzymatic hydrolysis and includes enzymatic adsorption, product inhibition, substrate reactivity and conversion of hemicellulose to xylose. However, it neglects thermal and mechanical enzymatic inactivation. & Sugarcane straw pre-treated with hot water. & The model presented a reasonable fit to the experimental data with solids load of 10--20\%, enzyme feed between 5 and 60 \unit{FPU\gram\tothe{-1}}, being possible to obtain glucose concentrations up to approximately \qty{110}{\gram\per\litre}. & \citeonline{ANGARITA2015} \\ \addlinespace They developed a dynamic model for the simultaneous feeding of substrate and enzyme, with the purpose of reaching high concentrations of glucose, in the process of enzymatic hydrolysis in a reactor operating in fed batch. & They determined the mass balances for volume, substrate and product. In addition, they considered the equation for the reaction rate, from the Michaelis-Menten equation with inhibition by the product (glucose). They proposed an equation for substrate and enzyme feeding. & Bagasse pre-treated by steam explosion and delignified with 4\%~\ce{NaOH}. & From the simulation, it was noticed that it was necessary to feed in three pulses of enzyme for the analyzed system. Furthermore, it was possible to reach glucose concentrations of \qty{160}{\gram\per\litre} and, in the experimental tests for model validation, product concentration of \qty{200}{\gram\per\litre}. & \citeonline{CAVALCANTI-MONTAÑO2013} \\ \end{xltabular} \end{landscape} \end{document} ```
2
https://tex.stackexchange.com/users/5001
694300
322,117
https://tex.stackexchange.com/questions/694278
-1
In my document I use a SVG file in the header (fancyhdr) and the same SVG is used independently on the title page. More or less like this: ``` ... \fancyhead[C]{ \includesvg[]{images/my-svg-file} } \begin{document} \begin{tikzpicture}[remember picture,overlay,shift={(current page.north)}] \node[anchor=west]{some text before}; \end{tikzpicture} \begin{tikzpicture}[remember picture,overlay,shift={(current page.north)}] \node[anchor=north]{\includesvg[]{images/my-svg-file}}; % <-- will not be rendered \end{tikzpicture} \begin{tikzpicture}[remember picture,overlay,shift={(current page.north)}] \node[anchor=east]{some text after}; \end{tikzpicture} \newpage While the header is deactivated on the first page, this page has the correct header... \newpage ... so does this page. \end{document} ``` I want to be able to compile this document using a batch script, so I can copy/rename the output PDF, delete all of those files that are generated during compilation (going to call them AUX files), and maybe do some other stuff. This is my batch file, but I don't think it's relevant (since the same happens if I use the MikTeX editor for compilation): ``` lualatex --shell-escape --enable-write18 my_document.tex DEL *.log DEL *.out DEL *.aux DEL *.table DEL *.lua DEL *.dat ``` Now, the problem is, that the very first occurence of the SVG image (see the comment in the tex snippet) is not rendered, nor is the text "some text before" and "some text after". But **only if the document is compiled without the AUX files existing in the .tex file's directory**. I'd like to understand why that happens... Shouldn't the compilation deliver the exact same results every time? How can files that exist from a previous compilation affect a subsequent compilation?! That seems like a serious flaw to me because the document might have changed dramatically between two compilations. In my opinion, the AUX files need to be considered obsolete after a compilation has finished, but I know little about LaTeX. I know that I have some options: * call the `luatex command twice` (tested this and it works, but it's ugly) * copy the PDF away from the compilation directory, but that's not prefered Instead I'd like to learn what causes the issue.
https://tex.stackexchange.com/users/148430
SVG is not rendered if (obsolete?) AUX files are deleted beforehand
true
As already stated by @Ulrike you should not delete any generated aux file in order to get the final processed document after several runs. In fact, package `svg` uses the aux file itself to determine the Inkscape version used. Nevertheless, using the same SVG file multiple times, I would highly recommend you to store this into a box once included and use this for your headers. Otherwise, the SVG file will be processed for each page without any benefit but an impact in performance, especially when used in a header for a large document. So a very simple approach would look like this ``` \documentclass{article} \usepackage{iftex} \iftutex \usepackage{fontspec} \else \usepackage[T1]{fontenc} \fi \usepackage{svg} \usepackage{tikz} \usepackage[headings]{fancyhdr} \pagestyle{headings} \begin{document} \newbox\fancyheadbox \savebox\fancyheadbox{\rule{100pt}{5pt}} %\savebox\fancyheadbox{\includesvg[]{images/my-svg-file}} \fancyhead[C]{\usebox\fancyheadbox} \begin{tikzpicture}[remember picture,overlay,shift={(current page.north)}] \node[anchor=west]{some text before}; \end{tikzpicture} \begin{tikzpicture}[remember picture,overlay,shift={(current page.north)}] \node[anchor=north]{\usebox\fancyheadbox}; \end{tikzpicture} \begin{tikzpicture}[remember picture,overlay,shift={(current page.north)}] \node[anchor=east]{some text after}; \end{tikzpicture} \newpage While the header is deactivated on the first page, this page has the correct header... \newpage ... so does this page. \end{document} ```
2
https://tex.stackexchange.com/users/38481
694302
322,118
https://tex.stackexchange.com/questions/693627
5
On CTAN, AFM files are often provided along with type1 (PFB) and TFM files. I wonder if I should include AFM files in a font package for CTAN at all. I assume that the AFM files are included just in case you use the font with some other programs outside the TeX-world. Is this assumption correct or are there cases where AFM are needed in programs that are provided with a common TeX distribution (e.g. dvips)?
https://tex.stackexchange.com/users/93550
Why should I include AFM files in a font package for CTAN?
false
For the orthodox TeX production chain, Neither DVIPS nor DVIPDF(M)(X) nor pdfTeX need AFM to work, and pdfTeX compatible processor would also work without AFM. If you are distributing Type1 fonts and the user want to edit the font in a font editor that doesn’t know TeX’s TFM format, they can import the AFM into the editor when editing so the various font metric information can also be updated and after that TFM can be generated from the AFM. luaotfload can load PFB with AFM *in case there is no TFM provided*. If you can provide AFM from a separated download place, or the AFM is actually straight up generated from TFM, AFM might not needed be distributed with font uploaded to CTAN.
2
https://tex.stackexchange.com/users/246082
694303
322,119
https://tex.stackexchange.com/questions/693627
5
On CTAN, AFM files are often provided along with type1 (PFB) and TFM files. I wonder if I should include AFM files in a font package for CTAN at all. I assume that the AFM files are included just in case you use the font with some other programs outside the TeX-world. Is this assumption correct or are there cases where AFM are needed in programs that are provided with a common TeX distribution (e.g. dvips)?
https://tex.stackexchange.com/users/93550
Why should I include AFM files in a font package for CTAN?
true
TFM files are able to encode only 256 characters per font. Type1 fonts and their AFM format can include unlimited number of characters, the standardized character-names are used in the format. LuaTeX with luaotfload is able to load Type1 fonts directly without TFM, it reads AFM+PFB files. The standardized names of characters are mapped to Unicode in such case, so user can access all characters of the font, no limited to 256 characters like TFM. If you are able to generate OTF format then it is much better choice. LuaTeX with luaotfload is able to load these fonts and all characters are accessible too. And all things are more simple and there can be more features ready to use in the font.. When OTF format is present in a font package then Type1 format (AFM+PFB) seems to be obsolete and there is no reason to use such format. Maybe, you want to provide it for users of obsolete TeX engines (like pdftex) where only TFM files are possible when loading the font. And users of such obsolete engines don't need the AFM format. Note that AFM format includes data of kerning pairs. If it is generated automatically, then almost each character to each character has its kerning pair, much of them unnecessary. If you remove such unnecessary kerning pairs from AFM then you get "normal size" of these files.
3
https://tex.stackexchange.com/users/51799
694311
322,123
https://tex.stackexchange.com/questions/693873
0
I get this way to create `\newcounter{bash}` from one forum that I forgot the link here. I want to know how to create the **table of contents for the codes** like `\tableofcontents` that is showing the pages of the codes that are inside the `\begin{bash} ... \end{bash}`. so it should be like this ``` code-1/caption-1 .... page 1 code-2/caption-2 .... page 3 code-n/caption-n .... page 45 ``` this is the MWE: ``` \documentclass[twoside]{book} \usepackage{amssymb} \usepackage{amsmath} \usepackage{mathtools} \usepackage{amsfonts} \usepackage{amssymb} \usepackage{latexsym} \usepackage{enumerate} \usepackage{wrapfig} \usepackage{siunitx} \usepackage{cite} \usepackage{cancel} \usepackage{ulem} \usepackage{makecell} \usepackage{newunicodechar} \usepackage[utf8]{inputenc} \usepackage{marginnote} \usepackage[table, dvipsnames]{xcolor} \usepackage{float} \usepackage{listings} \usepackage{regexpatch} \DeclareFixedFont{\ttb}{T1}{txtt}{bx}{n}{9} \DeclareFixedFont{\ttm}{T1}{txtt}{m}{n}{9} \usepackage{color} \newcounter{bash} \makeatletter \newcommand{\lstlistbashname}{List of Julia Codes} \lst@UserCommand\lstlistofbash{\bgroup \let\contentsname\lstlistbashname \let\lst@temp\@starttoc \def\@starttoc##1{\lst@temp{lop}}% \tableofcontents \egroup} \lstnewenvironment{bash}[1][]{% \renewcommand{\lstlistingname}{Julia Code}% \let\c@lstlisting=\c@bash \let\thelstlisting=\thebash \xpatchcmd*{\lst@MakeCaption}{lol}{lop}{}{}% \lstset{language=bash, keywordstyle=\sffamily\ttm, basicstyle=\sffamily\ttm, numbersep=5pt, frame=tb, columns=fullflexible, backgroundcolor=\color{yellow!20}, linewidth=0.95\linewidth, xleftmargin=0.05\linewidth, breaklines=true, captionpos=b, #1}} {} \makeatother %---------------------------------------------------------------------------------------- \begin{document} \tableofcontents \begin{bash} sudo -i \end{bash} \end{document} ``` thanks before.
https://tex.stackexchange.com/users/274656
How to show the table of contents for highlighted code?
true
Two changes 1. Comment out `\xpatchcmd*{\lst@MakeCaption}{lol}{lop}{}{}%` 2. Use `\addcontentsline{toc}{section}{Listings}` followed by `\lstlistoflistings` (source: <https://tex.stackexchange.com/a/97476/133968>) ``` \documentclass[twoside]{book} \usepackage{amssymb} \usepackage{amsmath} \usepackage{mathtools} \usepackage{amsfonts} \usepackage{amssymb} \usepackage{latexsym} \usepackage{enumerate} \usepackage{wrapfig} \usepackage{siunitx} \usepackage{cite} \usepackage{cancel} \usepackage{ulem} \usepackage{makecell} \usepackage{newunicodechar} \usepackage[utf8]{inputenc} \usepackage{marginnote} \usepackage[table, dvipsnames]{xcolor} \usepackage{float} \usepackage{listings} \usepackage{regexpatch} \DeclareFixedFont{\ttb}{T1}{txtt}{bx}{n}{9} \DeclareFixedFont{\ttm}{T1}{txtt}{m}{n}{9} \usepackage{color} \newcounter{bash} \makeatletter \newcommand{\lstlistbashname}{List of Julia Codes} \lst@UserCommand\lstlistofbash{\bgroup \let\contentsname\lstlistbashname \let\lst@temp\@starttoc \def\@starttoc##1{\lst@temp{lop}}% \tableofcontents \egroup} \lstnewenvironment{bash}[1][]{% \renewcommand{\lstlistingname}{Julia Code}% \let\c@lstlisting=\c@bash \let\thelstlisting=\thebash %\xpatchcmd*{\lst@MakeCaption}{lol}{lop}{}{}% \lstset{language=bash, keywordstyle=\sffamily\ttm, basicstyle=\sffamily\ttm, numbersep=5pt, frame=tb, columns=fullflexible, backgroundcolor=\color{yellow!20}, linewidth=0.95\linewidth, xleftmargin=0.05\linewidth, breaklines=true, captionpos=b, #1}} {} \makeatother %---------------------------------------------------------------------------------------- \begin{document} \addcontentsline{toc}{section}{Listings} \lstlistoflistings \begin{bash}[caption={Listing 1}] sudo -i \end{bash} \end{document} ```
1
https://tex.stackexchange.com/users/133968
694324
322,131
https://tex.stackexchange.com/questions/694318
2
I am using the algorithms environment from `algorithm2e` in a modified way with reduced width (following the solution [here](https://tex.stackexchange.com/questions/23296/setting-caption-rule-width-in-algorithm2e-algs)), see the MWE below. This generates an overfull box that I'd like to get rid of. How can I achieve this? ``` \documentclass{article} \usepackage{lipsum} \usepackage{etoolbox} \usepackage[ruled]{algorithm2e} \SetCustomAlgoRuledWidth{0.6\textwidth} \makeatletter \patchcmd{\@algocf@start}{% \begin{lrbox}{\algocf@algobox}% }{% \rule{0.2\textwidth}{\z@}% \begin{lrbox}{\algocf@algobox}% \begin{minipage}{0.6\textwidth}% }{}{} \patchcmd{\@algocf@finish}{% \end{lrbox}% }{% \end{minipage}% \end{lrbox}% }{}{} \makeatother \begin{document} \lipsum[1] \begin{algorithm}[h] \caption{NaiveSelect}\label{algo:naive-option} Some alg step \; \end{algorithm} \lipsum[2] \end{document} ``` The logfile says `Overfull \hbox (276.00105pt too wide) in paragraph at lines 24--27`.
https://tex.stackexchange.com/users/256504
Overfull hbox in patched use of algorithm2e environment
true
You need to fix `\algowidth`. ``` \documentclass{article} \usepackage{lipsum} \usepackage{etoolbox} \usepackage[ruled]{algorithm2e} \AtBeginDocument{% \SetCustomAlgoRuledWidth{0.6\textwidth}% \setlength{\algowidth}{0.8\textwidth}% } \makeatletter \patchcmd{\@algocf@start} {\begin{lrbox}{\algocf@algobox}} {% \hspace*{0.2\textwidth}% \begin{lrbox}{\algocf@algobox}% \begin{minipage}{0.6\textwidth}% } {}{} \patchcmd{\@algocf@finish} {\end{lrbox}} {\end{minipage}\end{lrbox}} {}{} \makeatother \begin{document} \lipsum[1] \begin{algorithm}[h] \caption{NaiveSelect}\label{algo:naive-option} Some alg step \; \end{algorithm} \lipsum[2] \end{document} ``` The value of `\textwidth` is known with certainty at begin document, so it's best to set parameters depending on it at that place. Using `\hspace*{0.2\textwidth}` is simpler than a rule.
3
https://tex.stackexchange.com/users/4427
694325
322,132
https://tex.stackexchange.com/questions/694199
1
For a syllabus .cls I'm updating for work, I already have a `answer` environment, that is only shown when the documentclass is provided the `answers` toggle (by default, the class receives `noanswer`). I use this toggle and environment to hide/show answers, depending on whether I compile the syllabus for students, or staff. When I use a `minted` environment inside this `answer` environment, I get errors. I understand from the minted documentation that there might be a conflict with `fancybox`, which *might* as well occur with `mdframed`(?). I've tried adapting my method to a minted-specific version by reading [this earlier post](https://tex.stackexchange.com/questions/42393/new-environment-with-minted), but with no success. I have included three attempts in the MWE. ``` %% file: example.cls \NeedsTeXFormat{LaTeX2e} \ProvidesClass{example}[For demonstration] \RequirePackage{xcolor} \colorlet{titlecolor}{blue} \colorlet{support}{yellow} \newif\if@answers \DeclareOption{answers}{\@answerstrue} \DeclareOption{noanswers}{\@answersfalse} \ExecuteOptions{noanswers} \ProcessOptions\relax \LoadClass[10pt]{article} \colorlet{lightbg}{titlecolor!7!white} \colorlet{darkbg}{titlecolor!25!white} \colorlet{lightsupport}{support!7!white} \colorlet{darksupport}{support!25!white} \DeclareRobustCommand{\toggletitlecolors}{% \colorlet{tempcolor}{titlecolor} \colorlet{titlecolor}{support} \colorlet{support}{tempcolor} \colorlet{tempcolor}{lightbg} \colorlet{lightbg}{lightsupport} \colorlet{lightsupport}{tempcolor} \colorlet{tempcolor}{darkbg} \colorlet{darkbg}{darksupport} \colorlet{darksupport}{tempcolor} } \RequirePackage{mdframed} \NewDocumentEnvironment{answer}{+b} {\if@answers% \toggletitlecolors% \begin{mdframed}[linecolor=titlecolor,backgroundcolor=lightbg]#1\end{mdframed}% \toggletitlecolors% \fi}{} ``` ``` %% file: mwe.tex \documentclass[answers]{example} \usepackage{minted} % Three flavours of my answercode environment attempts, iterated on through the raised errors/documentation read. Each includes a description of its origin and why I think it doesn't work. \makeatletter % Direct copy of the answer environment. In form this should work, but apparently, minted and NewdocumentEnvironment don't want to play together(?). \NewDocumentEnvironment{answercode1}{+b} {\if@answers% \toggletitlecolors% \begin{minted}{python}#1\end{minted} \toggletitlecolors% \fi}{} % Based on linked help thread. Doesn't work because the \if is not completed within the argument braces of \newenvironment \newenvironment{answercode2}[1][] {\if@answers \VerbatimEnvironment \begin{minted}{python}} {\end{minted}\fi} % Based on the above. Doesn't work because the \if wraps \begin and \end commands(?). \usepackage{comment} \newenvironment{answercode3}[1][] {\if@answers \VerbatimEnvironment \begin{minted}{python}\else\begin{comment}\fi} {\if@answers\end{minted}\else\end{comment}\fi} \makeatother \begin{document} This text is always visible. \begin{answer} This is only visible if \texttt{answers} is provided to the documentclass. \end{answer} \begin{minted}{python} this_works \end{minted} % With noanswers: no errors. % With answers: FancyVerb Error: % Extraneous input ` test \end {minted} \toggletitlecolors \fi \end {answercode1}' between \begin{minted}[<key=value>] and line end \begin{answer} \begin{minted}{python} test \end{minted} \end{answer} %% With noanswers: no errors. %% With answers: similar FancyVerb error: % Extraneous input `test\end {minted} \toggletitlecolors \fi \end {answercode1}' between \begin{minted}[<key=value>] and line end \begin{answercode1} test \end{answercode1} %% With noanswers: incomplete \iffalse. %% With answers: same FancyVerb error. % Extraneous input `test' between \begin{answercode2}[<key=value>] and line end. \begin{answercode2} test \end{answercode2} %% With noanswers: Runaway argument? File ended while scanning use of \next. %% With answers: similar FancyVerb error. % Extraneous input `\else \begin {comment}\fi test' between \begin{answercode3}[<key=value>] and line end \begin{answercode3} test \end{answercode3} \end{document} ``` So the concrete question is: how can I make an environment that contains a `minted` environment, and which can be hidden by setting a documentclass-level toggle?
https://tex.stackexchange.com/users/221009
Toggle to hide minted environment
false
So after some good nights' sleep, I realized I could just move the `\if@answers...\fi` outside of the environment definition, and define the `answercode` environment for both `@answers` and `@noanswers`. This code has made it in the syllabus .cls: ``` \if@answers \newenvironment{answercode}{% \toggletitlecolors% % Required when defining your own environments which include a minted environment \VerbatimEnvironment% \begin{minted}{python}% }{\end{minted}\toggletitlecolors} \else \NewDocumentEnvironment{answercode}{+b}{}{} \fi ``` I have chosen to create an 'empty' `\NewDocumentEnvironment` if `@noanswers`, instead of creating a new `comment` environment with `\includecomment{answercode}`. The latter recognized `_` characters and tried inserting `$`s to turn them into ill-defined math environments. That wasn't working for me. The empty `\NewDocumentEnvironment` at the end doesn't process the argument at all, so it seems. I started out wanting to be able to include the `minted` environment in the custom `answer`/`mdframed` environments, but I'm okay with just closing and opening smaller environments.
1
https://tex.stackexchange.com/users/221009
694328
322,134
https://tex.stackexchange.com/questions/694333
0
I have a command for setbuilder notation, `\newcommand{\set}[2]{\left\{ #1 \ \big| \ #2 \right\}}` Pretty simple stuff. I have issues, however, when I want larger characters in the set, for example summations, fractions, and whatnot as the vertical bar doesn't scale. Is there a way its height can be tied to the outside brackets?
https://tex.stackexchange.com/users/295611
Locking size of character to that of another character?
false
You might do like this: ``` \documentclass{article} \usepackage{amsmath} \newcommand{\set}[2]{\left\{ {#1}\vphantom{\big|} \;\middle|\; #2 \right\}} \begin{document} \begin{gather*} \set{x\in A}{x^{-1}=x^2} \\ \set{x\in A}{\frac{1}{x}=x^2} \end{gather*} \end{document} ``` The `\vphantom{\big|}` is meant to use at least `\big` size. However, you should take into account that `\left` and `\right` will in most cases choose too big a size. The documentation of `mathtools` shows alternative approaches.
2
https://tex.stackexchange.com/users/4427
694353
322,140
https://tex.stackexchange.com/questions/694279
0
This works as expected: ``` \documentclass{minimal} \ExplSyntaxOn % USE X instead of \space for a space. \catcode`\X=\active \defX{\space } % \mycheck:nnn <regex> <string to test against regex> <end of error message> \cs_set:Npn \mycheck:nnn #1#2#3 { \regex_match:nnTF {#1} {#2} { \typeout{Match.} } { \typeout{NoXmatch.} \typeout{ItXshouldXbeX#3.} } } \mycheck:nnn {\A(true|false)\Z} {true} {`true'XorX`false'} \mycheck:nnn {\A(true|false)\Z} {false} {`true'XorX`false'} \mycheck:nnn {\A(true|false)\Z} {neither} {`true'XorX`false'} \ExplSyntaxOff \begin{document} \end{document} ``` I would like to use something where I can call it with, for example, ``` \def\cs{true} % or false or something else \newcheck {\A(true|false)\Z} {cs} {`true'XorX`false'} ``` and the value of \cs is checked. I want to use cs name and the value of \cs in an improved error message. In practice the regex, cs, and the end of the error message will all change. Sometimes the regex will not check for one of several values.
https://tex.stackexchange.com/users/32050
having trouble calling \regex_match
false
Here is what I came up with to print control sequence name and control sequence value in the error message: ``` \documentclass{minimal} \ExplSyntaxOn % \mycheck:nnn <regex> <string to test against regex> <end of error message> \cs_set:Npn \mycheck:nnn #1#2#3 { \regex_match:nnTF {#1} {#2} { \typeout{Match.} } { \typeout{No~match.} % \remember contains the `~' \typeout{\c_backslash_str\remember is~`#2'.} \typeout{It~should~be~#3.} \stop } } \cs_generate_variant:Nn \mycheck:nnn { nv } \cs_set:Npn \Check:nnn #1#2#3 { \def\remember{#2~} \mycheck:nvn {\A(true|false)\Z} {#2} {`true'~or~`false'} } \def\cs{true} \Check:nnn {\A(true|false)\Z} {cs} {`true'~or~`false'} \def\cs{false} \Check:nnn {\A(true|false)\Z} {cs} {`true'~or~`false'} \def\cs{neither} \Check:nnn {\A(true|false)\Z} {cs} {`true'~or~`false'} \ExplSyntaxOff \begin{document} \end{document} ```
0
https://tex.stackexchange.com/users/32050
694356
322,142
https://tex.stackexchange.com/questions/694352
2
I have an Asymptote script which computes some values of a pair `K`. The values are increasing and when the pair below is attained I get a "cygwin exception". ``` K= (-1.53675691024507e+74,-4.05209495030412e+74) pair G = K / ((1.0, 0.0) - K - K*K); ^ colorMap4.asy: 107.5: runtime: 0 [asy] asy 713 cygwin_exception::open_stackdumpfile: Dumping stack trace to asy.exe.stackdump ``` I don't know what to do with this message. I tried to reinstall Asymptote but I don't have admin rights and there was an error due to forbidden symlinks on my laptop. Where is this stackdump file? Is it useful ? A number like 4e+74 is not gigantic so why does it crash? I've just tried to replace the expression of `G` by dividing the numerator and the denominator by `K`, to avoid the product `K*K`. Now the crash has gone but there's another one: ``` K= (-183907760887.815,-118807190831.258) _shipout(prefix,f,currentpatterns,format,wait,view,t); ^ C:/PortableApps/Asymptote/plain_shipout.asy: 116.11: Trying to use uninitialized value. ```
https://tex.stackexchange.com/users/18595
Asymptote cygwin exception
false
The first problem was indeed a float overflow. By getting rid of `K*K`, it worked. For the second problem, I had to modify `plain_shipout.asy`: ``` string prefix="ZOZO"; // this is my modification _shipout(prefix,f,currentpatterns,format,wait,view,t); ``` Then the program generates `ZOZO.eps`. Maybe there's another way to give the output name.
1
https://tex.stackexchange.com/users/18595
694359
322,143
https://tex.stackexchange.com/questions/694333
0
I have a command for setbuilder notation, `\newcommand{\set}[2]{\left\{ #1 \ \big| \ #2 \right\}}` Pretty simple stuff. I have issues, however, when I want larger characters in the set, for example summations, fractions, and whatnot as the vertical bar doesn't scale. Is there a way its height can be tied to the outside brackets?
https://tex.stackexchange.com/users/295611
Locking size of character to that of another character?
false
The TeX primitive `\middle` is here just for these cases. It was introduced in eTeX extension of TeX (sometime in the nineties). Its argument is an extensible parenthesis/fence like arguments of `\left` and `\right` primitives. It can be used only somewhere inside the group given by `\left...\right` and it gets the same size. Your macro can be defined as ``` \def\set#1#2{\left\{ #1 \vbox to.85em{} \;\middle|\; #2 \right\}} ``` the `\vbox to.85em{}` is a strut which is equal to `\big` size.
2
https://tex.stackexchange.com/users/51799
694360
322,144
https://tex.stackexchange.com/questions/694358
0
I am currently writing a thesis using the "report" document class, but I need to be able to reproduce the effect that `\maketitle` has in the "article" class. This is because I submitted a title page to my institution that needs to be exactly the same in the final thesis, but the submitted title page used the "article" document class. Is there any way to do this?
https://tex.stackexchange.com/users/303013
Title page for report to exactly emulate \maketitle of article class
false
If the title page needs to be exactly the same, one approach might be to use pdfpages and `\includepdf` the title page that you already gave them.
1
https://tex.stackexchange.com/users/107497
694361
322,145
https://tex.stackexchange.com/questions/43334
13
This question is related to [Extract first & last characters of macro argument?](https://tex.stackexchange.com/questions/43200/extract-first-last-characters-of-macro-argument). It seems that if, besides getting first and last tokens, one wants to accumulate the rest of the tokens, the solution is nontrivial. My solution appears convoluted. I wonder if David Carlisle can instantly pull a neater one out of his pocket. Full expansion of tokens should be avoided because they may contain undefined controls. ``` \documentclass{article} \makeatletter \usepackage{catoptions} \def\fl#1{\fl@i#1\@nil\@nil\@nnil} \def\fl@i#1#2#3\@nnil{% \def\rest{}\def\last{}% \edef\first{\ifstrcmpTF{#1}\@nil{}{\unexpanded{#1}}}% \edef\reserved@b{\unexpanded{#3}}% \ifcsemptyTF\reserved@b{% \edef\last{\ifstrcmpTF{#2}\@nil{}{\unexpanded{#2}}}% }{% \ifcseqTF\reserved@b\@nnil{% \edef\last{\ifstrcmpTF{#2}\@nil{}{\unexpanded{#2}}}% }{% \edef\last{\unexpanded{#2}}% \fl@ii#3\@nnil }% }% \ifx\last\rest\def\rest{}\fi } \def\fl@ii#1#2#3\@nnil{% \ifstrcmpTF{#1}\@nil{}{% \ifstrcmpTF{#2}\@nil{% \edef\rest{\expandcsonce\last\expandcsonce\rest}% \edef\last{\unexpanded{#1}}% }{% \edef\rest{\expandcsonce\rest\unexpanded{#1}}% \fl@ii#2#3\@nnil }% }% } \def\x{\string\x} \def\y#1{\fl{#1}\immediate\write20{Given token [\iflacus#1\dolacus empty/null\else#1\fi] ^^J[\first][\last][\rest]} } \immediate\write20{[first][last][rest]} \y{} \y{\x} \y{1\x2} \y{123} \y{1234\x} \begin{document} x \end{document} ```
https://tex.stackexchange.com/users/994
Extract first, last and rest of tokens
false
Here's an approach using a token cycle. ``` \documentclass{article} \usepackage[T1]{fontenc} \usepackage{tokcycle} \def\x{\string\x} \newcounter{tokcount} \newcommand\testnext{\stepcounter{tokcount}\tcpeek\zzz} \def\z#1{\ifx\empty#1\empty[][][]\else \setcounter{tokcount}{0}\zz#1\endzz\fi} \def\zz#1#2\endzz{[#1]\tokcycle {\testnext\tctestifx{\empty\zzz}{[##1]}{\addcytoks{##1}}} {\testnext\tctestifx{\empty\zzz}{[##1]}{\addcytoks{##1}}} {\testnext\tctestifx{\empty\zzz}{[##1]}{\addcytoks{##1}}} {\testnext\tctestifx{\empty\zzz}{[##1]}{\addcytoks{##1}}} {#2}% \ifnum\thetokcount=0 []\fi \expandafter[\the\cytoks]% } \begin{document} [First][Last][Mid] \z{} \z{\x} \z{12} \z{1\x3} \z{123} \z{12 } \z{1 3} \z{1234\x} \z{1234{\x\x}} \z{1234{\x\x}6} Detokenized Mid: \detokenize\expandafter{\the\cytoks} \end{document} ```
0
https://tex.stackexchange.com/users/25858
694365
322,148
https://tex.stackexchange.com/questions/233086
7
I have several manuscripts each with their own bibliography (\*.bib file). I'm now trying to combine these manuscripts into one document having one single bib file. My problem is that I have duplicate entries in these bib files that I would like to remove. My OS is OS X Yosemite, so I have access to BibDesk if that's an option (I mention this because this came up in several Google searches prior to me asking this question). I've also tried to use `bibtool` to comment out duplicates. It works well, but only on entires that are *exact* duplicates. My problem is that for the same reference, I have different cite keys across my different bib files. **My question is**: is there any way to clean up the merged bib file and either assign two cite keys to one reference---or---automatically detect duplicates (with different cite keys)? Thanks.
https://tex.stackexchange.com/users/9916
Avoiding duplicate entries in bibliography having different cite keys
false
I just run into the same problem and created a [website](https://enric1994.github.io/duplicate-reference-finder/) (with the help of ChatGPT) where you can just paste all your bibtex code. It finds the duplicate references based on the title.
0
https://tex.stackexchange.com/users/198960
694371
322,150
https://tex.stackexchange.com/questions/603149
4
Does anyone know a way to set **custom hotkeys** for often used code on Overleaf, so I can make my typing more efficient? I know there are default hotkeys for things such as bolden text (`ctrl + b`), but I can't find any option for setting up custom ones on google.
https://tex.stackexchange.com/users/245438
Custom hotkeys on Overleaf
false
As Tom from Overleaf Support said in a comment under your question, there is no built-in way to do that currently in Overleaf. I also wanted that functionality badly, so I developed a user script for personal use to do just that. Since a few other people I know found it useful, I polished it a bit and published it as a chrome browser extension called Shortleaf. If you're interested you can install it from the [chrome web store](https://chrome.google.com/webstore/detail/shortleaf/hmkemgnhfglmggklpfodjgkabaicchjn) (also works on Edge), or check out the [github project](https://github.com/andre-al/shortleaf/). It's fully configurable, but here are some examples of the built-in defaults for symbols: And for commands ("things with arguments"): It's an essential part of my workflow now, so hope you find it useful too!
0
https://tex.stackexchange.com/users/303019
694372
322,151
https://tex.stackexchange.com/questions/694373
1
I have the following pie chart and I would like to decrease the width of the black border line. ``` \begin{figure}[htbp] \resizebox{0.4\textwidth}{!}{ \centering \begin{tikzpicture}[font=\tiny] \pie[radius=1.2,rotate=0,color={blue, red, yellow, green}] {40/foo0, 51/foo1, 6/foo2, 3/foo3} \end{tikzpicture} } \centering \caption{foo foo foo} \label{fig:foo} \end{figure} ``` I tried the following solution ``` \begin{figure}[htbp] \centering \resizebox{0.4\textwidth}{!}{ \begin{tikzpicture}[font=\tiny] \pie[ radius=1.2, rotate=0, color={blue, red, yellow, green}, style={border=1pt} ]{ 40/foo0, 51/foo1, 6/foo2, 3/foo3 } \end{tikzpicture} } \caption{foo foo foo} \label{fig:foo} \end{figure} ``` It does the needed job, but I get the following error *Package pgfkeys Error: I do not know the key '/tikz/border=1pt' and I am going to ignore it. Perhaps you misspelled it.* How do I resolve this error?
https://tex.stackexchange.com/users/294333
How to change the border width of a tikz pie chart?
false
One (not-so-scientific) way could be to scale the `tikzpicture` up to say 4 times including the text, and then use `\scalebox{0.25}` to scale it down again to the original size. ``` \documentclass[border=0.2cm]{standalone} \usepackage{pgf-pie} \newcommand{\piechart}{% \pie[ radius=1.2, rotate=0, color={blue, red, yellow, green}, % style={border=1pt} ]{ 40/foo0, 51/foo1, 6/foo2, 3/foo3 } } \begin{document} \begin{tikzpicture} \piechart \end{tikzpicture} \scalebox{0.25}{% \begin{tikzpicture}[scale=4, every node/.style={scale=4}] \piechart \end{tikzpicture} } \end{document} ``` which, apparently works --
0
https://tex.stackexchange.com/users/146828
694377
322,153
https://tex.stackexchange.com/questions/694374
0
I am trying to typeset a series of verses some which have long lines. I want the long lines to be indented when it overflows to the next line. The package `parselines` does serve the purpose nicely. Here is the sample document: ``` \documentclass{article} \usepackage[ a5paper, body={10cm,17cm}, centering ]{geometry} \usepackage{parselines} \setlength{\parindent}{0pt} \begin{document} % \begin{minipage}[t]{.65\textwidth} \vspace*{0pt} \begin{parse lines}[\parindent 0pt]{\raggedright\hangindent1em\hangafter1 #1\par} Lorem ipsum dolor sit amet, consetetur sadipscing elitr, sed diam nonumy eirmod tempor invidunt ut labore et dolore magna aliquyam erat, sed diam voluptua At vero eos et accusam et justo duo dolores et ea rebum. \end{parse lines} \end{minipage} \hfill \begin{minipage}[t]{.3\textwidth} \vspace*{0pt} invidunt ut labore et dolore magna aliquyam erat, sed diam voluptua At vero eos et accusam et justo duo dolores et ea rebum. % \end{minipage} % \end{document} ``` Since this has to be done many times, I thought of defining a macro for the same like: ``` \newcommand{\POEM}[2]{% \begin{minipage}[t]{.65\textwidth} \vspace*{0pt} \begin{parse lines}[\parindent 0pt]{\raggedright\hangindent1em\hangafter1 #1\par} #1 \end{parse lines} \end{minipage} \hfill \begin{minipage}[t]{.3\textwidth} \vspace*{0pt} #2 \end{minipage} % } ``` The problem is `#1` of `parse lines` conflicts with the parameter of my macro. Can I avoid this? If there are other methods/packages to achieve this, I would like some pointers.
https://tex.stackexchange.com/users/24304
newcommand that includes parse lines
false
There are two problems in your approach. Not only `#1` (which must be changed to `##1` inside another macro) but the `\obeylines` setting (which does the `parse lines` environment) must be done before the the data are read from the file, i.e. you cannot first read the data to the parameter and then use `\obeylines` (or `\begin{parse lines}`) in your macro. I suggest to implement the `\POEM` macro using TeX primitives and basic macros only. There are three ideas * the typesetting is done by `\hbox to\hsize{\vtop{...}\hfil\vtop{...}}`. These are primitive commands used instead `\begin{minipage}`, `\end{minipage}`. * indentation in the first column is done using negative `\parindent` and the `\leftskip` primitive register is set for compensation. * the first parameter is read after `\obeylines` is set. The parameter is in the format `{data}`, the first `{` is ignored by `\let\next=` and the last `}` works like `\endgroup`, it closes the currently open `\vtop`. Then the macro continues like `\POEMB` using `\aftergroup` primitive. ``` \def\POEM{\hbox to\hsize\bgroup \vtop\bgroup \hsize=.65\hsize \obeylines \raggedright \parindent=-1em \leftskip=1em \aftergroup\POEMB \let\next=% } \def\POEMB #1{\hfil \vtop\bgroup \hsize=.3\hsize \parindent=0pt \emergencystretch=1em #1\par \egroup\egroup } \POEM { Lorem ipsum dolor sit amet, consetetur sadipscing elitr, sed diam nonumy eirmod tempor invidunt ut labore et dolore magna aliquyam erat, sed diam voluptua At vero eos et accusam et justo duo dolores et ea rebum. }{ invidunt ut labore et dolore magna aliquyam erat, sed diam voluptua At vero eos et accusam et justo duo dolores et ea rebum. } ```
3
https://tex.stackexchange.com/users/51799
694378
322,154
https://tex.stackexchange.com/questions/119428
16
This is a follow-up question from [Use tikz external feature with beamer \only](https://tex.stackexchange.com/questions/78955/use-tikz-external-feature-with-beamer-only) . Andrew's answer there is excellent, and does the job (almost) perfectly. The rough edge I have found was when I tried to use `\tikzsetnextfilename` together with it. Why would I want to do that? Because in beamer, one might need to reorder one's slides, or to add an overlay, etc. In this case, most pictures will need to be regenerated, even if they weren't changed. What is the problem? The following M(n)WE shows the usual way of using `\tikzsetnextfilename`. ``` \documentclass{beamer} \usepackage{tikz} \usetikzlibrary{external} \makeatletter \tikzset{ beamer externalizing/.style={% execute at end picture={% \tikzifexternalizing{% \ifbeamer@anotherslide \pgfexternalstorecommand{\string\global\string\beamer@anotherslidetrue}% \fi }{}% }% }, external/optimize=false } \makeatother \tikzset{every picture/.style={beamer externalizing}} \tikzexternalize \begin{document} \begin{frame} \tikzsetnextfilename{figure} \only<1>{Image 1:} \only<2>{Image 2:} \begin{tikzpicture} \only<1>{\node {Overlay 1};} \only<2>{\node {Overlay 2};} \end{tikzpicture} \end{frame} \end{document} ``` This doesn't work. I'm not pro enough with latex, beamer and tikz mechanics, but I suspect that the problem is `tikz externalize` trying to generate the two pictures with the same file name. And indeed, the following code snippet does work. ``` \documentclass{beamer} \usepackage{tikz} \usetikzlibrary{external} \makeatletter \tikzset{ beamer externalizing/.style={% execute at end picture={% \tikzifexternalizing{% \ifbeamer@anotherslide \pgfexternalstorecommand{\string\global\string\beamer@anotherslidetrue}% \fi }{}% }% }, external/optimize=false } \makeatother \tikzset{every picture/.style={beamer externalizing}} \tikzexternalize \begin{document} \begin{frame} \only<1>{\tikzsetnextfilename{figure-1}} \only<2>{\tikzsetnextfilename{figure-2}} \only<1>{Image 1:} \only<2>{Image 2:} \begin{tikzpicture} \only<1>{\node {Overlay 1};} \only<2>{\node {Overlay 2};} \end{tikzpicture} \end{frame} \end{document} ``` Now it is still far from perfect. For example, it requires to know precisely how many overlays are needed for every picture. Hence the question : is there a better, more natural way of achieving this? If not, is there a way to make this method transparent to the user (so that he doesn't need to count the overlays himself)?
https://tex.stackexchange.com/users/9517
Beamer overlays, tikz external and custom file name
false
As an extension to Andrew’s excellent answer, it is possible to co-opt his solution to overcome a major bottleneck of the original approach for using beamer overlays with tikz external. The original solution requires globally disabling the tikz external optimizations (i.e. it sets `external/optimize=false` in the preamble). As a result, during the externalization of any tikzpicture, all other tikzpictures in the document are also typeset, even though they will be discarded in the end. This costs a lot of compilation time for documents with many tikzpictures. As an alternative, we can use the `\tikzsetnextfilename` macro to locally disable the tikz external optimization only for the to-be-externalized tikzpicture and all preceding ones with the same base name. This will result in a considerable speed-up for presentations with many tikzpictures. ``` \documentclass{beamer} \usepackage{tikz} \usetikzlibrary{external} \makeatletter \newcommand*{\overlaynumber}{\number\beamer@slideinframe} \tikzset{ beamer externalizing/.style={% execute at end picture={% \tikzifexternalizing{% \ifbeamer@anotherslide \pgfexternalstorecommand{\string\global\string\beamer@anotherslidetrue}% \fi }{}% }% }, every picture/.style={beamer externalizing} } % remove the `-\overlaynumber` suffix from the jobname % the name is stored in `\job@no@suffix` and the number in `\job@suffix@number` \def\strip@suffix#1{% \begingroup% \edef\@tempa{#1-}% \expandafter\endgroup% \expandafter\@strip@suffix\@tempa\relax% } \def\@strip@suffix#1-#2\relax{% \ifx\relax#2\relax% \edef\job@suffix@number{#1}% \def\next{\relax}% \else% \expandafter\ifx\expandafter\relax\job@no@suffix\relax% \def\job@no@suffix{#1}% \else% \edef\job@no@suffix{\job@no@suffix-#1}% \fi% \def\next{\@strip@suffix#2\relax}% \fi% \next% } % check if the next tikzpicture is the to-be-externalized one % or has the same basename and precedes it \def\if@is@current@pic#1{% \begingroup% \def\job@no@suffix{}% \strip@suffix\pgfactualjobname% \ifnum\job@suffix@number<\overlaynumber\relax% \def\job@no@suffix{}% \fi% \edef\current@pic@basename{#1}% \edef\current@pic@basename{% \expandafter\detokenize\expandafter{\current@pic@basename}% }% \ifx\job@no@suffix\current@pic@basename% \expandafter\endgroup\expandafter\@firstoftwo% \else% \expandafter\endgroup\expandafter\@secondoftwo% \fi% } % add a `-\overlaynumber` suffix to the next tikzpicture name % and disable tikz external optimization where needed \let\orig@tikzsetnextfilename=\tikzsetnextfilename \renewcommand\tikzsetnextfilename[1]{% \orig@tikzsetnextfilename{#1-\overlaynumber}% \tikzifexternalizing{ \if@is@current@pic{\tikzexternal@filenameprefix#1}{% \tikzset{external/optimize=false}% }{% \tikzset{external/optimize=true}% }% }{}% } \makeatother \tikzexternalize[only named=true] \begin{document} \begin{frame} \tikzsetnextfilename{figure} \only<1>{Image 1:} \only<2>{Image 2:} \begin{tikzpicture} \only<1>{\node {Overlay 1};} \only<2>{\node {Overlay 2};} \end{tikzpicture} \end{frame} \end{document} ```
1
https://tex.stackexchange.com/users/303024
694379
322,155
https://tex.stackexchange.com/questions/522643
2
I am trying to externalize `pgfplots`, `gnuplot` and `contour gnuplot` in `beamer`. Towards this end I am using the `visible on=<>` facility of `\usetikzlibrary{overlay-beamer-styles}` (cf. [this answer](https://tex.stackexchange.com/a/55849/119955) by user [Daniel](https://tex.stackexchange.com/users/3751/daniel)) as well as the [automatic numbering solution](https://tex.stackexchange.com/a/119440/119955) from user [Loop Space](https://tex.stackexchange.com/users/86/loop-space). I created a MWE consisting of 3 frames each hosting 3 slides that contain (A) vanilla pgfplots (B) gnuplots (C) contour gnuplots. **Expected Behaviour:** When externalizing, say the images of the second frame, images on other frames should be ignored. **Actual Behaviour:** The contour plots get computed in every single overlay. In total 81 sets of contour plots get computed. If one deletes the first 2 frames (which do not contain contour plots), then still 27 sets of contours get computed. How to fix this bug? ``` \documentclass{beamer} \usepackage{tikz, pgfplots} \pgfplotsset{compat=1.16} \usepgfplotslibrary{external} \usetikzlibrary{overlay-beamer-styles} % automatic beamer numbering %\url{https://tex.stackexchange.com/q/119428/86} \makeatletter \newcommand*{\overlaynumber}{\number\beamer@slideinframe} \tikzset{ beamer externalizing/.style={% execute at end picture={% \tikzifexternalizing{% \ifbeamer@anotherslide \pgfexternalstorecommand{\string\global\string\beamer@anotherslidetrue}% \fi }{}% }% }, external/optimize=false } \let\orig@tikzsetnextfilename=\tikzsetnextfilename \renewcommand\tikzsetnextfilename[1]{\orig@tikzsetnextfilename{#1-\overlaynumber}} \makeatother \tikzset{every picture/.style={beamer externalizing}} \tikzexternalize[only named=true] \begin{document} \begin{frame}{pgfplots} \tikzsetnextfilename{pgfplots} \begin{tikzpicture} \begin{axis} \addplot[visible on=<1-3>] {x}; \addplot[visible on=<2-3>] {exp(x)}; \addplot[visible on=<3-3>] {x*x}; \end{axis} \end{tikzpicture} \end{frame} \begin{frame}{gnuplot} \tikzsetnextfilename{gnuplot} \begin{tikzpicture} \begin{axis} \addplot[visible on=<1-3>] gnuplot{x}; \addplot[visible on=<2-3>] gnuplot{exp(x)}; \addplot[visible on=<3-3>] gnuplot{x*x}; \end{axis} \end{tikzpicture} \end{frame} \begin{frame}{gnuplot contour} \tikzsetnextfilename{contour} \begin{tikzpicture} \begin{axis}[view={0}{90}, domain=-2:2] \addplot3[visible on=<1-3>,contour gnuplot={draw color=red,number=20, labels=false}] {x}; \addplot3[visible on=<2-3>,contour gnuplot={draw color=blue,number=20, labels=false}] {y}; \addplot3[visible on=<3-3>,contour gnuplot={draw color=black,number=20, labels=false}] {x^2+y^2}; \end{axis} \end{tikzpicture} \end{frame} \end{document} ```
https://tex.stackexchange.com/users/119955
Externalizing pgfplots/gnuplots in Beamer -- contour gets computed for every slide
false
The easiest way to get rid of some of those extra contour plots is to use `\only` instead of the `visible on=<>` key. This way the plots are only made on the indicated slides (with `visible on=<>`, they are generated on all slides but are displayed only on selected slides). ``` \begin{axis}[view={0}{90}, domain=-2:2] \addplot3[visible on=<1-3>,contour gnuplot={draw color=red,number=20, labels=false}] {x}; \only<2-3>{\addplot3[contour gnuplot={draw color=blue,number=20, labels=false}] {y};} \only<3>{\addplot3[contour gnuplot={draw color=black,number=20, labels=false}] {x^2+y^2};} \end{axis} ``` Getting rid of the contour plots generated while externalizing the frames the plots on other frames is trickier, but doable. I have added a solution for this problem to a different question ([see here](https://tex.stackexchange.com/questions/119428/beamer-overlays-tikz-external-and-custom-file-name/694379#694379)). Below is a complete MWE that combines both solutions, produces only 10 `contourmpX.table` files and compiles much faster. ``` \documentclass{beamer} \usepackage{tikz, pgfplots} \pgfplotsset{compat=1.16} \usepgfplotslibrary{external} \usetikzlibrary{overlay-beamer-styles} % automatic beamer numbering %\url{https://tex.stackexchange.com/q/119428/86} \makeatletter \newcommand*{\overlaynumber}{\number\beamer@slideinframe} \tikzset{ beamer externalizing/.style={% execute at end picture={% \tikzifexternalizing{% \ifbeamer@anotherslide \pgfexternalstorecommand{\string\global\string\beamer@anotherslidetrue}% \fi }{}% }% }, every picture/.style={beamer externalizing} } % remove the `-\overlaynumber` suffix from the jobname % the name is stored in `\job@no@suffix` and the number in `\job@suffix@number` \def\strip@suffix#1{% \begingroup% \edef\@tempa{#1-}% \expandafter\endgroup% \expandafter\@strip@suffix\@tempa\relax% } \def\@strip@suffix#1-#2\relax{% \ifx\relax#2\relax% \edef\job@suffix@number{#1}% \def\next{\relax}% \else% \expandafter\ifx\expandafter\relax\job@no@suffix\relax% \def\job@no@suffix{#1}% \else% \edef\job@no@suffix{\job@no@suffix-#1}% \fi% \def\next{\@strip@suffix#2\relax}% \fi% \next% } % check if the next tikzpicture is the to-be-externalized one % or has the same basename and precedes it \def\if@is@current@pic#1{% \begingroup% \def\job@no@suffix{}% \strip@suffix\pgfactualjobname% \ifnum\job@suffix@number<\overlaynumber\relax% \def\job@no@suffix{}% \fi% \edef\current@pic@basename{#1}% \edef\current@pic@basename{% \expandafter\detokenize\expandafter{\current@pic@basename}% }% \ifx\job@no@suffix\current@pic@basename% \expandafter\endgroup\expandafter\@firstoftwo% \else% \expandafter\endgroup\expandafter\@secondoftwo% \fi% } % add a `-\overlaynumber` suffix to the next tikzpicture name % and disable tikz external optimization where needed \let\orig@tikzsetnextfilename=\tikzsetnextfilename \renewcommand\tikzsetnextfilename[1]{% \orig@tikzsetnextfilename{#1-\overlaynumber}% \tikzifexternalizing{ \if@is@current@pic{\tikzexternal@filenameprefix#1}{% \tikzset{external/optimize=false}% }{% \tikzset{external/optimize=true}% }% }{}% } \makeatother \tikzexternalize[only named=true] \begin{document} \begin{frame}{pgfplots} \tikzsetnextfilename{pgfplots} \begin{tikzpicture} \begin{axis} \addplot[visible on=<1-3>] {x}; \addplot[visible on=<2-3>] {exp(x)}; \addplot[visible on=<3-3>] {x*x}; \end{axis} \end{tikzpicture} \end{frame} \begin{frame}{gnuplot} \tikzsetnextfilename{gnuplot} \begin{tikzpicture} \begin{axis} \addplot[visible on=<1-3>] gnuplot{x}; \addplot[visible on=<2-3>] gnuplot{exp(x)}; \addplot[visible on=<3-3>] gnuplot{x*x}; \end{axis} \end{tikzpicture} \end{frame} \begin{frame}{gnuplot contour} \tikzsetnextfilename{contour} \begin{tikzpicture} \begin{axis}[view={0}{90}, domain=-2:2] \addplot3[visible on=<1-3>,contour gnuplot={draw color=red,number=20, labels=false}] {x}; \only<2-3>{\addplot3[contour gnuplot={draw color=blue,number=20, labels=false}] {y};} \only<3>{\addplot3[contour gnuplot={draw color=black,number=20, labels=false}] {x^2+y^2};} \end{axis} \end{tikzpicture} \end{frame} \end{document} ```
2
https://tex.stackexchange.com/users/303024
694381
322,156
https://tex.stackexchange.com/questions/694380
3
So I have produced code, which I think is kind of a hack, but it seems to work so far in my testing. I have setup a new `expl3` function that sets a dimen variable. If the input for the dimen expression does not contain a unit known to TeX, then the unit defaults to `pt`. I have seen non-`expl3` packages have interfaces where users can set a dimen variable and have the unit default to `pt`. For example, the `fontsize` package has a package option `fontsize=<fontsize>` where, if the unit for `<fontsize>` is not given, it is automatically set to `pt`. My question is: Is there a better and more formal way to set a default unit (`pt`, `bp` `pc`, etc.) to a unitless expression when writing classes or packages in `expl3` ? I provide my minimal working example below. ``` \documentclass{article} \ExplSyntaxOn \prg_generate_conditional_variant:Nnn \regex_match:Nn { NV } { TF } \tl_new:N \l__module_tmpa_tl \dim_new:N \l__module_tmpa_dim % Checks if the input contains any unit known to TeX. % This regex is based off the regex given in section 8.1.1 of interface3.pdf. \regex_const:Nn \c_module_contains_any_unit_regex { (?i)pt|in|[cem]m|ex|[bs]p|[dn]d|[pcn]c } \cs_new:Nn \__module_dim_set_with_default_unit:Nn { \tl_set:Nx \l__module_tmpa_tl { #2 } \regex_match:NVTF \c_module_contains_any_unit_regex \l__module_tmpa_tl { \dim_set:Nn #1 { \l__module_tmpa_tl } } { \dim_set:Nn #1 { \fp_eval:n { \l__module_tmpa_tl } pt } } } \ExplSyntaxOff \begin{document} \ExplSyntaxOn % only for testing purposes \__module_dim_set_with_default_unit:Nn \l__module_tmpa_dim { 10 } % without unit \dim_use:N \l__module_tmpa_dim % the unit defaults to pt \newline \__module_dim_set_with_default_unit:Nn \l__module_tmpa_dim { 10bp } % with unit \dim_use:N \l__module_tmpa_dim \ExplSyntaxOff \end{document} ```
https://tex.stackexchange.com/users/278534
Default units in expl3
false
I don't understand your code because the `expl3` is too complicated for me, but you can compare, how to solve your task using TeX primitive `\afterassignment`. It seems to be more simple and more straightforward. ``` \def\setdimen#1#2{% \afterassignment\setdimenA #1=#2pt\relax } \def\setdimenA#1\relax{} %% test: \newdimen\tmpdim \setdimen\tmpdim {20} \the\tmpdim % prints: 20.0pt \setdimen\tmpdim {4em} \the\tmpdim % prints: 40.0pt ```
9
https://tex.stackexchange.com/users/51799
694382
322,157
https://tex.stackexchange.com/questions/694342
3
I have some trouble getting the references to subsections working precisely the way I want it with the `cleveref` package. I want to reference subsections with the `cleveref` package in such a way that it capitalises whenever I reference to a specific subsection (i.e. using `\cref{}`) but not when just talking about some subsection (i.e. `\namecref{}`). As `cleveref` usually only links up to the corresponding section, I introduce the `\crefname{}` and `\crefformat{}` commands. Unfortunately the capitalisation with `\cref{}` does not work and I don't understand what I am doing wrong. Here's a minimal example: ``` \documentclass{article} \usepackage[utf8]{inputenc} \usepackage{hyperref,cleveref} \crefname{subsection}{subsection}{subsections} \crefformat{subsection}{#2Subsection~#1#3} \begin{document} \section{Introduction} \subsection{First Subsection}\label{firstSubsection} In this \namecref{firstSubsection} I would expect \cref{firstSubsection} to be capitalised. \end{document} ``` I do understand that I could force this by using `\Cref{}` instead, but this is not the intended use of `\Cref` as by the package documentation, thus I must be doing something else wrong.
https://tex.stackexchange.com/users/139996
Properly capitalising subsections with the cleveref package
false
I wouldn't hesitate to use `\Cref` for the use case at hand. I think it's perfectly ok to add the instructions ``` \crefname{subsection}{subsection}{subsections} \Crefname{subsection}{Subsection}{Subsections} ``` in the preamble and to use `\Cref` in the body of the document whenever I want to generate the label "Subsection" (or "Subsections", in case there's more than one subsection-type item in the list of arguments of `\Cref`) rather than "subsection" (or "subsections"). Now, it is the case that differences in the behavior of `\cref` and `\Cref` are not *necessarily* limited to the use of a lowercase or uppercase letter for the first letter in the name label. For instance, if English is the language option in force and if the first two equations of a document need to be cross-referenced, `\cref{eq:1}` and `\cref{eq:1,eq:2}` generate "eq. (1)" and "eqs. (1) and (2)", respectively, whereas `\Cref{eq:1}` and `\Cref{eq:1,eq:2}` will generate "Equation (1)" and "Equations (1) and (2)". Put differently, `\Cref` not only changes "e" to "E" but can also be instructed not to abbreviate the name label. Importantly, though, the only two item types that get abbreviated by `\cref` but not by `\Cref` when the English-language option is in effect are `equation` and `figure`. Since nobody would appear to be arguing that `subsection`-type items should be abbreviated by `\cref` (to "subsec." and "subsecs."??) in the first place, and since applying `\Cref` to `subsection`-type items in no way interferes with how `\cref` and `\Cref` operate on `equation` and `figure`-type items, there's no reason *not* to use `\Cref` in the way set forth at the start of this answer, is there? ``` \documentclass{article} \usepackage[colorlinks,allcolors=blue]{hyperref} \usepackage[nameinlink]{cleveref} % 'nameinlink' is optional \crefname{subsection}{subsection}{subsections} \Crefname{subsection}{Subsection}{Subsections} \begin{document} \refstepcounter{section} \label{firstSection} \refstepcounter{subsection} \label{firstSubsection} \namecref{firstSection}, \nameCref{firstSection} \namecref{firstSubsection}, \nameCref{firstSubsection} \cref{firstSection}, \Cref{firstSection} \cref{firstSubsection}, \Cref{firstSubsection} \end{document} ```
2
https://tex.stackexchange.com/users/5001
694387
322,159
https://tex.stackexchange.com/questions/694380
3
So I have produced code, which I think is kind of a hack, but it seems to work so far in my testing. I have setup a new `expl3` function that sets a dimen variable. If the input for the dimen expression does not contain a unit known to TeX, then the unit defaults to `pt`. I have seen non-`expl3` packages have interfaces where users can set a dimen variable and have the unit default to `pt`. For example, the `fontsize` package has a package option `fontsize=<fontsize>` where, if the unit for `<fontsize>` is not given, it is automatically set to `pt`. My question is: Is there a better and more formal way to set a default unit (`pt`, `bp` `pc`, etc.) to a unitless expression when writing classes or packages in `expl3` ? I provide my minimal working example below. ``` \documentclass{article} \ExplSyntaxOn \prg_generate_conditional_variant:Nnn \regex_match:Nn { NV } { TF } \tl_new:N \l__module_tmpa_tl \dim_new:N \l__module_tmpa_dim % Checks if the input contains any unit known to TeX. % This regex is based off the regex given in section 8.1.1 of interface3.pdf. \regex_const:Nn \c_module_contains_any_unit_regex { (?i)pt|in|[cem]m|ex|[bs]p|[dn]d|[pcn]c } \cs_new:Nn \__module_dim_set_with_default_unit:Nn { \tl_set:Nx \l__module_tmpa_tl { #2 } \regex_match:NVTF \c_module_contains_any_unit_regex \l__module_tmpa_tl { \dim_set:Nn #1 { \l__module_tmpa_tl } } { \dim_set:Nn #1 { \fp_eval:n { \l__module_tmpa_tl } pt } } } \ExplSyntaxOff \begin{document} \ExplSyntaxOn % only for testing purposes \__module_dim_set_with_default_unit:Nn \l__module_tmpa_dim { 10 } % without unit \dim_use:N \l__module_tmpa_dim % the unit defaults to pt \newline \__module_dim_set_with_default_unit:Nn \l__module_tmpa_dim { 10bp } % with unit \dim_use:N \l__module_tmpa_dim \ExplSyntaxOff \end{document} ```
https://tex.stackexchange.com/users/278534
Default units in expl3
true
Using a regex here is slow and will say a value such as `\textwidth` requires a unit. LaTeX already provides `\@defaultunitsset` using the method wipet showed ``` \@defaultunitsset dimen value default ``` where `default` can be a unit or length such as `\unitlength` used in picture mode. You could use that directly or more naturally in expl3 give it an L3 name which would allow variants to be generated, so ``` \ExplSyntaxOn \dim_new:N \l__module_tmpa_dim \cs_new_eq:Nc \__module_dim_set_with_default_unit:Nnn {@defaultunitsset} \cs_new_protected:Npn \__module_dim_set_with_default_unit:Nn #1#2 { \__module_dim_set_with_default_unit:Nnn #1 { #2 }{ pt } } \__module_dim_set_with_default_unit:Nn \l__module_tmpa_dim { 10 } \dim_show:N \l__module_tmpa_dim \__module_dim_set_with_default_unit:Nn \l__module_tmpa_dim { 10 bp} \dim_show:N \l__module_tmpa_dim \stop ``` producing ``` > \l__module_tmpa_dim=10.0pt. <recently read> } l.13 \dim_show:N \l__module_tmpa_dim ? > \l__module_tmpa_dim=10.03749pt. <recently read> } l.17 \dim_show:N \l__module_tmpa_dim ? ```
7
https://tex.stackexchange.com/users/1090
694390
322,160
https://tex.stackexchange.com/questions/694373
1
I have the following pie chart and I would like to decrease the width of the black border line. ``` \begin{figure}[htbp] \resizebox{0.4\textwidth}{!}{ \centering \begin{tikzpicture}[font=\tiny] \pie[radius=1.2,rotate=0,color={blue, red, yellow, green}] {40/foo0, 51/foo1, 6/foo2, 3/foo3} \end{tikzpicture} } \centering \caption{foo foo foo} \label{fig:foo} \end{figure} ``` I tried the following solution ``` \begin{figure}[htbp] \centering \resizebox{0.4\textwidth}{!}{ \begin{tikzpicture}[font=\tiny] \pie[ radius=1.2, rotate=0, color={blue, red, yellow, green}, style={border=1pt} ]{ 40/foo0, 51/foo1, 6/foo2, 3/foo3 } \end{tikzpicture} } \caption{foo foo foo} \label{fig:foo} \end{figure} ``` It does the needed job, but I get the following error *Package pgfkeys Error: I do not know the key '/tikz/border=1pt' and I am going to ignore it. Perhaps you misspelled it.* How do I resolve this error?
https://tex.stackexchange.com/users/294333
How to change the border width of a tikz pie chart?
false
In the `tikzlibrarypie.code` file, we have, line 238 `style={thick}`. *(default parameters)* By replacing in your code `style={border=1pt}` by `style =thin` or `style =very thin`, we may get what you want.
0
https://tex.stackexchange.com/users/263375
694406
322,164
https://tex.stackexchange.com/questions/694411
1
I'm trying to top-align figure panels using `minipage`. It works fine if both minipages have the same width, but if they don't, it doesn't work: the figure panel in the smaller minipage appears below its desired position. I don't understand what is the problem, since minipage width should not matter. Here is my code: ``` \begin{figure}[h] \begin{minipage}[t]{0.7\textwidth} \centerline { \includegraphics[width=\textwidth]{example-image-a.png}}\vfill \centerline { \includegraphics[width=\textwidth]{example-image-b.png}} \end{minipage}\hfill \begin{minipage}[t]{0.3\textwidth} \centerline { \includegraphics[width=\textwidth]{example-image-c.png}} \end{minipage} \end{figure} ``` Among other things, I tried ``` \begin{minipage}[t][][t]{0.3\textwidth} ``` as suggested [here](https://tex.stackexchange.com/a/132240/293937), as well as `\strut` and `\raisebox` as suggested [here](https://tex.stackexchange.com/a/378553/293937), with no luck so far.
https://tex.stackexchange.com/users/293937
vertically aligning panels of varying width with minipage
true
The problem is that the `\includegraphics` extend upward from the "top-aligned" baseline. Differing image sizes will leave them misaligned at top. Here, I use the `\belowbaseline` macro from `stackengine` package to achieve top alignment. ``` \documentclass{article} \usepackage{graphicx,stackengine} \begin{document} \begin{figure}[h] \belowbaseline[0pt]{\begin{minipage}[t]{0.7\textwidth} \centerline { \includegraphics[width=\textwidth]{example-image-a.png}}\vfill \centerline { \includegraphics[width=\textwidth]{example-image-b.png}} \end{minipage}}\hfill \belowbaseline[0pt]{\begin{minipage}[t]{0.3\textwidth} \centerline { \includegraphics[width=\textwidth]{example-image-c.png}} \end{minipage}} \end{figure} \end{document} ```
0
https://tex.stackexchange.com/users/25858
694412
322,167
https://tex.stackexchange.com/questions/283151
1
I have a matrix with labels on the left and top. Now I want to have a label on all sides of the matrix. How can I change my code? ``` \documentclass[10 pt, a4paper, leqno, oneside] {report} \usepackage{kbordermatrix} \begin{document} \renewcommand{\kbldelim}{(}% Left delimiter \renewcommand{\kbrdelim}{)}% Right delimiter \[ \tilde{\textbf{m}} = \kbordermatrix{ \mbox{} & c_1 & c_2 & c_3 & c_4 & c_5 \\ % & c_1 & c_2 & c_3 & c_4 & c_5 \\ r_1 & 1 & 1 & 1 & 1 & 1 \\ r_2 & 0 & 1 & 0 & 0 & 1 \\ r_3 & 0 & 0 & 1 & 0 & 1 \\ r_4 & 0 & 0 & 0 & 1 & 1 \\ r_5 & 0 & 0 & 0 & 0 & 1 } \] \end{document} ```
https://tex.stackexchange.com/users/91405
Labeling all sides of the matrix with kbordermatrix
false
You can do that with `nicematrix`. ``` \documentclass{article} \usepackage{nicematrix} \begin{document} \[ \tilde{\textbf{m}} = \begin{pNiceMatrix}[first-col,last-col=6,first-row,last-row=6] & c_1 & c_2 & c_3 & c_4 & c_5 \\ r_1 & 1 & 1 & 1 & 1 & 1 & r_5 \\ r_2 & 0 & 1 & 0 & 0 & 1 & r_4 \\ r_3 & 0 & 0 & 1 & 0 & 1 & r_3 \\ r_4 & 0 & 0 & 0 & 1 & 1 & r_2 \\ r_5 & 0 & 0 & 0 & 0 & 1 & r_1 \\ & c_5 & c_4 & c_3 & c_2 & c_1 \\ \end{pNiceMatrix} \] \end{document} ```
0
https://tex.stackexchange.com/users/163000
694415
322,168
https://tex.stackexchange.com/questions/694399
1
I have figures which I use in several places, some of them in dark context and some of them light (for example, a my obsidian vault is dark but a PDF of my thesis is light). As such, some of the figures are colored to work in a dark environment, and some in light. But sometimes I want to take a figure from a dark context and use it in a light context, or vice versa. So far I have created a copy of the figure for the light/dark mode by simply inverting the colors. I use color schemes in which this looks mostly fine. But manually inverting the colors and saving a copy is exhausting, and inefficient. I want to do this automatically, and possibly without saving a copy of the original figure. **Is there a way to invert the colors of a figure while compiling the output of a latex document?** Thanks a lot! Edit: I saw [this question](https://tex.stackexchange.com/questions/34110/is-it-possible-to-invert-substitute-the-colors-of-included-graphics), but the answers were basically "you can't". Since the answers are unsatisfactory and the question is VERY old, I thought it would be best to open a new one. But if this is not the custom here, please let me know and I'll ask there instead.
https://tex.stackexchange.com/users/139015
Invert image colors in latex
false
Here's a [sagetex](https://ctan.org/pkg/sagetex) solution along the lines of my answer to [Partial or entire Image Blurring in TikZ?](https://tex.stackexchange.com/questions/295100/partial-or-entire-image-blurring-in-tikz/390470#390470). Python takes care of the inverting the image during the compilation process. The picture is save and then `\sagestr{result1}` puts the text `\includegraphics[width=2in]{MonaInv.png}` into the LaTeX document. ``` \documentclass{article} \usepackage{sagetex} \usepackage{graphicx} \begin{document} Try this:\\ \includegraphics[width=2in]{Mona.png} \begin{sagesilent} from PIL import Image, ImageChops img = Image.open('Mona.png') Inv1 = ImageChops.invert(img) Inv1.save('MonaInv.png') result1 = r"\includegraphics[width=2in]{MonaInv.png}" \end{sagesilent} \sagestr{result1} \end{document} ``` The result in [Cocalc](https://cocalc.com/) is: PIL refers to [Python Pillow](https://pillow.readthedocs.io/en/stable/). The easiest way to experiment this way is with a free Cocalc account.
0
https://tex.stackexchange.com/users/6513
694417
322,170
https://tex.stackexchange.com/questions/389142
1
I want to write a matrix with equal column widths, plus have a vertical line down the matrix. By using the solutions given [here](https://tex.stackexchange.com/questions/39852/set-horizontal-width-of-matrix-in-amsmath) and [here](https://tex.stackexchange.com/questions/253739/vertical-and-horizontal-line-in-a-matrix), I have ``` \documentclass{article} \usepackage{geometry} \usepackage{amsmath} \usepackage{graphicx} % draw vertical line down matrix \makeatletter \renewcommand*\env@matrix[1][*\c@MaxMatrixCols c]{% \hskip -\arraycolsep \let\@ifnextchar\new@ifnextchar \array{#1}} \makeatother \begin{document} \resizebox{\linewidth}{!}{% \begin{equation} \begin{pmatrix}[cc|cc] C1 & Column2 & C3 & C4 \\ \hline C5 & C6 & C7 & Column8 \end{pmatrix}$% \end{equation} } \end{document} ``` The output matrix does not have equal column widths, and I get an error `Missing $ inserted`. How can I solve this problem?
https://tex.stackexchange.com/users/30232
Equal matrix column width and draw vertical line
false
The environment `{pNiceMatrix}` of `nicematrix` has a key `columns-width=auto` which specify that all the columns must have the same width. ``` \documentclass{article} \usepackage{nicematrix} \begin{document} \[\begin{pNiceArray}{cc|cc}[columns-width=auto,margin] C1 & Column2 & C3 & C4 \\ \hline C5 & C6 & C7 & Column8 \end{pNiceArray}\] \end{document} ```
0
https://tex.stackexchange.com/users/163000
694419
322,171
https://tex.stackexchange.com/questions/694400
1
I have been able to make the long table, but right now it goes outside my pages. I can only see 2 full columns, a partial half of the 3rd column, and the 4th one is completely bleeding out of the page. This is for a Paper and I can't share the full code because of that. But this is how I start it out, the table is all good, but I need help realigning it to fit my page. I would appreciate any advice! ``` \begin{longtable}{@{}|l|l|l|l|@{}} \toprule \textbf{X} & \textbf{X} & \textbf{X} & \textbf{Citation} \\* \midrule \endhead ```
https://tex.stackexchange.com/users/303048
Long Table Realignment Help
false
You haven't provided a reason for why the table's width exceeds `\textwidth`. I'll assume (hopefully correctly) that the reason is that you're not allowing automatic line-breaking in the columns. Moreover, I'll assume that allowing automatic line breaking will, in fact, remedy the situation as long as the column widths are set suitably. If these assumptions are correct, I would like to suggest is that you load the [xltabular](https://www.ctan.org/pkg/xltabular) package instead of the `longtable` package and replace ``` \begin{longtable}{@{}|l|l|l|l|@{}} ``` and ``` \end{longtable} ``` with ``` \begin{xltabular}{\textwidth}{ XXXX } ``` and ``` \end{xltabular} ``` respectively. Do note that `X` is *not* random filler stuff but a particular column type. The table's target or design width will be `\textwidth`. Is this a useful starting point for you? Please advise. --- The following code takes up the preceding ideas and provides a minimally compilable test document. ``` \documentclass{article} \usepackage{xltabular,ragged2e,booktabs} \newcolumntype{L}{>{\RaggedRight}X} % no full justification \begin{document} \begin{xltabular}{\textwidth}{@{} LLL l @{}} % <-- the crucial new line %% headers and footers \caption{A four-column table} \\ \toprule \textbf{X} & \textbf{Y} & \textbf{Z} & Ref. \\ \midrule \endfirsthead \multicolumn{4}{@{}l}{\tablename~\thetable, continued} \\[0.5ex] \toprule \textbf{X} & \textbf{Y} & \textbf{Z} & Ref. \\ \midrule \endhead \midrule \multicolumn{4}{r@{}}{\footnotesize (continued on following page)}\\ \endfoot \bottomrule \endlastfoot %% body of table a & b & c & d \\ e & f & g & h \\ i & j & k & l \\ \end{xltabular} \end{document} ```
0
https://tex.stackexchange.com/users/5001
694425
322,172
https://tex.stackexchange.com/questions/694368
0
I have an environment whose behavior depends some outer circumstances. In some cases, the environment should act as a table cell (and in other cases it should act as a paragraph). The appropriate `\begin{tabular}{...}` and `\end{tabular}` are printed by another macros, which also change their behavior appropriately. However, I can't define the appropriate environment. The MWE is: ``` \documentclass{article} \newenvironment{cell}{}{&} \begin{document} \begin{tabular}{lll} \begin{cell} abc \end{cell} \end{tabular} \end{document} ``` What am I doing wrong and how can I fix it?
https://tex.stackexchange.com/users/168600
Cannot create an environment for a table cell
false
Using this post: <https://tex.stackexchange.com/a/8084/168600> I've found a solution: ``` \documentclass{article} \usepackage{environ} \NewEnviron{cell}{% \expandafter\gdef\expandafter\gtemp\expandafter{% \BODY\expandafter& }% \aftergroup\gtemp } \begin{document} \begin{tabular}{l|l|l|l} \begin{cell} abc \end{cell} \begin{cell} def \end{cell} \end{tabular} \end{document} ```
0
https://tex.stackexchange.com/users/168600
694431
322,175
https://tex.stackexchange.com/questions/694358
0
I am currently writing a thesis using the "report" document class, but I need to be able to reproduce the effect that `\maketitle` has in the "article" class. This is because I submitted a title page to my institution that needs to be exactly the same in the final thesis, but the submitted title page used the "article" document class. Is there any way to do this?
https://tex.stackexchange.com/users/303013
Title page for report to exactly emulate \maketitle of article class
false
Article class has two `\maketitle` definitions. One creates a titlepage: ``` \newcommand\maketitle{\begin{titlepage}% \let\footnotesize\small \let\footnoterule\relax \let \footnote \thanks \null\vfil \vskip 60\p@ \begin{center}% {\LARGE \@title \par}% \vskip 3em% {\large \lineskip .75em% \begin{tabular}[t]{c}% \@author \end{tabular}\par}% \vskip 1.5em% {\large \@date \par}% % Set date in \large size. \end{center}\par \@thanks \vfil\null \end{titlepage}% \setcounter{footnote}{0}% \global\let\thanks\relax \global\let\maketitle\relax \global\let\@thanks\@empty \global\let\@author\@empty \global\let\@date\@empty \global\let\@title\@empty \global\let\title\relax \global\let\author\relax \global\let\date\relax \global\let\and\relax } ``` The other uses: ``` \newcommand\maketitle{\par \begingroup \renewcommand\thefootnote{\@fnsymbol\c@footnote}% \def\@makefnmark{\rlap{\@textsuperscript{\normalfont\@thefnmark}}}% \long\def\@makefntext##1{\parindent 1em\noindent \hb@xt@1.8em{% \hss\@textsuperscript{\normalfont\@thefnmark}}##1}% \if@twocolumn \ifnum \col@number=\@ne \@maketitle \else \twocolumn[\@maketitle]% \fi \else \newpage \global\@topnum\z@ % Prevents figures from going at top of page. \@maketitle \fi \thispagestyle{plain}\@thanks \endgroup \setcounter{footnote}{0}% \global\let\thanks\relax \global\let\maketitle\relax \global\let\@maketitle\relax \global\let\@thanks\@empty \global\let\@author\@empty \global\let\@date\@empty \global\let\@title\@empty \global\let\title\relax \global\let\author\relax \global\let\date\relax \global\let\and\relax } \def\@maketitle{% \newpage \null \vskip 2em% \begin{center}% \let \footnote \thanks {\LARGE \@title \par}% \vskip 1.5em% {\large \lineskip .5em% \begin{tabular}[t]{c}% \@author \end{tabular}\par}% \vskip 1em% {\large \@date}% \end{center}% \par \vskip 1.5em} \fi ```
0
https://tex.stackexchange.com/users/34505
694432
322,176
https://tex.stackexchange.com/questions/694294
3
Suppose that I have a dimension (call it `\shape`) whose value is to change locally several times throughout a piece of code. Suppose also that I have defined a command (called `\shifter` in the code that follows) that effects these changes. Then, is it possible to use, at the *beginning* of the code, the *final* value that `\shape` will take on? For example: ``` \documentclass{article} \usepackage{showframe} \usepackage{etoolbox} \setlength{\parindent}{0pt} % Cancel automatic indentation \newdimen\shape % Let there be the dimension \shape \setlength{\shape}{0pt} % Let \shape start at 0pt \newdimen\shapecompare % Let there be the dimension \shapecompare \newcommand{\shifter}[1]{% If \shape is less than the width of the input of \shifter, then make \shape equal to the width of the input. Otherwise, do nothing. \settowidth\shapecompare{#1}% \ifdimless{\shape}{\shapecompare}% {\setlength{\shape}{\shapecompare}}% {}% }% \begin{document} % At this moment (namely, the very beginning of the document), I would like to make use of whatever value \shape will end up at by the end of the code (namely, by the end, \shape = the width of the words ``Yes, sir, I will be there.''). \hspace{\shape}Hello \shifter{Hello} \hspace{\shape}Hello Hello \shifter{Yes, sir, I will be there.} \hspace{\shape}Hello Yes, sir, I will be there. \end{document} ``` Note: Stephen's answer (<https://tex.stackexchange.com/a/55432/277990>) to the question [How to retrieve a value which is set later on in the document?](https://tex.stackexchange.com/q/55365/277990) seems like it could be relevant to my situation, but when I tried to replace its use of `\setvalue` and `\getvalue` into the corresponding terms in my situation, I couldn't get it to work --- and on top of that I'm not sure how the stuff about `.aux` works.
https://tex.stackexchange.com/users/277990
Make code retrieve a dimensional value from later on in the code?
true
You need to write the setting in the `.aux` file, which is read in the next LaTeX run. Here you need `\global` settings, because the `.aux` file is read in a group. ``` \documentclass{article} \usepackage{ifthen} \usepackage{showframe} \newdimen\shape \global\shape=0pt \makeatletter \AtEndDocument{\immediate\write\@auxout{\global\shape=\the\shape}} \makeatother \newcommand{\shifter}[1]{% \settowidth{\dimen0}{#1}% \ifdim\shape<\dimen0 \global\shape=\dimen0 \fi } \setlength{\parindent}{0pt} \begin{document} \hspace{\shape}Hello \shifter{Tyrannosaurus} \hspace{\shape}Hello Tyrannosaurus % check the space \end{document} ``` ### First run ### Second run
4
https://tex.stackexchange.com/users/4427
694439
322,181
https://tex.stackexchange.com/questions/255635
4
I updated to `Tex Live 2015` on `Ubuntu 14.04` and trying to use `tlmgr --gui` to update packages but it not working. Installed the `perl-tk` through ``` sudo apt-get install perl-tk ``` and then used ``` tlmgr --gui ``` but it says ``` Segmentation fault (core dumped) ``` and also tried ``` tlmgr gui ``` but with the same message ``` Segmentation fault (core dumped) ``` Any idea to solve the issue. Thanks in advance for your help.
https://tex.stackexchange.com/users/4821
GUI version of the TeX Live manager for TL2015 does not work
false
I don't know that this is a definitive answer, as it may not be reproducible, but I had this exact same problem and accidentally resolved it. I tried removing and reinstalling `perl-tk`. That did nothing. I performed the test suggested in the question's comment thread: running `./install-tl --gui` worked fine, so the problem was indeed specific to `tlmgr --gui`. After that, I gave up on the problem; however, I was having issues with texworks. I ran the following commands to resolve my texworks issues: ``` sudo apt remove texworks sudo apt autoremove sudo apt remove tex-common sudo apt install tex-common sudo apt install texworks ``` `sudo apt remove tex-common` was because I was getting an error with `autoremove` after removing textworks, complaining about tex-common being missing from `usr/share/...` Note that I had previously done `sudo rm -rf /usr/share/texlive`,`sudo apt autoremove` in order to remove an old version of texlive that was interfering with my installation of "vanilla texlive" as per the [quick install instructions](https://tug.org/texlive/quickinstall.html). I believe the lines that fixed the problem are simply, ``` sudo apt remove tex-common sudo apt autoremove sudo apt install tex-common ``` After logging in and logging out, I can confirm that `tlmgr --gui` still works. I believe it has something to do with my reinstalling the `tex-common` package. Most likely, the old version was in the wrong place due to my previous apt install of texlive and the vanilla `tlmgr --gui` was somehow pointing to it so as to cause the segmentation fault. That is my best guess; but, in any case, the problem is resolved. If anyone else has this problem and manages to fix it reproducibly, I would be interested in further explanation.
0
https://tex.stackexchange.com/users/214708
694451
322,186
https://tex.stackexchange.com/questions/694460
3
I want to create a `\pagenumbering` style using devanagari alphabets only for `\frontmatter`. here is an example which I want to create: ``` i -> अ ii -> आ iii -> इ iv -> ई v -> उ vi -> ऊ ``` etc. P.S. This is a natural order for Hindi/Sanskrit alphabets using devanagari script. I created an sty file as: ``` % varnamala.sty \NeedsTeXFormat{LaTeX2e} \ProvidesPackage{varnamala} \RequirePackage{fancyhdr} % Define your custom symbols here \newcommand{\customPageSymbol}[1]{% \ifcase#1% 0 \or अ% 1 \or आ% 2 \or इ% 3 \or ई% 4 \or उ% 5 \or ऊ% 6 \or ऋ% 7 \or ॠ% 8 \or ऌ% 9 \or ॡ% 10 \or ए% 11 \or ऐ% 12 \or ओ% 13 \or औ% 14 \or क्% 15 \or ख्% 16 \else *\textbf{?}*% for numbers greater than 5 \fi% } ``` Here is the tex file: ``` % !TEX TS-program = xelatex % !TEX encoding = UTF-8 \documentclass{book} \usepackage{polyglossia} \usepackage{fontspec} \setmainfont[Script=Devanagari,Mapping=devanagarinumerals]{Sahadeva} % Replace with the actual font name \usepackage{varnamala} \setdefaultlanguage{hindi} %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% \begin{document} \frontmatter %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% \renewcommand{\thepage}{\customPageSymbol{\arabic{page}}} %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% \title{my title} \maketitle \chapter{प्रस्तावना} यह एक हिंदी किताब की प्रस्तावना है। \tableofcontents \mainmatter \chapter{1} \end{document} ``` I did some work and now it works fine but if I remove `\renewcommand{\thepage}{\customPageSymbol{\arabic{page}}}` line from main tex file I am not able to see the devanagari varnamala, instead I see roman numerals. The question completely changes now to "how to add this command directly to sty file so that it works?" P.S. Here I used a custom font [FROM THIS LINK](https://bombay.indology.info/software/fonts/devanagari/index.html)
https://tex.stackexchange.com/users/98446
How to create a \pagenumbering style?
true
`\thepage` is not always a number that can be used with `\ifcase`, it might be `i`, `ii`, or `1 of 32` depending on the current style. The latex convention is to define a `\@...` style taking a number, eg `\@roman`, and a document command taking a counter name, eg `\roman`. So: ``` \newcommand{\@devnum}[1]{% \ifcase#1% 0 \or अ% 1 \or आ% 2 \or इ% 3 \or ई% 4 \or उ% 5 \else *\textbf{?}*% for numbers greater than 5 \fi% } \newcommand{\devnum}[1]{\@devnum{\value{#1}} ``` Then you can use ``` \fancypagestyle{customstyle}{%% \fancyhf{}%% % Clear all headers and footers \renewcommand{\headrulewidth}{0pt}%% % Remove header line \fancyfoot[C]{\devnum{page} (\roman{page})} % Custom symbol in the center of the footer } ```
5
https://tex.stackexchange.com/users/1090
694461
322,189
https://tex.stackexchange.com/questions/267604
9
I'm doing my cv with the moderncv package and I'm using the classic style. I would like to add a date of birth line directly above the adress. Does anyone know how to do this? I've tried various solutions but they all seem to be broken.
https://tex.stackexchange.com/users/87764
Moderncv adding date of birth to personal information
false
It is possible to add your date of birth using ``` \born{Your Date birth} ```
1
https://tex.stackexchange.com/users/188683
694470
322,192
https://tex.stackexchange.com/questions/694463
-1
I have copied below code in my source file. Code does not appear in proper format(as it is). All text mix up (without any gap). No caption at the bottom. Getting error message "environment 1stlisting not defined". Plz guide me how i can correct it? I am adding list between two lines. ``` Used variable (n,m) are critical and are used by anothere functionas described in below listing. \begin{lstlisting}[language=Python, caption=Python example] import numpy as np def incmatrix(genl1,genl2): m = len(genl1) n = len(genl2) M = None #to become the incidence matrix VT = np.zeros((n*m,1), int) dummy variable compute the bitwise xor matrix M1 = bitxormatrix(genl1) M2 = np.triu(bitxormatrix(genl2),1) for i in range(m-1): for j in range(i+1, m): [r,c] = np.where(M2 == M1[i,j]) for k in range(len(r)): VT[(i)*n + r[k]] = 1; VT[(i)*n + c[k]] = 1; VT[(j)*n + r[k]] = 1; VT[(j)*n + c[k]] = 1; if M is None: M = np.copy(VT) else: M = np.concatenate((M, VT), 1) VT = np.zeros((n*m,1), int) return M \end{lstlisting} Now VT value is assigned to fictorial function for mathematical calculations. ``` Text appears as Used variable (n,m) are critical and are used by anothere functionas described in below listing. language=Python, caption=Python example] import numpy as np def incmatrix(genl1,genl2): m = len(genl1) n = len(genl2) M = None #to become the incidence matrix VT = np.zeros((n\*m,1), int) dummy variable compute the bitwise xor matrix M1 = bitxormatrix(genl1)M2 = np.triu(bitxormatrix(genl2),1) for i in range(m-1):for j in range(i+1, m): [r,c] = np.where(M2 == M1[i,j]) for k in range(len(r)): VT[(i)\*n + r[k]] = 1; VT[(i)\*n + c[k]] = 1; VT[(j)\*n + r[k]] = 1;VT[(j)*n + c[k]] = 1; if M is None: M = np.copy(VT) else: M = np.concatenate((M, VT), 1) VT = np.zeros((n*m,1), int) return M. Now VT value is assigned to fictorial function for mathematical calculations.
https://tex.stackexchange.com/users/303059
Listing error on overleaf
false
You have not provided a test document showing an error. The `lslisting` shown will not produce the error mentioned, and produces this output ``` \documentclass{article} \usepackage{listings} \begin{document} \begin{lstlisting}[language=Python, caption=Python example] import numpy as np def incmatrix(genl1,genl2): m = len(genl1) n = len(genl2) M = None #to become the incidence matrix VT = np.zeros((n*m,1), int) dummy variable compute the bitwise xor matrix M1 = bitxormatrix(genl1) M2 = np.triu(bitxormatrix(genl2),1) for i in range(m-1): for j in range(i+1, m): [r,c] = np.where(M2 == M1[i,j]) for k in range(len(r)): VT[(i)*n + r[k]] = 1; VT[(i)*n + c[k]] = 1; VT[(j)*n + r[k]] = 1; VT[(j)*n + c[k]] = 1; if M is None: M = np.copy(VT) else: M = np.concatenate((M, VT), 1) VT = np.zeros((n*m,1), int) return M \end{lstlisting} \end{document} ```
1
https://tex.stackexchange.com/users/1090
694477
322,195
https://tex.stackexchange.com/questions/694464
0
Is it possible to have two table of contents in beamer which contain the contents of two different sections, e.g. the main part and the appendix part. One table of content only includes sections from the main part, and the latter one which is shown after the main part only shows the appendix sections?
https://tex.stackexchange.com/users/35996
Two tables of contents in a beamer presentation
false
The `\appendix` macro will automatically do this for you: ``` \documentclass{beamer} \begin{document} \begin{frame} \tableofcontents \end{frame} \section{main section} \begin{frame} \end{frame} \appendix \begin{frame} \tableofcontents \end{frame} \section{appendix section} \begin{frame} \end{frame} \end{document} ```
0
https://tex.stackexchange.com/users/36296
694480
322,197
https://tex.stackexchange.com/questions/694484
7
I want to have several short definitions on the same line as the definition number. With that purpose in mind, how may one center A is B in the last definition? The MWE is: ``` \documentclass{article} \newtheorem{Definiton}{Definiton} \begin{document} \begin{Definiton} A is B \end{Definiton} \begin{Definiton} \begin{center} A is B \end{center} \end{Definiton} \begin{Definiton} \begin{center} \hfill A is B \end{center} \end{Definiton} \begin{Definiton} \begin{center} \hfill A is B ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ \end{center} \end{Definiton} \end{document} ```
https://tex.stackexchange.com/users/24406
How to center in the definition context?
true
The answer depends importantly on what the centering operation is supposed to span. Do you want to center "A is B" on the *remainder part* of the line (i.e., after subtracting the space taken up by the string "**Definition n.**") or on the *entire* line? Solutions for both cases are given below. Note that the code uses `\hspace*{\fill}` instead of `\hfill`. ``` \documentclass{article} \usepackage{amsthm,showframe} \newtheorem{Definition}{Definition} \begin{document} \begin{center} $|$ \end{center} \begin{Definition} \hspace*{\fill} A is B \hspace*{\fill} \end{Definition} \begin{Definition} \hspace*{\fill} A is B \hspace*{\fill}\hphantom{\textup{\textbf{Definition \theDefinition.}}} \end{Definition} \begin{center} $|$ \end{center} \end{document} ```
7
https://tex.stackexchange.com/users/5001
694486
322,199
https://tex.stackexchange.com/questions/694483
-1
I am working with `Texifier`. I am getting this error: root.tex LaTeX Error: File `boiboites.sty' not found. This is because I was trying to use this package: `\usepackage{boiboites}` My entire code: ``` \documentclass{article} \usepackage[T1]{fontenc} \usepackage[utf8]{inputenc} \usepackage{amsmath} \usepackage{boiboites} \newboxedtheorem[boxcolor=orange, background=blue!5, titlebackground=blue!20, titleboxcolor = black]{theo}{Théorème}{test} \begin{document} \begin{theo}[Loi des grands nombres] Soit $(X_n)_{n\in \mathbb{N}}$ une suite de variables aléatoires réelles indépendantes identiquement distribuées telles que $X_1 \in L^1$. Alors : $$\frac{1}{n} \sum_{i=1}^n X_i \overset{\textnormal{p.s.}}{\longrightarrow} \mathbb{E} (X_1) .$$ \end{theo} \end{document} ```
https://tex.stackexchange.com/users/nan
File `boiboites.sty' not found
false
The package has never been part of supported distributions. If you *really* need it the internet archive has snapshots,eg <https://web.archive.org/web/20171225020925/http://alexisfles.ch/files/latex/boiboites/boiboites.sty>
3
https://tex.stackexchange.com/users/1090
694487
322,200
https://tex.stackexchange.com/questions/694481
0
I am writing some code that makes use of a dimension (termed `\shape` below) that gets adjusted several times over the course of the code. *The value `\shape` has by the time the code is finished* is what is used when `\shape` is called. (See my previous question [Make code retrieve a dimensional value from later on in the code?](https://tex.stackexchange.com/q/694294/277990) ) Is there a way to adjust the following code somewhat so that different parts of it are cordoned off from the rest, as it were, and within these parts, `\shape` gets adjusted locally, as opposed to globally, and the value `\shape` has when called within such a part is the value it has by the end of that part of the code (as opposed to *by the end of the (entire) code*)? ``` \documentclass{article} \usepackage{tabularx} \usepackage{showframe} \setlength{\parindent}{0pt} % The following ~dozen lines are taken from egreg's answer (https://tex.stackexchange.com/a/694439/277990) to a previous question of mine: \newdimen\shape \global\shape=0pt \makeatletter \AtEndDocument{\write\@auxout{\global\shape=\the\shape}} \makeatother \newcommand{\shifter}[1]{% \settowidth{\dimen0}{#1}% \ifdim\shape<\dimen0 \global\shape=\dimen0 \fi } \newcommand{\proofpiece}[1]{% \begin{tabularx}{\linewidth}{r >$r<$ @{} >{\raggedright${}}X<{$} p{\shape}} #1 \end{tabularx} }% \newcommand{\rcc}[1]{% ''rightmost column contents'' #1 \shifter{#1} } \begin{document} The following has the output I desire, and the source code is satisfactory: \proofpiece{ 1. & \multicolumn{2}{l}{Math} & \rcc{Words}\\ 2. & m & = 9/3 & \rcc{Words}\\ 3. & & = 3 & \rcc{Words}\\ } \proofpiece{ 4. & 34x+2 & = 30/2 & \rcc{Wider words}\\ 5. & & = 15 & \rcc{Words}\\ } \vspace{2cm} However, suppose we write a second proof in the same document: \proofpiece{ 1. & \multicolumn{2}{l}{Math} & \rcc{Words}\\ 2. & m & = 2+2 & \rcc{Words}\\ 3. & & = 4 & \rcc{Words}\\ } \proofpiece{ 4. & 34x+2 & = 16/2 & \rcc{Words}\\ 5. & & = 8 & \rcc{Words}\\ } Unfortunately, the width of the rightmost column is equal to the width of the widest entry in the {\em previous} proof (namely, ``Wider words''). \end{document} ``` Note: I doubt that this is relevant, but David Carlisle's answer (<https://tex.stackexchange.com/a/693585/277990>) to one of my previous questions provides context as to why `\proofpiece` is the way it is.
https://tex.stackexchange.com/users/277990
Locally adjust a dimension written into aux
true
Use a different dimen register for each group, also beware underfull box warnings from missing `%` ``` \documentclass{article} \usepackage{tabularx} \usepackage{showframe} \setlength{\parindent}{0pt} % The following ~dozen lines are taken from egreg's answer (https://tex.stackexchange.com/a/694439/277990) to a previous question of mine: \makeatletter \newdimen\shapea \AtEndDocument{\immediate\write\@auxout{\global\shapea=\the\shapea}} \newdimen\shapeb \AtEndDocument{\immediate\write\@auxout{\global\shapeb=\the\shapeb}} \makeatother \newcommand{\shifter}[1]{% \settowidth{\dimen0}{#1}% \ifdim\shape<\dimen0 \global\shape=\dimen0 \fi } \newcommand{\proofpiece}[2]{% \let\shape#1% \begin{tabularx}{\linewidth}{r >$r<$ @{} >{\raggedright${}}X<{$} p{#1}} #2 \end{tabularx}% }% \newcommand{\rcc}[1]{% ''rightmost column contents'' #1 \shifter{#1} } \begin{document} The following has the output I desire, and the source code is satisfactory: \proofpiece\shapea{ 1. & \multicolumn{2}{l}{Math} & \rcc{Words}\\ 2. & m & = 9/3 & \rcc{Words}\\ 3. & & = 3 & \rcc{Words}\\ } \proofpiece\shapea{ 4. & 34x+2 & = 30/2 & \rcc{Wider words}\\ 5. & & = 15 & \rcc{Words}\\ } \vspace{2cm} However, suppose we write a second proof in the same document: \proofpiece\shapeb{ 1. & \multicolumn{2}{l}{Math} & \rcc{Words}\\ 2. & m & = 2+2 & \rcc{Words}\\ 3. & & = 4 & \rcc{Words}\\ } \proofpiece\shapeb{ 4. & 34x+2 & = 16/2 & \rcc{Words}\\ 5. & & = 8 & \rcc{Words}\\ } Unfortunately, the width of the rightmost column is equal to the width of the widest entry in the {\em previous} proof (namely, ``Wider words''). \end{document} ```
3
https://tex.stackexchange.com/users/1090
694491
322,202
https://tex.stackexchange.com/questions/694497
0
I cannot use fancyhdr because of a conflict. There is a similar question but the answer refers to the memoir class ([How to change page number location on ALL pages (including chapter pages) WITHOUT fancyhdr?](https://tex.stackexchange.com/questions/153829/how-to-change-page-number-location-on-all-pages-including-chapter-pages-withou)). I'm using the octavo class, so it does not apply. In my case, I do not need page numbers on ALL pages, only to change the position, the rest that octavo does is fine. Is there a tex way to do this? ``` \documentclass[12pt]{octavo} \usepackage[ paperwidth=160mm, paperheight=240mm, textheight=18cm, textwidth=11cm, inner=2cm] {geometry} \usepackage{lipsum} \begin{document} \lipsum[1-5] \end{document} ```
https://tex.stackexchange.com/users/254618
Change location of page numbers (bottom, outer) without fancyhdr
true
You can define your own page style. The code is mostly copied from the definition of page style `plain` (or `\ps@plain` to be more precise) from `source2e`, with slight modifications. ``` \documentclass[12pt]{octavo} \usepackage[ paperwidth=160mm, paperheight=240mm, textheight=18cm, textwidth=11cm, inner=2cm] {geometry} \usepackage{lipsum} \makeatletter \newcommand*\ps@mystyle{% \let\@mkboth\@gobbletwo \let\@oddhead\@empty \def\@oddfoot{% \reset@font \hfil \thepage } \let\@evenhead\@empty \def\@evenfoot{% \reset@font \thepage \hfil } } \makeatother \pagestyle{mystyle} \begin{document} \lipsum[1]\marginpar{Hello} \end{document} ``` Note that chapter (and maybe other objects as well) force plain style, so if you want this style in chapter pages, you can redefine the plain style instead of defining your own style: ``` \documentclass[12pt]{octavo} \usepackage[ paperwidth=160mm, paperheight=240mm, textheight=18cm, textwidth=11cm, inner=2cm] {geometry} \usepackage{lipsum} \makeatletter \renewcommand*\ps@plain{% \let\@mkboth\@gobbletwo \let\@oddhead\@empty \def\@oddfoot{% \reset@font \hfil \thepage } \let\@evenhead\@empty \def\@evenfoot{% \reset@font \thepage \hfil } } \makeatother \pagestyle{plain} \begin{document} \chapter{Chapter} \lipsum[1] \end{document} ``` or you can redefine `\chapter`...
1
https://tex.stackexchange.com/users/264024
694500
322,205
https://tex.stackexchange.com/questions/460930
0
I have written this in latex: ``` \begin {equation} \label{E:1} A={\frac{w_i}{w_j}} = {a_{ij}} ={\bbordermatrix{& C_1 & C_2 & C_\ldots & C_n \cr C_1 & (w_1/w_1)=1 & (w_1/w_2)=a_{12} & \ldots & (w_1/w_n)=a_{1n} \cr C_2 & (w_2/w_1)=1/a_{12} & (w_2/w_2)=1 & \ldots & (w_2/w_n)=a_{2n} \cr \vdots & \vdots & \vdots & \ddots & \vdots \cr C_n & (w_n/w_1)=1/a_{1n} & (w_n/w_2)=1/a_{2n} & \ldots & (w_n/w_n)=1 \cr}} \end {equation} ``` And I found this: > > Missing { inserted. > > > Check that your $'s match around math expressions. If they do, then you've probably used a symbol in normal text that needs to be in math mode. Symbols such as subscripts ( \_ ), integrals ( \int ), Greek letters ( \alpha, \beta, \delta ), and modifiers (\vec{x}, \tilde{x} ) must be written in math mode. See the full list here.If you intended to use mathematics mode, then use $ … $ for 'inline math mode', $$ … $$ for 'display math mode' or alternatively \begin{math} … \end{math}. > > > Learn more > > \mathinner > l.393 ...)=1/a\_{2n} & \ldots & (w\_n/w\_n)=1 \cr} > } > A left brace was mandatory here, so I've put one in. > You might want to delete and/or insert some corrections > so that I will find a matching right brace soon. > If you're confused by all this, try typing `I}' now. > > > ! Missing } inserted. > > } > l.393 ...)=1/a\_{2n} & \ldots & (w\_n/w\_n)=1 \cr} > } > I've put in what seems to be necessary to fix > the current column of the current alignment. > Try to go on, since this might almost work. > > > *I have tried to find this problem, but I couldn't find anything.* > > > Can someone help me? Thanks in advance.
https://tex.stackexchange.com/users/175112
Matrix in latex using border matrix
false
For information, here is a way to construct that matrix with `{pNiceMatrix}` of `nicematrix`. ``` \documentclass{article} \usepackage{nicematrix} \begin{document} \[ A = \frac{w_i}{w_j} = a_{ij} = \begin{pNiceMatrix}[first-col,first-row] & C_1 & C_2 & C_{\ldots} & C_n \\ C_1 & (w_1/w_1)=1 & (w_1/w_2)=a_{12} & \ldots & (w_1/w_n)=a_{1n} \\ \Vdots[shorten=6pt] & \vdots & \vdots & \ddots & \vdots \\ C_n & (w_n/w_1)=1/a_{1n} & (w_n/w_2)=1/a_{2n} & \ldots & (w_n/w_n)=1 \end{pNiceMatrix} \] \end{document} ```
0
https://tex.stackexchange.com/users/163000
694505
322,208
https://tex.stackexchange.com/questions/417834
3
I have a matrix with elements outside of this matrix: ``` \documentclass{article} \begin{document} \begin{equation} \bordermatrix{ & A_1 & A_2 & \cdots & A_n \cr C_1 & w_1 & w_2 & \ldots & w_1 \cr C_2 & w_2 & w_2 & \ldots & w_2 \cr \vdots & \vdots & \vdots & \ddots & \vdots \cr C_n & w_n & w_n & \ldots & w_n \cr } \end{equation} \end{document} ``` I would like to be able to add a second column, let say B\_1, B2,..., B\_n, to the left of the C column. How to do that ?
https://tex.stackexchange.com/users/155342
Two columns outside matrix
false
With `{NiceMatrix}` of `nicematrix`. ``` \documentclass{article} \usepackage{nicematrix} \begin{document} \begin{equation} \begin{NiceMatrix} & & A_1 & A_2 & \cdots & A_n \\ B_1 & C_1 & w_1 & w_2 & \ldots & w_1 \\ B_2 & C_2 & w_2 & w_2 & \ldots & w_2 \\ \vdots & \vdots & \vdots & \vdots & \ddots & \vdots \\ B_n & C_n & w_n & w_n & \ldots & w_n \CodeAfter \SubMatrix({2-3}{5-6}) \end{NiceMatrix} \end{equation} \end{document} ```
1
https://tex.stackexchange.com/users/163000
694507
322,210
https://tex.stackexchange.com/questions/694317
0
``` "errorSummary": { "error": [ "! Package svg Error: File `emptystar.svg' is missing.\n", "! Package svg Error: File `emptystar.svg' is missing.\n", "! Package svg Error: File `emptystar.svg' is missing.\n", "! Package svg Error: File `emptystar.svg' is missing.\n", "! Package svg Error: File `emptystar.svg' is missing.\n" ], Above is error ``` below is the function snippet ``` \usepackage{luacode} \usepackage{svg} \svgpath{{services/pdf_generator/libs/common-utils/}} \begin{luacode*} function generateRatingMarker(rating) local rating = tonumber(rating) -- Limit the rating to the range [0, 5] if rating > 5 then rating = 5 elseif rating < 0 then rating = 0 end -- Print color SVG images for i = 1, rating do tex.print("\\includesvg{emptystar}") -- Corrected path and removed extra slashes end -- Print empty SVG images for i = rating + 1, 5 do tex.print("\\includesvg{emptystar}") -- Corrected path and removed extra slashes end end ``` and believe me I have those emptystar.svg in the same folder I specified above
https://tex.stackexchange.com/users/302987
I'm getting this error of 'cannot find .svg file in the directory' while it was there in the directory
false
I have solved the issue, this issue is not related to not finding the file but was caused by not enabling `escape shell command`.
0
https://tex.stackexchange.com/users/302987
694510
322,212
https://tex.stackexchange.com/questions/694484
7
I want to have several short definitions on the same line as the definition number. With that purpose in mind, how may one center A is B in the last definition? The MWE is: ``` \documentclass{article} \newtheorem{Definiton}{Definiton} \begin{document} \begin{Definiton} A is B \end{Definiton} \begin{Definiton} \begin{center} A is B \end{center} \end{Definiton} \begin{Definiton} \begin{center} \hfill A is B \end{center} \end{Definiton} \begin{Definiton} \begin{center} \hfill A is B ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ \end{center} \end{Definiton} \end{document} ```
https://tex.stackexchange.com/users/24406
How to center in the definition context?
false
If you *really* want to hinder readability, you can either center in the available space (definition 2) or center absolutely (definition 3). The package `zref` and `\centerref` are only needed if you choose the third way. Also, `showframe` and `\markcenter` should be removed from the production version. Personally, I'd not try and push things far away from what they belong to, so I'd stick to the definition 1 style. ``` \documentclass{article} \usepackage[savepos]{zref} \usepackage{showframe}% just for the example \newtheorem{Definition}{Definition} \newcounter{centerdef} \newcommand{\centerdef}[1]{% \leavevmode \stepcounter{centerdef}% \zsaveposx{CENTERDEF\arabic{centerdef}}% \makebox[\dimeval{\columnwidth+1in-\zposx{CENTERDEF\arabic{centerdef}}sp}]{#1}% } % just for the example \newcommand{\markcenter}{\par{\centering\vrule height8pt\par}} \begin{document} \markcenter \begin{Definition} A is B \end{Definition} \begin{Definition} \hfill A is B\hspace*{\fill} \end{Definition} \begin{Definition} \centerdef{A is B} \end{Definition} \markcenter \end{document} ``` Note: the first LaTeX run after adding a `\centerdef` will produce an overfull box, but the next run will be OK.
5
https://tex.stackexchange.com/users/4427
694519
322,215
https://tex.stackexchange.com/questions/694524
0
The comma after the equation coincides with the number of the equation using the `eqnarray` . How can get rid of that? ``` \documentclass{article} \usepackage{amsmath} \begin{document} \begin{eqnarray} S_{EMS}=\frac{1}{16 \pi G_4} \int_{\mathcal{l}} \mathrm{d^4}x \ \sqrt{-r} \ \left[p - \frac{f(\xi)}{4}D_{MN}D^{MN} -\frac{1}{2}\partial_{M}\phi \partial^{l}\xi -V(\phi)\right], \end{eqnarray} \end{document} ```
https://tex.stackexchange.com/users/278014
Comma after an equation coincides with the equation number
false
`eqnarray` should be avoided in general, and if used should have two `&` on each row. But single line equations use `equation` ``` \documentclass{article} \usepackage{amsmath} \begin{document} \begin{equation} S_{\mathrm{EMS}}=\frac{1}{16 \pi G_4} \int_{\mathcal{L}} \mathrm{d^4}x \sqrt{-r} \left[p - \frac{f(\xi)}{4}D_{MN}D^{MN} -\frac{1}{2}\partial_{M}\phi \partial^{l}\xi -V(\phi)\right], \end{equation} \end{document} ```
3
https://tex.stackexchange.com/users/1090
694525
322,218
https://tex.stackexchange.com/questions/694530
0
I'm using the authorindex package to make a, you guessed it, index of authors. I'd like to make the fontsize smaller than the built-in command \aisize allows; it has normal (default) and small, but my publisher requires footnotesize. The package doc says "You can redefine it outside the theauthorindex environment to customize the font size". Has anyone done this? I have very little experience with redefining commands...
https://tex.stackexchange.com/users/302700
Redifine \aisize in authorindex package for footnotesize
false
the `small` option just does ``` \renewcommand\aisize{\small} ``` so you want ``` \renewcommand\aisize{\footnotesize} ``` after loading the package
1
https://tex.stackexchange.com/users/1090
694531
322,221
https://tex.stackexchange.com/questions/694545
3
I would like to match the pattern "start with `>>`" in a string and replace this with a command; and if multiple `>>` appear, it should match and replace multiple times. For example, given the string `aaa>>bbb>>ccc`, I would like to convert it into `aaa\somecommand{bbb}\somecommand{ccc}`. My idea is to use `\regex_replace_all:nnN`, but I cannot seem to find the correct regex pattern: for example, `>>(.*)` would only match once for this string. How to properly achieve this? Below is a MWE: ``` \documentclass{article} \begin{document} \NewDocumentCommand \somecommand { m } { \begin{center} #1 \end{center} } \ExplSyntaxOn \NewDocumentCommand \replace { m } { \tl_set:Nn \l_tmpa_tl { #1 } \regex_replace_all:nnN { >> ((?:.(?:?!>>))*.) } % needs to be changed { \c{somecommand}\{\1\} } \l_tmpa_tl \tl_use:N \l_tmpa_tl } \ExplSyntaxOff \replace{aaa>>bbb>>ccc} % expected: aaa\somecommand{bbb}\somecommand{ccc} \end{document} ```
https://tex.stackexchange.com/users/194994
expl3: Match a regex pattern multiple times
true
No need to use regexes, unless you need to preserve spaces around `>>`. ``` \documentclass{article} \begin{document} \ExplSyntaxOn \NewDocumentCommand \somecommand { m } { \jinwen_somecommand:n { #1 } } \NewDocumentCommand \replace { m } { \jinwen_replace:n { #1 } } \tl_new:N \l__jinwen_replace_head_tl \seq_new:N \l__jinwen_replace_tail_seq \cs_new:Nn \jinwen_somecommand:n { \,---\, #1 \,---\, } \cs_new_protected:Nn \jinwen_replace:n { \seq_set_split:Nnn \l__jinwen_replace_tail_seq { >> } { #1 } \seq_pop_left:NN \l__jinwen_replace_tail_seq \l__jinwen_replace_head_tl \tl_use:N \l__jinwen_replace_head_tl \seq_map_function:NN \l__jinwen_replace_tail_seq \jinwen_somecommand:n } \ExplSyntaxOff X\replace{}X \replace{aaa} \replace{aaa>>bbb} \replace{aaa>>bbb>>ccc} \end{document} ```
2
https://tex.stackexchange.com/users/4427
694546
322,226
https://tex.stackexchange.com/questions/694545
3
I would like to match the pattern "start with `>>`" in a string and replace this with a command; and if multiple `>>` appear, it should match and replace multiple times. For example, given the string `aaa>>bbb>>ccc`, I would like to convert it into `aaa\somecommand{bbb}\somecommand{ccc}`. My idea is to use `\regex_replace_all:nnN`, but I cannot seem to find the correct regex pattern: for example, `>>(.*)` would only match once for this string. How to properly achieve this? Below is a MWE: ``` \documentclass{article} \begin{document} \NewDocumentCommand \somecommand { m } { \begin{center} #1 \end{center} } \ExplSyntaxOn \NewDocumentCommand \replace { m } { \tl_set:Nn \l_tmpa_tl { #1 } \regex_replace_all:nnN { >> ((?:.(?:?!>>))*.) } % needs to be changed { \c{somecommand}\{\1\} } \l_tmpa_tl \tl_use:N \l_tmpa_tl } \ExplSyntaxOff \replace{aaa>>bbb>>ccc} % expected: aaa\somecommand{bbb}\somecommand{ccc} \end{document} ```
https://tex.stackexchange.com/users/194994
expl3: Match a regex pattern multiple times
false
Using just LaTeX2e, with the `listofitems` package. Note that the output of the command is stored in the token list `\mytoks`. ``` \documentclass{article} \usepackage{listofitems} \newtoks\mytoks \newcommand\addtotoks[2]{\global#1\expandafter{\the#1#2}} \newcommand\xaddtotoks[2]{\expandafter\addtotoks\expandafter #1\expandafter{#2}} \NewDocumentCommand \somecommand { m } { \begin{center} #1 \end{center} } \newcommand\replace[1]{% \setsepchar{>>}% \mytoks{}% \readlist\mylist{#1}% \foreachitem\z\in\mylist[]{% \ifnum\zcnt=1\xaddtotoks\mytoks{\z}\else \xaddtotoks\mytoks{\expandafter{\z}}\fi% \ifnum\zcnt<\mylistlen \addtotoks\mytoks{\somecommand}\fi% }% \the\mytoks } \begin{document} \replace{Initial Text>>Next Text Group>>The Final Text Group} \end{document} ```
1
https://tex.stackexchange.com/users/25858
694551
322,228
https://tex.stackexchange.com/questions/694534
1
I want to write an equation that behaves like inline-math w.r.t to horizontal alignment (i.e., the equations’ left edge is where the text before it ends; and the text after it is indented, so it starts behind the equation), but like display-math w.r.t. to vertical alignment (equation sits between two lines of text, math is `\displaystyle`) Vaguely what I want: ``` ... in the middle of some paragraph explaining whatever maths is happening so we get T = EQUATION such that this line continues where we left off... ``` (I don’t really know how to phrase this well, I hope it’s still understandable)
https://tex.stackexchange.com/users/221575
How to put display equations (with some space around them) inline?
true
This is a surprisingly complex problem, but doable, and the solution will give a nice tour through TeX’s display mechanism. This is a global overview of the solution: * First, the equation is pre-composed in a separate box, so that we can determine its dimensions. * Then, we try and ensure there is enough space for the equation, by manipulating the `\parfillskip`. * We place the box we pre-composed in an ordinary display, whose dimensions and positioning we impose manually with the `\displayindent` and `\displaywidth` parameters. * The length of the line before the equation can be found, once we are inside the display, in `\predisplaysize`. * Finally, we start the next line with the proper indentation. The interaction between the `\parfillskip` and the `\predisplaysize` is particularly subtle: * First, we set `\parfillskip` to the width of the equation, plus infinite stretch. This ensures we have enough room, but may result in overfull lines. * To this, we add a *shrink* equal to the width of the equation. This prevents overfull lines, but throws our ensurance of having enough room overboard again. * Now the wonderful thing is that TeX sets `\predisplaysize` to `\maxdimen` if and only if no infinite stretch is applied in the `\parfillskip`. So by this value can we now know if enough room has been made. The complete solution involves a few more edge cases, and careful treatment of the spacing around the equation: ``` \documentclass{article} \usepackage{polyglossia, unicode-math} \begin{document} % extra horizontal and vertical spacing \newskip \inlineEqHskip \inlineEqHskip = 4pt plus 2pt \newskip \inlineEqVskip \inlineEqVskip = 4pt plus 2pt % registers for storing intermediate results \newdimen \inlineEqWidth \newbox \inlineEqBox \newenvironment{inline equation} % % code for the \begin of the environment % {\ifvmode % special case: no paragraph text preceding the equation % compensate for the following \strut \kern -\ht\strutbox \kern -\dp\strutbox % start a paragraph \noindent \kern -\inlineEqHskip \fi % spacing before the equation \unskip \nobreak % prevent line breaks here \hskip\inlineEqHskip % horizontal space \strut % make previous spaces undiscardable % store the equation in a box \setbox\inlineEqBox = \hbox\bgroup $\displaystyle} % start of box contents % % code for the \end of the environment % {$\egroup % close the box we opened above \begingroup % assignments will be local by default % adjust vertical spacing (note that we are inside a group) \abovedisplayskip = \inlineEqVskip \belowdisplayskip = \inlineEqVskip % ensure there is enough space left for this equation: % the ‘minus’ part prevents overfull line messages \parfillskip = \wd\inlineEqBox plus 1 fill minus \wd\inlineEqBox $$ % open the real equation so we can change the display spacing variables \displaywidth = \wd\inlineEqBox % otherwise equal to the line width \ifdim \predisplaysize < \maxdimen % true if we have enough room \advance \predisplaysize by -2em % tex adds 2em by itself \advance \displayindent by \predisplaysize \else % edge case: the equation cannot fit on the line % this causes the \parfillskip to have no infinite stretch applied, % which makes TeX set \predisplaysize to \maxdimen \predisplaysize = 0pt \fi % calculate the offset of the next line \global \inlineEqWidth = \dimexpr \wd\inlineEqBox + \predisplaysize + \inlineEqHskip \relax % add the box we made and close the equation \box \inlineEqBox $$ % start the next line \strut \hskip \inlineEqWidth % horizontal space \allowbreak % the equation may end a line \endgroup \ignorespaces} % example paragraphs \hrule \noindent An example, \begin{inline equation} 1 + 1 + 1 = 3, \end{inline equation} of an inline display equation. \hrule \noindent At the end of a line, however, or with a very long equation, \begin{inline equation} 1 + 1 + 1 + 1 + 1 = 5, \end{inline equation} you may run into trouble and, though we can detect this situation, it will not look very nice. \hrule \begin{inline equation} 1 + 1 = 2 \end{inline equation} Starting a paragraph with an inline display is also detectable, but hard to find an appropriate solution for. \hrule \end{document} ```
3
https://tex.stackexchange.com/users/258593
694552
322,229
https://tex.stackexchange.com/questions/691449
0
I know the `restatable` environment from the packages `thm-restate` combined with `thmtools`, which allows to formulate theorems that can be restated later in the document. Now I am wondering, if there is a similar solution for equations like `equation`, `align`, etc.. I have already tried to just reuse that `restatable` environment for equations, but as expected I got an error. I have already found "solutions" that suggestion to copy the content and tag the reference number. However, this seems to be a stopgap.
https://tex.stackexchange.com/users/143676
restate an equation
false
The code below provides a command `\NewSavedEnvironment{<new-envname>}{<orig-envname>}` that defines an environment with syntax ``` \begin{<new-envname>}{customid} \end{<new-envname>} ``` whose contents can be restated with `\customid*`. ``` \documentclass{article} \usepackage{thmtools,amsmath} \newenvironment{donothing}{}{} \NewDocumentCommand{\NewSavedEnvironment}{m m}{ \NewDocumentEnvironment{#1}{m +b}{% \begin{restatable}{donothing}{##1} \begin{#2} ##2 \end{#2} \end{restatable}% }{\unskip\ignorespacesafterend} } \NewSavedEnvironment{savedequation}{equation} \NewSavedEnvironment{savedalign}{align} \begin{document} \begin{savedequation}{somename} \label{mylab} \sum_i a_i \end{savedequation} \begin{savedalign}{anothername} f: X &\to Y \\ x &\mapsto n\cdot x \end{savedalign} \somename* \anothername* \ref{mylab} \end{document} ``` If you want to use this for environments that don't use the `equation` counter, see [this answer](https://tex.stackexchange.com/a/694557/208544).
1
https://tex.stackexchange.com/users/208544
694556
322,231
https://tex.stackexchange.com/questions/690161
0
I'm trying to have two copies of the same algorithm, with the same number twice in a paper. The `restatable` environment is able to reproduce the algorithm but introduces a new algorithm number each time it is restated. For example: ``` \begin{restatable}{algorithm}{myAlgo} \vdots \end{restatable} % ... \myAlgo* % will introduce a new number, even when using * ``` **Question:** Is there a (simple) way to restate an algorithm while using the same number as before. Note: this question is extremely [similar to this one](https://tex.stackexchange.com/questions/318813/how-do-you-restate-an-algorithm). However, no answer was provided there and the question was (inexplicably, to me) closed.
https://tex.stackexchange.com/users/110312
How to restate an algorithm with the same algorithm number?
true
The counters that don't increment with `restatable` are stored in the comma-separated list `\thmt@innercounters`. By default it only contains `equation`. You can redefine this to use the algorithm counter, which at least for `algorithm2e` is `algocf`. ``` \documentclass{article} \usepackage{algorithm2e,thmtools} \makeatletter \def\thmt@innercounters{equation,algocf} \makeatother \begin{document} \begin{restatable}{algorithm}{myAlgo} \SetAlgoLined \KwData{this text} \KwResult{how to write algorithm with \LaTeX2e } initialization\; \While{not at end of this document}{ read current\; \eIf{understand}{ go to next section\; current section becomes this one\; }{ go back to the beginning of current section\; } } \caption{How to write algorithms} \end{restatable} \myAlgo* \end{document} ```
1
https://tex.stackexchange.com/users/208544
694557
322,232
https://tex.stackexchange.com/questions/694553
3
I have a very simple LaTeX problem which confuses me. I want to write a macro which creates a running total of given numbers. The answer by Ulrike Fischer [here](https://tex.stackexchange.com/questions/367892/is-there-any-way-i-can-define-a-variable-to-calculate-total-value-in-for-loop-in) is almost exactly what I want - simple and without extra packages. This is what I have: ``` \documentclass{article} \usepackage{tabularx} \newcommand\mySum{0} \newcommand\clearSum{\renewcommand\mySum{0}} \newcommand\addToSum[1]{\xdef\mySum{\fpeval{\mySum + #1}}} \newcommand{\newNumber}[1]{ \addToSum{#1} % Print number: #1 \\ } \newenvironment{RunningCount} { % Open environment: \tabularx{\linewidth}{c} } { % Close environment: \endtabularx } \begin{document} \begin{RunningCount} \newNumber{0.435} \newNumber{0.764} Total: \mySum \end{RunningCount} \end{document} ``` This produces twice the actual value. (It seems that sometimes it results in other multiples, but in this simple example above it is always twice). I can fix it by adding ``` \begin{document} \clearSum ... ``` to the above. But ideally I do not want to do this. This seems to be an issue with tabularx - if I remove the tabularx from the environment, it works fine. As commented, tabularx must be evaluating its contents multiple times (twice in this case), as it measures its contents and finds a good layout. I guess environments like align have a similar problem. Is there a way of getting round this multiple evaluation, apart from putting a \clearSum at the beginning of the document?
https://tex.stackexchange.com/users/274486
LaTeX macro for summing numbers
false
Your example had a `c` column in which case `tabularx` should not be used and the problem would go. With `X` you can reset your macro at the point tx resets latex counters. ``` \documentclass{article} \usepackage{tabularx,etoolbox} \makeatletter \patchcmd\TX@trial\TX@ckpt{\TX@ckpt\clearSum}{}{} \makeatother \newcommand\mySum{0} \newcommand\clearSum{\renewcommand\mySum{0}} \newcommand\addToSum[1]{\xdef\mySum{\fpeval{\mySum + #1}}} \newcommand{\newNumber}[1]{%%%% \addToSum{#1}%%%% % Print number: #1 \\%% } \newenvironment{RunningCount} {%%%%% % Open environment: \noindent\tabularx{\linewidth}{X} } { % Close environment: \endtabularx } \begin{document} \begin{RunningCount} \newNumber{0.435} \newNumber{0.764} Total: \mySum \end{RunningCount} \end{document} ```
2
https://tex.stackexchange.com/users/1090
694561
322,235
https://tex.stackexchange.com/questions/694553
3
I have a very simple LaTeX problem which confuses me. I want to write a macro which creates a running total of given numbers. The answer by Ulrike Fischer [here](https://tex.stackexchange.com/questions/367892/is-there-any-way-i-can-define-a-variable-to-calculate-total-value-in-for-loop-in) is almost exactly what I want - simple and without extra packages. This is what I have: ``` \documentclass{article} \usepackage{tabularx} \newcommand\mySum{0} \newcommand\clearSum{\renewcommand\mySum{0}} \newcommand\addToSum[1]{\xdef\mySum{\fpeval{\mySum + #1}}} \newcommand{\newNumber}[1]{ \addToSum{#1} % Print number: #1 \\ } \newenvironment{RunningCount} { % Open environment: \tabularx{\linewidth}{c} } { % Close environment: \endtabularx } \begin{document} \begin{RunningCount} \newNumber{0.435} \newNumber{0.764} Total: \mySum \end{RunningCount} \end{document} ``` This produces twice the actual value. (It seems that sometimes it results in other multiples, but in this simple example above it is always twice). I can fix it by adding ``` \begin{document} \clearSum ... ``` to the above. But ideally I do not want to do this. This seems to be an issue with tabularx - if I remove the tabularx from the environment, it works fine. As commented, tabularx must be evaluating its contents multiple times (twice in this case), as it measures its contents and finds a good layout. I guess environments like align have a similar problem. Is there a way of getting round this multiple evaluation, apart from putting a \clearSum at the beginning of the document?
https://tex.stackexchange.com/users/274486
LaTeX macro for summing numbers
false
I think David Carlisle's answer is probably better, but this is perhaps also useful for people in a similar predicament. After a little experimentation I got it working by putting a `\clearSum` in the environment opening, like this: ``` \documentclass{article} \usepackage{tabularx} \newcommand\mySum{0} \newcommand\clearSum{\renewcommand\mySum{0}} \newcommand\addToSum[1]{\xdef\mySum{\fpeval{\mySum + #1}}} \newcommand{\newNumber}[2]{ %% ORDER MATTERS: \addToSum{#2} % Print number: #1 & #2 \\ } \newenvironment{RunningCount} { % Open environment: \tabularx{\linewidth}{X | r} %% ORDER MATTERS: Desc & Count \\ \clearSum } { % Close environment: & Total: \mySum \endtabularx } \begin{document} \begin{RunningCount} \newNumber{First no:}{0.4} \newNumber{Second no:}{0.3} \newNumber{Third no:}{0.2} \newNumber{Fourth no:}{0.1} \end{RunningCount} \end{document} ``` The two places where I have marked `%% Order matters:` are the crucial point, and the fact that there are two of them makes this a slightly subtle point. In particular, the \clearSum must happen at the end of the environment opening and not like ``` \newenvironment{RunningCount} { % Open environment: \tabularx{\linewidth}{X | r} %% ORDER IS INCORRECT. Will behave strangely: \clearSum Desc & Count \\ } { ... ``` whilst replacing the relevant part of the above code with the following also produces the wrong answer: ``` \newcommand{\newNumber}[2]{ %% ORDER IS INCORRECT. Will behave strangely: % Print number: #1 & #2 \\ \addToSum{#2} } ``` I think both of these are to do with the way tabularx carries out multiple parses.
1
https://tex.stackexchange.com/users/274486
694564
322,236
https://tex.stackexchange.com/questions/694577
0
I am writing a thesis and I want to have two abstracts in different languages, English and Catalan. I started with a thesis template from my university (only in English) and then added the Babel package. I can successfully create two abstracts in different languages, but I'm not managing to change the name of the second Abstract to "Resum". Found online that Babel changes renewcommand so this is the solution for most people: ``` \addto{\captionscatalan}{\renewcommand{\abstractname}{Resum}} ``` This does not work for me, though, as the second one still appears as "Abstract". This is how I defined them: ``` \documentclass[a4paper, oneside]{discothesis} \usepackage[utf8]{inputenc} \usepackage[T1]{fontenc} \usepackage[english,catalan]{babel} \begin{document} %Abstract in English \begin{abstract} Abstract \end{abstract} %Abstract in Catalan \begin{abstract} \selectlanguage{catalan} \addto{\captionscatalan}{\renewcommand{\abstractname}{Resum}} Resum \end{abstract} \selectlanguage{english} \end{document} ``` Also tried defining my own environment and got exactly the same result: ``` \documentclass[a4paper, oneside]{discothesis} \usepackage[utf8]{inputenc} \usepackage[T1]{fontenc} \usepackage[english,catalan]{babel} \newenvironment{poliabstract}[1] {\renewcommand{\abstractname}{#1}\begin{abstract}} {\end{abstract}} \begin{document} \selectlanguage{english} \begin{poliabstract}{Abstract} Abstract in english \end{poliabstract} \selectlanguage{catalan} \begin{poliabstract}{Resum} Resum en català \end{poliabstract} \selectlanguage{english} \end{document} ``` The abstract is defined in this way in the cls file, haven't touched anything from the template file: ``` \newenvironment{abstract} {\chapter*{Abstract}} {\vfill %kai \noindent %kai \ifx \@keywords \@empty \relax \else {\bf Keywords:} \@keywords \\[6pt] %tobias \fi % \ifx \@categories \@empty \relax \else {\bf CR Categories:} \@categories %tobias \fi \addcontentsline{toc}{chapter}{Abstract} } ```
https://tex.stackexchange.com/users/303159
Can't change name of Abstract while using Babel
false
The definition of the `abstract` from your template is a little bit strange. But since you're more or less bound to the template, here's my simple and fast solution. Just redefine the environment, using `xparse` and its check mechanisms for optional arguments, the following way in the praeambel: ``` \makeatletter \RenewDocumentEnvironment{abstract}{o}{% \chapter*{\abstractname}% \IfValueT{#1}{\begin{otherlanguage}{#1}}% }{% \vfill %kai \noindent %kai \ifx \@keywords \@empty \relax \else {\bf Keywords:} \@keywords \\[6pt] %tobias \fi % \ifx \@categories \@empty \relax \else {\bf CR Categories:} \@categories %tobias \fi \addcontentsline{toc}{chapter}{\abstractname}% \IfValueT{#1}{\end{otherlanguage}}% } \makeatother ``` Now you can use it the following way: ``` \begin{abstract}[<language-option>] Text... \end{abstract} ``` If the optional argument is left away, you use the main language of your document. And you still can use the `\addto{\captionscatalan}{\renewcommand{\abstractname}{Resum}}` command, which is the recommended way with `babel`.
0
https://tex.stackexchange.com/users/297560
694583
322,245
https://tex.stackexchange.com/questions/694582
6
According to [latexref.xyz](https://latexref.xyz/_005cbaselineskip-_0026-_005cbaselinestretch.html): > > The `\baselineskip` is a rubber length > > > but also > > The `\baselineskip`’s value is reset every time a font change happens and so any direct change to `\baselineskip` would vanish the next time there was a font switch. > > > Now if I do `\showthe\baselineskip` in an empty `article` I see `12.0pt`, without `plus` and `minus` component. Would it make sense to use these components? In what situations, and how does one use these components if the value gets reset? If it does not make sense, why is it specifically a *rubber* length?
https://tex.stackexchange.com/users/23992
Would it make sense to use the "plus" and "minus" components of \baselineskip?
true
You almost never want variable baseline spacing in normal running text, but it can be useful in some display contexts, eg to adjust the line spacing to make a paragraph match the height of an adjacent image. ``` \documentclass{article} \usepackage{graphicx} \begin{document} \includegraphics[height=6cm, width=3cm]{example-image} \parbox[b][6cm][b]{3cm}{% A paragraph of text alongside an image. A paragraph of text alongside an image. A paragraph of text alongside an image. A paragraph of text alongside an image. A paragraph of text alongside an image. A paragraph of text alongside an image. } \bigskip \includegraphics[height=6cm, width=3cm]{example-image} \parbox[b][6cm][s]{3cm}{% \setlength\baselineskip{12pt plus 5pt minus 1pt} A paragraph of text alongside an image. A paragraph of text alongside an image. A paragraph of text alongside an image. A paragraph of text alongside an image. A paragraph of text alongside an image. A paragraph of text alongside an image. } \end{document} ```
11
https://tex.stackexchange.com/users/1090
694585
322,246
https://tex.stackexchange.com/questions/694590
0
I am generating a [PDF](https://siouxfallsaa.org/meeting-schedule.pdf) using a [.tex file](https://siouxfallsaa.org/meeting-schedule.tex) of similar name. Generating the PDF with pdflatex generates a number of `Underfull \hbox (badness 10000) in paragraph at lines 539--542`, with each set of line numbers referring to a minipage block. ``` \begin{minipage}{\columnwidth} \vskip 1ex\textbf{GenZoom Recovery\hfill\begin{minipage}{\dimexpr\linewidth-27ex\relax}\raggedleft \mbox{6:30PM}\end{minipage}} Zoom-Only\hfill WA\\{\6pt We meet daily for quick and short meetings to help each other through the work day.} \end{minipage} \begin{minipage}{\columnwidth} \vskip 1ex\textbf{Broken Meeting No.1\hfill\begin{minipage}{\dimexpr\linewidth-27ex\relax}\raggedleft \mbox{6:30PM}\end{minipage}} Guiding Schoolhouse\hfill WA\\ 567 Beacon Lane, Nurtureville, NV, 89007 \end{minipage} ``` I suspect this has to do with using a minipage inside of a minipage in order to get times/tags aligned to the right side. I read that trailing/unused `\\` can cause these warnings, but removing them didn't seem to produce any change. Full example, as requested: ``` \documentclass[11pt,twoside,letterpaper]{article} \usepackage[utf8]{inputenc} \usepackage[letterpaper,margin=0.25in]{geometry} \setlength{\parindent}{0em} \setlength{\parskip}{1ex} \usepackage{anyfontsize} \usepackage{mathptmx} \usepackage{multicol} \usepackage{microtype} \usepackage{graphicx} \usepackage{enumitem} \def\6pt{\fontsize{6}{7.2}\selectfont} \def\7pt{\fontsize{7}{8}\selectfont} \def\8pt{\fontsize{8.5}{10}\selectfont} \def\gutter{\hspace{0.02\textwidth}} \fontfamily{phv}\fontseries{mc}\selectfont \begin{document} {\textbf{Meetings}}\hrulefill\vskip 1ex \begin{multicols}{4} \vskip 2ex{\8pt\textbf{Sunday}}\hrulefill\vskip 1ex {\7pt \begin{minipage}{\columnwidth} \vskip 1ex\textbf{Serenity Path AA\hfill\begin{minipage}{\dimexpr\linewidth-27ex\relax}\raggedleft \mbox{6:30PM}\end{minipage}}\\ Harmony Church\hfill WA\\ 345 Ascend Street, Serenity Springs, NV, 89007\\ \end{minipage} \begin{minipage}{\columnwidth} \vskip 1ex\textbf{GenZoom Recovery\hfill\begin{minipage}{\dimexpr\linewidth-27ex\relax}\raggedleft \mbox{6:30PM}\end{minipage}}\\ Zoom-Only\hfill WA\\{\6pt We meet daily for quick and short meetings to help each other through the work day.} \end{minipage} } \end{multicols} \end{document} ```
https://tex.stackexchange.com/users/303161
Underfull \hbox (badness 10000) in paragraph within nested minipages
false
Welcome to TeX.SE! **Edit:** * Thank you for editing question. * Provided document example works doesn't generate any warnings, however throw two bad boxes. * Your code in is unnecessary complicated. * In my MWE below I remove all `\mbox`es and nested mini pages. * So, MWE which not produce your problem, can be: ``` \documentclass[11pt,twoside,letterpaper]{article} \usepackage[letterpaper,margin=0.25in]{geometry} \setlength{\parindent}{0em} % <---- \setlength{\parskip}{1ex} \usepackage{anyfontsize} \usepackage{mathptmx} \usepackage{multicol} \usepackage{microtype} \usepackage{graphicx} \usepackage{enumitem} \def\6pt{\fontsize{6}{7.2}\selectfont} \def\7pt{\fontsize{7}{8}\selectfont} \def\8pt{\fontsize{8.5}{10}\selectfont} \def\gutter{\hspace{0.02\textwidth}} \fontfamily{phv} \fontseries{mc}\selectfont \begin{document} Nunc sed pede. Praesent vitae lectus. Praesent neque justo, vehicula eget, interdum id, facilisis et, nibh. Phasellus at purus et libero lacinia dictum. Fusce aliquet. Nulla eu ante placerat leo semper dictum. Mauris metus. Curabitur lobortis. Curabitur sollicitudin hendrerit nunc. Donec ultrices lacus id ipsum. \textbf{Meetings}\hrulefill \vskip 1ex \begin{multicols}{4} \vskip 2ex \begin{minipage}[t]{\linewidth}\8pt \textbf{Sunday} \hrulefill \end{minipage} \begin{minipage}[t]{\linewidth}\7pt \textbf{Serenity Path AA} \hfill 6:30PM \\ Harmony Church \hfill WA \\ 345 Ascend Street, Serenity Springs, NV, 89007 \end{minipage} \begin{minipage}[t]{\linewidth} \textbf{GenZoom Recovery} \hfill 6:30PM \\ Zoom-Only \hfill WA \\ \6pt We meet daily for quick and short meetings to help each other through the work day. \end{minipage} \end{multicols} \end{document} ``` It not produce any warnings nor bad boxes BTW, are you sure that you need for columns? Are for your example are not sufficient just three?
0
https://tex.stackexchange.com/users/18189
694591
322,249
https://tex.stackexchange.com/questions/694567
1
> > *This is actually a follow-up / the real question of [this previous question](https://tex.stackexchange.com/q/694545/194994).* > > > I would like to convert text start with `>>` into centered text. > > The motivation for this seemingly silly purpose would be to add a new syntax to my package [`jwjournal`](https://www.ctan.org/pkg/jwjournal), so that lines like `>> (some remark)` would be converted into centered annotations. > > > Suppose that the string to be parsed has been stored into a token list `\l_jwjournal_tmp_tl`. The goal is to recognize `>>` and make the text after it centered. However, if multiple `>>` are found, the corresponding text should be centered separately. Thus for example, if the content of `\l_jwjournal_tmp_tl` is `aaa>>bbb>>ccc`, I would like `bbb` and `ccc` to be centered. [This previous question](https://tex.stackexchange.com/q/694545/194994) already addressed the main issue of parsing this token list properly. The problem for me now is that `\l_jwjournal_tmp_tl` shall be used later for further parsing and I would thus like the parsed result to directly overwrite `\l_jwjournal_tmp_tl` (just like `\regex_replace_all:nnN` which directly modifies the value of the given token list). How should I achieve this? Below is a MWE. ``` \documentclass{article} \begin{document} \ExplSyntaxOn \newenvironment{JWJournalCompactCenter} % https://tex.stackexchange.com/a/98893 {\parskip=0pt\par\nopagebreak\centering} {\par\noindent\ignorespacesafterend} \NewDocumentCommand \JWJournalCompactCenterText { m } { \begin{JWJournalCompactCenter} #1 \end{JWJournalCompactCenter} } \tl_new:N \l_jwjournal_tmp_tl \tl_set:Nn \l_jwjournal_tmp_tl { aaa >>bbb >>ccc } % \tl_new:N \l__mymodule_replace_head_tl % \seq_new:N \l__mymodule_replace_tail_seq % \cs_new_protected:Nn \mymodule_replace:n % { % \regex_split:nnN { >> } { #1 } \l__mymodule_replace_tail_seq % \seq_pop_left:NN \l__mymodule_replace_tail_seq \l__mymodule_replace_head_tl % \tl_use:N \l__mymodule_replace_head_tl % \seq_map_function:NN \l__mymodule_replace_tail_seq \JWJournalCompactCenterText % } \tl_use:N \l_jwjournal_tmp_tl \ExplSyntaxOff \end{document} ```
https://tex.stackexchange.com/users/194994
Convert lines start with >> into centered text
true
Instead of directly printing via `\tl_use:N` and `\tl_map_function:NN` you could simply put the result of those steps into your token list: ``` \documentclass{article} \begin{document} \ExplSyntaxOn \newenvironment{JWJournalCompactCenter} % https://tex.stackexchange.com/a/98893 {\parskip=0pt\par\nopagebreak\centering} {\par\noindent\ignorespacesafterend} \NewDocumentCommand \JWJournalCompactCenterText { m } { \begin{JWJournalCompactCenter} #1 \end{JWJournalCompactCenter} } \tl_new:N \l_jwjournal_tmp_tl \tl_set:Nn \l_jwjournal_tmp_tl { aaa >>bbb >>ccc } \seq_new:N \l__mymodule_replace_tail_seq \cs_new_protected:Nn \mymodule_replace:n { \regex_split:nnN { >> } { #1 } \l__mymodule_replace_tail_seq \seq_pop_left:NN \l__mymodule_replace_tail_seq \l_jwjournal_tmp_tl \seq_map_inline:Nn \l__mymodule_replace_tail_seq { \tl_put_right:Nn \l_jwjournal_tmp_tl { \JWJournalCompactCenterText {##1} } } } \tl_use:N \l_jwjournal_tmp_tl \ExplSyntaxOff \end{document} ```
1
https://tex.stackexchange.com/users/117050
694594
322,251
https://tex.stackexchange.com/questions/694576
0
How do I add a title image in the first page in a double-column `LaTeX` template? I tried the following, but the image crosses to the right column ``` \titlepic{\includegraphics[image.png}} ``` Basically, I need an environment like `figure*` but for a title image. Any suggestions?
https://tex.stackexchange.com/users/302874
Title image in LaTeX double column
false
Too long for a comment: The only code that you show is erroneous, but this causes a fatal error (= no output), not what you said (="the image crosses to the right column"). As pointed the comments, it is not possible guess the true problem without an example document, but the fact that you are using a template smells bad, because `\titlepic` used correctly should work just as you expected in the standard article class with the `twocolumn` option: ``` \documentclass[twocolumn]{article} \usepackage{titlepic} \usepackage{graphicx} \usepackage{lipsum} \title{Title} \author{You} \date{Some time ago} \titlepic{\includegraphics [width=4cm]{example-image}} \begin{document} \maketitle \lipsum \end{document} ``` If you template is not using a standard class, most probably is relevant this warning from the manual: > > **Note**: titlepic only works with the default document classes article, report and book. > > > Alternatively, with other classes as `memoir` you can try to do the same but without `titlepic`: ``` \documentclass{article} % also work with memoir \usepackage{graphicx} \usepackage{lipsum} \title{Title} \author{You} \date{Some time ago} \begin{document} \twocolumn[\maketitle {\centering\includegraphics[width=4cm]{example-image}\bigskip\par}] \lipsum \end{document} ```
1
https://tex.stackexchange.com/users/11604
694595
322,252
https://tex.stackexchange.com/questions/694590
0
I am generating a [PDF](https://siouxfallsaa.org/meeting-schedule.pdf) using a [.tex file](https://siouxfallsaa.org/meeting-schedule.tex) of similar name. Generating the PDF with pdflatex generates a number of `Underfull \hbox (badness 10000) in paragraph at lines 539--542`, with each set of line numbers referring to a minipage block. ``` \begin{minipage}{\columnwidth} \vskip 1ex\textbf{GenZoom Recovery\hfill\begin{minipage}{\dimexpr\linewidth-27ex\relax}\raggedleft \mbox{6:30PM}\end{minipage}} Zoom-Only\hfill WA\\{\6pt We meet daily for quick and short meetings to help each other through the work day.} \end{minipage} \begin{minipage}{\columnwidth} \vskip 1ex\textbf{Broken Meeting No.1\hfill\begin{minipage}{\dimexpr\linewidth-27ex\relax}\raggedleft \mbox{6:30PM}\end{minipage}} Guiding Schoolhouse\hfill WA\\ 567 Beacon Lane, Nurtureville, NV, 89007 \end{minipage} ``` I suspect this has to do with using a minipage inside of a minipage in order to get times/tags aligned to the right side. I read that trailing/unused `\\` can cause these warnings, but removing them didn't seem to produce any change. Full example, as requested: ``` \documentclass[11pt,twoside,letterpaper]{article} \usepackage[utf8]{inputenc} \usepackage[letterpaper,margin=0.25in]{geometry} \setlength{\parindent}{0em} \setlength{\parskip}{1ex} \usepackage{anyfontsize} \usepackage{mathptmx} \usepackage{multicol} \usepackage{microtype} \usepackage{graphicx} \usepackage{enumitem} \def\6pt{\fontsize{6}{7.2}\selectfont} \def\7pt{\fontsize{7}{8}\selectfont} \def\8pt{\fontsize{8.5}{10}\selectfont} \def\gutter{\hspace{0.02\textwidth}} \fontfamily{phv}\fontseries{mc}\selectfont \begin{document} {\textbf{Meetings}}\hrulefill\vskip 1ex \begin{multicols}{4} \vskip 2ex{\8pt\textbf{Sunday}}\hrulefill\vskip 1ex {\7pt \begin{minipage}{\columnwidth} \vskip 1ex\textbf{Serenity Path AA\hfill\begin{minipage}{\dimexpr\linewidth-27ex\relax}\raggedleft \mbox{6:30PM}\end{minipage}}\\ Harmony Church\hfill WA\\ 345 Ascend Street, Serenity Springs, NV, 89007\\ \end{minipage} \begin{minipage}{\columnwidth} \vskip 1ex\textbf{GenZoom Recovery\hfill\begin{minipage}{\dimexpr\linewidth-27ex\relax}\raggedleft \mbox{6:30PM}\end{minipage}}\\ Zoom-Only\hfill WA\\{\6pt We meet daily for quick and short meetings to help each other through the work day.} \end{minipage} } \end{multicols} \end{document} ```
https://tex.stackexchange.com/users/303161
Underfull \hbox (badness 10000) in paragraph within nested minipages
false
I can explain you why there are two Underfull \hbox warnings when your full example is processed. ``` Underfull \hbox (badness 10000) in paragraph at lines 27--30 Underfull \hbox (badness 10000) in paragraph at lines 26--37 ``` First one is due to your bad `\\` at the end of line 29. The `\\` is defined as `\hfil\break` in this context and this creates empty line in the paragraph which is underfull. More exact explanation needs to understand deeply the paragraph breaking algorithm in TeX, it is not only for short explanation. The main message is: the paragraph cannot end by `\\`. The second Underfull message is here because you have four columns declared by `\begin{multicols}` but only material for three columns is available. If you add a line before `\end{multicols}` with something, for example: ``` ... } something \end{multicols} ... ``` then the second Underfull message disappear. Note that if you define ``` \def\6pt{...} ``` then you don't define the control sequence `\6pt` but only the control sequence `\6` which is macro with the obligatory parameter `pt`. It works in your case but it seems that there is misunderstanding how TeX tokenizer works and how macros are defined.
4
https://tex.stackexchange.com/users/51799
694597
322,253
https://tex.stackexchange.com/questions/694567
1
> > *This is actually a follow-up / the real question of [this previous question](https://tex.stackexchange.com/q/694545/194994).* > > > I would like to convert text start with `>>` into centered text. > > The motivation for this seemingly silly purpose would be to add a new syntax to my package [`jwjournal`](https://www.ctan.org/pkg/jwjournal), so that lines like `>> (some remark)` would be converted into centered annotations. > > > Suppose that the string to be parsed has been stored into a token list `\l_jwjournal_tmp_tl`. The goal is to recognize `>>` and make the text after it centered. However, if multiple `>>` are found, the corresponding text should be centered separately. Thus for example, if the content of `\l_jwjournal_tmp_tl` is `aaa>>bbb>>ccc`, I would like `bbb` and `ccc` to be centered. [This previous question](https://tex.stackexchange.com/q/694545/194994) already addressed the main issue of parsing this token list properly. The problem for me now is that `\l_jwjournal_tmp_tl` shall be used later for further parsing and I would thus like the parsed result to directly overwrite `\l_jwjournal_tmp_tl` (just like `\regex_replace_all:nnN` which directly modifies the value of the given token list). How should I achieve this? Below is a MWE. ``` \documentclass{article} \begin{document} \ExplSyntaxOn \newenvironment{JWJournalCompactCenter} % https://tex.stackexchange.com/a/98893 {\parskip=0pt\par\nopagebreak\centering} {\par\noindent\ignorespacesafterend} \NewDocumentCommand \JWJournalCompactCenterText { m } { \begin{JWJournalCompactCenter} #1 \end{JWJournalCompactCenter} } \tl_new:N \l_jwjournal_tmp_tl \tl_set:Nn \l_jwjournal_tmp_tl { aaa >>bbb >>ccc } % \tl_new:N \l__mymodule_replace_head_tl % \seq_new:N \l__mymodule_replace_tail_seq % \cs_new_protected:Nn \mymodule_replace:n % { % \regex_split:nnN { >> } { #1 } \l__mymodule_replace_tail_seq % \seq_pop_left:NN \l__mymodule_replace_tail_seq \l__mymodule_replace_head_tl % \tl_use:N \l__mymodule_replace_head_tl % \seq_map_function:NN \l__mymodule_replace_tail_seq \JWJournalCompactCenterText % } \tl_use:N \l_jwjournal_tmp_tl \ExplSyntaxOff \end{document} ```
https://tex.stackexchange.com/users/194994
Convert lines start with >> into centered text
false
I thing that if you have an accumulated text in (say) `\tmpb` macro, then you can print it in the "centering" mode (without changing it) or you can use it in another way. You needn't change it. At TeX primitive level, the example can looks like this: ``` \def\printcenter#1>>#2\end{#1\par \ifx\relax#2\relax\else \afterfi{\docenter#2\end}\fi} \def\docenter#1>>#2{\centerline{#1}\ifx\end#2\else\afterfi{\docenter#2}\fi} \def\afterfi#1#2\fi{\fi#1} \def\tmpb{aaa>>bbb>>ccc} \expandafter\printcenter \tmpb>>\end % prints aaa at the left, bbb, ccc at the center \def\tmpb{xxx} \expandafter\printcenter \tmpb>>\end % prints xxx at the left ```
1
https://tex.stackexchange.com/users/51799
694598
322,254
https://tex.stackexchange.com/questions/694577
0
I am writing a thesis and I want to have two abstracts in different languages, English and Catalan. I started with a thesis template from my university (only in English) and then added the Babel package. I can successfully create two abstracts in different languages, but I'm not managing to change the name of the second Abstract to "Resum". Found online that Babel changes renewcommand so this is the solution for most people: ``` \addto{\captionscatalan}{\renewcommand{\abstractname}{Resum}} ``` This does not work for me, though, as the second one still appears as "Abstract". This is how I defined them: ``` \documentclass[a4paper, oneside]{discothesis} \usepackage[utf8]{inputenc} \usepackage[T1]{fontenc} \usepackage[english,catalan]{babel} \begin{document} %Abstract in English \begin{abstract} Abstract \end{abstract} %Abstract in Catalan \begin{abstract} \selectlanguage{catalan} \addto{\captionscatalan}{\renewcommand{\abstractname}{Resum}} Resum \end{abstract} \selectlanguage{english} \end{document} ``` Also tried defining my own environment and got exactly the same result: ``` \documentclass[a4paper, oneside]{discothesis} \usepackage[utf8]{inputenc} \usepackage[T1]{fontenc} \usepackage[english,catalan]{babel} \newenvironment{poliabstract}[1] {\renewcommand{\abstractname}{#1}\begin{abstract}} {\end{abstract}} \begin{document} \selectlanguage{english} \begin{poliabstract}{Abstract} Abstract in english \end{poliabstract} \selectlanguage{catalan} \begin{poliabstract}{Resum} Resum en català \end{poliabstract} \selectlanguage{english} \end{document} ``` The abstract is defined in this way in the cls file, haven't touched anything from the template file: ``` \newenvironment{abstract} {\chapter*{Abstract}} {\vfill %kai \noindent %kai \ifx \@keywords \@empty \relax \else {\bf Keywords:} \@keywords \\[6pt] %tobias \fi % \ifx \@categories \@empty \relax \else {\bf CR Categories:} \@categories %tobias \fi \addcontentsline{toc}{chapter}{Abstract} } ```
https://tex.stackexchange.com/users/303159
Can't change name of Abstract while using Babel
true
The name ‘Abstract’ is hardcoded in the (somewhat buggy) class. So you must redefine `abstract`, as suggested before. The following works for me, and it’s (imo) the canonical way the use two abstracts (I’m assuming Catalan is the main language): ``` \documentclass[a4paper, oneside]{discothesis} \usepackage[utf8]{inputenc} \usepackage[T1]{fontenc} \usepackage[english,catalan]{babel} \makeatletter \renewenvironment{abstract} {\chapter*{\abstractname}} {\vfill %kai \noindent %kai \ifx \@keywords \@empty \relax \else {\bf Keywords:} \@keywords \\[6pt] %tobias \fi \ifx \@categories \@empty \relax \else {\bf CR Categories:} \@categories %tobias \fi \addcontentsline{toc}{chapter}{\abstractname}} \makeatother \begin{document} \begin{otherlanguage}{english} \begin{abstract} Abstract \end{abstract} \end{otherlanguage} \begin{abstract} Resum \end{abstract} \end{document} ``` If the main language is English, reverse the order of languages (ie, `catalan,english`), and change the abstracts to: ``` \begin{abstract} Abstract \end{abstract} \begin{otherlanguage}{catalan} \begin{abstract} Resum \end{abstract} \end{otherlanguage} ``` If you find further issues (for example, ‘Keywords’ is hardcoded, too), please extend your MWE.
1
https://tex.stackexchange.com/users/5735
694600
322,256
https://tex.stackexchange.com/questions/694590
0
I am generating a [PDF](https://siouxfallsaa.org/meeting-schedule.pdf) using a [.tex file](https://siouxfallsaa.org/meeting-schedule.tex) of similar name. Generating the PDF with pdflatex generates a number of `Underfull \hbox (badness 10000) in paragraph at lines 539--542`, with each set of line numbers referring to a minipage block. ``` \begin{minipage}{\columnwidth} \vskip 1ex\textbf{GenZoom Recovery\hfill\begin{minipage}{\dimexpr\linewidth-27ex\relax}\raggedleft \mbox{6:30PM}\end{minipage}} Zoom-Only\hfill WA\\{\6pt We meet daily for quick and short meetings to help each other through the work day.} \end{minipage} \begin{minipage}{\columnwidth} \vskip 1ex\textbf{Broken Meeting No.1\hfill\begin{minipage}{\dimexpr\linewidth-27ex\relax}\raggedleft \mbox{6:30PM}\end{minipage}} Guiding Schoolhouse\hfill WA\\ 567 Beacon Lane, Nurtureville, NV, 89007 \end{minipage} ``` I suspect this has to do with using a minipage inside of a minipage in order to get times/tags aligned to the right side. I read that trailing/unused `\\` can cause these warnings, but removing them didn't seem to produce any change. Full example, as requested: ``` \documentclass[11pt,twoside,letterpaper]{article} \usepackage[utf8]{inputenc} \usepackage[letterpaper,margin=0.25in]{geometry} \setlength{\parindent}{0em} \setlength{\parskip}{1ex} \usepackage{anyfontsize} \usepackage{mathptmx} \usepackage{multicol} \usepackage{microtype} \usepackage{graphicx} \usepackage{enumitem} \def\6pt{\fontsize{6}{7.2}\selectfont} \def\7pt{\fontsize{7}{8}\selectfont} \def\8pt{\fontsize{8.5}{10}\selectfont} \def\gutter{\hspace{0.02\textwidth}} \fontfamily{phv}\fontseries{mc}\selectfont \begin{document} {\textbf{Meetings}}\hrulefill\vskip 1ex \begin{multicols}{4} \vskip 2ex{\8pt\textbf{Sunday}}\hrulefill\vskip 1ex {\7pt \begin{minipage}{\columnwidth} \vskip 1ex\textbf{Serenity Path AA\hfill\begin{minipage}{\dimexpr\linewidth-27ex\relax}\raggedleft \mbox{6:30PM}\end{minipage}}\\ Harmony Church\hfill WA\\ 345 Ascend Street, Serenity Springs, NV, 89007\\ \end{minipage} \begin{minipage}{\columnwidth} \vskip 1ex\textbf{GenZoom Recovery\hfill\begin{minipage}{\dimexpr\linewidth-27ex\relax}\raggedleft \mbox{6:30PM}\end{minipage}}\\ Zoom-Only\hfill WA\\{\6pt We meet daily for quick and short meetings to help each other through the work day.} \end{minipage} } \end{multicols} \end{document} ```
https://tex.stackexchange.com/users/303161
Underfull \hbox (badness 10000) in paragraph within nested minipages
false
You have `\\` at the end of a paragraph generating an underful box, but more generally the `multicols` and nested minipages are not helping. If you simplfy the markup it is easier to avoid empty boxes. ``` \documentclass[11pt,twoside,letterpaper]{article} \usepackage[utf8]{inputenc} \usepackage[letterpaper,margin=0.25in]{geometry} \setlength{\parindent}{0em} \setlength{\parskip}{1ex} \usepackage{anyfontsize} \usepackage{mathptmx} \usepackage{multicol} \usepackage{microtype} \usepackage{graphicx} \usepackage{enumitem} \def\sixpt{\fontsize{6}{7.2}\selectfont} \def\sevenpt{\fontsize{7}{8}\selectfont} \def\eightpt{\fontsize{8.5}{10}\selectfont} \def\gutter{\hspace{0.02\textwidth}} \fontfamily{phv}\fontseries{mc}\selectfont \begin{document} \textbf{Meetings}\hrulefill\vspace{1ex} \sevenpt \begin{minipage}[t]{.235\columnwidth} \eightpt\textbf{Sunday}\hrulefill \end{minipage}\gutter \begin{minipage}[t]{.235\columnwidth} \textbf{Serenity Path AA\hfill 6:30PM}\par Harmony Church\hfill WA\par \sixpt 345 Ascend Street, Serenity Springs, NV, 89007 \end{minipage}\gutter \begin{minipage}[t]{.235\columnwidth} \textbf{GenZoom Recovery\hfill 6:30PM}\par Zoom-Only\hfill WA\par \sixpt We meet daily for quick and short meetings to help each other through the work day. \end{minipage} \end{document} ```
1
https://tex.stackexchange.com/users/1090
694604
322,257
https://tex.stackexchange.com/questions/694586
0
I have recently switched from using texlive2022 to texlive2023, and in the process some things seem to have broken in hyperxmp. In particular, if I use the following ``` \documentclass{article} \usepackage{hyperxmp} \usepackage{hyperref} \title{Baking through the ages} \author{Larry Fine, Moe Howard} \hypersetup{pdftitle={Baking through the ages}, pdfauthor={A. Baker, C. Kneader}, pdflang={en}, pdfkeywords={cookies, muffins, cakes}, pdfpublisher={Baking International} } \begin{document} \maketitle This is the document. \end{document} ``` Under texlive2022 with hyperxmp v5.9, this produced XMP that identifies the authors from pdfauthor: ``` <dc:creator> <rdf:Seq> <rdf:li>A. Baker</rdf:li> <rdf:li>C. Kneader</rdf:li> </rdf:Seq> </dc:creator> ``` (I deliberately created an example with different values in `\author` to see where hyperxmp picks it up from). Under texlive2023 with hyperxmp v5.11, it omits this section for `<dc:creator` entirely, and the author information is not present elsewhere. There are certainly differences between hyperxmp 5.11 and hyperxmp 5.9, but I could find nothing that is directly related to how pdfauthor is handled. At this point I'm at a loss to solve the problem. Can anyone suggest a source of the problem here? Can someone try that document under texlive2023 and then inspect the pdf file to see if the `dc:creator` field is there? You don't need a pdf tool to see it, since the XMP package is just text inside the PDF.
https://tex.stackexchange.com/users/274723
Why does hyperxmp 5.11 no longer generate dc:creator for authors in XMP?
true
`hyperxmp` tries to change the way how `hyperref` handles options (both in the package options and in `\hypersetup`) as it wants to catch the content of options like `pdfauthor` for the XMP-metadata. It does it by redefining `\ProcessKeyvalOptions` to inject its code. That is not a good idea as `\ProcessKeyvalOptions` is used by other packages too and in 2022 it was discovered that it can lead to a loop: <https://tex.stackexchange.com/a/648036/2388>. In version 5.11 hyperxmp tries to repair this and resets `\ProcessKeyvalOptions` to the original meaning after the first use: ``` \let\hyxmp@ProcessKeyvalOptions=\ProcessKeyvalOptions \renewcommand*{\ProcessKeyvalOptions}{% \global\let\ProcessKeyvalOptions=\hyxmp@ProcessKeyvalOptions \hyxmp@redefine@Hyp \hyxmp@ProcessKeyvalOptions } ``` But this "fix" makes the patch actually useless as `hyperref` loads at the begin a package which uses `\ProcessKeyvalOptions` too and so the `hyperxmp` redefinitions are lost. You should report this error. As a work-around loading `hyperxmp` after `hyperref` should more or less work as long as you set all relevant options in a later `\hypersetup`. As an alternative you can set the XMP-metadata by loading with `\DocumentMetadata` the PDF management from the pdfmanagement-testphase code. See the `l3pdfmeta` documentation or <https://tug.org/TUGboat/tb43-3/tb135fischer-xmp.pdf> for how XMP are handled: ``` \DocumentMetadata{} \documentclass{article} \usepackage{hyperref} \title{Baking through the ages} \author{Larry Fine, Moe Howard} \hypersetup{pdftitle={Baking through the ages}, pdfauthor={A. Baker, C. Kneader}, pdflang={en}, pdfkeywords={cookies, muffins, cakes}, pdfpublisher={Baking International} } \begin{document} \maketitle This is the document. \end{document} ```
3
https://tex.stackexchange.com/users/2388
694606
322,258
https://tex.stackexchange.com/questions/694590
0
I am generating a [PDF](https://siouxfallsaa.org/meeting-schedule.pdf) using a [.tex file](https://siouxfallsaa.org/meeting-schedule.tex) of similar name. Generating the PDF with pdflatex generates a number of `Underfull \hbox (badness 10000) in paragraph at lines 539--542`, with each set of line numbers referring to a minipage block. ``` \begin{minipage}{\columnwidth} \vskip 1ex\textbf{GenZoom Recovery\hfill\begin{minipage}{\dimexpr\linewidth-27ex\relax}\raggedleft \mbox{6:30PM}\end{minipage}} Zoom-Only\hfill WA\\{\6pt We meet daily for quick and short meetings to help each other through the work day.} \end{minipage} \begin{minipage}{\columnwidth} \vskip 1ex\textbf{Broken Meeting No.1\hfill\begin{minipage}{\dimexpr\linewidth-27ex\relax}\raggedleft \mbox{6:30PM}\end{minipage}} Guiding Schoolhouse\hfill WA\\ 567 Beacon Lane, Nurtureville, NV, 89007 \end{minipage} ``` I suspect this has to do with using a minipage inside of a minipage in order to get times/tags aligned to the right side. I read that trailing/unused `\\` can cause these warnings, but removing them didn't seem to produce any change. Full example, as requested: ``` \documentclass[11pt,twoside,letterpaper]{article} \usepackage[utf8]{inputenc} \usepackage[letterpaper,margin=0.25in]{geometry} \setlength{\parindent}{0em} \setlength{\parskip}{1ex} \usepackage{anyfontsize} \usepackage{mathptmx} \usepackage{multicol} \usepackage{microtype} \usepackage{graphicx} \usepackage{enumitem} \def\6pt{\fontsize{6}{7.2}\selectfont} \def\7pt{\fontsize{7}{8}\selectfont} \def\8pt{\fontsize{8.5}{10}\selectfont} \def\gutter{\hspace{0.02\textwidth}} \fontfamily{phv}\fontseries{mc}\selectfont \begin{document} {\textbf{Meetings}}\hrulefill\vskip 1ex \begin{multicols}{4} \vskip 2ex{\8pt\textbf{Sunday}}\hrulefill\vskip 1ex {\7pt \begin{minipage}{\columnwidth} \vskip 1ex\textbf{Serenity Path AA\hfill\begin{minipage}{\dimexpr\linewidth-27ex\relax}\raggedleft \mbox{6:30PM}\end{minipage}}\\ Harmony Church\hfill WA\\ 345 Ascend Street, Serenity Springs, NV, 89007\\ \end{minipage} \begin{minipage}{\columnwidth} \vskip 1ex\textbf{GenZoom Recovery\hfill\begin{minipage}{\dimexpr\linewidth-27ex\relax}\raggedleft \mbox{6:30PM}\end{minipage}}\\ Zoom-Only\hfill WA\\{\6pt We meet daily for quick and short meetings to help each other through the work day.} \end{minipage} } \end{multicols} \end{document} ```
https://tex.stackexchange.com/users/303161
Underfull \hbox (badness 10000) in paragraph within nested minipages
false
Do define commands for such jobs! You don't need nested minipages and guesswork about the spacing. The following accommodates three meetings per line, if more are on some day they're set under the others. ``` \documentclass[11pt,twoside,letterpaper]{article} %\usepackage[utf8]{inputenc} % <-- no longer needed \usepackage[letterpaper,margin=0.25in]{geometry} %\usepackage{anyfontsize}% <-- obsolete and useless with mathptmx \usepackage{mathptmx} %\usepackage{multicol}% <-- not needed \usepackage{microtype} \newcommand{\sixpt}{\fontsize{6}{7.2}\selectfont} \newcommand{\sevenpt}{\fontsize{7}{8}\selectfont} \newcommand{\eightpt}{\fontsize{8.5}{10}\selectfont} \newcommand{\gutter}{1em} \newcommand{\WIDTH}{\dimeval{(\textwidth-\dimeval{\gutter}*3)/4}} \newcommand{\DAY}[1]{% \par\addvspace{2ex}% \hspace*{-\leftskip}% \makebox[\WIDTH][l]{\eightpt\bfseries #1\hrulefill}% \hspace{\gutter}\ignorespaces } \newcommand{\MEETING}[5]{% \begin{minipage}[t]{\WIDTH} \setlength{\lineskip}{1pt} \sevenpt {\bfseries #1\hfill #2\par} {#3\hfill #4\par} #5 \end{minipage}\hspace{\gutter plus 2pt minus 2pt}\ignorespaces } \setlength{\parindent}{0em} \AtBeginDocument{% \setlength{\leftskip}{\dimeval{\WIDTH+\gutter}}% \setlength{\lineskip}{1ex}% } %\fontfamily{phv}\fontseries{mc}\selectfont % <-- does nothing at all \begin{document} \hspace*{-\leftskip}\textbf{Meetings}\hrulefill \vspace{1ex} \DAY{Sunday} \MEETING{Serenity Path AA}{6:30PM}{Harmony Church}{WA}{ 345 Ascend Street, Serenity Springs, NV, 89007 } \MEETING{GenZoom Recovery}{6:30PM}{Zoom-Only}{WA}{ \sixpt We meet daily for quick and short meetings to help each other through the work day. } \DAY{Monday} \MEETING{Serenity Path AA}{6:30PM}{Harmony Church}{WA}{ 345 Ascend Street, Serenity Springs, NV, 89007 } \MEETING{GenZoom Recovery}{6:30PM}{Zoom-Only}{WA}{ \sixpt We meet daily for quick and short meetings to help each other through the work day. } \MEETING{GenZoom Recovery}{6:30PM}{Zoom-Only}{WA}{ \sixpt We meet daily for quick and short meetings to help each other through the work day. } \DAY{Tuesday} \MEETING{Serenity Path AA}{6:30PM}{Harmony Church}{WA}{ 345 Ascend Street, Serenity Springs, NV, 89007 } \MEETING{Serenity Path AA}{6:30PM}{Harmony Church}{WA}{ 345 Ascend Street, Serenity Springs, NV, 89007 } \MEETING{GenZoom Recovery}{6:30PM}{Zoom-Only}{WA}{ \sixpt We meet daily for quick and short meetings to help each other through the work day. } \MEETING{GenZoom Recovery}{6:30PM}{Zoom-Only}{WA}{ \sixpt We meet daily for quick and short meetings to help each other through the work day. } \end{document} ``` The gutter between columns is parameterized so you can change it in a single place. The column widths are computed accordingly. Please, check the `<--` tags in the code and remove those parts. For instance, `anyfontsize` is obsolete and useless anyway when you load scalable fonts such as those provided by `mathptmx`. Note that `\def\6pt{...}` is accepted by TeX, but I cannot recommend using it.
1
https://tex.stackexchange.com/users/4427
694608
322,259
https://tex.stackexchange.com/questions/694612
1
I tried building a table with fixed column width and centered text/symbols. I used the following script. ``` \begin{center} \begin{tabular}{ |p{.1cm}|p{.1cm}|p{.1cm}| } \hline $\bigcirc$ & A & A \\ \hline \end{tabular} \end{center} ``` I also tried using \centering and \hspace{...} to adjust the position of the text, but it doesn't work. How do I center the text/symbols within a column of some chosen width?
https://tex.stackexchange.com/users/303189
Centering text and symbols in tables with fixed column width
true
If you don't need line breaks within your cells, you could use either a `w` column (which will suppress the overfull box warning from your content being too wide for your .1cm column width) or use `W` column (and make sure that your columns are wide enough for your content): ``` \documentclass{article} \usepackage{mathtools} \usepackage{array} \begin{document} \begin{center} \begin{tabular}{ |w{c}{.1cm}|w{c}{.1cm}|w{c}{.1cm}| } \hline $\bigcirc$ & A & A \\ \hline \end{tabular} \end{center} \begin{center} \begin{tabular}{ |W{c}{.4cm}|W{c}{.4cm}|W{c}{.4cm}| } \hline $\bigcirc$ & A & A \\ \hline \end{tabular} \end{center} \end{document} ```
1
https://tex.stackexchange.com/users/36296
694613
322,263
https://tex.stackexchange.com/questions/427614
8
I recently discovered the `pdfcomment` package to annotate my latex-generated PDF files. Here is a minimum working example of what I have been doing: ``` \documentclass{article} \usepackage[utf8]{inputenc} \usepackage[T1]{fontenc} \usepackage{lmodern} \usepackage[rgb]{xcolor} \usepackage{pdfcomment} \begin{document} A comment appears here: \pdfcomment[icon=Insert,color=red,author={author1}]{comment1_text} \end{document} ``` Now the following question arose: I would like to include the comment of someone else and provide an answer to it, which is appearing under the same icon. Much like I could do in Adobe Acrobat: I can add a note, write some text and then hit the reply button to type an answer. I would like to achieve the same, but in latex. Something along the lines of (in pseudo-code) ``` \begin{document} A comment appears here: \pdfcomment[icon=Insert,color=red,author={author1}]{comment1_text}[author={author2}]{reply_author2} \end{document} ``` where now the `reply_author2` appears as a reply under the same note. Is something like this possible? --- To provide some additional input. When I generate a very simple PDF with: ``` \documentclass{article} \usepackage[utf8]{inputenc} \usepackage[T1]{fontenc} \usepackage{lmodern} \begin{document} This is a test document to show annotation in LaTeX vs Adobe Acrobat. The goal is to have the same sort of reply ability as is in Adobe which is very important for collaboration on LaTeX generated documents with people who do not use LaTeX. \end{document} ``` I can then open the PDF in Adobe sw and add annotation (insert text type). Then I use this `python` code: ``` from PyPDF2 import PdfFileReader reader = PdfFileReader("test-ad.pdf") for page in reader.pages: try : for annot in page["/Annots"] : print (annot.getObject()) # (1) print ("") except : # there are no annotations on this page pass ``` to extract annotations directly from the PDF, I get: ``` {'/AP': {'/N': IndirectObject(10, 0, 139968916562832)}, '/C': [0, 0, 1], '/Contents': 'insert some text', '/CreationDate': "D:20230828101145-04'00'", '/F': 4, '/M': "D:20230828101153-04'00'", '/NM': '436dc8e6-1207-4d79-91be-a5432a1ce7b9', '/P': IndirectObject(9, 0, 139968916562832), '/Popup': IndirectObject(18, 0, 139968916562832), '/RC': '<?xml version="1.0"?><body xmlns="http://www.w3.org/1999/xhtml" xmlns:xfa="http://www.xfa.org/schema/xfa-data/1.0/" xfa:APIVersion="Acrobat:22.1.0" xfa:spec="2.0.2" ><p dir="ltr"><span dir="ltr" style="font-size:9.9pt;text-align:left;color:#000000;font-weight:normal;font-style:normal">insert some text</span></p></body>', '/RD': [0.781097, 0.781067, 0.781097, 0.781128], '/Rect': [253.424, 703.434, 264.928, 712.807], '/Subj': 'Inserted Text', '/Subtype': '/Caret', '/T': 'me', '/Type': '/Annot'} {'/F': 28, '/Open': False, '/Parent': IndirectObject(17, 0, 139968916562832), '/Rect': [595.276, 598.026, 799.276, 712.026], '/Subtype': '/Popup', '/Type': '/Annot'} ``` When I open the file again and add reply to that annotation comment and again extract the annotations with `python`, I get: ``` {'/AP': {'/N': IndirectObject(10, 0, 139968905121360)}, '/C': [0, 0, 1], '/Contents': 'insert some text', '/CreationDate': "D:20230828101145-04'00'", '/F': 4, '/M': "D:20230828101153-04'00'", '/NM': '436dc8e6-1207-4d79-91be-a5432a1ce7b9', '/P': IndirectObject(9, 0, 139968905121360), '/Popup': IndirectObject(18, 0, 139968905121360), '/RC': '<?xml version="1.0"?><body xmlns="http://www.w3.org/1999/xhtml" xmlns:xfa="http://www.xfa.org/schema/xfa-data/1.0/" xfa:APIVersion="Acrobat:22.1.0" xfa:spec="2.0.2" ><p dir="ltr"><span dir="ltr" style="font-size:9.9pt;text-align:left;color:#000000;font-weight:normal;font-style:normal">insert some text</span></p></body>', '/RD': [0.781097, 0.781067, 0.781097, 0.781128], '/Rect': [253.424, 703.434, 264.928, 712.807], '/Subj': 'Inserted Text', '/Subtype': '/Caret', '/T': 'me', '/Type': '/Annot'} {'/F': 28, '/Open': False, '/Parent': IndirectObject(17, 0, 139968905121360), '/Rect': [595.276, 598.026, 799.276, 712.026], '/Subtype': '/Popup', '/Type': '/Annot'} {'/AP': {'/N': IndirectObject(28, 0, 139968905121360), '/R': IndirectObject(29, 0, 139968905121360)}, '/C': [1, 0.819611, 0], '/Contents': 'reply to the comment', '/CreationDate': "D:20230828101251-04'00'", '/F': 28, '/IRT': IndirectObject(17, 0, 139968905121360), '/M': "D:20230828101251-04'00'", '/NM': 'dfc46577-b2cb-4666-a159-31fc4cbef078', '/Name': '/Comment', '/P': IndirectObject(9, 0, 139968905121360), '/Popup': IndirectObject(27, 0, 139968905121360), '/RC': '<?xml version="1.0"?><body xmlns="http://www.w3.org/1999/xhtml" xmlns:xfa="http://www.xfa.org/schema/xfa-data/1.0/" xfa:APIVersion="Acrobat:22.1.0" xfa:spec="2.0.2" ><p dir="ltr"><span dir="ltr" style="font-size:9.8pt;text-align:left;font-weight:normal;font-style:normal">reply to the comment</span></p></body>', '/Rect': [253.424, 688.807, 277.424, 712.807], '/Subj': 'Sticky Note', '/Subtype': '/Text', '/T': 'me', '/Type': '/Annot'} {'/F': 28, '/Open': False, '/Parent': IndirectObject(26, 0, 139968905121360), '/Rect': [595.276, 598.807, 799.276, 712.807], '/Subtype': '/Popup', '/Type': '/Annot'} ``` One thing I noticed is that the original comment has tag `/C` but the comment has in addition also `/R`. If that is all that is needed or there are some other details, I do not know. I guess one would need to understand the PDF specification.
https://tex.stackexchange.com/users/159420
Adding reply to annotation using pdfcomment
false
Well actually the package contains an (undocumented) command `\pdfreply` that sets the needed `/IRT` reference. The implementation is a bit buggy as it errors on the first compilation but by setting an arbitrary default it seems to work (you must compile twice). ``` \documentclass{article} \usepackage[T1]{fontenc} \usepackage{lmodern} \usepackage[rgb]{xcolor} \usepackage{pdfcomment} \makeatletter \renewcommand*{\pc@get@PDFOBJID}[1]% {% \zref@extractdefault{#1}{PCPDFOBJID}{S,0}% }% \makeatother \begin{document} A comment appears here: \pdfcomment[id=A,icon=Insert,color=red,author={author1}]{comment1_text} \pdfreply[replyto=A,author={author2}]{comment1_text} \end{document} ```
3
https://tex.stackexchange.com/users/2388
694614
322,264
https://tex.stackexchange.com/questions/694567
1
> > *This is actually a follow-up / the real question of [this previous question](https://tex.stackexchange.com/q/694545/194994).* > > > I would like to convert text start with `>>` into centered text. > > The motivation for this seemingly silly purpose would be to add a new syntax to my package [`jwjournal`](https://www.ctan.org/pkg/jwjournal), so that lines like `>> (some remark)` would be converted into centered annotations. > > > Suppose that the string to be parsed has been stored into a token list `\l_jwjournal_tmp_tl`. The goal is to recognize `>>` and make the text after it centered. However, if multiple `>>` are found, the corresponding text should be centered separately. Thus for example, if the content of `\l_jwjournal_tmp_tl` is `aaa>>bbb>>ccc`, I would like `bbb` and `ccc` to be centered. [This previous question](https://tex.stackexchange.com/q/694545/194994) already addressed the main issue of parsing this token list properly. The problem for me now is that `\l_jwjournal_tmp_tl` shall be used later for further parsing and I would thus like the parsed result to directly overwrite `\l_jwjournal_tmp_tl` (just like `\regex_replace_all:nnN` which directly modifies the value of the given token list). How should I achieve this? Below is a MWE. ``` \documentclass{article} \begin{document} \ExplSyntaxOn \newenvironment{JWJournalCompactCenter} % https://tex.stackexchange.com/a/98893 {\parskip=0pt\par\nopagebreak\centering} {\par\noindent\ignorespacesafterend} \NewDocumentCommand \JWJournalCompactCenterText { m } { \begin{JWJournalCompactCenter} #1 \end{JWJournalCompactCenter} } \tl_new:N \l_jwjournal_tmp_tl \tl_set:Nn \l_jwjournal_tmp_tl { aaa >>bbb >>ccc } % \tl_new:N \l__mymodule_replace_head_tl % \seq_new:N \l__mymodule_replace_tail_seq % \cs_new_protected:Nn \mymodule_replace:n % { % \regex_split:nnN { >> } { #1 } \l__mymodule_replace_tail_seq % \seq_pop_left:NN \l__mymodule_replace_tail_seq \l__mymodule_replace_head_tl % \tl_use:N \l__mymodule_replace_head_tl % \seq_map_function:NN \l__mymodule_replace_tail_seq \JWJournalCompactCenterText % } \tl_use:N \l_jwjournal_tmp_tl \ExplSyntaxOff \end{document} ```
https://tex.stackexchange.com/users/194994
Convert lines start with >> into centered text
false
Here's a combined solution (just a proof of concept, change the functions to your liking). ``` \documentclass{article} \begin{document} \ExplSyntaxOn \NewDocumentCommand \somecommand { m } { \jinwen_somecommand:n { #1 } } \NewDocumentCommand \replace { m } { \jinwen_replace_use:n { #1 } } \tl_new:N \l__jinwen_replace_head_tl \seq_new:N \l__jinwen_replace_tail_seq \cs_new:Nn \jinwen_somecommand:n { \,---\, #1 \,---\, } \cs_new_protected:Nn \jinwen_replace_use:n { \__jinwen_split:n { #1 } \tl_use:N \l__jinwen_replace_head_tl \seq_map_function:NN \l__jinwen_replace_tail_seq \jinwen_somecommand:n } \cs_new_protected:Nn \jinwen_replace_save:N { \__jinwen_split:V #1 \tl_set_eq:NN #1 \l__jinwen_replace_head_tl % the head \seq_map_inline:Nn \l__jinwen_replace_tail_seq { \tl_put_right:Nn #1 { \jinwen_somecommand:n { ##1 } } } } \cs_new_protected:Nn \__jinwen_split:n { \seq_set_split:Nnn \l__jinwen_replace_tail_seq { >> } { #1 } \seq_pop_left:NN \l__jinwen_replace_tail_seq \l__jinwen_replace_head_tl } \cs_generate_variant:Nn \__jinwen_split:n { V } \ExplSyntaxOff X\replace{}X \replace{aaa} \replace{aaa>>bbb} \replace{aaa>>bbb>>ccc} \ExplSyntaxOn \tl_new:N \l_jinwen_test_tl \tl_set:Nn \l_jinwen_test_tl { aaa>>bbb>>ccc } \jinwen_replace_save:N \l_jinwen_test_tl \tl_show:N \l_jinwen_test_tl \ExplSyntaxOff \end{document} ``` As you see in the log file, the token list variable is changed as expected. ``` > \l_jinwen_test_tl=aaa\jinwen_somecommand:n {bbb}\jinwen_somecommand:n {ccc}. ```
1
https://tex.stackexchange.com/users/4427
694615
322,265