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/684291
1
I have an enumerate of questions. Each of those questions has some opening text and then a nested enumerate. I give an example below that results in a page-break in the middle of the second question in the PDF output. I mark with `\newpage` where I would like the page-break to be (automatically) inserted. In this particular example, I want the first question to be on page 1, and the second and third to be on page 2 (just because they both happen to fit). I also put my attempt commented out in below. I try to start a "samepage" environment right at the beginning of an `\item` and I try to end it at the end of the (nested) enumerate environment. The code seems to work on a simpler example, but in the current example it fails with the error `! LaTeX Error: \begin{samepage} on input line 56 ended by \end{center}.` In any case, my approach seemed fragile anyway so I'm hoping there's a better solution. I think the reason I find this hard is because of the way `\item` works. If it were `\item{contents}` then I think it would be easier to patch. That's why I tried to hack together an approach that hooks into the beginning of `\item` and end of `\enumerate`. I'm looking for a solution that can patch `\item` and base `enumerate` (rather than using `\newitem` or enumitem). i.e., I'm hoping that I can just drop some preamble code in. There are related questions. For example, [Page breaks within enumerated list](https://tex.stackexchange.com/questions/76483/page-breaks-within-enumerated-list) is related but is not about nested enumerates and also the solution seems to use enumitem. ``` \documentclass{article} \makeatletter %% my attempt: %\let\OldItem\item %\renewcommand{\item}{\OldItem \ifnum \@listdepth=1 \begin{samepage}\fi} %\AfterEndEnvironment{enumerate}{\ifnum \@listdepth=1 \end{samepage}\fi} \makeatother \begin{document} \begin{enumerate} \item 2 + 2 = ? \\ filler\\ filler\\ filler\\ filler\\ filler\\ filler\\ filler\\ filler\\ filler\\ filler\\ filler\\ filler\\ filler\\ filler\\ filler\\ filler\\ filler\\ filler\\ filler\\ filler\\ filler\\ filler\\ filler\\ filler\\ \begin{enumerate} \item 1 \item 2 \item 3 \item 4 \end{enumerate} % I do not want to put this page break in manually: % \newpage \item Consider the joint probability distribution below: filler\\ filler\\ filler\\ filler\\ filler\\ filler\\ filler\\ filler\\ \begin{center} \begin{tabular}{|ccc|} \hline & $X_{2}=0$ & $X_{2}=1$\tabularnewline \hline $X_{1}=0$ & $\frac{1}{10}$ & $\frac{3}{10}$\tabularnewline \hline $X_{1}=1$ & $\frac{2}{10}$ & $\frac{4}{10}$\tabularnewline \hline \end{tabular} \par\end{center} What is $P(X_{1}=1)$? \begin{enumerate} \item I do not know. \item 4 \item 17 \item 88 \end{enumerate} \item 2 - 2 + 5 = filler\\ filler\\ filler\\ filler\\ filler\\ filler\\ filler\\ filler\\ filler\\ filler\\ filler\\ filler\\ filler\\ filler\\ filler\\ filler\\ filler\\ filler\\ filler\\ \begin{enumerate} \item 1 \item 2 \item 3 \item 4 \end{enumerate} \end{enumerate} \end{document} ```
https://tex.stackexchange.com/users/12212
Prevent page break within \item of an enumerate
true
You could try the following. Don't use `\\` at the end of paragraphs. This only give underfull hbox messages. ``` \documentclass{article} \makeatletter \AddToHook{cmd/item/before}{% \if@nmbrlist %only for enumerate? \ifnum \@listdepth=1 \penalty-200 \samepage \fi \fi} \makeatother \begin{document} \begin{enumerate} \item 2 + 2 = ? \\ filler\\ filler\\ filler\\ filler\\ filler\\ filler\\ filler\\ filler\\ filler\\ filler\\ filler\\ filler\\ filler\\ filler\\ filler\\ filler\\ filler\\ filler\\ filler\\ filler\\ filler\\ filler\\ filler\\ filler\\ \begin{enumerate} \item 1 \item 2 \item 3 \item 4 \end{enumerate} % I do not want to put this page break in manually: % \newpage \item Consider the joint probability distribution below: filler\\ filler\\ filler\\ filler\\ filler\\ filler\\ filler\\ filler \begin{center} \begin{tabular}{|ccc|} \hline & $X_{2}=0$ & $X_{2}=1$\tabularnewline \hline $X_{1}=0$ & $\frac{1}{10}$ & $\frac{3}{10}$\tabularnewline \hline $X_{1}=1$ & $\frac{2}{10}$ & $\frac{4}{10}$\tabularnewline \hline \end{tabular} \end{center} What is $P(X_{1}=1)$? \begin{enumerate} \item I do not know. \item 4 \item 17 \item 88 \end{enumerate} \item 2 - 2 + 5 = filler\\ filler\\ filler\\ filler\\ filler\\ filler\\ filler\\ filler\\ filler\\ filler\\ filler\\ filler\\ filler\\ filler\\ filler\\ filler\\ filler\\ filler\\ filler \begin{enumerate} \item 1 \item 2 \item 3 \item 4 \end{enumerate} \end{enumerate} \end{document} ```
3
https://tex.stackexchange.com/users/2388
684926
317,754
https://tex.stackexchange.com/questions/684923
1
With which options and above all where can the head of the arrow (coordinative bond) be designed (e.g. triangle as head)? This should be possible with TikZ? ``` \documentclass{article} \usepackage{chemfig} \renewcommand*\printatom[1]{\ensuremath{\mathsf{#1}}} \begin{document} \chemfig{*5(--N(-[,1.5,,,->]Co)---)} \end{document} ```
https://tex.stackexchange.com/users/167873
Representation of a chemical bond as an arrow
false
You are looking for something like this: ``` \documentclass{article} \usepackage{chemfig} \renewcommand*\printatom[1]{\ensuremath{\mathsf{#1}}} \begin{document} \chemfig{*5(--N(-[,1.5,,,-Stealth,dashed]Co)---)} \end{document} ``` In the fifth position you can pass TikZ arguments to `chemfig` allowing you to alter the shape of the bound or arrow in this case.
1
https://tex.stackexchange.com/users/189383
684928
317,756
https://tex.stackexchange.com/questions/684879
2
How can I programmatically find the height and width of a node? ``` \usepackage{twemojis} \begin{tikzpicture} \tikzset{nodestyle/.style={rectangle, rounded corners, draw=black, thick, fill=black!50}} \node[nodestyle] (node00) at (0, 0) {{\LARGE\texttwemoji{dollar banknote}}}; \node[nodestyle, right=0pt of node00] (node01) {}; \end{tikzpicture} ``` I would like to set the height and width `node01` identical to `node00`.
https://tex.stackexchange.com/users/277830
How to programmatically find the height and width of a node?
false
You might also be interested by this solution that computes it by computing the distance between the north/east anchors, subtracting the width of the line, directly using standard operations on paths: [TikZ: Get width of node that shouln't be drawn](https://tex.stackexchange.com/questions/336257/tikz-get-width-of-node-that-shoulnt-be-drawn)
0
https://tex.stackexchange.com/users/116348
684930
317,757
https://tex.stackexchange.com/questions/684803
1
I am dealing with a bilingual document using `polyglossia`: Arabic (main) and French (secondary, mostly math only). ``` \usepackage{polyglossia} \setdefaultlanguage{arabic} \setmainlanguage[locale=algeria]{arabic} \setotherlanguage{french} \newfontfamily\arabicfont[Script=Arabic]{XB Yas} ``` The > > \textfrench > > > command helped me to render theorem numbering with the same font used for the math content (i.e. french text). ``` \theoremstyle{definition} \newtheorem{defn}{تعريف}[chapter] \renewcommand{\thedefn}{\textfrench{\arabic{defn}}} ``` The only problem is that, the mention > > [chapter] > > > in ``` \newtheorem{defn}{تعريف}[chapter] ``` doesn't do the expected thing (just get ignored) due to that last line: ``` \renewcommand{\thedefn}{\textfrench{\arabic{defn}}} ``` The result being chapter numbers not included when numbering that "defn" theorem-like environment. **EDIT:** The whole context ``` \documentclass[10pt,twoside,a5paper]{book} \usepackage[margin=2.5cm]{geometry} \usepackage{amsmath,amsthm,amsfonts,amssymb} \usepackage[default]{fontsetup} \usepackage{fancyhdr} \fancypagestyle{plain}{% \fancyhf{} \renewcommand\headrulewidth{0pt} } \pagestyle{fancy} \fancyhf{} \renewcommand\headrulewidth{0pt} \fancyhead[CE]{\footnotesize \bfseries الفضاءات المترية} \fancyhead[CO]{\footnotesize \bfseries \leftmark} \fancyhead[RE,LO]{\textfrench{\thepage}} \usepackage{polyglossia} \setdefaultlanguage{arabic} \setmainlanguage[locale=algeria]{arabic} \setotherlanguage{french} \newfontfamily\arabicfont[Script=Arabic]{XB Yas} \theoremstyle{definition} \newtheorem{defn}{تعريف}[chapter] \renewcommand{\thedefn}{\textfrench{\arabic{defn}}} \newtheorem{remq}{ملاحظة}[chapter] \renewcommand{\theremq}{\textfrench{\arabic{remq}}} \newtheorem*{demn}{البرهان} \newtheorem*{consq}{استنتاج} \newtheorem{propn}{نتيجة}[chapter] \renewcommand{\thepropn}{\textfrench{\arabic{propn}}} \newtheorem{xmpl}{مثال}[chapter] \renewcommand{\thexmpl}{\textfrench{\arabic{xmpl}}} \renewcommand{\thechapter}{\textfrench{\arabic{chapter}}} \renewcommand{\theenumi}{\textfrench{\arabic{enumi}}} \linespread{1.5} \title{الفضاءات المترية} \begin{document} \renewcommand{\chaptername}{الفصل} \thispagestyle{plain} \chapter{مفاهيم أساسية} \begin{defn} لتكن $X$ مجموعة اختيارية غير خالية. نسمي مسافة على $X$ كل تطبيق $d$ من $X\times X$ في $\mathbb{R}_+$ يحقق الشروط التالية~: $$ \begin{aligned} d(x,y)=0 \Longleftrightarrow x=y & \quad .1 \\ \forall (x,y) \in X^2, \; d(x,y)=d(y,x) & \quad .2 \\ \centerdot \quad \forall (x,y,z) \in X^3, \; d(x,z) \leqslant d(x,y)+d(y,z) & \quad .3 \end{aligned}$$ \end{defn} \begin{remq} العلاقة الواردة في الشرط 3 تسمى المتراجحة المثلثية و~ذلك لكونها تعبيرا معمما على العلاقة بين أضلاع المثلث في الهندسة الأقليدية حيث أن طول الضلع يكون أقل من أو يساوي مجموع طولي الضلعين الآخرين. \end{remq} \end{document} ``` **SECOND EDIT:** It is not just about enforcing Arabic digits over Hindi digits, as some may think.
https://tex.stackexchange.com/users/296021
\textfrench causing no chapter numbers in theorem numbering
true
Using `\textfrench{\arabic{<counter>}}` is definitly not the right way. I would define a `\latin` command that chooses the Roman font as set by `fontsetup`. I changed the Arabic font, because I don't have XB Ras. ``` \documentclass[10pt,twoside,a5paper]{book} \usepackage[margin=2.5cm]{geometry} \usepackage{amsmath,amsthm,amsfonts,amssymb} \usepackage[default]{fontsetup} \usepackage{polyglossia} \usepackage{fancyhdr} \fancypagestyle{plain}{% \fancyhf{} \renewcommand\headrulewidth{0pt} } \pagestyle{fancy} \fancyhf{} \renewcommand\headrulewidth{0pt} \fancyhead[CE]{\footnotesize \bfseries الفضاءات المترية} \fancyhead[CO]{\footnotesize \bfseries \leftmark} \fancyhead[RE,LO]{\latin{\thepage}} \setmainlanguage[locale=algeria]{arabic} \setotherlanguage{french} \newfontfamily\arabicfont[Script=Arabic]{Scheherazade} \theoremstyle{definition} \newtheorem{defn}{تعريف}[chapter] \renewcommand{\thedefn}{\latin{\arabic{defn}}} \newtheorem{remq}{ملاحظة}[chapter] \renewcommand{\theremq}{\latin{\arabic{remq}}} \newtheorem*{demn}{البرهان} \newtheorem*{consq}{استنتاج} \newtheorem{propn}{نتيجة}[chapter] \renewcommand{\thepropn}{\latin{\arabic{propn}}} \newtheorem{xmpl}{مثال}[chapter] \renewcommand{\thexmpl}{\latin{\arabic{xmpl}}} \renewcommand{\thechapter}{\latin{\arabic{chapter}}} \renewcommand{\theenumi}{\latin{\arabic{enumi}}} \NewDocumentCommand{\latin}{m}{{\fontfamily{\rmdefault}\selectfont#1}} \linespread{1.5} \title{الفضاءات المترية} \begin{document} \renewcommand{\chaptername}{الفصل} \thispagestyle{plain} \setcounter{chapter}{9} \chapter{مفاهيم أساسية} \begin{defn} لتكن $X$ مجموعة اختيارية غير خالية. نسمي مسافة على $X$ كل تطبيق $d$ من $X\times X$ في $\mathbb{R}_+$ يحقق الشروط التالية~: \[ \begin{aligned} d(x,y)=0 \Longleftrightarrow x=y & \quad .1 \\ \forall (x,y) \in X^2, \; d(x,y)=d(y,x) & \quad .2 \\ \centerdot \quad \forall (x,y,z) \in X^3, \; d(x,z) \leqslant d(x,y)+d(y,z) & \quad .3 \end{aligned} \] \end{defn} \begin{remq} العلاقة الواردة في الشرط 3 تسمى المتراجحة المثلثية و~ذلك لكونها تعبيرا معمما على العلاقة بين أضلاع المثلث في الهندسة الأقليدية حيث أن طول الضلع يكون أقل من أو يساوي مجموع طولي الضلعين الآخرين. \end{remq} \end{document} ``` The chapter number is set to 10 in order to show that the order of digits is correct. Don't use `$$` with LaTeX. If you want to add the chapter number to the theorem-like environments: ``` \renewcommand{\thedefn}{\latin{\arabic{chapter}.\arabic{defn}}} \renewcommand{\theremq}{\latin{\arabic{chapter}.\arabic{remq}}} \renewcommand{\thepropn}{\latin{\arabic{chapter}.\arabic{propn}}} \renewcommand{\thexmpl}{\latin{\arabic{chapter}.\arabic{xmpl}}} ```
3
https://tex.stackexchange.com/users/4427
684931
317,758
https://tex.stackexchange.com/questions/684945
0
Every time I try to use the `\textcite` command in the "unified" style, I get an "undefined control sequence" error from Overleaf. But when I switch to the "authoryear" style, the error goes away. How do I fix this? Here's part of my preamble: ``` \documentclass[12pt]{article} \usepackage{graphicx} \usepackage{example-sentences} \usepackage[backend=biber, style=unified, natbib=true]{biblatex} \addbibresource{references.bib} \usepackage [english]{babel} \usepackage [autostyle, english = american]{csquotes} \MakeOuterQuote{"} ``` And here's the error message I get from Overleaf: ``` \blx@biblinkstart [#1]->\blx@sfsave \hyper@natlinkstart {\the \c@refsection ... l.23 ...ime today," from \textcite{rior_gen_2021}} . The control sequence at the end of the top line of your error message was never \def'ed. If you have misspelled it (e.g., `\hobx'), type `I' and the correct spelling (e.g., `I\hbox'). Otherwise just continue, and I'll forget about whatever was undefined. ! Undefined control sequence. \blx@biblinkstart ...x@sfsave \hyper@natlinkstart {\the \c@refsection @#1}\b... l.23 ...ime today," from \textcite{rior_gen_2021}} . The control sequence at the end of the top line of your error message was never \def'ed. If you have misspelled it (e.g., `\hobx'), type `I' and the correct spelling (e.g., `I\hbox'). Otherwise just continue, and I'll forget about whatever was undefined. ``` And again, none of this happens if I use the authoryear style (but I would like to use the unified style instead). What should I do please?
https://tex.stackexchange.com/users/296470
Biblatex command \textcite not working with unified style on Overleaf
false
The implementation of `unified`'s `\textcite` command requires that you load `hyperref`. It uses code inspired by <https://tex.stackexchange.com/a/27615/35864>. See for example <https://github.com/semprag/biblatex-sp-unified/issues/48>. [The documentation](http://mirrors.ctan.org/macros/latex/contrib/biblatex-contrib/biblatex-unified/biblatex-unified.pdf) states > > The unified citation style relies on hyperlinking between in-text citations and the > bibliography. So, the `hyperref` package is required. It is automatically loaded > by `sp.cls` but if you use a different document class and `hyperref` is not loaded > by that class, you need to add `\usepackage{hyperref}` to your preamble as > well. > > > Add `\usepackage{hyperref}` to your document preamble. (Note that apart from a few documented exceptions, `hyperref` should generally be the last package you load). The following MWE compiles just fine ``` \documentclass[english]{article} \usepackage[T1]{fontenc} \usepackage{babel} \usepackage{csquotes} \usepackage[backend=biber, style=unified]{biblatex} \usepackage{hyperref} \addbibresource{biblatex-examples.bib} \begin{document} Lorem \textcite{sigfridsson} \printbibliography \end{document} ``` as is, but will throw an error if you omit the `\usepackage{hyperref}` line.
3
https://tex.stackexchange.com/users/35864
684946
317,764
https://tex.stackexchange.com/questions/684947
0
I am using a few symbols from Unicode that the `utfsym` package provides. These symbols are used repeatedly maybe hundreds of times, so I have defined shortcut commands like this to use them: ``` \newcommand{\Train}[0]{\xspace} ``` It seems that they are compiled individually each time they are used, which takes a large proportion of the total time of pdf compilation (I am using xelatex). The output log shows the same symbols being compiled repeatedly with lines like this repeating many times. ``` xelatex> (c:/texlive/2023/texmf-dist/tex/latex/utfsym/usym1F688.tikz) ``` Is there any way to "cache" the symbols to use them repeatedly without compiling them repeatedly? All symbols are used only in text mode. Note: I have tried replacing the literal characters with `\usym{1F688}` etc in the command definition. If anything, this slows it down.
https://tex.stackexchange.com/users/295003
Repeated include of utfsym symbols
true
After some experimentation, replacing the `utfsym` use with icons in pdf format that are included with `\includegraphics` seems to be much much faster.
0
https://tex.stackexchange.com/users/295003
684948
317,765
https://tex.stackexchange.com/questions/684953
1
I am trying to use `\l_tmpa_tl` in the `align` environment. The requirements are to set the variable *inside* of `align` and use `&`. The current result shows `x=` leaving the right-hand side of the equal sign empty. In case the variable is assigned outside the `align` environment, or `&` is omitted, it works as expected. I kindly ask why this is occurring and how to fix? ``` \documentclass{article} \usepackage{amsmath} \ExplSyntaxOn \NewDocumentCommand{\mycmd}{}{ \begin{align} \tl_set:Nn \l_tmpa_tl {1} x &=\l_tmpa_tl \end{align} } \ExplSyntaxOff \begin{document} \mycmd \end{document} ```
https://tex.stackexchange.com/users/167081
LaTeX 3 - Using the align environment with scratch variables
false
Something like this? ``` \documentclass{article} \usepackage{amsmath} \ExplSyntaxOn \NewDocumentCommand{\mycmd}{}{ \begin{align} \tl_gset:Nn \g_tmpa_tl {1+k^2} x &= \tl_use:N \g_tmpa_tl \end{align} } \ExplSyntaxOff \begin{document} \mycmd \end{document} ```
1
https://tex.stackexchange.com/users/6880
684955
317,768
https://tex.stackexchange.com/questions/636302
0
I have written a biology assignment in TeX, and am now struggling with making my bibliography match with the format we need to use for the course, that is, matching [this guide for authors](https://www.elsevier.com/journals/european-journal-of-cell-biology/0171-9335?generatepdf=true). We were told it is the Harvard style, but reading other questions on here I am realising that doesn't mean much. I'm fairly new to LaTex so I don't know what to do to get my bibliography in this style. I'm using the biblatex package, and currently using the authoryear style, but it's not really the same. [An example of the style in an article is here.](https://pdf.sciencedirectassets.com/273240/1-s2.0-S0171933522X00022/1-s2.0-S0171933522000048/main.pdf?X-Amz-Security-Token=IQoJb3JpZ2luX2VjEEcaCXVzLWVhc3QtMSJHMEUCIHA6ATR%2BSY3ofF0%2BNY8NQ5109r%2FaihiCTd2gxB2Ip%2BIbAiEArn5vlOhSFs2snS%2Fy6NsFKBaM3EWVeivC03Z0HOLR8UwqgwQIsP%2F%2F%2F%2F%2F%2F%2F%2F%2F%2FARAEGgwwNTkwMDM1NDY4NjUiDHH%2F8Rf8u%2BNZMY5N6CrXA2CiTnoB2v3kAXOi4Vh%2FnpY291Ez6fAh1df5ipZBZ9ANbPpCxJh%2FC0axVTr6fIKjEr6UUO0O%2B7w24GYsLE715drk8OwTOnAPXNWx2%2BJIH7hfu6%2F0l%2B7eBcIHXlihwTQ5b%2F06iEBkGZmOJo9FyrT9idpZnmwJ0mJ%2FEZ9fOXjy5e5GRcNP7muzWpi6%2FiAfL6BlVc5n4AmMHjkajIOgW%2F7xpc%2Fgva8fZ4ADJxCLXtuYe6IwbExXrD%2BC6%2Fb80lrKFaSykpksJVWW7kmmUnXyR62c46pmiB9AGVvyCOwNoRejyA5vkeb1Ktm0aOBzTlAoKJPUIslLZl7wJzB1qJcOPFkGAJASpA9Eq%2FDnFEWtD6C4dhrLhZiKThN5Wp3%2FZWslvaU8%2F7HytdPNl%2BuNPz5nDx6fCczImWaOyAap1HKpYYppirjwK9Nd92z0bHHdUHr8E%2FB1dhy2wASH%2BX4BgG3bndcwnTIjeh4DIxAzTXgga8BPuRr6U7mqmtdEC3Jvvm%2F%2BEFKXCfGPX3bTrLQafe0cpLeACReYCyyZocEHHIh2vXzm3A75uwXl%2B1P%2B78XqKwY18rZI%2FMhv9ZObEYeeckh8TcCm2L8VR%2F3ZYuZLiuuZke7RGW91WA273Ed%2F%2FjCnnJqRBjqlATgsz7fYTUQ43zGpo3uu49jAt6hxGO6PKXDscVwNtftRKXPGW5T9fupV%2FMamS7y8E1p059VJpB80dOhRZuZL9vs61HP9Xor4PqZXR%2FerkmFER%2BS1h5r%2BHb893cnOYa8L8gSg5P9Du6OnH6C2m%2BLJrpKc3vm44G30aVRpNpFCvtseBImJO%2FlI%2FLBHA5Hv1yozy0kKvF7zwVVAWHjdmAy97KmzhXz%2Bsg%3D%3D&X-Amz-Algorithm=AWS4-HMAC-SHA256&X-Amz-Date=20220307T234552Z&X-Amz-SignedHeaders=host&X-Amz-Expires=300&X-Amz-Credential=ASIAQ3PHCVTYXOEU6GWA%2F20220307%2Fus-east-1%2Fs3%2Faws4_request&X-Amz-Signature=46aba13614eed35b77627b7269d3fb9ee4375895a959aebe4a67fd679c37086f&hash=4b2a3fd5b31eb4e58cb0e5f5b8b23a1082a064c16ae431618f45914a5c785c2e&host=68042c943591013ac2b2430a89b270f6af2c76d8dfd086a07176afe7c76c2c61&pii=S0171933522000048&tid=spdf-0024e76b-c386-4725-b61f-3aaf2f2f4538&sid=115186bd915f574a777a4ed-b4f1559c384egxrqa&type=client&ua=4c0a5a5852525f065159&rr=6e87350d794c16a9)
https://tex.stackexchange.com/users/264947
Is there a European Journal of Cell Biology bibliography style?
false
I used `biblatex` (and its extension, see [`biblatex-ext`](https://ctan.mirror.garr.it/mirrors/ctan/macros/latex/contrib/biblatex-contrib/biblatex-ext/biblatex-ext.pdf)) to create what you need. Maybe further refinements are needed (I only tested `article` and `book` as bib entries). ``` \begin{filecontents}[overwrite]{bib.bib} @article{andreadis1992structure, title={Structure and novel exons of the human. tau. gene}, author={Andreadis, Athena and Brown, William M and Kosik, Kenneth S}, journal={Biochemistry}, volume={31}, number={43}, pages={10626--10633}, year={1992}, publisher={ACS Publications} } @article{baker2001electrostatics, title={Electrostatics of nanosystems: application to microtubules and the ribosome}, author={Baker, Nathan A and Sept, David and Joseph, Simpson and Holst, Michael J and McCammon, J Andrew}, journal={Proceedings of the National Academy of Sciences}, volume={98}, number={18}, pages={10037--10041}, year={2001}, publisher={National Acad Sciences}, url={https://the/url/of/the/article.com} } @article{desta2020performance, title={Performance and its limits in rigid body protein-protein docking}, author={Desta, Israel T and Porter, Kathryn A and Xia, Bing and Kozakov, Dima and Vajda, Sandor}, journal={Structure}, volume={28}, number={9}, pages={1071--1081}, year={2020}, publisher={Elsevier} } @book{laskowski2011ligplot+, title={LigPlot+: multiple ligand--protein interaction diagrams for drug discovery}, author={Laskowski, Roman A and Swindells, Mark B}, year={2011}, publisher={ACS Publications} } \end{filecontents} \documentclass[a4paper]{article} \usepackage[english]{babel} \usepackage{csquotes} \usepackage[ style=ext-authoryear, maxbibnames=99, maxcitenames=2, giveninits=true, uniquename=init, ]{biblatex} \usepackage{xurl} % Citation settings % comma between name and year in citations \renewcommand*{\nameyeardelim}{\addcomma\space} % Bibliography settings % Inversion of given and family names \DeclareNameAlias{sortname}{family-given} %remove "and" before the last name \DeclareDelimAlias[bib]{finalnamedelim}{multinamedelim} % remove parentheses around year and put a comma before it \DeclareFieldFormat{biblabeldate}{\addcomma\addspace #1} % no space between initials \renewcommand*{\bibinitdelim}{} % titles without quotes \DeclareFieldFormat{title}{#1} \DeclareFieldFormat[article]{title}{#1} % journal in normal font \DeclareFieldFormat{journaltitle}{#1} % space between journal title \renewcommand*{\jourvoldelim}{\addspace} % leave out "In:" before journal name \renewbibmacro{in:}{\ifentrytype{article}{}{\printtext{\bibstring{in}\intitlepunct\nopunct}}} % print only volume (no number) \renewbibmacro*{volume+number+eid}{% \printfield{volume}% \setunit{\addcomma\addspace}% } % leave out "pp." from pages \DeclareFieldFormat{pages}{#1} % URL without the word "URL" and normal font \urlstyle{same} \DeclareFieldFormat{url}{\url{#1}} % END Bibliography and citation customization \addbibresource{bib.bib} \begin{document} Autocite: \autocite{laskowski2011ligplot+} Two citations \autocite{baker2001electrostatics, desta2020performance} Cite: \cite{desta2020performance} Parencite: \parencite{andreadis1992structure} Textcite: \textcite{baker2001electrostatics} \printbibliography \end{document} ```
0
https://tex.stackexchange.com/users/101651
684962
317,771
https://tex.stackexchange.com/questions/684951
0
I often use the `description` environment and I want to separate the label from the text not only by whitespace, but also by a small circle. I'm using the `enumitem` package to customize the `description` env., but I did not find a way of adding text after the label. Default look: ``` Item text text text text text text text text text text text text text text text text text text text text text ``` What I want: ``` Item ○ text text text text text text text text text text text text text text text text text text text text text ``` I already tried the following: ``` \setlist[description]{labelsep={\circ}} ``` and ``` \setlist[description]{% before={\changeitem}, after={\renewcommand\item\olditem}, } \newcommand{\changeitem}{% \let\olditem\item \renewcommand\item[1]{\olditem (##1) \circ } } ``` But both examples did not achieve the result I wanted.
https://tex.stackexchange.com/users/286979
Add symbol after the lable of every description item
true
Adapted from [Append something to the label item using enumitem?](https://tex.stackexchange.com/questions/170736): ``` \documentclass{article} \usepackage{enumitem} \newcommand{\addcircle}[1]{#1 $\circ$} \setlist[description]{% font=\addcircle} \begin{document} \begin{description} \item [item1] a first item \item [item2] a second item \end{description} \end{document} ```
1
https://tex.stackexchange.com/users/216203
684964
317,773
https://tex.stackexchange.com/questions/660589
3
I use `\acrshort` for acronyms I've defined with the package `glossaries`. I want to keep the hyperref link for acronyms but I would like to change the colour : black for acronyms when they appear in text and keep blue for other hyperlinks. I found the command `\renewcommand` but I don't manage to use it properly I guess. I tried: `\renewcommand*{\acrshort}[1]{\textcolor{black}{#1}}` Here's a MWE, I tried to delete as much as possible what was not needed. ``` \documentclass[a4paper,12pt,twoside, openright]{book} %\pdfobjcompresslevel 0 % Language packages \usepackage[utf8]{inputenc} \usepackage[T1]{fontenc} \usepackage[frenchb, english]{babel} \usepackage[]{csquotes} \usepackage{lipsum} \usepackage[usenames,dvipsnames]{color} \usepackage{colortbl} \usepackage[backref = page, bookmarks = true, colorlinks = true, linkcolor = RoyalBlue, citecolor = RoyalBlue]{hyperref} % citation \usepackage{tcolorbox} \definecolor{mylightblue1}{RGB}{235, 242, 249} % light blue for boxes \definecolor{mylightblue2}{RGB}{118, 166, 214} % contour for boxes %%%%%%%%%%%%%%%%%%%%%%%%%% \usepackage[acronym]{glossaries} \newacronym{mqi}{MQI}{\textit{Morphological Quality Index}} \makeglossaries \usepackage[graphicx]{realboxes} \usepackage[ruled,vlined]{algorithm2e} \usepackage{times} % Biblio \usepackage{natbib} \bibliographystyle{apalike-fr} % Start of script \begin{document} \lipsum[1-2] The \acrshort{mqi} is new a morphological index used in Italy to measure the morphological status of waterbodies. \end{document} ```
https://tex.stackexchange.com/users/188799
Change colour of acronyms only with glossaries package
false
I just came across this - if you don't capitalize the color it works perfectly! I just made one line in the package header like this: ``` \usepackage[acronym]{glossaries}\renewcommand*{\glstextformat}[1]{\textcolor{black}{#1}} ```
1
https://tex.stackexchange.com/users/296484
684966
317,774
https://tex.stackexchange.com/questions/684953
1
I am trying to use `\l_tmpa_tl` in the `align` environment. The requirements are to set the variable *inside* of `align` and use `&`. The current result shows `x=` leaving the right-hand side of the equal sign empty. In case the variable is assigned outside the `align` environment, or `&` is omitted, it works as expected. I kindly ask why this is occurring and how to fix? ``` \documentclass{article} \usepackage{amsmath} \ExplSyntaxOn \NewDocumentCommand{\mycmd}{}{ \begin{align} \tl_set:Nn \l_tmpa_tl {1} x &=\l_tmpa_tl \end{align} } \ExplSyntaxOff \begin{document} \mycmd \end{document} ```
https://tex.stackexchange.com/users/167081
LaTeX 3 - Using the align environment with scratch variables
false
Your question is: why `&` breaks the pattern? The answer is here. The align environment is based on `\halign` TeX primitive. Each item in the data part of `\halign` (separated by `&`) is packed into `\hbox` and `\hbox` opens TeX group, reads the horizontal list and closes TeX group. This is reason, why each part between `&` is processed in a single group. Each assignment (including `\tl_set:Nn` which is nothing else than `\def` primitive) is local, i.e. the value is set only in the scope of the group. Note that `\tl_gset:Nn` is equal to `\gdef` primitive and this assignment is global, independent of the groups.
6
https://tex.stackexchange.com/users/51799
684977
317,780
https://tex.stackexchange.com/questions/684978
2
I want to define in a `\foreach` loop a bunch of coordinates in terms of previously defined coordinates: ``` \documentclass[tikz]{standalone} \begin{document} \begin{tikzpicture} \coordinate (A0) at (0,0); \foreach \i in {1,...,10}{ \def\j{\i-1} \coordinate (A\i) at A(\j)+(5*\i,\i*\i); } \end{tikzpicture} \end{document} ``` However, this does not seem to work, because (as I understand it), TikZ does not evaluate `\j-1`. Is there a way to fix this? I would like to avoid copy pasting the same code over and over again.
https://tex.stackexchange.com/users/295779
Defining coordinates in `foreach`
true
You have to use `evaluate`. And I suppose that with `A(\j)` you intended `(A\j)`: ``` \documentclass[tikz]{standalone} \begin{document} \begin{tikzpicture} \coordinate (A0) at (0,0); \foreach[evaluate=\i as \j using int(\i-1)] \i in {1,...,10}{ \coordinate (A\i) at (A\j)+(5*\i,\i*\i); } \end{tikzpicture} \end{document} ```
4
https://tex.stackexchange.com/users/101651
684981
317,782
https://tex.stackexchange.com/questions/684978
2
I want to define in a `\foreach` loop a bunch of coordinates in terms of previously defined coordinates: ``` \documentclass[tikz]{standalone} \begin{document} \begin{tikzpicture} \coordinate (A0) at (0,0); \foreach \i in {1,...,10}{ \def\j{\i-1} \coordinate (A\i) at A(\j)+(5*\i,\i*\i); } \end{tikzpicture} \end{document} ``` However, this does not seem to work, because (as I understand it), TikZ does not evaluate `\j-1`. Is there a way to fix this? I would like to avoid copy pasting the same code over and over again.
https://tex.stackexchange.com/users/295779
Defining coordinates in `foreach`
false
Here is a solution who relies on computing `\i-1` previously to correctly define `(A\j)` by using `\pgfmathparse` and `\pgfmathresult`. The translation by `(5*\i,\i*\i)` are shifted with the corresponding options. ``` \documentclass[tikz]{standalone} \begin{document} \begin{tikzpicture} \coordinate (A0) at (0,0); \foreach \i in {1,...,10}{ \pgfmathparse{\i-1} \def\j{\pgfmathresult} \coordinate (A\i) at ([xshift={5*\i}, yshift={\i*\i}]A\j); %Test % \node (A\i) at ([xshift={5*\i}, yshift={\i*\i}]A\j); } \end{tikzpicture} \end{document} ```
2
https://tex.stackexchange.com/users/169294
684982
317,783
https://tex.stackexchange.com/questions/684953
1
I am trying to use `\l_tmpa_tl` in the `align` environment. The requirements are to set the variable *inside* of `align` and use `&`. The current result shows `x=` leaving the right-hand side of the equal sign empty. In case the variable is assigned outside the `align` environment, or `&` is omitted, it works as expected. I kindly ask why this is occurring and how to fix? ``` \documentclass{article} \usepackage{amsmath} \ExplSyntaxOn \NewDocumentCommand{\mycmd}{}{ \begin{align} \tl_set:Nn \l_tmpa_tl {1} x &=\l_tmpa_tl \end{align} } \ExplSyntaxOff \begin{document} \mycmd \end{document} ```
https://tex.stackexchange.com/users/167081
LaTeX 3 - Using the align environment with scratch variables
true
The instruction `\tl_set:Nn \l_tmpa_tl {xyz}` is an *assignment*, just like `\int_incr:N \l_tmpa_int`, `\dim_set:Nn \l_tmpa_dim { 1pt }`. There are many kinds of assignments and it's actually mostly unimportant to know how `expl3` deals with them. Of course, they'll be ultimately done with one of the primitive TeX assignments. Assignments can be *global* or *local* and the programming guidelines for `expl3` are quite fussy in requiring that variables are declared with a `g` or `l` prefix that specifies whether the variable is used in local or global assignments. But the name is just a name and it's the programmer who's in charge of using the correct assignment command. The first three examples above are *local* assignments, but I'll add one more ``` \tl_set:Nn \l_tmpa_tl {xyz} \int_incr:N \l_tmpa_int` \dim_set:Nn \l_tmpa_dim { 1pt } \tl_set_eq:NN \l_tmpa_tl \g_tmpb_tl ``` All the variables should have been declared before being set. I added the last example to show that a global variable `\g_tmpb_tl` may be used in the context of a local assignment: the variable `\l_tmpa_tl` is *locally* made equal to `\g_tmpb_tl`. The corresponding *global* assignments would be ``` \tl_gset:Nn \g_tmpa_tl {xyz} \int_gincr:N \g_tmpa_int` \dim_gset:Nn \g_tmpa_dim { 1pt } \tl_gset_eq:NN \g_tmpa_tl \g_tmpb_tl ``` But the question remains: what's the difference? A local assignment will affect the variable's value only in the current group and the value will be reset to the previous one when the group ends. This doesn't happen with global assignments: the value will be set at all group levels. What's a group? Well, this requires some knowledge on basic TeX concepts. A group can be initiated with `{` and will end at the matching `}` (but not when TeX is looking for the argument to a macro); or by `\group_begin:` (that's `\begingroup` in primitive form) and will end at the matching `\group_end:` (that's `\endgroup`); or by `\left`, ending at the matching `\right` (or `\middle`, which is basically implemented as `\right.\left`). LaTeX environments start with `\begin` that will issue `\group_begin:`; the corresponding `\end` issues the matching `\group_end:`, so this is why LaTeX environments form groups. But groups are initiated also in other situations, the most important being *boxes*. When you start collecting material to be set in a box, be it `\hbox:n` or `\vbox:n` or `\vtop:n`, but also when `\hbox_set:Nn` and similar functions, TeX will open a group, ending it when the `}` ending the collection is scanned. So with ``` \tl_set:Nn \l_tmpa_tl {a} \hbox:n { \tl_set:Nn \l_tmpa_tl {b} \tl_use:N \l_tmpa_tl } \tl_use:N \l_tmpa_tl ``` you'll get “ba”. The token list variable is set to “b” inside the box, but when the box ends, the previous value is restored. To the contrary, with ``` \tl_gset:Nn \g_tmpa_tl {a} \hbox:n { \tl_gset:Nn \g_tmpa_tl {b} \tl_use:N \g_tmpa_tl } \tl_use:N \g_tmpa_tl ``` you'll get “bb”, because the assignment inside the box is global. But what's the connection with your problem? It has to do with alignments. You can think that, when TeX is collecting material for a cell in an alignment (be it `tabular`, `array`, `align`, `split`, `aligned`, `cases` and so on), it does a special operation ``` \hbox_set_ALIGNMENT:n { ... } ``` No, there is no such function: the real one is not accessible to the user and is only available at the deep TeX levels where typesetting is done. The made-up name is just to underline that ***each alignment cell*** is inside a group. Now you see wher your problem lies: the material after `\begin{align}` up to `&` is inside a group and the assignment `\tl_set:Nn \l_tmpa_tl {1}` is forgotten as soon as `&` is scanned and the alignment box is built. #### Additional bits Also declaring a variable is an assignment. For instance ``` \tl_new:N \l_jumaily_foo_tl \int_const:Nn \c_jumaily_foo_int { 42 } ``` You can think to the former as the creation of a *pointer* to a variable. The pointer and so the variable are created *globally*, so after the first declaration, the token list variable `\l_jumaily_foo_tl` will be available at all levels, but assignment of values to it should be local. The second instruction globally creates the constant and globally assigns a value to it.
1
https://tex.stackexchange.com/users/4427
684993
317,787
https://tex.stackexchange.com/questions/684990
2
I am using forest to draw data structures (in particular AVL- / (a,b)-trees). I want to draw connecting lines between all leaves automatically (so far I have manually named them and drawn lines using foreach statements, which is a bit annoying). The following somewhat works: ``` for tree={edge={->},if n children=0{}{treenode}}, for leaves={leafnode,tier=list,if={id()!=id("!rL")}{tikz={\draw[<->,thick,gray] () -- (!>);}}{}}, for root={rootnode} [5 & 19,align=cc [5] [19] [$\infty$] ] ``` (the `id()!=id("!rL")` is the only way I could come up with to detect whether the current leaf is not the last one, as there `!>` is not defined) However, I also want to animate insertion/deletion of nodes without changing the layout, i.e. add phantom nodes ``` for tree={edge={->},if n children=0{}{treenode}}, for leaves={leafnode,tier=list,if={id()!=id("!rL")}{tikz={\draw[<->,thick,gray] () -- (!>);}}{}}, for root={rootnode} [5,align=c [5] [,phantom] [$\infty$] ] ``` Now, the phantom node is still treated as the next (later non-existent) sibling, but I would want to draw a line from the node 5 to the $\infty$ node directly. Can I somehow search for the next non-phantom (or non-empty-content) sibling? I couldn't wrap my head around the `while` / `until` constructs of forest and examples seem to be sparse. EDIT: Abstractly, I think the question reduces to "how can I get a handle on the first node satisfying a criterion in a nodewalk" EDIT2: MWE ``` \documentclass{article} \usepackage{tikz,forest} \begin{document} \tikzset{box/.style={draw,rectangle,minimum height=0.7cm,minimum width=1cm}} \begin{forest} for tree={edge={->},anchor=north,box}, for leaves={tier=list,if={id()!=id("!rL")}{tikz={\draw[<->] () -- (!>);}}{}}, [x [a] [b] [c] ] \end{forest} \end{document} ```
https://tex.stackexchange.com/users/32779
Forest: Search for a node matching criterion
false
After posting I stumbled upon the `define long step` example in the forest doc. This does seem to work: ``` \documentclass{article} \usepackage{tikz,forest} \begin{document} \tikzset{box/.style={draw,rectangle,minimum height=0.7cm,minimum width=1cm}} \forestset{ define long step={nextleaf}{n args=0}{do while={>{O}{phantom}}{next on tier}}, connect leaves/.style={delay={if={>{O!P&}{phantom}{id()!=id("!rL")}}{tikz={\draw[-] () -- (!nextleaf);}}{}}} } \begin{forest} for tree={anchor=north,box}, for leaves={tier=list,connect leaves} [x [a] [b] [c] ] \end{forest} \end{document} ``` But I still can't figure out a nicer way check if the current node is on the end of the tree.
2
https://tex.stackexchange.com/users/32779
684997
317,789
https://tex.stackexchange.com/questions/653428
2
I want to insert a file path containing a `ß`. Therefore I want to use the `\path{}`-command from the `hyperref`-package to set it correctly (i.e. not to replace all `\` by `/`). However, my file path contains a German "umlaut" and so I get a wrong result. How can I tell `hyperref`, to read the `ß` as a symbol and not as its two-byte UTF-8 representative? My code example: ``` \documentclass[ngerman]{scrartcl} \usepackage[utf8]{inputenc} \usepackage[T1]{fontenc} \usepackage{lmodern} \usepackage[ngerman=ngerman-x-latest]{hyphsubst} \usepackage[ngerman]{babel} % language \usepackage{hyperref} % include links \begin{document} Test ä, ö, ü und ß. \path{hier entlang... ß} \end{document} ``` The output of `Test ä, ö, ü und ß.` works well, but inside the `\path`-environment the `ß` is replaced by its two bytes. As I read, `hyperref` seems to read the input bytewise. How to tell `hyperref` to read "UTF-8" instead? I also checked that my code file itself is saved in UTF-8 properly.
https://tex.stackexchange.com/users/277972
ß inside \path{} of hyperref-package
false
`url` package (loaded by `hyperref`) provides `\path` as a variant of its `\url`. The way `\url` works is that it will detokenize its argument via usage of `\meaning`. This destroys the `pdflatex` (inputenc, now default in LaTeX) support for UTF-8 characters which relies on making some bytes active. Retokenizing the whole thing via `\scantokens` looks dangerous as after all the whole point is to handle special stuff such as `%`, and one would need to find the right time to it. As a less intrusive method let's add (I probably did not find the best entry-point, there is a `\Url@HyperHook` which perhaps could be considered, I took `\Url@actpercent` as entry point. You have to explicitly enumerate all characters you want to allow. I did not add interface for a comma separated input of many such characters, simply the main command for one character at a time. Proof of concept: ``` \documentclass[ngerman]{scrartcl} % \usepackage[utf8]{inputenc}% not needed with recent LaTeX \usepackage[T1]{fontenc} \usepackage{lmodern} \usepackage[ngerman=ngerman-x-latest]{hyphsubst} \usepackage[ngerman]{babel} % language \usepackage{hyperref} % include links \makeatletter \newcommand\userrescuethischarforurlcommand[1]{% \expandafter\user@rescuethischar\expandafter{\detokenize{#1}}{\hbox{#1}}% } \def\user@rescuethischar#1#2{% \g@addto@macro\Url@actpercent{\Url@Edit\Url@String{#1}{#2}}% } \makeatother \userrescuethischarforurlcommand{ß} \begin{document} Test ä, ö, ü und ß. \path{hier entlang... ß} \end{document} ``` produces The `\hbox` is as work-around to LaTeX not accepting some character commands in math mode, and `\url` uses underneath math mode. Extended example: ``` \userrescuethischarforurlcommand{ß} \userrescuethischarforurlcommand{ä} \userrescuethischarforurlcommand{ö} \userrescuethischarforurlcommand{ü} \begin{document} Test ä, ö, ü und ß. \path{hier entlang... äöüß} \end{document} ```
1
https://tex.stackexchange.com/users/293669
685007
317,791
https://tex.stackexchange.com/questions/685003
0
I typed a work using wx Maxima. I am really short on time. Is there a way I can convert wxmx/wxm file to LaTeX or PDF? Pls answers should be very basic (i.e a toddler can understand). Also this work includes long equations and matrices but no diagrams or tables, just plain text.Thanks.
https://tex.stackexchange.com/users/295796
Convert from wxmaxima to LaTeX
true
1 Export -------- The best way to do it seems to use `wxMaxima`'s `export` menu (File/Export). Example: Exporting this results in that: As you can see, the code generated is quite complex and certainly not intended to edit manually. ``` \documentclass[fleqn]{article} %% Created with wxMaxima 22.04.0 \setlength{\parskip}{\medskipamount} \setlength{\parindent}{0pt} \usepackage{iftex} \ifPDFTeX % PDFLaTeX or LaTeX \usepackage[utf8]{inputenc} \usepackage[T1]{fontenc} \DeclareUnicodeCharacter{00B5}{\ensuremath{\mu}} \else % XeLaTeX or LuaLaTeX \usepackage{fontspec} \fi \usepackage{graphicx} \usepackage{color} \usepackage{amsmath} \usepackage{grffile} \usepackage{ifthen} \newsavebox{\picturebox} \newlength{\pictureboxwidth} \newlength{\pictureboxheight} \newcommand{\includeimage}[1]{ \savebox{\picturebox}{\includegraphics{#1}} \settoheight{\pictureboxheight}{\usebox{\picturebox}} \settowidth{\pictureboxwidth}{\usebox{\picturebox}} \ifthenelse{\lengthtest{\pictureboxwidth > .95\linewidth}} { \includegraphics[width=.95\linewidth,height=.80\textheight,keepaspectratio]{#1} } { \ifthenelse{\lengthtest{\pictureboxheight>.80\textheight}} { \includegraphics[width=.95\linewidth,height=.80\textheight,keepaspectratio]{#1} } { \includegraphics{#1} } } } \newlength{\thislabelwidth} \DeclareMathOperator{\abs}{abs} \definecolor{labelcolor}{RGB}{100,0,0} \begin{document} \noindent %%%%%%%% %% INPUT: \begin{minipage}[t]{4.000000em}\color{red}\bfseries --\ensuremath{\ensuremath{>}} \end{minipage} \begin{minipage}[t]{\textwidth}\color{blue} R:\ s\ /\ phi;\\ D:\ (R-x)\ *\ (1-cos(phi)); \end{minipage} %%%% OUTPUT: \[\displaystyle \tag{R} \frac{s}{phi}\mbox{}\] \[\tag{D} \left( 1-\cos{(phi)}\right) \, \left( \frac{s}{phi}-x\right) \mbox{} \] %%%%%%%%%%%%%%%% \noindent %%%%%%%% %% INPUT: \begin{minipage}[t]{4.000000em}\color{red}\bfseries --\ensuremath{\ensuremath{>}} \end{minipage} \begin{minipage}[t]{\textwidth}\color{blue} trigreduce(\%); \end{minipage} %%%% OUTPUT: \[\displaystyle \tag{\% o6} \cos{(phi)} x-x-\frac{\cos{(phi)} s}{phi}+\frac{s}{phi}\mbox{} \] %%%%%%%%%%%%%%%% \noindent %%%%%%%% %% INPUT: \begin{minipage}[t]{4.000000em}\color{red}\bfseries --\ensuremath{\ensuremath{>}} \end{minipage} \begin{minipage}[t]{\textwidth}\color{blue} factor(\%); \end{minipage} %%%% OUTPUT: \[\displaystyle \tag{\% o7} \frac{\left( \cos{(phi)}-1\right) \, \left( phi x-s\right) }{phi}\mbox{} \] %%%%%%%%%%%%%%%% \noindent %%%%%%%% %% INPUT: \begin{minipage}[t]{4.000000em}\color{red}\bfseries --\ensuremath{\ensuremath{>}} \end{minipage} \begin{minipage}[t]{\textwidth}\color{blue} radcan(\%); \end{minipage} %%%% OUTPUT: \[\displaystyle \tag{\% o8} \frac{\left( phi \cos{(phi)}-phi\right) x+\left( 1-\cos{(phi)}\right) s}{phi}\mbox{} \] %%%%%%%%%%%%%%%% \noindent %%%%%%%% %% INPUT: \begin{minipage}[t]{4.000000em}\color{red}\bfseries --\ensuremath{\ensuremath{>}} \end{minipage} \begin{minipage}[t]{\textwidth}\color{blue} delta:\ (1-cos(phi))\ *\ s/phi\ -\ (1\ -\ cos(phi)/phi); \end{minipage} %%%% OUTPUT: \[\displaystyle \tag{delta} \frac{\left( 1-\cos{(phi)}\right) s}{phi}+\frac{\cos{(phi)}}{phi}-1\mbox{} \] %%%%%%%%%%%%%%%% \noindent %%%%%%%% %% INPUT: \begin{minipage}[t]{4.000000em}\color{red}\bfseries --\ensuremath{\ensuremath{>}} \end{minipage} \begin{minipage}[t]{\textwidth}\color{blue} trigsimp(delta); \end{minipage} %%%% OUTPUT: \[\displaystyle \tag{\% o14} -\frac{\left( \cos{(phi)}-1\right) s-\cos{(phi)}+phi}{phi}\mbox{} \] %%%%%%%%%%%%%%%% \end{document} ``` 2 Listings ---------- As an alternative you can use package `listing` to copy equations into your Latex editor, like below. HOWEVER, this one still doesn't compile because you have to remove all multiplication dots. It may be useful on occasion. (You may want to chose a different language than PHP. Have a look into the manual.) ``` \documentclass[10pt,a4paper]{article} \usepackage{listings} \begin{document} \lstset{language=PHP,breaklines=true} \begin{lstlisting} --> R: s / phi; D: (R-x) * (1-cos(phi)); (R) s/phi (D) (1-cos(phi))(s/phi-x) --> trigreduce(%); (%o6) cos(phi)x-x-(cos(phi) s)/phi+s/phi --> factor(%); (%o7) ((cos(phi)-1)·(phi·x-s))/phi --> radcan(%); (%o8) ((phi·cos(phi)-phi)x+(1-cos(phi))·s)/phi --> delta: (1-cos(phi)) * s/phi - (1 - cos(phi)/phi); (delta) ((1-cos(phi))·s)/phi+cos(phi)/phi-1 --> trigsimp(delta); (%o14) -((cos(phi)-1)·s-cos(phi)+phi)/phi \end{lstlisting} \end{document} ``` 3 pdf ----- Just print your wxmx file (File/Print). To do so your system needs to have a pdf-printer installed. Don't know, how good or bad the pdfs will be.
0
https://tex.stackexchange.com/users/245790
685009
317,792
https://tex.stackexchange.com/questions/16466
100
I want to have a vector with a superscript: ``` \vec{o}^t ``` But this gives very bad results: the t is overlapping with the vector arrow. How do I fix this (and why does this give bad results in the first place) ?
https://tex.stackexchange.com/users/5066
vector arrow with superscript
false
You just have to put y into the whole bracket like: ``` \vec{o^t} ``` This should give a result like:
0
https://tex.stackexchange.com/users/296517
685010
317,793
https://tex.stackexchange.com/questions/684990
2
I am using forest to draw data structures (in particular AVL- / (a,b)-trees). I want to draw connecting lines between all leaves automatically (so far I have manually named them and drawn lines using foreach statements, which is a bit annoying). The following somewhat works: ``` for tree={edge={->},if n children=0{}{treenode}}, for leaves={leafnode,tier=list,if={id()!=id("!rL")}{tikz={\draw[<->,thick,gray] () -- (!>);}}{}}, for root={rootnode} [5 & 19,align=cc [5] [19] [$\infty$] ] ``` (the `id()!=id("!rL")` is the only way I could come up with to detect whether the current leaf is not the last one, as there `!>` is not defined) However, I also want to animate insertion/deletion of nodes without changing the layout, i.e. add phantom nodes ``` for tree={edge={->},if n children=0{}{treenode}}, for leaves={leafnode,tier=list,if={id()!=id("!rL")}{tikz={\draw[<->,thick,gray] () -- (!>);}}{}}, for root={rootnode} [5,align=c [5] [,phantom] [$\infty$] ] ``` Now, the phantom node is still treated as the next (later non-existent) sibling, but I would want to draw a line from the node 5 to the $\infty$ node directly. Can I somehow search for the next non-phantom (or non-empty-content) sibling? I couldn't wrap my head around the `while` / `until` constructs of forest and examples seem to be sparse. EDIT: Abstractly, I think the question reduces to "how can I get a handle on the first node satisfying a criterion in a nodewalk" EDIT2: MWE ``` \documentclass{article} \usepackage{tikz,forest} \begin{document} \tikzset{box/.style={draw,rectangle,minimum height=0.7cm,minimum width=1cm}} \begin{forest} for tree={edge={->},anchor=north,box}, for leaves={tier=list,if={id()!=id("!rL")}{tikz={\draw[<->] () -- (!>);}}{}}, [x [a] [b] [c] ] \end{forest} \end{document} ```
https://tex.stackexchange.com/users/32779
Forest: Search for a node matching criterion
true
Here's two ways to do this. Both deploy the same basic idea: we visit the non-phantom leaves, use `alias'=last` to remember the previously visited node and get the `id` of the previous node into the `tikz` code using `.process` handler. (We only draw when `last` points to a valid node, this is checked by `if nodewalk valid`, and we initialize `last` to an invalid node at the start.) The first way uses `where` to visit the non-phantom leaves. The first argument is a `pgfmath` expression. A combination of `where n children` and `if phantom` would work as well. (Note that `where` is technically speaking not a nodewalk.) ``` \documentclass{article} \usepackage{forest} \begin{document} \tikzset{box/.style={draw,rectangle,minimum height=0.7cm,minimum width=1cm}} \begin{forest} for tree={edge={->},anchor=north,box}, % We delay to process the "phantom"s in the tree first: delay={ % Set name "last" to an invalid node. Argh, cumbersome: for nodewalk={on invalid={fake}{id=0,alias'=last}}{}, % Visit the non-phantom leaves: where={n_children==0 && !phantom}{ if nodewalk valid={name=last}{% Do we have the "last" node? % Yes. Identifying the current node inside \draw is not a problem: % "()". Possibly the best way to refer to the last node inside TikZ % code (which is executed much much later) is to paste its "id" there. % In ".process", "O" gets the option (name.option), and "w" injects % that into the code as "#1". tikz+/.process=Ow {last.id}{ \draw[red, thick]()--(!id=#1); }, }{% The "false" branch of "if nodewalk valid". }, % Name the current node as last. alias'=last, }{% The "false" branch of "where". }, }, [x [a] [b] [,phantom] [c] ] \end{forest} \end{document} ``` The second way uses a real nodealk. We `filter` nodewalk `leaves` using `pgfmath` expression `!phantom`. ``` \documentclass{article} \usepackage{forest} \begin{document} \tikzset{box/.style={draw,rectangle,minimum height=0.7cm,minimum width=1cm}} \begin{forest} for tree={edge={->},anchor=north,box}, delay={ for nodewalk={on invalid={fake}{id=0,alias'=last}}{}, % Filtering: walk the leaves of the tree, and step on those that are not phantom. for filter={leaves}{!phantom}{ if nodewalk valid={name=last}{ tikz+/.process=Ow {last.id}{ \draw[red, thick]()--(!id=#1); }, }{}, alias'=last, }, }, [x [a] [b] [,phantom] [c] ] \end{forest} \end{document} ```
4
https://tex.stackexchange.com/users/16819
685013
317,794
https://tex.stackexchange.com/questions/596341
2
To implement the approach discussed here: [Automatic detection of Overleaf for fallback images](https://tex.stackexchange.com/questions/596258/automatic-detection-of-overleaf-for-fallback-images) I wanted to give my tikz-files their own names, such that I can either include the tikz-file when compiling locally or the pdf-file when working on overleaf (which is significantly easier when knowing the file name of the PDF beforehand). Therefore, I included `tikzsetnextfilename` in my tikzfiles. Unfortunately, that seems to disable the scaling possibility given by `includegraphics` and `tikzscale`. As example, with two files `main.tex` and `sub.tikz`: main.tex: ``` \documentclass{article} \usepackage{standalone} \usepackage{tikz} \usetikzlibrary{external} \usepackage{pgfplotstable} \usepackage{pgfplots} \usepackage{filecontents} \usepackage{tikzscale} \begin{filecontents*}{file1.dat} x y 0 0 1 1 2 2 3 3 4 4 5 5 \end{filecontents*} \usepackage{subcaption} \tikzexternalize[prefix=tikz-cache/] \tikzset{external/force remake} \usetikzlibrary{pgfplots.groupplots} \pgfplotsset{every axis/.append style={ label style={font=\footnotesize\bfseries}, tick label style={font=\footnotesize}, legend style={font=\footnotesize} }, y axis/.append style={align=center}} \tikzset{Line Label/.style={font=\footnotesize,scale=2}} \newcommand{\figurefontsize}{\footnotesize} \begin{document} \begin{figure}[htpb] \centering \includegraphics[width=7\linewidth]{sub.tikz} \caption{Image I} \end{figure} \end{document} ``` sub.tikz: ``` \pgfplotstableread{file1.dat}{\tablea} \tikzsetnextfilename{sub} \begin{tikzpicture} \begin{axis}[ ymin=0, ymax=30, xmin=0, xmax=5, xlabel={$x$}, ylabel={$y$}, grid=major, legend entries={\(y_1\),\(y_2\),\(y_1+y_2\)}, legend pos = north west ] % Select appropriate columns \addplot [blue, mark=*] table [x=x,y=y] {\tablea}; \end{axis} \end{tikzpicture} ``` When disabling tikzsetnextfilename, scaling works, and the graph is scaled appropriately. Enabling it leads to a fixed scaling factor of 1, though, without any log errors or warnings. Is there a solution or an explanation (or possibly both)?
https://tex.stackexchange.com/users/61517
Using tikzsetnextfilename for naming external tikz-files disables tikzscale
false
For me, moving `\tikzsetnextfilename{extname}` out and before the `\includegraphics[opts]{filename.tikz}`, rather than having it *inside* `filename.tikz` solved the problem.
0
https://tex.stackexchange.com/users/87996
685018
317,796
https://tex.stackexchange.com/questions/43008
316
What is the "best LaTeX practices" for writing absolute value symbols? Are there any packages which provide good methods? Some options include `|x|` and `\mid x \mid`, but I'm not sure which is best...
https://tex.stackexchange.com/users/9757
Absolute Value Symbols
false
``` \documentclass[a4paper,12pt]{article} \usepackage[utf8]{inputenc} \usepackage{amsmath} \usepackage{amsfonts} \usepackage{amssymb} \usepackage{esvect,commath} \author{Nguyễn Văn Minh Hiếu} \begin{document} $\overrightarrow{AB}$\\ $\abs{\vv{AB}}$\\ $\abs[1]{\vv{a}}+\abs[1]{\vv{b}}=\abs[1]{\vv{c}}$\\ \end{document} ```
0
https://tex.stackexchange.com/users/142618
685022
317,797
https://tex.stackexchange.com/questions/685015
0
Basically I have the problem that theorem, examples, lemmas etc. are numbered with the same numbering, while definitions have a numbering of their own. E.g. typing \begin{definiton} gives me Definition 1.1, now typing \begin{theorem} twice gives me Theorem 1.1 and 1.2 respectively. MWE: ``` \documentclass{article} \graphicspath{ {/images/.} } \newtheorem{theorem}{Theorem}[section] \newtheorem{corollary}{Corollary}[theorem] \newtheorem{lemma}[theorem]{Lemma} \theoremstyle{definition} \newtheorem{exmp}{Example}[section] \theoremstyle{definition} \newtheorem{definition}{Definition}[section] \theoremstyle{remark} \newtheorem*{remark}{Remark} \begin{Definition} This gives me Definition 1.1 \end{Definition} \begin{Theorem} This only gives me Theorem 1.1. \end{Theorem} \begin{Remark} This gives me Remark 1.2, since Theorem 1.1 already exists before it. \end{Remark} \end{document} ```
https://tex.stackexchange.com/users/296514
How to change that the numbering of theorem and definitons stays consistent?
false
It is unclear what you want to achieve, but in any case your MWE cannot possibly compile: among other issues, it lacks loading `amsthm`, it omits `\begin{document}`, and inconsistently uses `Theorem` when it should be `theorem` and vice versa. Are you trying to use a single sequence of numbers within each section for all kinds of numbered theorem-like environments? If so, the following should achieve this: ``` \documentclass{article} \usepackage{amsthm} \newtheorem{theorem}{Theorem}[section] \newtheorem{corollary}[theorem]{Corollary} \newtheorem{lemma}[theorem]{Lemma} \theoremstyle{definition} \newtheorem{exmp}[theorem]{Example} \theoremstyle{definition} \newtheorem{definition}[theorem]{Definition} \theoremstyle{remark} \newtheorem*{remark}{Remark} \begin{document} \section{The section} \begin{definition} This gives me Definition 1.1 \end{definition} \begin{lemma} A preliminary result. \end{lemma} \begin{theorem} This only gives me Theorem 1.1. \end{theorem} \begin{corollary} A consequence of the preceding theorem. \end{corollary} \begin{remark} This gives me an unnumbered remark. \end{remark} \end{document} ```
0
https://tex.stackexchange.com/users/13492
685026
317,799
https://tex.stackexchange.com/questions/653428
2
I want to insert a file path containing a `ß`. Therefore I want to use the `\path{}`-command from the `hyperref`-package to set it correctly (i.e. not to replace all `\` by `/`). However, my file path contains a German "umlaut" and so I get a wrong result. How can I tell `hyperref`, to read the `ß` as a symbol and not as its two-byte UTF-8 representative? My code example: ``` \documentclass[ngerman]{scrartcl} \usepackage[utf8]{inputenc} \usepackage[T1]{fontenc} \usepackage{lmodern} \usepackage[ngerman=ngerman-x-latest]{hyphsubst} \usepackage[ngerman]{babel} % language \usepackage{hyperref} % include links \begin{document} Test ä, ö, ü und ß. \path{hier entlang... ß} \end{document} ``` The output of `Test ä, ö, ü und ß.` works well, but inside the `\path`-environment the `ß` is replaced by its two bytes. As I read, `hyperref` seems to read the input bytewise. How to tell `hyperref` to read "UTF-8" instead? I also checked that my code file itself is saved in UTF-8 properly.
https://tex.stackexchange.com/users/277972
ß inside \path{} of hyperref-package
false
Let's add some support for the UTF-8 prefix `0xC3`. Other prefixes can be added in a similar way. ``` \documentclass{article} \usepackage[T1]{fontenc} \usepackage{lmodern}% less ugly ß \usepackage{url} \AddToHook{cmd/Url@OT1encSpecials/after}{\do\^^c3{\checknextCthree}} \AddToHook{cmd/Url@T1encSpecials/after}{\do\^^c3{\checknextCthree}} \newcommand{\checknextCthree}[1]{\mbox{\UrlFont\csname u8:\string^^c3\string#1\endcsname}} \begin{document} Test ä, ö, ü und ß. \path{hier entlang... ß} \end{document} ``` I removed all inessential bits. Two additions are necessary in order to also support OT1.
3
https://tex.stackexchange.com/users/4427
685030
317,801
https://tex.stackexchange.com/questions/685035
1
I have a Tikz graph of a step function which I'm trying to draw, and I think most of it is boiler-plate, but the part that I wrote which isn't working as I'd hoped is: ``` \foreach \i in {0,1,...,5} \draw[domain=(\i*0.5):((\i+1)*0.5),variable=\x] plot ({\x},{\i*2/5}) node[right] at (((\i+1)*0.5), (\i*2/5)) {$v=\i \cdot 2/5$}; ``` When the last line, `node[right]...` is removed, it draws as expected, but when this line is included, it breaks things. The puzzling thing to me is that I wrote this for-loop to abstract a previous implementation where I wrote each line individually. When the lines were written individually, this `node[right]...` stuff did work! So I'm not sure what about abstracting it into a for-loop caused it to break. --- Anyway, my main guess as to what is going wrong is something to do with how Tikz is grouping expressions. So I figured I might be able to fix this by simply declaring a variable `\j` set equal to `\i+1` and then perhaps it this will help it to track what is where in the expression better. But after a bit of googling I haven't seen anyone explain how to declare variables in Tikz or more specifically inside of a foreach loop. --- If it helps, though, here is the rest of the drawing: ``` \begin{tikzpicture}[xscale=1.5,yscale=4] \draw [very thin, gray!30, step=0.5cm] grid (3.9,2.1); \draw [thick] [->] (-0.2,0)--(4.2,0) node[right, below] {$t$}; \foreach \x in {0.5,...,3.5} \draw[xshift=\x cm, thick] (0pt,-1pt)--(0pt,1pt) node[yshift=-0.5cm] {$\x$}; \draw [thick] [->] (0,-0.2)--(0,2.2) node[above, left] {$v$}; \foreach \y in {0,0.5,...,2} \draw[yshift=\y cm, thick] (-1pt,0pt)--(1pt,0pt) node[left] {$\y$}; % \draw [domain=0:0.5, variable=\x] plot ({\x}, {0}) node[below right] at (0.4,0.15) {$v=0$}; % The above, in the comment, isn't quite right but it's an example of something that works when not abstracted into the foreach below. \foreach \i in {0,1,...,5} \draw[domain=(\i*0.5):((\i+1)*0.5),variable=\x] plot ({\x},{\i*2/5}) node[right] at (((\i+1)*0.5), (\i*2/5)) {$v=\i \cdot 2/5$}; \end{tikzpicture} ```
https://tex.stackexchange.com/users/62274
Declaring variables in Tikz
true
Perhaps this code solve your problem: ``` \foreach \i in {0,1,...,5} { \pgfmathsetmacro{\j}{\i*2/5} % <-- added to declare the \j variable \draw[domain=(\i*0.5):((\i+1)*0.5),variable=\x] plot ({\x},{\j}) node[right] () {$v=\j$}; } ```
2
https://tex.stackexchange.com/users/24644
685037
317,802
https://tex.stackexchange.com/questions/685033
4
I've tried so many fonts and none of them work, all I get is: ``` ! LaTeX Error: File `ebgaramond.sty' not found. ``` This is an example of what I have on my document, though I've tried many others: ``` \usepackage{fontspec} \usepackage{ebgaramond} ``` People have told me XeLaTeX or LuaLaTeX would have these fonts with `fontspec` right out of the box, but that doesn't seem to be the case at all. Here is my current version of XeLaTeX: ``` XeTeX 3.141592653-2.6-0.999995 (TeX Live 2023/Arch Linux) kpathsea version 6.3.5 Primary author of XeTeX: Jonathan Kew. Compiled with ICU version 72.1; using 72.1 Compiled with zlib version 1.2.13; using 1.2.13 Compiled with FreeType2 version 2.13.0; using 2.13.0 Compiled with Graphite2 version 1.3.14; using 1.3.14 Compiled with HarfBuzz version 7.1.0; using 7.2.0 Compiled with libpng version 1.6.39; using 1.6.39 Compiled with pplib version v2.05 less toxic i hope Compiled with fontconfig version 2.14.2; using 2.14.2 ``` And my version of LuaLaTeX: ``` This is LuaHBTeX, Version 1.16.0 (TeX Live 2023/Arch Linux) Development id: 7567 ``` Is there a command on either XeLaTeX or LuaLaTeX for installing fonts? What am I missing?
https://tex.stackexchange.com/users/64441
fontspec not finding fonts with neither XeLaTeX nor LuaLaTeX
true
``` luafindfont ebgaramond ``` will show you which Garamond are installed. If the output is empty you have to install the Garamond package: <https://www.ctan.org/pkg/ebgaramond> And with ``` \usepackage{fontspec} \setmainfont{EBGaramond-Regular.otf} ``` you can load Garamond without the *package* `ebgaramond`.
4
https://tex.stackexchange.com/users/187802
685040
317,803
https://tex.stackexchange.com/questions/685041
0
I encountered an issue with balancing the bibliography using the `flushend` package. When the `\printbibliography` command is located in the preamble (and in my case, the entire code is in the class file), `flushend` stops balancing the last column. If I still need to use `\printbibliography` as indicated, is there a way to work around this issue? ``` % !TeX program = lualatex % !TeX encoding = utf8 \documentclass[twocolumn]{article} \begin{filecontents*}{bibdata.bib} @InProceedings{Cao, author="Cao, Cheng and Caverlee, James", editor="Hanbury, Allan and Kazai, Gabriella and Rauber, Andreas and Fuhr, Norbert", title="Detecting Spam URLs in Social Media via Behavioral Analysis", booktitle="Advances in Information Retrieval", year="2015", publisher="Springer International Publishing", address="Cham", pages="703--714", } @article{Ramesh, title = {An efficacious method for detecting phishing webpages through target domain identification}, journal = {Decision Support Systems}, volume = {61}, pages = {12-22}, year = {2014}, issn = {0167-9236}, doi = {https://doi.org/10.1016/j.dss.2014.01.002}, url = {https://www.sciencedirect.com/science/article/pii/S0167923614000037}, author = {Gowtham Ramesh and Ilango Krishnamurthi and K. Sampath Sree Kumar}, } @misc{Xu, title={A Transformer-based Model to Detect Phishing URLs}, author={Pingfan Xu}, year={2021}, eprint={2109.02138}, archivePrefix={arXiv}, primaryClass={cs.CR} } @misc{Le, title={URLNet: Learning a URL Representation with Deep Learning for Malicious URL Detection}, author={Hung Le and Quang Pham and Doyen Sahoo and Steven C. H. Hoi}, year={2018}, eprint={1802.03162}, archivePrefix={arXiv}, primaryClass={cs.CR} } @article{Wolpert, title = {Stacked generalization}, journal = {Neural Networks}, volume = {5}, number = {2}, pages = {241-259}, year = {1992}, issn = {0893-6080}, doi = {https://doi.org/10.1016/S0893-6080(05)80023-1}, url = {https://www.sciencedirect.com/science/article/pii/S0893608005800231}, author = {David H. Wolpert}, } @inproceedings{Choi, author = {Choi, Hyunsang and Zhu, Bin B. and Lee, Heejo}, title = {Detecting Malicious Web Links and Identifying Their Attack Types}, year = {2011}, publisher = {USENIX Association}, address = {USA}, pages = {11}, numpages = {1}, location = {Portland, OR}, series = {WebApps'11} } \end{filecontents*} \usepackage{fontspec} \defaultfontfeatures{Ligatures={TeX}} \usepackage[math-style=TeX]{unicode-math} \usepackage[english]{babel} \usepackage{flushend} \usepackage{lipsum} \RequirePackage[backend=biber, % bibstyle=gost-numeric, maxnames = 10, babel=other, isbn=true, url=true, doi=true, % defernumbers=true, sorting=none, backend=biber, ]{biblatex} \addbibresource{bibdata.bib} \setlength\bibitemsep{0.5\itemsep} \setlength{\biblabelsep}{1ex} \AtEndDocument{ \printbibliography } \begin{document} \lipsum[1-6] \nocite{*} \end{document} ```
https://tex.stackexchange.com/users/66024
How to force balancing columns with bibliography if \printbibliography in \AtEndDocument command
true
the flushend package prepends code to `\enddocument` and that means that your code is too late. It would be better if flushend would use the hook too, then one could use a rule to get the right order: ``` \documentclass[twocolumn]{article} \begin{filecontents*}{bibdata.bib} @InProceedings{Cao, author="Cao, Cheng and Caverlee, James", editor="Hanbury, Allan and Kazai, Gabriella and Rauber, Andreas and Fuhr, Norbert", title="Detecting Spam URLs in Social Media via Behavioral Analysis", booktitle="Advances in Information Retrieval", year="2015", publisher="Springer International Publishing", address="Cham", pages="703--714", } @article{Ramesh, title = {An efficacious method for detecting phishing webpages through target domain identification}, journal = {Decision Support Systems}, volume = {61}, pages = {12-22}, year = {2014}, issn = {0167-9236}, doi = {https://doi.org/10.1016/j.dss.2014.01.002}, url = {https://www.sciencedirect.com/science/article/pii/S0167923614000037}, author = {Gowtham Ramesh and Ilango Krishnamurthi and K. Sampath Sree Kumar}, } @misc{Xu, title={A Transformer-based Model to Detect Phishing URLs}, author={Pingfan Xu}, year={2021}, eprint={2109.02138}, archivePrefix={arXiv}, primaryClass={cs.CR} } @misc{Le, title={URLNet: Learning a URL Representation with Deep Learning for Malicious URL Detection}, author={Hung Le and Quang Pham and Doyen Sahoo and Steven C. H. Hoi}, year={2018}, eprint={1802.03162}, archivePrefix={arXiv}, primaryClass={cs.CR} } @article{Wolpert, title = {Stacked generalization}, journal = {Neural Networks}, volume = {5}, number = {2}, pages = {241-259}, year = {1992}, issn = {0893-6080}, doi = {https://doi.org/10.1016/S0893-6080(05)80023-1}, url = {https://www.sciencedirect.com/science/article/pii/S0893608005800231}, author = {David H. Wolpert}, } @inproceedings{Choi, author = {Choi, Hyunsang and Zhu, Bin B. and Lee, Heejo}, title = {Detecting Malicious Web Links and Identifying Their Attack Types}, year = {2011}, publisher = {USENIX Association}, address = {USA}, pages = {11}, numpages = {1}, location = {Portland, OR}, series = {WebApps'11} } \end{filecontents*} %\usepackage{fontspec} %\defaultfontfeatures{Ligatures={TeX}} %\usepackage[math-style=TeX]{unicode-math} \usepackage[english]{babel} \usepackage{flushend} \makeatletter \def\initialize@flushend{% %% %% Activates flushend package functionality. %% \global\let\saved@orig@@outputdblcol\@outputdblcol \global\let\balanced@@outputdblcol\last@outputdblcol % use hook instead of patching: \AddToHook{enddocument}[flushend]{\let\@outputdblcol\balanced@@outputdblcol}% \g@addto@macro\footnoterule{\vskip\z@}% \savingvdiscards=\@ne } \makeatother \usepackage{lipsum} \RequirePackage[backend=biber, % bibstyle=gost-numeric, maxnames = 10, babel=other, isbn=true, url=true, doi=true, % defernumbers=true, sorting=none, backend=biber, ]{biblatex} \addbibresource{bibdata.bib} \setlength\bibitemsep{0.5\itemsep} \setlength{\biblabelsep}{1ex} \AddToHook{enddocument}[my]{\printbibliography} \DeclareHookRule{enddocument}{my}{before}{flushend} %ensure that flushend is later \begin{document} \lipsum[1-6] \nocite{*} \end{document} ```
1
https://tex.stackexchange.com/users/2388
685045
317,806
https://tex.stackexchange.com/questions/685031
0
I have a trouble with this code: ``` \documentclass{article} \usepackage{mathtools} \begin{document} \begin{equation} \begin{split} a&=b+c\\& \begin{split} =c+d+e&\qquad\text{this is}\\ =f+g&\qquad\text{this is}\\ =h. \end{split} \end{split} \end{equation} \begin{equation} \begin{split} a&=b+c\qquad\text{this is}\\ &=f+g\qquad\text{this is}\\ &=h. \end{split} \end{equation} \end{document} ``` My problem is this: In first equation the =-signs are not left-aligned, and I'd like to have something like the second equation, keeping `\text{this is}` in the same alignment of last equation. I hope my question is clear. Thank you so much in advanced.
https://tex.stackexchange.com/users/244759
Trouble with split alignment in equations
true
You get no error from nesting `split` inside `split`, but no good output either. You can use `alignedat` instead of `split`. ``` \documentclass{article} \usepackage{mathtools} \begin{document} \begin{equation} \begin{alignedat}{2} a &= b+c\\ &= c+d+e &\qquad& \text{this is} \\ &= f+g && \text{this is} \\ &= h. \end{alignedat} \end{equation} \end{document} ``` Or, more simply, `aligned`.
2
https://tex.stackexchange.com/users/4427
685054
317,811
https://tex.stackexchange.com/questions/593370
3
There's a lot of data in these tables and I really do not want to copy paste it for a presentation. Can we somehow convert them to MS word tables?
https://tex.stackexchange.com/users/211290
Is there a quick way to convert Latex table to MS word/power point table?
false
I believe that opening your pdf with Word and having it auto convert the pdf into a readable word document is the fastest and easiest method for converting a LaTeX table into a word or powerpoint table. However, for completeness an alternative method is: <https://www.tablesgenerator.com/>. Go to File>From LaTeX code Then paste your Latex Code: Then, copy paste the table it creates into word or powerpoint and format as needed.
1
https://tex.stackexchange.com/users/296554
685070
317,817
https://tex.stackexchange.com/questions/685066
3
The following code writes the character width (cursor advance width), and the x and y coordinates of the glyph bounding box, to the log file. Here it is for letter "a" : ``` \documentclass[12pt]{article} % Compile with lualatex. \usepackage{fontspec} \setmainfont{Latin Modern Roman} \begin{document} \directlua{ local fontdata = font.getfont (font.current ()) local descriptions = fontdata.shared.rawdata.descriptions local glyphdata = descriptions [utf.byte ("a")] inspect (glyphdata) } \end{document} ``` Relevant part of the log file: ``` table={ ["boundingbox"]={ 34, -10, 474, 446 }, ["depth"]=10, ["height"]=446, ["index"]=28, ["name"]="a", ["unicode"]=97, ["width"]=490, } ``` That is correct, as determined by opening the font in Fontforge. The numerical value of the units is in terms of the design grid units. That would normally be 1000 per em for an OpenType font, but could be 1024, 2048, or 4096 for a TrueType font. It could even be none of those. My question: Using code similar to the above, how can I determine what font design grid units were used?
https://tex.stackexchange.com/users/287367
Luaotfload get font grid units
true
You can print `unit_per_em` value from the font table: ``` \directlua{ local fontdata = font.getfont (font.current ()) local unit = fontdata.units_per_em texio.write_nl("unit per em: ") texio.write(unit) texio.write_nl("") local descriptions = fontdata.shared.rawdata.descriptions local glyphdata = descriptions [utf.byte ("a")] inspect (glyphdata) } ```
5
https://tex.stackexchange.com/users/51799
685071
317,818
https://tex.stackexchange.com/questions/684970
0
I would like all my index entries to be in title case, though the argument of he index is not. `\index{john smith}` should result in "John Smith". How to achieve that?
https://tex.stackexchange.com/users/13651
Index in Title Case automatically
false
OK, this seems to work, but I have to define a new command ``` \newcommand*\myindex[1]{% \def\@myuppercasewords{\myuppercase@i#1 \@nil}% #1\index{#1@\@myuppercasewords}} \def\myuppercase@i#1 #2\@nil{% \mymacro{#1}% \ifx\\#2\\% \else \@ReturnAfterFi{% \space \myuppercase@i#2\@nil }% \fi} \long\def\@ReturnAfterFi#1\fi{\fi#1} ``` However it messes up the subentries (\index Tower!pisa}
0
https://tex.stackexchange.com/users/13651
685073
317,819
https://tex.stackexchange.com/questions/684291
1
I have an enumerate of questions. Each of those questions has some opening text and then a nested enumerate. I give an example below that results in a page-break in the middle of the second question in the PDF output. I mark with `\newpage` where I would like the page-break to be (automatically) inserted. In this particular example, I want the first question to be on page 1, and the second and third to be on page 2 (just because they both happen to fit). I also put my attempt commented out in below. I try to start a "samepage" environment right at the beginning of an `\item` and I try to end it at the end of the (nested) enumerate environment. The code seems to work on a simpler example, but in the current example it fails with the error `! LaTeX Error: \begin{samepage} on input line 56 ended by \end{center}.` In any case, my approach seemed fragile anyway so I'm hoping there's a better solution. I think the reason I find this hard is because of the way `\item` works. If it were `\item{contents}` then I think it would be easier to patch. That's why I tried to hack together an approach that hooks into the beginning of `\item` and end of `\enumerate`. I'm looking for a solution that can patch `\item` and base `enumerate` (rather than using `\newitem` or enumitem). i.e., I'm hoping that I can just drop some preamble code in. There are related questions. For example, [Page breaks within enumerated list](https://tex.stackexchange.com/questions/76483/page-breaks-within-enumerated-list) is related but is not about nested enumerates and also the solution seems to use enumitem. ``` \documentclass{article} \makeatletter %% my attempt: %\let\OldItem\item %\renewcommand{\item}{\OldItem \ifnum \@listdepth=1 \begin{samepage}\fi} %\AfterEndEnvironment{enumerate}{\ifnum \@listdepth=1 \end{samepage}\fi} \makeatother \begin{document} \begin{enumerate} \item 2 + 2 = ? \\ filler\\ filler\\ filler\\ filler\\ filler\\ filler\\ filler\\ filler\\ filler\\ filler\\ filler\\ filler\\ filler\\ filler\\ filler\\ filler\\ filler\\ filler\\ filler\\ filler\\ filler\\ filler\\ filler\\ filler\\ \begin{enumerate} \item 1 \item 2 \item 3 \item 4 \end{enumerate} % I do not want to put this page break in manually: % \newpage \item Consider the joint probability distribution below: filler\\ filler\\ filler\\ filler\\ filler\\ filler\\ filler\\ filler\\ \begin{center} \begin{tabular}{|ccc|} \hline & $X_{2}=0$ & $X_{2}=1$\tabularnewline \hline $X_{1}=0$ & $\frac{1}{10}$ & $\frac{3}{10}$\tabularnewline \hline $X_{1}=1$ & $\frac{2}{10}$ & $\frac{4}{10}$\tabularnewline \hline \end{tabular} \par\end{center} What is $P(X_{1}=1)$? \begin{enumerate} \item I do not know. \item 4 \item 17 \item 88 \end{enumerate} \item 2 - 2 + 5 = filler\\ filler\\ filler\\ filler\\ filler\\ filler\\ filler\\ filler\\ filler\\ filler\\ filler\\ filler\\ filler\\ filler\\ filler\\ filler\\ filler\\ filler\\ filler\\ \begin{enumerate} \item 1 \item 2 \item 3 \item 4 \end{enumerate} \end{enumerate} \end{document} ```
https://tex.stackexchange.com/users/12212
Prevent page break within \item of an enumerate
false
Is's a biy old style, but it works: ``` \def\RepItem#1{\OldItem\parbox[t]{\linewidth}{#1}} \documentclass{article} \usepackage{blindtext}% MWE only \usepackage{showframe}% alignment tool %\newcommand{\RepItem}[1]{\OldItem\parbox[t]{\linewidth}{#1}} \AtBeginEnvironment{enumerate}{\let\OldItem=\item% in case enumerate changes \item first \let\item=\RepItem \addtolength{\itemsep}{0pt plus 1fil}} % changes are local to enumerate, but could be passed to nested environments \begin{document} \begin{enumerate} \item\blindtext \item\blindtext \item\blindtext \item\blindtext \item\blindtext \end{enumerate} \end{document} ```
0
https://tex.stackexchange.com/users/136748
685075
317,820
https://tex.stackexchange.com/questions/685067
3
I recall seeing somewhere that registers 0-9 are to be used locally if they are even and globally if they are odd (or was it the other way around). Once you use a register globally, no one else can use it safely. You have essentially claimed that register for your exclusive use, which is what `\newlength`, `\newcount` and `\newsavebox` are for. If you **have** to use a register globally and don't want to tie one up permanently, I suggest you grab one from `\@freelist` and release it when done.
https://tex.stackexchange.com/users/34505
Registers 0-9 policies
true
The policy of using even-numbered scratch registers locally and odd-numbered ones globally was suggested by Knuth himself in the TeXbook. Here's the part where they are mentioned the first time (page 122): > > Sometimes, however, you want to use a register just for temporary > storage, and you know that it won't conflict with anybody else's macros. > Registers `\count255`, `\dimen255`, `\skip255`, `\muskip255`, and > `\toks255` are > traditionally kept available for such purposes. Furthermore, plain TeX > reserves `\dimen0` to `\dimen9`, `\skip0` to `\skip9`, `\muskip0` to > `\muskip9`, and `\box0` to `\box9` for “scratchwork”; these registers > are never allocated by the `\new...` operations. We have seen that > `\count0` through `\count9` are special, and `\box255` also turns out to > be special; so those registers should be avoided unless you know what you > are doing. > > > Knuth's more precise on page 346: > > *2. Allocation of registers.* The second major part of the > `plain.tex` file provides a foundation on which systems of independently > developed macros can coexist peacefully without interfering in their > usage of registers. The idea is that macro writers should abide by the > following ground rules: > > > (1) Registers numbered 0 to 9 are always free for > temporary “scratch” use, but their values are always assumed to be > clobbered whenever any other macro might get into control. (This applies > to registers like `\dimen0`, `\toks0`, `\skip1`, `\box3`, etc.; but TeX > has already reserved `\count0` through `\count9` for page number > identification.) > > > (2) The registers `\count255`, `\dimen255`, `\skip255`, > `\muskip255`, and `\toks255` are freely available in the same way. > > > (3) All assignments to the scratch registers whose numbers are > 1, 3, 5, 7, and 9 should be `\global`; all assignments to the > other scratch registers (0, 2, 4, 6, 8, 255) should be non-`\global`. > (This prevents the phenomenon of “save stack buildup” discussed > in Chapter 27.) > > > LaTeX follows the same rules, because the register allocation system is the same as in plain TeX. Well, it used to be, because now LaTeX also uses the extended range of registers, but for the ones up to 255 it's still essentially the same. Scratch registers are used quite extensively in the LaTeX kernel, particularly box registers. You can see an example of (global) usage of `\box1` in the code for `\bordermatrix`. There's little problem in using a register globally: the idea is that in such case, nothing that *might* use the same register can appear; typically something like ``` \setbox\tw@\vbox{\unvcopy\z@\global\setbox\@ne\lastbox}% ``` Here's a possible problem: you might have something that uses `\box1` in the matrix entries. Say you have a complicated symbol to be constructed with box registers and you need global assignments; so long as you *don't* rely on the contents of the box register across usages, you're safe. Otherwise, allocate a new register. Sometimes it happens that weird output is produced with local registers, because some macro uses the same registers. In such cases, adding a group level usually solves the issue. But LaTeX uses the extended range, with more than 32000 registers available for each type: in case of even small doubts, allocate a new register.
4
https://tex.stackexchange.com/users/4427
685086
317,828
https://tex.stackexchange.com/questions/685062
2
I'm playing a bit with the new `l3pdffield-testphase`. ``` \RequirePackage{pdfmanagement-testphase} \DocumentMetadata{uncompress} \documentclass[varwidth, margin = 5pt]{standalone} \usepackage{l3pdffield-testphase} % For some reason, l3color is not in TeXLive, but l3draw defines color macros \usepackage{l3draw} \ExplSyntaxOn \cs_set_eq:NN\pdffieldtextfield\pdffield_textfield:n % Manual definition taken from xcolor-material \color_set:nnn{MaterialOrange100}{HTML}{FFE0B2} \ExplSyntaxOff \begin{document} \pdffieldtextfield{V = {Test 1}, name = test1, backgroundcolor = MaterialOrange100, bordercolor = red, width = 4cm} \end{document} ``` I understand that fillable forms rely heavily on the viewer (the `chrome/chromium` internal pdf viewer does a pretty good job, whereas `evince` segfaults). But neither chrome nor evince can display neither the `backgroudcolor` nor the `bordercolor`. So, my question is: is the error on the viewer side or is it something that I don't understand with the new `l3color` color management or is it buggy for now?
https://tex.stackexchange.com/users/8425
Are background color and border color supported for pdf forms?
true
You would need to activate the `NeedAppearances` option to tell the pdfviewer that it should build up a "look". This can be done with ``` \pdfmanagement_add:nnn{Catalog/AcroForm}{NeedAppearances}{true} ``` But `NeedAppearances` is deprecated in pdf 2.0. The alternative is to add appearances (=small graphics) to the definition (l3draw is not required, you can also use tikz or whatever; in a current LaTeX it is no longer needed to load pdfmanagement-testphase explicitly, it is done by \DocumentMetadata): ``` \DocumentMetadata{} \documentclass[varwidth, margin = 5pt]{standalone} \usepackage{l3pdffield-testphase} \usepackage{l3draw} \ExplSyntaxOn \cs_set_eq:NN\pdffieldtextfield\pdffield_textfield:n \color_set:nnn{MaterialOrange100}{HTML}{FFE0B2} \pdffield_appearance:nn{cjorssen/textfield} { \draw_begin: \color_fill:n { MaterialOrange100 } \color_stroke:n { red } \draw_path_rectangle:nn { 0 , 0 } { 4cm , 12pt } \draw_path_use:n {fill} \draw_path_use:n {stroke} \draw_end: } \ExplSyntaxOff \begin{document} \pdffieldtextfield{V = {Test 1}, name = test1, appearance=cjorssen/textfield, width = 4cm} \end{document} ```
4
https://tex.stackexchange.com/users/2388
685091
317,830
https://tex.stackexchange.com/questions/685038
1
(Possibly related to [this](https://tex.stackexchange.com/questions/255543/are-tikzmark-and-tikzexternalize-incompatible-targeting-sub-nodes), but the example and the error are very different from what I've come up with. Plus it's a question from 2015, and the answers have been updated in 2017 and no later, so I expect things might have changed in the meanwhile.) Here's a MWE ``` \documentclass{article} \usepackage{tikz} \usetikzlibrary{ external, tikzmark } \tikzexternalize[only named=true, prefix=externalized/] \begin{document} \tikzsetnextfilename{green} \tikz{\draw[fill=green] (0,0) circle (12pt);}\dots A node: \tikzmarknode{NodeName}{TikZ mark node} % the following env is not actually necessary to trigger the error \begin{tikzpicture}[remember picture, overlay] \node[yshift=-0.9em] at (NodeName) {some text under it}; \end{tikzpicture} \end{document} ``` which errors like this ``` ... ===== Image 'externalized/green' is up-to-date. ====== ! Package tikz Error: Giving up on this path. Did you forget a semicolon?. See the tikz package documentation for explanation. Type H <return> for immediate help. ... l.16 A node: \tikzmarknode{NodeName}{TikZ mark node} [1{/usr/local/texlive/2023/texmf-var/fonts/map/pdftex/updmap/pdftex.map}<./exte rnalized/green.pdf>] (./externalizing.aux)) (see the transcript file for additional information) 413 words of node memory still in use: 3 hlist, 1 vlist, 1 rule, 2 glue, 3 kern, 1 glyph, 5 attribute, 48 glue_spec , 5 attribute_list, 2 write nodes avail lists: 2:179,3:87,4:10,5:24,6:4,7:196,9:78,11:2 </usr/share/fonts/OTF/lmroman10-regular.otf> Output written on externalizing.pdf (1 page, 5387 bytes). SyncTeX written on externalizing.synctex.gz. Transcript written on externalizing.log. ``` As the example should suggest, in my actual usecase, I use `\tikzmarknode` to have a way to position a tikz node with some text with respect to inline text. I'm not interested in externalizing this picture, even because it would not make sense, I think, as all it does is provide positioning. However, I do have other "ordinary" TikZ picture around that I do want to externalize. Therefore, the fact that commenting `\tikzexternalize` is enough to avoid the error is clearly not viable. The obvious solution, which I'm adopting so far, is to enclose every usage of `\tikzmarknode`+`tikzpicture` within `\tikzexternaldisable` and `\tikzexternalenable`, like this: ``` \documentclass{article} \usepackage{tikz} \usetikzlibrary{ external, tikzmark } \tikzexternalize[only named=true, prefix=externalized/] \begin{document} \tikzsetnextfilename{green} \tikz{\draw[fill=green] (0,0) circle (12pt);}\dots \tikzexternaldisable A node: \tikzmarknode{NodeName}{TikZ mark node} % the following env is not actually necessary to trigger the error \begin{tikzpicture}[remember picture, overlay] \node[yshift=-0.9em] at (NodeName) {some text under it}; \end{tikzpicture} \tikzexternalenable \end{document} ``` However, I'm wondering why is that, and whether there's a better solution than disseminating `\tikzexternaldisable` and `\tikzexternalenable` around. Furthermore, since I use `only named=true`, I don't understand why TikZ should attempt any externalization at all when meeting a `\tikzmarknode`. --- From `tlmgr gui` I see that the table *Local rev. (ver.)* for `tikzmark` is *64819 (1.15)*.
https://tex.stackexchange.com/users/87996
Error when using TikZ external and tikzmark libraries together
true
This is not actually a `tikzmark` issue, but rather is related to differing behaviour in TikZ with and without the `external` library. I can stop the error occurring with `tikzmark` but that doesn't fix the underlying issue. In short, the following code is fine without the `external` library loaded but not with it: ``` \tikz {\draw (0,0) -- (1,0)} ``` With the `external` library then Tikz complains about the missing semi-colon at the end of the `\draw` command. The fact that this works (when the `external` library is not loaded) is by design - looking at the TikZ code then there is an explicit check for this via a conditional `\iftikz@auto@end@path` which finishes a path if this hasn't already been triggered by a semi-colon. And just before the definition of the `\tikz` command there is an example in the code that doesn't have the semi-colon: ``` % Example: % % The rectangle \tikz{\draw (0,0) rectangle (1em,1ex)} has width 1em and % height 1ex. ``` The reason you are seeing this with `\tikzmarknode` is that when all the extra is stripped away then it becomes `\tikz {\node[node contents={Stuff}]}` without the semi-colon. Now, I can put the semi-colon in there - line 507 of `tikzlibrarytikzmark.code.tex` should be changed to `];}%` - but that doesn't explain what is really going on. [I've raised an issue on the TikZ/pgf issue tracker](https://github.com/pgf-tikz/pgf/issues/1258) and the TikZ/pgf team has responded saying that the external library is currently unmaintained but that there are alternatives that are more robust. So I've add the semi-colon in to the tikzmark library [on github](https://github.com/loopspace/tikzmark) (and will send to CTAN next time I'm sending them stuff) as above to stop the error from arising as that at least means that tikzmark doesn't cause this error to arise. (I'll also just note that as far as I can tell, this error doesn't actually do anything - the picture still gets processed - so equivalently you could just ignore it.)
1
https://tex.stackexchange.com/users/86
685092
317,831
https://tex.stackexchange.com/questions/685089
2
Do you know a way to insert an empty row every multiple of 5 using the `\DTLforeach` command? Please test this minimal code: ``` \documentclass{minimal} \usepackage[utf8]{inputenc} \usepackage{datatool} \DTLnewdb{myDB} \DTLnewrow{myDB} \DTLnewdbentry{myDB}{Fst}{1}\DTLnewdbentry{myDB}{Snd}{0,995025}\DTLnewdbentry{myDB}{Trd}{0,990099} \DTLnewrow{myDB} \DTLnewdbentry{myDB}{Fst}{2}\DTLnewdbentry{myDB}{Snd}{1,985099}\DTLnewdbentry{myDB}{Trd}{1,970395} \DTLnewrow{myDB} \DTLnewdbentry{myDB}{Fst}{3}\DTLnewdbentry{myDB}{Snd}{2,970248}\DTLnewdbentry{myDB}{Trd}{2,940985} \DTLnewrow{myDB} \DTLnewdbentry{myDB}{Fst}{4}\DTLnewdbentry{myDB}{Snd}{3,950496}\DTLnewdbentry{myDB}{Trd}{3,901966} \DTLnewrow{myDB} \DTLnewdbentry{myDB}{Fst}{5}\DTLnewdbentry{myDB}{Snd}{4,925866}\DTLnewdbentry{myDB}{Trd}{4,853431} \DTLnewrow{myDB} \DTLnewdbentry{myDB}{Fst}{6}\DTLnewdbentry{myDB}{Snd}{5,896384}\DTLnewdbentry{myDB}{Trd}{5,795476} \DTLnewrow{myDB} \DTLnewdbentry{myDB}{Fst}{7}\DTLnewdbentry{myDB}{Snd}{6,862074}\DTLnewdbentry{myDB}{Trd}{6,728195} \DTLnewrow{myDB} \DTLnewdbentry{myDB}{Fst}{8}\DTLnewdbentry{myDB}{Snd}{7,822959}\DTLnewdbentry{myDB}{Trd}{7,651678} \DTLnewrow{myDB} \DTLnewdbentry{myDB}{Fst}{9}\DTLnewdbentry{myDB}{Snd}{8,779064}\DTLnewdbentry{myDB}{Trd}{8,566018} \DTLnewrow{myDB} \DTLnewdbentry{myDB}{Fst}{10}\DTLnewdbentry{myDB}{Snd}{9,730412}\DTLnewdbentry{myDB}{Trd}{9,471305} \DTLnewrow{myDB} \DTLnewdbentry{myDB}{Fst}{11}\DTLnewdbentry{myDB}{Snd}{10,677027}\DTLnewdbentry{myDB}{Trd}{10,367628} \begin{document} \begin{tabular}{crr} \DTLforeach{myDB}{\one=Fst,\two=Snd,\three=Trd} {\one & \two & \three \\} \end{tabular} \end{document} ```
https://tex.stackexchange.com/users/50486
Appending an empty row every chunk of five rows using the datatool package
false
Rather than a blank line I'd use `\addlinespace` from `booktabs`. ``` \documentclass{article} \usepackage{datatool} \usepackage{booktabs} \DTLnewdb{myDB} \DTLnewrow{myDB} \DTLnewdbentry{myDB}{Fst}{1}\DTLnewdbentry{myDB}{Snd}{0,995025}\DTLnewdbentry{myDB}{Trd}{0,990099} \DTLnewrow{myDB} \DTLnewdbentry{myDB}{Fst}{2}\DTLnewdbentry{myDB}{Snd}{1,985099}\DTLnewdbentry{myDB}{Trd}{1,970395} \DTLnewrow{myDB} \DTLnewdbentry{myDB}{Fst}{3}\DTLnewdbentry{myDB}{Snd}{2,970248}\DTLnewdbentry{myDB}{Trd}{2,940985} \DTLnewrow{myDB} \DTLnewdbentry{myDB}{Fst}{4}\DTLnewdbentry{myDB}{Snd}{3,950496}\DTLnewdbentry{myDB}{Trd}{3,901966} \DTLnewrow{myDB} \DTLnewdbentry{myDB}{Fst}{5}\DTLnewdbentry{myDB}{Snd}{4,925866}\DTLnewdbentry{myDB}{Trd}{4,853431} \DTLnewrow{myDB} \DTLnewdbentry{myDB}{Fst}{6}\DTLnewdbentry{myDB}{Snd}{5,896384}\DTLnewdbentry{myDB}{Trd}{5,795476} \DTLnewrow{myDB} \DTLnewdbentry{myDB}{Fst}{7}\DTLnewdbentry{myDB}{Snd}{6,862074}\DTLnewdbentry{myDB}{Trd}{6,728195} \DTLnewrow{myDB} \DTLnewdbentry{myDB}{Fst}{8}\DTLnewdbentry{myDB}{Snd}{7,822959}\DTLnewdbentry{myDB}{Trd}{7,651678} \DTLnewrow{myDB} \DTLnewdbentry{myDB}{Fst}{9}\DTLnewdbentry{myDB}{Snd}{8,779064}\DTLnewdbentry{myDB}{Trd}{8,566018} \DTLnewrow{myDB} \DTLnewdbentry{myDB}{Fst}{10}\DTLnewdbentry{myDB}{Snd}{9,730412}\DTLnewdbentry{myDB}{Trd}{9,471305} \DTLnewrow{myDB} \DTLnewdbentry{myDB}{Fst}{11}\DTLnewdbentry{myDB}{Snd}{10,677027}\DTLnewdbentry{myDB}{Trd}{10,367628} \newcounter{jjhenry} \newcommand{\possiblyaddspace}{% \noalign{\stepcounter{jjhenry}\ifnum\value{jjhenry}=5 \setcounter{jjhenry}{0}\fi}% \ifnum\value{jjhenry}=0 \addlinespace\fi } \begin{document} \setcounter{jjhenry}{0} \begin{tabular}{crr} \DTLforeach{myDB}{\one=Fst,\two=Snd,\three=Trd} {\one & \two & \three \\ \possiblyaddspace} \end{tabular} \end{document} ``` The counter is reset to 0 when it reaches the value 5.
1
https://tex.stackexchange.com/users/4427
685093
317,832
https://tex.stackexchange.com/questions/685083
3
Say I want the `description` environment in ``` \documentclass{article} \usepackage{amsmath} \begin{document} Some text\\ some more \begin{center} center \end{center} \begin{description} \item[desc1] text1 \item[desc2] text2 text2 \item[desc3] text3 text3 text3 \end{description} other text \end{document} ``` do be horizontally centered, as a whole, i.e. the longest item should be horizontally centered in the page. Clearly, if one of the entries is longer than `\textwidth`, then it would be back the original position. Enclosing it in the `center` environment doesn't seem to work. I thought `\hfill` would come handy, but I haven't managed to write a solution using it. I guess another strategy could consist in computing the width of the environment being typeset, and using that as the width of an enclosing `minipage`, or something. --- I see [here](https://tex.stackexchange.com/questions/238846/how-to-center-an-itemize-in-beamer-together-with-its-headline) using `tabular` as an alternative is proposed, but I was looking for a cleaner solution.
https://tex.stackexchange.com/users/87996
How do I center a bullet/numbered/description list horizontally?
true
You can put the `description` in a `varwidth`-box (which produces a `minpage` and calculates it's width): ``` \documentclass{article} \usepackage{amsmath} \usepackage{varwidth} \begin{document} Some text\\ some more \begin{center} center \end{center} \begin{center} \begin{varwidth}{\textwidth} \begin{description} \item[desc1] text1 \item[desc2] text2 text2 \item[desc3] text3 text3 text3 \end{description} \end{varwidth} \end{center} other text \end{document} ```
4
https://tex.stackexchange.com/users/29873
685095
317,833
https://tex.stackexchange.com/questions/684291
1
I have an enumerate of questions. Each of those questions has some opening text and then a nested enumerate. I give an example below that results in a page-break in the middle of the second question in the PDF output. I mark with `\newpage` where I would like the page-break to be (automatically) inserted. In this particular example, I want the first question to be on page 1, and the second and third to be on page 2 (just because they both happen to fit). I also put my attempt commented out in below. I try to start a "samepage" environment right at the beginning of an `\item` and I try to end it at the end of the (nested) enumerate environment. The code seems to work on a simpler example, but in the current example it fails with the error `! LaTeX Error: \begin{samepage} on input line 56 ended by \end{center}.` In any case, my approach seemed fragile anyway so I'm hoping there's a better solution. I think the reason I find this hard is because of the way `\item` works. If it were `\item{contents}` then I think it would be easier to patch. That's why I tried to hack together an approach that hooks into the beginning of `\item` and end of `\enumerate`. I'm looking for a solution that can patch `\item` and base `enumerate` (rather than using `\newitem` or enumitem). i.e., I'm hoping that I can just drop some preamble code in. There are related questions. For example, [Page breaks within enumerated list](https://tex.stackexchange.com/questions/76483/page-breaks-within-enumerated-list) is related but is not about nested enumerates and also the solution seems to use enumitem. ``` \documentclass{article} \makeatletter %% my attempt: %\let\OldItem\item %\renewcommand{\item}{\OldItem \ifnum \@listdepth=1 \begin{samepage}\fi} %\AfterEndEnvironment{enumerate}{\ifnum \@listdepth=1 \end{samepage}\fi} \makeatother \begin{document} \begin{enumerate} \item 2 + 2 = ? \\ filler\\ filler\\ filler\\ filler\\ filler\\ filler\\ filler\\ filler\\ filler\\ filler\\ filler\\ filler\\ filler\\ filler\\ filler\\ filler\\ filler\\ filler\\ filler\\ filler\\ filler\\ filler\\ filler\\ filler\\ \begin{enumerate} \item 1 \item 2 \item 3 \item 4 \end{enumerate} % I do not want to put this page break in manually: % \newpage \item Consider the joint probability distribution below: filler\\ filler\\ filler\\ filler\\ filler\\ filler\\ filler\\ filler\\ \begin{center} \begin{tabular}{|ccc|} \hline & $X_{2}=0$ & $X_{2}=1$\tabularnewline \hline $X_{1}=0$ & $\frac{1}{10}$ & $\frac{3}{10}$\tabularnewline \hline $X_{1}=1$ & $\frac{2}{10}$ & $\frac{4}{10}$\tabularnewline \hline \end{tabular} \par\end{center} What is $P(X_{1}=1)$? \begin{enumerate} \item I do not know. \item 4 \item 17 \item 88 \end{enumerate} \item 2 - 2 + 5 = filler\\ filler\\ filler\\ filler\\ filler\\ filler\\ filler\\ filler\\ filler\\ filler\\ filler\\ filler\\ filler\\ filler\\ filler\\ filler\\ filler\\ filler\\ filler\\ \begin{enumerate} \item 1 \item 2 \item 3 \item 4 \end{enumerate} \end{enumerate} \end{document} ```
https://tex.stackexchange.com/users/12212
Prevent page break within \item of an enumerate
false
As John Kormylo suggested, you can use `\vtop` (the internal command `\parbox[t]...` use) to prevent from `item`'s to break between pages. Instead of adding the necessary curly braces, with `\vtop` you can wrap the argument with `\bgroup` and `\egroup`, which might be easier if you are using LyX. Personally, I wouldn't redefine `\item`, as there are more than several environments that use it internally, even some that might surprise you (such as environments defined with `\newtheorem` or `amsthm`'s proof environment). As mentioned in the comments, you can use LyX's `ItemCommand` to replace `\item` with the desired code, instead of redefining `\item`. So, basically we want to replace `\item` with `\item\leavevmode\vtop{<text>}`, but that would be hard, so we can replace it with `\item\leavevmode\vtop\bgroup`. To close the group, just prepend `\egroup` to `\item`, but that would create unbalanced grouping with the first and last use of `\egroup\item\leavevmode\vtop\bgroup`, luckily we can fix it with some hooks. We also nee to add `\hsize\linewidth\@parboxrestore` after `\bgroup` to get the correct width and indentation. Here is a LyX file that demonstrate the idea: ``` #LyX 2.3 created this file. For more info see http://www.lyx.org/ \lyxformat 544 \begin_document \begin_header \save_transient_properties true \origin unavailable \textclass article \begin_preamble %% my attempt: %\let\OldItem\item %\renewcommand{\item}{\OldItem \ifnum \@listdepth=1 \begin{samepage}\fi} %\AfterEndEnvironment{enumerate}{\ifnum \@listdepth=1 \end{samepage}\fi} \AddToHook{cmd/enumerate/after}{\bgroup} \AddToHook{env/enumerate/end}{\egroup} \newcommand*\myitem{\egroup\item\leavevmode\vtop\bgroup\hsize\linewidth\@parboxrestore} \end_preamble \use_default_options false \maintain_unincluded_children false \begin_local_layout Format 66 Style Enumerate ItemCommand myitem End \end_local_layout \language english \language_package none \inputencoding auto \fontencoding default \font_roman "default" "default" \font_sans "default" "default" \font_typewriter "default" "default" \font_math "auto" "auto" \font_default_family default \use_non_tex_fonts false \font_sc false \font_osf false \font_sf_scale 100 100 \font_tt_scale 100 100 \use_microtype false \use_dash_ligatures true \graphics default \default_output_format default \output_sync 0 \bibtex_command default \index_command default \paperfontsize default \spacing single \use_hyperref false \papersize default \use_geometry false \use_package amsmath 1 \use_package amssymb 0 \use_package cancel 0 \use_package esint 1 \use_package mathdots 0 \use_package mathtools 0 \use_package mhchem 0 \use_package stackrel 0 \use_package stmaryrd 0 \use_package undertilde 0 \cite_engine basic \cite_engine_type default \biblio_style plain \use_bibtopic false \use_indices false \paperorientation portrait \suppress_date false \justification true \use_refstyle 0 \use_minted 0 \index Index \shortcut idx \color #008000 \end_index \secnumdepth 3 \tocdepth 3 \paragraph_separation indent \paragraph_indentation default \is_math_indent 0 \math_numbering_side default \quotes_style english \dynamic_quotes 0 \papercolumns 1 \papersides 1 \paperpagestyle default \tracking_changes false \output_changes false \html_math_output 0 \html_css_as_file 0 \html_be_strict false \end_header \begin_body \begin_layout Enumerate 2 + 2 = ? \begin_inset Newline newline \end_inset filler \begin_inset Newline newline \end_inset filler \begin_inset Newline newline \end_inset filler \begin_inset Newline newline \end_inset filler \begin_inset Newline newline \end_inset filler \begin_inset Newline newline \end_inset filler \begin_inset Newline newline \end_inset filler \begin_inset Newline newline \end_inset filler \begin_inset Newline newline \end_inset filler \begin_inset Newline newline \end_inset filler \begin_inset Newline newline \end_inset filler \begin_inset Newline newline \end_inset filler \begin_inset Newline newline \end_inset filler \begin_inset Newline newline \end_inset filler \begin_inset Newline newline \end_inset filler \begin_inset Newline newline \end_inset filler \begin_inset Newline newline \end_inset filler \begin_inset Newline newline \end_inset filler \begin_inset Newline newline \end_inset filler \begin_inset Newline newline \end_inset filler \begin_inset Newline newline \end_inset filler \begin_inset Newline newline \end_inset filler \begin_inset Newline newline \end_inset filler \begin_inset Newline newline \end_inset filler \end_layout \begin_deeper \begin_layout Enumerate 1 \end_layout \begin_layout Enumerate 2 \end_layout \begin_layout Enumerate 3 \end_layout \begin_layout Enumerate 4 \end_layout \begin_layout Standard \begin_inset ERT status collapsed \begin_layout Plain Layout % I do not want to put this page break in manually: \end_layout \begin_layout Plain Layout \end_layout \end_inset \begin_inset ERT status collapsed \begin_layout Plain Layout % \backslash newpage \end_layout \begin_layout Plain Layout \end_layout \end_inset \end_layout \end_deeper \begin_layout Enumerate Consider the joint probability distribution below: filler \begin_inset Newline newline \end_inset filler \begin_inset Newline newline \end_inset filler \begin_inset Newline newline \end_inset filler \begin_inset Newline newline \end_inset filler \begin_inset Newline newline \end_inset filler \begin_inset Newline newline \end_inset filler \begin_inset Newline newline \end_inset filler \end_layout \begin_deeper \begin_layout Standard \align center \begin_inset Tabular <lyxtabular version="3" rows="3" columns="3"> <features tabularvalignment="middle"> <column alignment="center" valignment="top"> <column alignment="center" valignment="top"> <column alignment="center" valignment="top"> <row> <cell alignment="center" valignment="top" topline="true" leftline="true" usebox="none"> \begin_inset Text \begin_layout Plain Layout \end_layout \end_inset </cell> <cell alignment="center" valignment="top" topline="true" usebox="none"> \begin_inset Text \begin_layout Plain Layout \begin_inset Formula $X_{2}=0$ \end_inset \end_layout \end_inset </cell> <cell alignment="center" valignment="top" topline="true" rightline="true" usebox="none"> \begin_inset Text \begin_layout Plain Layout \begin_inset Formula $X_{2}=1$ \end_inset \end_layout \end_inset </cell> </row> <row> <cell alignment="center" valignment="top" topline="true" leftline="true" usebox="none"> \begin_inset Text \begin_layout Plain Layout \begin_inset Formula $X_{1}=0$ \end_inset \end_layout \end_inset </cell> <cell alignment="center" valignment="top" topline="true" usebox="none"> \begin_inset Text \begin_layout Plain Layout \begin_inset Formula $\frac{1}{10}$ \end_inset \end_layout \end_inset </cell> <cell alignment="center" valignment="top" topline="true" rightline="true" usebox="none"> \begin_inset Text \begin_layout Plain Layout \begin_inset Formula $\frac{3}{10}$ \end_inset \end_layout \end_inset </cell> </row> <row> <cell alignment="center" valignment="top" topline="true" bottomline="true" leftline="true" usebox="none"> \begin_inset Text \begin_layout Plain Layout \begin_inset Formula $X_{1}=1$ \end_inset \end_layout \end_inset </cell> <cell alignment="center" valignment="top" topline="true" bottomline="true" usebox="none"> \begin_inset Text \begin_layout Plain Layout \begin_inset Formula $\frac{2}{10}$ \end_inset \end_layout \end_inset </cell> <cell alignment="center" valignment="top" topline="true" bottomline="true" rightline="true" usebox="none"> \begin_inset Text \begin_layout Plain Layout \begin_inset Formula $\frac{4}{10}$ \end_inset \end_layout \end_inset </cell> </row> </lyxtabular> \end_inset \end_layout \begin_layout Standard What is \begin_inset Formula $P(X_{1}=1)$ \end_inset ? \end_layout \begin_layout Enumerate I do not know. \end_layout \begin_layout Enumerate 4 \end_layout \begin_layout Enumerate 17 \end_layout \begin_layout Enumerate 88 \end_layout \end_deeper \begin_layout Enumerate 2 - 2 + 5 = filler \begin_inset Newline newline \end_inset filler \begin_inset Newline newline \end_inset filler \begin_inset Newline newline \end_inset filler \begin_inset Newline newline \end_inset filler \begin_inset Newline newline \end_inset filler \begin_inset Newline newline \end_inset filler \begin_inset Newline newline \end_inset filler \begin_inset Newline newline \end_inset filler \begin_inset Newline newline \end_inset filler \begin_inset Newline newline \end_inset filler \begin_inset Newline newline \end_inset filler \begin_inset Newline newline \end_inset filler \begin_inset Newline newline \end_inset filler \begin_inset Newline newline \end_inset filler \begin_inset Newline newline \end_inset filler \begin_inset Newline newline \end_inset filler \begin_inset Newline newline \end_inset filler \begin_inset Newline newline \end_inset filler \end_layout \begin_deeper \begin_layout Enumerate 1 \end_layout \begin_layout Enumerate 2 \end_layout \begin_layout Enumerate 3 \end_layout \begin_layout Enumerate 4 \end_layout \end_deeper \end_body \end_document ``` And its LateX output is (for all of you worrying about the fact that LyX adds `\usepackage[latin9]{inputenc}` to the preamble, it is fixed in LyX 2.4): ``` %% LyX 2.3.7 created this file. For more info, see http://www.lyx.org/. %% Do not edit unless you really know what you are doing. \documentclass{article} \usepackage[latin9]{inputenc} \makeatletter %%%%%%%%%%%%%%%%%%%%%%%%%%%%%% LyX specific LaTeX commands. %% Because html converters don't know tabularnewline \providecommand{\tabularnewline}{\\} %%%%%%%%%%%%%%%%%%%%%%%%%%%%%% User specified LaTeX commands. %% my attempt: %\let\OldItem\item %\renewcommand{\item}{\OldItem \ifnum \@listdepth=1 \begin{samepage}\fi} %\AfterEndEnvironment{enumerate}{\ifnum \@listdepth=1 \end{samepage}\fi} \AddToHook{cmd/enumerate/after}{\bgroup} \AddToHook{env/enumerate/end}{\egroup} \newcommand*\myitem{\egroup\item\leavevmode\vtop\bgroup\hsize\linewidth\@parboxrestore} \makeatother \begin{document} \begin{enumerate} \myitem 2 + 2 = ? \\ filler\\ filler\\ filler\\ filler\\ filler\\ filler\\ filler\\ filler\\ filler\\ filler\\ filler\\ filler\\ filler\\ filler\\ filler\\ filler\\ filler\\ filler\\ filler\\ filler\\ filler\\ filler\\ filler\\ filler \begin{enumerate} \myitem 1 \myitem 2 \myitem 3 \myitem 4 \end{enumerate} % I do not want to put this page break in manually: % \newpage \myitem Consider the joint probability distribution below: filler\\ filler\\ filler\\ filler\\ filler\\ filler\\ filler\\ filler \begin{center} \begin{tabular}{|ccc|} \hline & $X_{2}=0$ & $X_{2}=1$\tabularnewline \hline $X_{1}=0$ & $\frac{1}{10}$ & $\frac{3}{10}$\tabularnewline \hline $X_{1}=1$ & $\frac{2}{10}$ & $\frac{4}{10}$\tabularnewline \hline \end{tabular} \par\end{center} What is $P(X_{1}=1)$? \begin{enumerate} \myitem I do not know. \myitem 4 \myitem 17 \myitem 88 \end{enumerate} \myitem 2 - 2 + 5 = filler\\ filler\\ filler\\ filler\\ filler\\ filler\\ filler\\ filler\\ filler\\ filler\\ filler\\ filler\\ filler\\ filler\\ filler\\ filler\\ filler\\ filler\\ filler \begin{enumerate} \myitem 1 \myitem 2 \myitem 3 \myitem 4 \end{enumerate} \end{enumerate} \end{document} ```
1
https://tex.stackexchange.com/users/264024
685098
317,834
https://tex.stackexchange.com/questions/685099
0
I want to cross-reference custom items in my document the same way I would do for figures, tables etc... For example I would like to add something like `\label{custom_item: label}` and then use something like `\ref{custom_item: label}` to produce "Item 1", "Item 2" etc.. How can I do it? Obviously the label "Item" would be written every time and not produced by LaTeX, the same way you have to write "Figure" when referencing figures.
https://tex.stackexchange.com/users/45524
Cross-reference random elements
true
You only need a counter that you increase with `\refstepcounter`: ``` \documentclass{article} \newcounter{myitem} \begin{document} \refstepcounter{myitem}\label{myitem-a} \refstepcounter{myitem}\label{myitem-b} Item~\ref{myitem-a}, Item~\ref{myitem-b} \end{document} ```
2
https://tex.stackexchange.com/users/2388
685100
317,835
https://tex.stackexchange.com/questions/685014
1
I want to implement a option key for a custom `tcolorbox` environment, where when I include it in the optional arguments it expands to something like `underlay = {<tikz code>}` . In the following code, I want to substitute the `underlay = {...}` with a simple key like `quotation`. My goal is to reproduce the second box like this: `\begin{sigbox}[quotation]` ``` \documentclass[11pt]{scrreprt} \usepackage{lipsum} \usepackage[skins]{tcolorbox} % % \newtcolorbox{sigbox}[1][]{% enhanced, remember, colback=yellow!25!white, arc=0pt, boxrule=0pt, leftrule=3 ex % , colframe=yellow!85!red!33!white % , underlay = {% \path[fill=yellow!25!white] (frame.south west) -- ([yshift=3 ex]frame.south west) -- ([xshift = 1.5 ex ,yshift=1.5 ex]frame.south west) -- ([xshift = 3 ex , % yshift = 3 ex]frame.south west) -- ([xshift = 3 ex]frame.south west) -- cycle; }% , overlay = {% \path ([xshift=1.5 ex, yshift = -2.25 ex]frame.north west) node % {\textcolor{tcbcolback!33!white}{\LARGE\textbf{!}}};% }% ,#1 % }% % \begin{document} % \begin{sigbox} \lipsum[7] \end{sigbox} % \begin{sigbox}[% underlay = {% \path ([xshift=1.5 ex, yshift = -5.5 ex]frame.north west) node % {\textcolor{tcbcolback!33!white}{\LARGE\textbf{"}}};% }% ]% \lipsum[8] \end{sigbox} % \end{document} ``` Should I just create a macro ala `\newcommand{\quotation}{underlay = {<tikz code>}}`; can I implement this with some conditional expression from e.g. `xstring`; or do I have to learn how `pgfkeys` works?
https://tex.stackexchange.com/users/204893
Defining custom option keys for tcolorbox
false
I think what you are looking for is `\tcbset` which can help you to create custom styles (I simplified the code a bit): ``` \documentclass[11pt]{scrreprt} \usepackage{lipsum} \usepackage[skins]{tcolorbox} \tcbset{ quotation/.style={ overlay = { \node[text=tcbcolback!33!white, font=\LARGE\bfseries] at ([xshift=1.5ex, yshift=-2.25ex]frame.north west) {"}; } } } \newtcolorbox{sigbox}[1][]{ enhanced, remember, colback=yellow!25!white, arc=0pt, boxrule=0pt, leftrule=3ex, colframe=yellow!85!red!33!white, underlay = { \path[fill=yellow!25!white] (frame.south west) -- ([yshift=3ex]frame.south west) -- ([xshift=1.5ex, yshift=1.5ex]frame.south west) -- ([xshift=3ex, yshift=3ex]frame.south west) -- ([xshift=3ex]frame.south west) -- cycle; }, overlay = { \node[text=tcbcolback!33!white, font=\LARGE\bfseries] at ([xshift=1.5ex, yshift=-2.25ex]frame.north west) {!}; }, #1 } \begin{document} \begin{sigbox} \lipsum[2] \end{sigbox} \begin{sigbox}[quotation] \lipsum[2] \end{sigbox} \end{document} ``` You should always be careful not to overwrite existing styles, of course.
2
https://tex.stackexchange.com/users/47927
685116
317,840
https://tex.stackexchange.com/questions/685019
1
I wanted to use `tabto` to insert symbols into the margins of my document. I did this as in the following MWE: ``` \documentclass[11pt]{scrartcl} \usepackage[ngerman]{babel} \usepackage[T1]{fontenc} \usepackage{tikz} \usepackage{lipsum} \usepackage{tabto, calc} % \def\marginsymbol{\protect\marginsymbolhelper} % \def\marginsymbolhelper{\tabto*{-1ex}\makebox[0cm]{$\bullet$}\tabto*{\TabPrevPos}} % The following works, too: \newcommand{\marginsymbol}{\tabto*{-3.5ex}{% \begin{tikzpicture}[remember picture, overlay ]% \node[circle, fill=pink] at (0, 0) {\textcolor{white!90!pink}{\LARGE\textbf{i}}}; \end{tikzpicture} }% \tabto*{\TabPrevPos}}% \newcommand{\marginsig}{\tabto*{\textwidth + 3.5ex}{% \begin{tikzpicture}[remember picture, overlay ]% \node[circle, fill=pink] at (0, 0) {\textcolor{white!90!pink}{\LARGE\textbf{i}}}; \end{tikzpicture} }% \tabto*{\TabPrevPos} }% \begin{document} \section{Eins} Dieser Text ist nicht Lorem Ipsum Dieser Text ist nicht Lorem Ipsum Dieser Text ist nicht Lorem Ipsum\marginsymbol Dieser Text ist nicht Lorem Ipsum Dieser Text ist nicht Lorem Ipsum Dieser Text ist nicht Lorem Ipsum Dieser Text ist nicht Lorem Ipsum Dieser Text ist nicht Lorem Ipsum Dieser Text ist nicht Lorem Ipsum Dieser Text ist nicht Lorem Ipsum Dieser Text ist nicht Lorem Ipsum Dieser Text ist nicht Lorem Ipsum Dieser Text ist nicht Lorem Ipsum Dieser Text ist nicht Lorem Ipsum Dieser Text ist nicht Lorem Ipsum Dieser Text ist nicht Lorem Ipsum Dieser Text ist nicht Lorem Ipsum Dieser Text ist nicht Lorem Ipsum Dieser Text ist nicht Lorem Ipsum Dieser Text ist nicht Lorem Ipsum Dieser Text ist nicht Lorem Ipsum Dieser Text ist nicht Lorem Ipsum Dieser Text ist nicht Lorem Ipsum Dieser Text ist nicht Lorem Ipsum Dieser Text ist nicht Lorem Ipsum Dieser Text ist nicht Lorem Ipsum Dieser Text ist nicht Lorem Ipsum Dieser Text ist nicht Lorem Ipsum Dieser Text ist nicht Lorem Ipsum Dieser Text ist nicht Lorem Ipsum Dieser Text ist nicht Lorem Ipsum Dieser\marginsig Text ist nicht Lorem Ipsum Dieser Text ist nicht Lorem Ipsum Dieser Text ist nicht Lorem Ipsum Dieser Text ist nicht Lorem Ipsum Dieser Text ist nicht Lorem Ipsum Dieser Text ist nicht Lorem Ipsum Dieser Text ist nicht Lorem Ipsum Dieser Text ist nicht Lorem Ipsum Dieser Text ist nicht Lorem Ipsum Dieser Text ist nicht Lorem Ipsum Dieser Text ist nicht Lorem Ipsum Dieser Text ist nicht Lorem Ipsum Dieser Text ist nicht Lorem Ipsum Dieser Text ist nicht Lorem Ipsum Dieser Text ist nicht Lorem Ipsum Dieser Text ist nicht Lorem Ipsum Dieser Text ist nicht Lorem Ipsum Dieser Text ist nicht Lorem Ipsum Dieser Text ist nicht Lorem Ipsum Dieser Text ist nicht Lorem Ipsum Dieser Text ist nicht Lorem Ipsum Dieser Text ist nicht Lorem Ipsum Dieser Text ist nicht Lorem Ipsum Dieser Text ist nicht Lorem Ipsum Dieser Text ist nicht Lorem Ipsum Dieser Text ist nicht Lorem Ipsum \end{document} ``` The symbol in the right margin (\marginsig) causes the text to continue at the right position, but in the next line. This problem is independent of using a tikzpicture environment, or tikz at all. How can I fix this?
https://tex.stackexchange.com/users/204893
Tabto inserts line break when tabbing into right margin
false
There are several methods to print material into the margins. In your case it seems, you want to print into the left and the right margin. Because you are already using a KOMA-Script class, here is a suggestion using the KOMA-Script package `scrlayer-notecolumn`, that provides the usage of several note columns: ``` \documentclass{scrartcl}% 11pt is the default and therefore not needed \usepackage[ngerman]{babel} \usepackage[T1]{fontenc} \usepackage{tikz} \usepackage{lipsum} \usepackage{scrlayer-scrpage,scrlayer-notecolumn} \DeclareRobustCommand*{\marginsymbol}{% \begin{tikzpicture} \node[circle, fill=pink] at (0, 0) {\textcolor{white!90!pink}{\LARGE\textbf{i}}}; \end{tikzpicture} }% \DeclareNewNoteColumn[reversemarginpar]{reversemarginpar} \NewDocumentCommand{\marginsign}{s} {% \IfBooleanTF{#1}% {\makenote[reversemarginpar]{\raggedleft\marginsymbol}}% {\makenote{\marginsymbol}}% } \begin{document} \section{Eins} Dieser Text ist nicht Lorem Ipsum Dieser Text ist nicht Lorem Ipsum Dieser Text ist nicht Lorem Ipsum\marginsign* Dieser Text ist nicht Lorem Ipsum Dieser Text ist nicht Lorem Ipsum Dieser Text ist nicht Lorem Ipsum Dieser Text ist nicht Lorem Ipsum Dieser Text ist nicht Lorem Ipsum Dieser Text ist nicht Lorem Ipsum Dieser Text ist nicht Lorem Ipsum Dieser Text ist nicht Lorem Ipsum Dieser Text ist nicht Lorem Ipsum Dieser Text ist nicht Lorem Ipsum Dieser Text ist nicht Lorem Ipsum Dieser Text ist nicht Lorem Ipsum Dieser Text ist nicht Lorem Ipsum Dieser Text ist nicht Lorem Ipsum Dieser Text ist nicht Lorem Ipsum Dieser Text ist nicht Lorem Ipsum Dieser Text ist nicht Lorem Ipsum Dieser Text ist nicht Lorem Ipsum Dieser Text ist nicht Lorem Ipsum Dieser Text ist nicht Lorem Ipsum Dieser Text ist nicht Lorem Ipsum Dieser Text ist nicht Lorem Ipsum Dieser Text ist nicht Lorem Ipsum Dieser Text ist nicht Lorem Ipsum Dieser Text ist nicht Lorem Ipsum Dieser Text ist nicht Lorem Ipsum Dieser Text ist nicht Lorem Ipsum Dieser Text ist nicht Lorem Ipsum Dieser\marginsign{} Text ist nicht Lorem Ipsum Dieser Text ist nicht Lorem Ipsum Dieser Text ist nicht Lorem Ipsum Dieser Text ist nicht Lorem Ipsum Dieser Text ist nicht Lorem Ipsum Dieser Text ist nicht Lorem Ipsum Dieser Text ist nicht Lorem Ipsum Dieser Text ist nicht Lorem Ipsum Dieser Text ist nicht Lorem Ipsum Dieser Text ist nicht Lorem Ipsum Dieser Text ist nicht Lorem Ipsum Dieser Text ist nicht Lorem Ipsum Dieser Text ist nicht Lorem Ipsum Dieser Text ist nicht Lorem Ipsum Dieser Text ist nicht Lorem Ipsum Dieser Text ist nicht Lorem Ipsum Dieser Text ist nicht Lorem Ipsum Dieser Text ist nicht Lorem Ipsum Dieser Text ist nicht Lorem Ipsum Dieser Text ist nicht Lorem Ipsum Dieser Text ist nicht Lorem Ipsum Dieser Text ist nicht Lorem Ipsum Dieser Text ist nicht Lorem Ipsum Dieser Text ist nicht Lorem Ipsum Dieser Text ist nicht Lorem Ipsum Dieser Text ist nicht Lorem Ipsum \end{document} ``` After two LaTeX runs you'd get: But to be kind: You don't need an extra package, you can simply use `\marginpar` with a trick to reach the left margin: ``` \documentclass{scrartcl}% 11pt is the default and therefore not needed \usepackage[ngerman]{babel} \usepackage[T1]{fontenc} \usepackage{tikz} \usepackage{lipsum} %\usepackage{scrlayer-scrpage,scrlayer-notecolumn} \DeclareRobustCommand*{\marginsymbol}{% \begin{tikzpicture} \node[circle, fill=pink] at (0, 0) {\textcolor{white!90!pink}{\LARGE\textbf{i}}}; \end{tikzpicture} }% %\DeclareNewNoteColumn[reversemarginpar]{reversemarginpar} \NewDocumentCommand{\marginsign}{s} {% \IfBooleanTF{#1}% {\marginpar{\makebox[0pt][l]{\hspace*{-\dimexpr\textwidth+2\marginparsep}\raisebox{-\ht\strutbox}{\makebox[0pt][r]{\marginsymbol}}}}}% {\marginpar{\raisebox{-\ht\strutbox}{\marginsymbol}}}% } \begin{document} \section{Eins} Dieser Text ist nicht Lorem Ipsum Dieser Text ist nicht Lorem Ipsum Dieser Text ist nicht Lorem Ipsum\marginsign* Dieser Text ist nicht Lorem Ipsum Dieser Text ist nicht Lorem Ipsum Dieser Text ist nicht Lorem Ipsum Dieser Text ist nicht Lorem Ipsum Dieser Text ist nicht Lorem Ipsum Dieser Text ist nicht Lorem Ipsum Dieser Text ist nicht Lorem Ipsum Dieser Text ist nicht Lorem Ipsum Dieser Text ist nicht Lorem Ipsum Dieser Text ist nicht Lorem Ipsum Dieser Text ist nicht Lorem Ipsum Dieser Text ist nicht Lorem Ipsum Dieser Text ist nicht Lorem Ipsum Dieser Text ist nicht Lorem Ipsum Dieser Text ist nicht Lorem Ipsum Dieser Text ist nicht Lorem Ipsum Dieser Text ist nicht Lorem Ipsum Dieser Text ist nicht Lorem Ipsum Dieser Text ist nicht Lorem Ipsum Dieser Text ist nicht Lorem Ipsum Dieser Text ist nicht Lorem Ipsum Dieser Text ist nicht Lorem Ipsum Dieser Text ist nicht Lorem Ipsum Dieser Text ist nicht Lorem Ipsum Dieser Text ist nicht Lorem Ipsum Dieser Text ist nicht Lorem Ipsum Dieser Text ist nicht Lorem Ipsum Dieser Text ist nicht Lorem Ipsum Dieser\marginsign{} Text ist nicht Lorem Ipsum Dieser Text ist nicht Lorem Ipsum Dieser Text ist nicht Lorem Ipsum Dieser Text ist nicht Lorem Ipsum Dieser Text ist nicht Lorem Ipsum Dieser Text ist nicht Lorem Ipsum Dieser Text ist nicht Lorem Ipsum Dieser Text ist nicht Lorem Ipsum Dieser Text ist nicht Lorem Ipsum Dieser Text ist nicht Lorem Ipsum Dieser Text ist nicht Lorem Ipsum Dieser Text ist nicht Lorem Ipsum Dieser Text ist nicht Lorem Ipsum Dieser Text ist nicht Lorem Ipsum Dieser Text ist nicht Lorem Ipsum Dieser Text ist nicht Lorem Ipsum Dieser Text ist nicht Lorem Ipsum Dieser Text ist nicht Lorem Ipsum Dieser Text ist nicht Lorem Ipsum Dieser Text ist nicht Lorem Ipsum Dieser Text ist nicht Lorem Ipsum Dieser Text ist nicht Lorem Ipsum Dieser Text ist nicht Lorem Ipsum Dieser Text ist nicht Lorem Ipsum Dieser Text ist nicht Lorem Ipsum Dieser Text ist nicht Lorem Ipsum \end{document} ```
0
https://tex.stackexchange.com/users/277964
685117
317,841
https://tex.stackexchange.com/questions/684849
0
I have a document that is split into two titles. The main document contains section 1 and appendix A, and the supplement contains appendix B (the rest of the appendices). The numbering is fine without bibunit, but it resets with it. How to prevent the reset? Maybe start with a manual hack that starts the supplement appendix from a specific letter? ``` \documentclass[acmtog]{acmart} \usepackage{blindtext} \usepackage{bibunits} \acmJournal{CIE}\acmVolume{0}\acmNumber{0}\acmArticle{0}\acmYear{202x}\acmMonth{0} \let\maketitlesup\maketitle \usepackage{xpatch} \xpatchcmd{\maketitlesup}{\@mkteasers}{}{}{} \xpatchcmd{\maketitlesup}{\@mkabstract}{}{}{} \begin{document} \title{Title} \author{Author} \maketitle \begin{bibunit} \section{1} \blindtext \appendix \section{A} \blindtext \end{bibunit} \setcounter{page}{1} \title{Title---Supplement} \maketitlesup %\appendix \begin{bibunit} \section{B} \blindtext \end{bibunit} \end{document} ```
https://tex.stackexchange.com/users/34827
bibunit resets appendix number
true
Acmart finally supports biblatex. It has, however, a similar issue, but at least I can set the counter manually. ``` \documentclass[acmtog,natbib=false]{acmart} \usepackage{blindtext} \usepackage[datamodel=acmdatamodel,style=acmauthoryear]{biblatex} \addbibresource{/prj/notes/paper.bib} \addbibresource{/prj/notes/levi.bib} \acmJournal{CIE}\acmVolume{0}\acmNumber{0}\acmArticle{0}\acmYear{202x}\acmMonth{0} \let\maketitlesup\maketitle \usepackage{xpatch} \xpatchcmd{\maketitlesup}{\@mkteasers}{}{}{} \xpatchcmd{\maketitlesup}{\@mkabstract}{}{}{} \begin{document} \title{Title} \author{Author} \maketitle \begin{refsection} \section{1} \blindtext \appendix \section{A} \blindtext \cite{myles14fieldtrace} \printbibliography \end{refsection} \setcounter{page}{1} \title{Title---Supplement} \maketitlesup \begin{refsection} \appendix \setcounter{section}{1} \section{B} \blindtext \citet{shtengel17} \printbibliography \end{refsection} \end{document} ```
0
https://tex.stackexchange.com/users/34827
685122
317,844
https://tex.stackexchange.com/questions/685021
2
writing my thesis, book template and Libertine font. I choose to place footnotes in margin using the sidenotes packages. Works fine, but i found the in text numbers to the note quite big, and after some check, i found the realscripts package which allows the use of the specific superscript included in the font. But sidenotes seems not to fully capture this change, as only the margin number appears in superscript font, the in text number doesn't change. Any way to force sidenotes using real superscripts font ? ``` \documentclass[11pt, a4paper]{book} \usepackage[french]{babel} \usepackage{libertine} \usepackage{sidenotes} \usepackage{realscripts} \begin{document} \section{Superscript font check} This is a non specific font superscript \textsuperscript*{1} And this is a specific font superscript \textsuperscript{1} \medskip The side note call uses a non specific superscript\sidenote{check font superscript} The note itself in the margin is visibly using a specific font superscript... Foot note is correctly using specific superscript\footnote{check foot note} \end{document} ```
https://tex.stackexchange.com/users/296521
real specific superscript font with sidenote
true
Added a redefinition of the sidenote mark to correct the issue. ``` % !TeX TS-program = xelatex \documentclass[11pt, a4paper]{book} \usepackage[french]{babel} \usepackage{libertine} \usepackage{sidenotes} \usepackage{realscripts} %%************************************* added <<<< \makeatletter \RenewDocumentCommand \@sidenotes@thesidenotemark { m } {\leavevmode% \ifhmode% \edef \@x@sf {\the\spacefactor}% \nobreak% \fi \hbox{\textsuperscript{#1}}% \ifhmode% \spacefactor \@x@sf% \fi } \makeatother %%************************************* \begin{document} \section{Superscript font check} This is a non specific font superscript \textsuperscript*{1} And this is a specific font superscript \textsuperscript{1} \medskip The side note call now uses a specific superscript~\sidenote{check font superscript} The note itself in the margin is visibly using a specific font superscript... Foot note is correctly using specific superscript\footnote{check foot note} \end{document} ``` Note the use of `~` if wanted to make a space before `\sidenote` (french rules), to avoid breaking the line there.
1
https://tex.stackexchange.com/users/161015
685132
317,847
https://tex.stackexchange.com/questions/685125
1
I try to create a command that shows the euro value. I want it to show different types (0 decimal digits, 2 decimal digits or all decimal digits) and have this set by a `\seteurformat` command. That works great (uncommented part of the code). I also want to have to option to temporarily change the length just for one call of the command and therefore created a local variable but somehow the copying from the global to the local variable does not work and it stays empty which leads to nothing being displayed... ``` \documentclass{scrlttr2} \usepackage[ngerman]{babel} \RequirePackage[defaultsans, scale=0.9]{opensans} \renewcommand\familydefault{\sfdefault} \usepackage[detect-all, separate-uncertainty]{siunitx} \sisetup{group-minimum-digits = 4, group-separator = {~}, locale=DE} \ExplSyntaxOn \str_new:N \g__eur_length_str \NewDocumentCommand{\seteurformat}{m} { \str_gset:Nn \g__eur_length_str { #1 } } \str_new:N \l__eur_length_temp_str \NewDocumentCommand{\EUR}{O{}m} { \str_if_empty:nTF { #1 } { % true \str_set:Nn \l__eur_length_temp_str { \str_show:N \g__eur_length_str } } { % false \str_set:Nn \l__eur_length_temp_str { #1 } } \str_case:Vn \l__eur_length_temp_str { {full}{\num[group-separator = {.}, minimum-decimal-digits=2]{#2} \nobreakspace \unit{€}} {standard}{\num[group-separator = {.},round-mode = places, round-precision = 2]{#2} \nobreakspace \unit{€}} {min}{\num[group-separator = {.}, round-mode = places, round-precision = 0]{#2} \nobreakspace \unit{€}} } % this part works but then I lose the option to temporarily change the length with #1 % \str_case:Vn \g__eur_length_str % { % {full}{\num[group-separator = {.}, minimum-decimal-digits=2]{#2} \nobreakspace \unit{€}} % {standard}{\num[group-separator = {.},round-mode = places, round-precision = 2]{#2} \nobreakspace \unit{€}} % {min}{\num[group-separator = {.}, round-mode = places, round-precision = 0]{#2} \nobreakspace \unit{€}} % } } \ExplSyntaxOff \begin{document} \seteurformat{full} \EUR{456} \seteurformat{min} \EUR{456} \EUR[full]{456} \EUR{456} \EUR[min]{456} \EUR{456} \end{document} ```
https://tex.stackexchange.com/users/281557
Copying one string into another does not work expl3
true
You seem to have a wrong idea of what `\str_show:N` does. If you want to set a string to the value of another one, you do ``` \str_set_eq:NN \l__eur_length_temp_str \g__eur_length_str ``` Here's a fixed code: ``` \documentclass{article} \usepackage[default, scale=0.9]{opensans} \usepackage[detect-all, separate-uncertainty]{siunitx} \sisetup{group-minimum-digits = 4, group-separator = {~}, locale=DE} \ExplSyntaxOn \str_new:N \g__eur_length_str \str_new:N \l__eur_length_temp_str \NewDocumentCommand{\seteurformat}{m} { \str_gset:Nn \g__eur_length_str { #1 } } \NewDocumentCommand{\EUR}{om} { \group_begin: \IfNoValueTF{#1} {% no optional argument \str_set_eq:NN \l__eur_length_temp_str \g__eur_length_str } {% optional argument present \str_set:Nn \l__eur_length_temp_str { #1 } } \str_case:Vn \l__eur_length_temp_str { {full}{\num[group-separator = {.}, minimum-decimal-digits=2]{#2} \nobreakspace \unit{€}} {standard}{\num[group-separator = {.},round-mode = places, round-precision = 2]{#2} \nobreakspace \unit{€}} {min}{\num[group-separator = {.}, round-mode = places, round-precision = 0]{#2} \nobreakspace \unit{€}} } \group_end: } \ExplSyntaxOff \begin{document} \seteurformat{full} \EUR{456} (full) \seteurformat{min} \EUR{456} (min) \EUR[full]{456} (full) \EUR{456} (min) \EUR[min]{456} (min) \EUR[standard]{456} (standard) \end{document} ``` A better implementation, where the user level command is handed to an internal function and there's no need to copy strings. ``` \documentclass{article} \usepackage[default, scale=0.9]{opensans} \usepackage[detect-all, separate-uncertainty]{siunitx} \sisetup{group-minimum-digits = 4, group-separator = {~}, locale=DE} \ExplSyntaxOn \str_new:N \g__eur_length_str \NewDocumentCommand{\seteurformat}{m} { \str_gset:Nn \g__eur_length_str { #1 } } \NewDocumentCommand{\EUR}{om} { \IfNoValueTF{#1} {% no optional argument \mrcarnivore_eur_print:Vn \g__eur_length_str { #2 } } {% optional argument present \mrcarnivore_eur_print:nn { #1 } { #2 } } } \cs_new_protected:Nn \mrcarnivore_eur_print:nn { \str_case:nn { #1 } { {full}{\num[group-separator = {.}, minimum-decimal-digits=2]{#2} \nobreakspace \unit{€}} {standard}{\num[group-separator = {.},round-mode = places, round-precision = 2]{#2} \nobreakspace \unit{€}} {min}{\num[group-separator = {.}, round-mode = places, round-precision = 0]{#2} \nobreakspace \unit{€}} } } \cs_generate_variant:Nn \mrcarnivore_eur_print:nn { V } \ExplSyntaxOff \begin{document} \seteurformat{full} \EUR{456} (full) \seteurformat{min} \EUR{456} (min) \EUR[full]{456} (full) \EUR{456} (min) \EUR[min]{456} (min) \EUR[standard]{456} (standard) \end{document} ```
2
https://tex.stackexchange.com/users/4427
685137
317,849
https://tex.stackexchange.com/questions/685126
0
I am using the `algorithm` package to create a list of algorithms in my thesis written with `toptesi` by Claudio Beccari. However, I am having trouble including the list of algorithms in the table of contents. Currently, I am generating the lists and table of contents using the commands `\figurespagetrue \tablespagetrue \indici`. Is there a way to include the list of algorithms in the table of contents, or is there a command that I can use to achieve this?
https://tex.stackexchange.com/users/296611
List of Algorithms with toptesi
true
Added a redefinition of `\indici` to produce and include the list of algorithms (with captions) when `\algospagetrue` is invoked before `\indici`. The algorithms are numbered in the same style as the tables and figures (adding the chapter number). Use `\renewcommand{\listalgorithmname}{<title>}` to change the name of the list of algorithms. . ``` % !TEX encoding = UTF-8 Unicode % !TEX TS-program = pdflatex \documentclass[% corpo=13pt, twoside, % stile=classica, oldstyle, autoretitolo, greek, evenboxes, % tipotesi, ]{toptesi} %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% \usepackage[utf8]{inputenc}% si può scegliere anche latin1, ma lo si sconsiglia fortemente \usepackage[T1]{fontenc} \usepackage{lmodern} \usepackage{lipsum} %%*********************************************** added <<<<<<<<<<<<<<<< \usepackage{algpseudocode} % added here <<<<<<<<<<<<<<<< \usepackage{algorithm} % added here <<<<<<<<<<<<<<<< \newif\ifalgospage \algospagefalse \renewcommand{\listalgorithmname}{Elenco degli algoritmi}% to change the list name <<<<<<<<<<< \renewcommand{\indici}{% \iffrontmatter\else\frontmattertrue\fi \tableofcontents \iftablespage {\addvspace{10pt} \let\saveaddvspace=\addvspace% \def\addvspace##1{} \listoftables \let\addvspace=\saveaddvspace} \fi \iffigurespage {\addvspace{10pt} \let\saveaddvspace=\addvspace% \def\addvspace##1{} \listoffigures \let\addvspace=\saveaddvspace} \fi \ifalgospage % added <<<<<<<<<< {\addvspace{10pt} \let\saveaddvspace=\addvspace% \def\addvspace##1{} \addcontentsline{toc}{chapter}{\listalgorithmname} \listofalgorithms \let\addvspace=\saveaddvspace} \fi \ifbool{@twoside}{\cleardoublepage[empty]}{}} \let\allcontents\indici \onecolumn \if@twoside \unless\ifScuDo \flushbottom \else \raggedbottom \fi \else \ifx\@xivpt\f@size \raggedbottom \else \flushbottom \fi \fi \brokenpenalty=10000 \def\interlinea#1{\linespread{#1}\selectfont} \def\endinterlinea{\par} \def\@floatboxreset{% \reset@font \linespread{1}% \normalsize \@setminipage } \makeatletter \renewcommand\thealgorithm{\thechapter.\arabic{algorithm}} % add the chapter number to the algorithm number <<<< \@addtoreset{algorithm}{chapter} \makeatother %%********************************************** \usepackage{hyperref} % must be last package <<<<<<<<<<<< \hypersetup{% pdfpagemode={UseOutlines}, bookmarksopen, pdfstartview={FitH}, colorlinks, linkcolor={blue}, citecolor={blue}, urlcolor={blue} } \begin{document} \tablespagetrue \figurespagetrue \algospagetrue % to produce and include the list of algorithms to the indice <<<<<<<<<<<<<<<<<<<<<<<< \indici \mainmatter \part{Prima Parte} \chapter{Introduzione generale} \lipsum[1] Le grandezze in gioco sono evidenziate nella figura \ref{fig:orbita}. \begin{figure}[ht!] \caption{Orbita del generico satellite; si noti l'eccentricit\`a dell'orbita rispetto al pianeta.}\label{fig:orbita} \end{figure} \chapter{Il barometro} Il mercurio gode della sorprendente qualit\`a et propriet\`a, cio\`e che esso diventa tanto solido da potersene fare una testa di martello et infiggere chiodi aguzzi nel legname. \begin{table}[htp!] % crea un floating body col nome Tabella nella \centering % comando necessario per centrare la tabella \caption[Densit\`a del mercurio]{Densit\`a del mercurio} \label{t:1} % didascalia con label \end{table} \chapter{Diversi algoritmi} \begin{algorithm}[ht!] \caption{An algorithm with caption}\label{alg:cap} \begin{algorithmic} \Require $n \geq 0$ \Ensure $y = x^n$ \State $y \gets 1$ \State $X \gets x$ \State $N \gets n$ \While{$N \neq 0$} \If{$N$ is even} \State $X \gets X \times X$ \State $N \gets \frac{N}{2} $ \Comment{This is a comment} \ElsIf{$N$ is odd} \State $y \gets y \times X$ \State $N \gets N - 1$ \EndIf \EndWhile \end{algorithmic} \end{algorithm} \end{document} ```
0
https://tex.stackexchange.com/users/161015
685140
317,850
https://tex.stackexchange.com/questions/685139
3
Given my table code below, I would like to add `\cline` to the last column, after the multirow fourth column. ``` \documentclass[10pt,fleqn]{article} \usepackage{array} \usepackage{multirow} \begin{document} \begin{table}[] \begin{tabular}{|l|l|l|l|l|} \hline first & second & third & fourth & fifth \\\hline 1 & first & two & \multirow{5}{*}{list} &\\\cline{1-3} 2 & second & three & &\\\cline{1-3} 3 & third & four & &\\\cline{1-3} 4 & fourth &five & &\\\cline{1-3} 5 & fifth & six & &\\\hline \end{tabular} \end{table} \end{document} ``` I have tried `\cline{1-3,5}`, `\cline{1-3}\cline{5}`. These do not work. How would on go about it?
https://tex.stackexchange.com/users/76578
How to add \cline to a fifth column after a multirow fourth column
false
The argument of `\cline` has to be a *range* of columns, separated by `-`. If `\cline` is supposed to span just one column, state that column's number both before and after `-`. For the table at hand, what you need to enter is `\cline{1-3} \cline{5-5}`. ``` \documentclass{article} \usepackage{array,multirow} \begin{document} \begin{table}[ht] \centering \begin{tabular}{|l|l|l|l|l|} \hline first & second & third & fourth & fifth \\ \hline 1 & first & two & \multirow{5}{*}{list} & \\ \cline{1-3}\cline{5-5} 2 & second & three & & \\ \cline{1-3}\cline{5-5} 3 & third & four & & \\ \cline{1-3}\cline{5-5} 4 & fourth & five & & \\ \cline{1-3}\cline{5-5} 5 & fifth & six & & \\ \hline \end{tabular} \end{table} \end{document} ```
2
https://tex.stackexchange.com/users/5001
685142
317,851
https://tex.stackexchange.com/questions/685149
1
The AMSTHM, and AMS latex in general, do a good job of counting theorems. For example "number by section" or "number by sub sub section. To satisfy multiple authors I need to do both. For example: Theorem 4.2.1.5 in sub subsection counting might be Theorem 4.23 in by section counting. I would like to use sub sub section counting, but display both counts : Theorem 4.2.1.5 (aka 4.23). I know I will need to define a new counter, but how I can get it the correct values I do not see. Any hints would be appreciated.
https://tex.stackexchange.com/users/260766
Can I get the AMS-Latex AMSTHM package to count theorems two different ways?
true
You can encapsulate your theorems in another environment, that changes the numbering, e.g.: ``` \documentclass{article} \usepackage{amsmath} \newtheorem{stheorem}{Theorem}[section] \newcounter{dctheorem}[subsubsection] \counterwithin{dctheorem}{subsection} \newenvironment{dctheorem}{% \ifnum \value{subsection}>0 \stepcounter{dctheorem}% \ifnum \value{subsubsection}>0 \renewcommand*{\thestheorem}{\thesubsubsection.\arabic{dctheorem} (aka \thesection.\arabic{stheorem})}% \else \renewcommand*{\thestheorem}{\thesubsection.\arabic{dctheorem} (aka \thesection.\arabic{stheorem})}% \fi \fi \stheorem }{% \endstheorem } \begin{document} \section{Referencing} See the theorems \ref{th:section}, \ref{th:subsectionA}, \ref{th:subsectionB}, \ref{th:subsubsectionA}, and \ref{th:subsubsectionB}. \section{Test Section} \begin{dctheorem}\label{th:section} This is a test theorem at section level. \end{dctheorem} \subsection{Test Subsection} \begin{dctheorem}\label{th:subsectionA} This is a test theorem at subsection level. \end{dctheorem} \subsubsection{Test Subsubsection} \begin{dctheorem}\label{th:subsubsectionA} This is a test theorem at subsubsection level. \end{dctheorem} \begin{dctheorem}\label{th:subsubsectionB} This is another test theorem at subsubsection level. \end{dctheorem} \subsection{Second Test Subsection} \begin{dctheorem}\label{th:subsectionB} This is a test theorem at subsection level. \end{dctheorem} \end{document} ```
0
https://tex.stackexchange.com/users/277964
685160
317,856
https://tex.stackexchange.com/questions/334246
115
What does the actual phrase above mean?
https://tex.stackexchange.com/users/116447
What does the phrase "Underfull \hbox (badness 10000) in paragraph" actually mean?
false
I just find out that using new line command `\\` in latex (overleaf) causes the problem. If you end a line with `\\` and start with a nonempty line then it works fine. Example: ``` \begin{document} Hello this is the first line.\\ This is the second line.\\ \end{document} ``` But when I need to skip one line (like pressing enter twice) I must use `\\ \\` (i.e. \\ twice). Since we are putting \\ at the end of an empty line this causes the problem. Example: ``` \begin{document} Hello this is the first line.\\ \\ %This is an empty line This is the third line. \end{document} ``` **Solution:** Use a text in white color between `\\` and `\\` to resolve this, though xcolor package will be required for this. Here is the code. ``` \begin{article} \usepackage{xcolor} Hello this is the first line.\\ {\color{white}-}\\ % This line will now show in pdf and no error will be generated. This is the third line. \end{article} ``` Hope this works!
0
https://tex.stackexchange.com/users/296651
685168
317,858
https://tex.stackexchange.com/questions/685161
1
I am calculating a value with pgfmathparse, pgfmathroundto and pgfmathresult. It works all fine in normal text mode, but when I call the command in a caption, I get an "Incomplete \iffalse; all text was ignored after line 14" error. Here is a minimal working sample: ``` \documentclass{article} \usepackage{graphicx} \usepackage{tikz} \newcommand{\myCalculation}[2]{\pgfmathparse{100 - #1 - #2}100 - #1 - #2 = \pgfmathroundto{\pgfmathresult}\pgfmathresult} \begin{document} Calculate \myCalculation{30}{20.11}. % this works. \begin{figure}[h] \centering \includegraphics[width=0.5\linewidth]{example-image} \caption{Calculate \myCalculation{30}{20.11}.} % this returns an error. \end{figure} \end{document} ``` This also happens for a table caption, btw. While it works inside the table itself, a table caption calling the function raises the error again. Is there a way to make such a command work in a caption, or is this a known bug?
https://tex.stackexchange.com/users/281886
Incomplete \iffalse error with pgfmathparse in a caption
true
You can use a protected command (which `\pgfmathparse` isn't) encapsulating the computation and use the more accurate floating point library that's included in the LaTeX kernel. ``` \documentclass{article} \usepackage{graphicx} \NewDocumentCommand{\myCalculation}{mm}{% $100 - #1 - #2 = \fpeval{round(100-#1-#2,\myAccuracy)}$% } \newcommand{\myAccuracy}{2} \begin{document} \listoffigures \section{Test} Calculate \myCalculation{30}{20.11}. % this works. \begin{figure}[htp] \centering \includegraphics[width=0.5\linewidth]{example-image} \caption{Calculate \myCalculation{30}{20.11}.} \end{figure} \end{document} ```
1
https://tex.stackexchange.com/users/4427
685171
317,860
https://tex.stackexchange.com/questions/503388
5
I read link: <https://www.overleaf.com/blog/613-tip-of-the-week-how-to-convert-typeset-pdf-pages-into-raster-image-formats> i use Texmarker 5.0.3 Can i convert main.pdf to multi images (each page = one image)? Example code: ``` \documentclass[11pt]{article} \usepackage{blindtext} %\usepackage{tikz} \usepackage{tcolorbox} \begin{document} \blindtext \begin{tcolorbox}[width=\textwidth,height=5cm] ABC DEF \end{tcolorbox} \blindtext \newpage \clearpage \blindtext \begin{tcolorbox}[width=\textwidth,height=5cm] XXX YYY \end{tcolorbox} \blindtext \end{document} ``` Thank in advance
https://tex.stackexchange.com/users/169612
Convert Pdf to multi images (png,jpg)
false
I find `pdftoppm` (poppler tool) to be much more efficient than imagemagick/convert, with a better quality (when I set a too high quality with convert, it crashes). For instance, you can do: ``` pdftoppm -jpeg -r 300 -scale-to-x 1920 -scale-to-y 1080 yourfile.pdf output-prefix ``` and it will create many images like `output-prefix-01.jpg`, `output-prefix-02.jpg`… (the number of 0 is determined depending on the number of files)
-1
https://tex.stackexchange.com/users/116348
685173
317,861
https://tex.stackexchange.com/questions/685165
0
I have this code ``` \documentclass{article} \usepackage{chemfig} \begin{document} \schemestart 2\chemfig{\charge{90:3pt={\tiny $-$1},90:8pt={\tiny $+$5}}{S}_2\charge{80:3pt={\tiny $-$2}}{O}^{2-}_{3 \, (aq)}} \arrow \chemfig{\charge{90:3pt={\tiny 0},90:8pt={\tiny $+$5}}{S}_4\charge{80:3pt={\tiny $-$2}}{O}^{2-}_{6 \, (aq)}} \+ 2\chemfig{e^{-}} \schemestop \end{document} ``` The problem here is that the numbers under sulfur and oxygen are different because the 4 and (aq) are under the 2- but I want it to be beneath the Oxygen exactly like at sulfur. Is there a way? I tried it with different curly brackets but I didn’t find a solution yet, can anyone help please?
https://tex.stackexchange.com/users/295942
Superscripted and subordinated Terms with chemfig
true
You could use the `\charge` macro to change the positions of the sulphur indices to match the position of the oxygen indices. Or place the phase and ion charge outside the compound composition using brackets, but I have a feeling you don't want to do that. So this is an example how the `\charge` macro can be used to reposition the sulphur indices to a lower position: ``` \documentclass{article} \usepackage{chemfig} \begin{document} \schemestart 2\chemfig{\charge{90:3pt={\tiny $-$1},90:8pt={\tiny $+$5}}{S}\charge{60:-4pt={\scriptsize 2}}{\phantom{..}}\charge{80:3pt={\tiny $-$2}}{O}^{2-}_{3 \, (aq)}} \arrow \chemfig{\charge{90:3pt={\tiny 0},90:8pt={\tiny $+$5}}{S}\charge{60:-4pt={\scriptsize 4}}{\phantom{..}}\charge{80:3pt={\tiny $-$2}}{O}^{2-}_{6 \, (aq)}} \+ 2\chemfig{e^{-}} \schemestop \end{document} ```
3
https://tex.stackexchange.com/users/189383
685176
317,863
https://tex.stackexchange.com/questions/685177
1
I am trying to create a custom title page in an scrbook class of document. The code is as follows: ``` \documentclass[openany]{scrbook} \title{Sample LaTeX Book With Custome Title Page} \author{Eva} \date{\today} \usepackage{blindtext} \begin{document} \begin{titlepage} \begin{tabular}{|l|c|l|} \hline Name & : & \textbf{\author} \\ \hline Submission Date & : & \textbf{\date} \\ \hline \end{tabular} \end{titlepage} \blinddocument \end{document} ``` The problem is that the third column, where my name, and the date should appear, remains blank. I tried to keep @author instead of \author in the third column. But when I did it, the third column had the word "author" instead of taking my name. What am I missing in this?
https://tex.stackexchange.com/users/267842
How can I add author's name and date in a table on the title page of scrbook class of LaTeX document?
true
You could use the *internal* storage macros, used by `\author{…}` and `\date{…}` (and also by `\maketitle`). Because they have *internal names* using `@`, you either [have to use `\makeatletter` and `\makeatother`](https://tex.stackexchange.com/questions/8351/what-do-makeatletter-and-makeatother-do) or `\csname …\endcsname`: ``` \documentclass[openany]{scrbook} \title{Sample LaTeX Book With Custome Title Page} \author{Eva} \date{\today} \usepackage{blindtext} \begin{document} \begin{titlepage} \begin{tabular}{|l|c|l|} \hline Name & : & \textbf{\csname @author\endcsname} \\ \hline Submission Date & : & \textbf{\csname @date\endcsname} \\ \hline \end{tabular} \end{titlepage} \blinddocument \end{document} ``` But I do not see any sense to not make it simple (and avoid internal macros): ``` \documentclass[openany]{scrbook} \usepackage{blindtext} \begin{document} \begin{titlepage} \begin{tabular}{|l|c|l|} \hline Name & : & \textbf{Eva} \\ \hline Submission Date & : & \textbf{\today} \\ \hline \end{tabular} \end{titlepage} \blinddocument \end{document} ``` Both examples result in: which is IMHO very ugly, so that I would rather use something like: ``` \documentclass[openany]{scrbook} \usepackage{blindtext} \usepackage{array} \begin{document} \begin{titlepage} \fbox{\begin{tabular}{l<{:}l} Name & \textbf{Eva} \\ Submission Date & \textbf{\today} \\ \end{tabular}} \end{titlepage} \blinddocument \end{document} ``` or even without the `\fbox`.
0
https://tex.stackexchange.com/users/277964
685178
317,864
https://tex.stackexchange.com/questions/685141
1
I used `pgfplots.sty` to draw a plot inside presentation. Data for the plot I generate inside `\foreach` loop and store in a macro. This works fine in presentation mode but when using `beamerarticle` package and `article` class many errors are shown. The sample code is below: ``` %\documentclass{beamer} \documentclass{article} \usepackage{beamerarticle} \usepackage{pgffor} \usepackage{fp} \usepackage{pgfplots} \usepackage{etoolbox} \usepackage{tikz} \begin{document} \def\tablebody{x,y\\} \makeatletter \foreach \x in {1,2,3,4}{ \FPeval\s{clip(x*x)} \protected@xappto\tablebody{\x,\s\\} } \makeatother \begin{frame}{Title} \begin{figure} \centering \begin{tikzpicture} \begin{axis}[xmin=0,xmax=5,ymin=0,ymax=20] \edef\plotargs{[blue] table[col sep=comma,row sep=\\]{\tablebody}} \expandafter\addplot\plotargs; \end{axis} \end{tikzpicture} \end{figure} \end{frame} \end{document} ``` Is any way to show the plot in article mode using `beamerarticle`?
https://tex.stackexchange.com/users/296619
pgfplots with inline data stored in macro in beamer article mode
false
I'm not sure if this workaround will cause other problems down the road, but you could get your document to compile like this: ``` %\documentclass{beamer} \documentclass{article} \usepackage{beamerarticle} \makeatletter \renewcommand<>{\\}{\only#1{\beameroriginal\\}} \renewcommand<>{\@centercr}{\only#1{\beameroriginal\@centercr}} \renewcommand<>{\@normalcr}{\only#1{\beameroriginal\@normalcr}} \makeatother \usepackage{pgffor} \usepackage{fp} \usepackage{pgfplots} \usepackage{etoolbox} \usepackage{tikz} \begin{document} \def\tablebody{x,y\\} \makeatletter \foreach \x in {1,2,3,4}{ \FPeval\s{clip(x*x)} \protected@xappto\tablebody{\x,\s\\} } \makeatother \begin{frame}{Title} \begin{figure} \centering \begin{tikzpicture} \begin{axis}[xmin=0,xmax=5,ymin=0,ymax=20] \edef\plotargs{[blue] table[col sep=comma,row sep=\\]{\tablebody}} \expandafter\addplot\plotargs; \end{axis} \end{tikzpicture} \end{figure} \end{frame} \end{document} ```
0
https://tex.stackexchange.com/users/36296
685179
317,865
https://tex.stackexchange.com/questions/38200
18
The following code works: ``` \def \robble {robble} \def \robbles {\robble\robble} ``` But the following but doesn't: ``` \def \robbles {robble} \def \robbles {\robbles robble} ``` The overall goal is to get `robbles` to be robblerobble. I need something like the second example, where I am appending on to the current value of a variable. The way it is written right now causes a stack overflow. Is there a way to append to variables in LaTeX?
https://tex.stackexchange.com/users/7408
Appending to Variables
false
If we wish to expand completely the macro, then `\edef\mymacro{\mymacro,3}` works great as mentionned above. But if you only want to expand once your macro, then I like `\expanded{…}` more and more (intuitively, it expands its parameter, except for tokens prefixed with `\noexpand`, and then it expands the resulting string). Since we want to postpone the evaluation of `\def` and `\mymacro`, we can simply prepend `\noexpand` in front of them: ``` \documentclass{article} \begin{document} \def\mymacro{1,2} My macro is \mymacro \expanded{\noexpand\def\noexpand\mymacro{\unexpanded\expandafter{\mymacro},3}} My macro is \mymacro \end{document} ``` Note that `\unexpanded\expandafter{…}` can be replaced with `\expandonce{…}` if we load etoolbox, since it actually expands only once the macro.
0
https://tex.stackexchange.com/users/116348
685188
317,868
https://tex.stackexchange.com/questions/685187
2
I want to assign the values of other commands (like `\nobreakspace`) to a string to be able to use these later. Assigning does not seem to work as it is taking the commands literaly... ``` \documentclass{scrlttr2} \usepackage{tgheros} \renewcommand\familydefault{\sfdefault} \usepackage[ngerman]{babel} % ===================================== % correct number displaying \usepackage[mode=text, reset-text-series = false, separate-uncertainty, group-digits=integer, group-minimum-digits = 4]{siunitx} \sisetup{group-separator = {\,}, input-decimal-markers={,.}, output-decimal-marker = {,}} \ExplSyntaxOn \str_new:N \g__eur_length_str \NewDocumentCommand{\setcurrencyformat}{m} { \str_gset:Nn \g__eur_length_str { #1 } } \NewDocumentCommand{\EUR}{om} { \currency_print_value:nnn { #1 } { #2 } { € } } \NewDocumentCommand{\currency}{om} { \currency_print_value:nnn { #1 } { #2 } { } } \cs_new_protected:Nn \currency_print_value:nnn { \IfNoValueTF{#1} {% no optional argument \currency_print:Vnn \g__eur_length_str { #2 } { #3 } } {% optional argument present \currency_print:nnn { #1 } { #2 } { #3 } } } \str_new:N \l__currency_temp_str \cs_new_protected:Nn \currency_print:nnn { \str_if_eq:nnTF {#3} { } { % empty \str_set:Nn \l__currency_temp_str {} } { % not empty \str_set:Nn \l__currency_temp_str { \nobreakspace \unit{#3} } } \str_show:N \l__currency_temp_str \str_case:nn { #1 } { { full } { \num[group-separator = {.}, minimum-decimal-digits = 2]{#2} \str_use:N \l__currency_temp_str } { standard }{ \num[group-separator = {.}, round-mode = places, round-precision = 2]{#2} \str_use:N \l__currency_temp_str } { min } { \num[group-separator = {.}, round-mode = places, round-precision = 0]{#2} \str_use:N \l__currency_temp_str } { noseperator } { #2 } %\nobreakspace \unit{#3} } } } \cs_generate_variant:Nn \currency_print:nnn { V } \setcurrencyformat{full} \ExplSyntaxOff % ===================================== % calculation \RequirePackage{booktabs} \begin{document} \begin{letter}{} \currency[noseparator]{123.45678} (currency[noseparator]) \EUR{456.7890} (EUR) \end{letter} \end{document} ``` Is `\str_set:nn \l_temp_str { \nobreakspace \unit{#3} }` not correct? I also tried `\str_set:nV \l_temp_str { \nobreakspace \unit{#3} }` to take the value of the commands which did not work either...
https://tex.stackexchange.com/users/281557
Assigning commands to str does not work
true
The `str` datatype matches the result of primitives such as `\string`, `\detokenize`, ... All character tokens of catcode 12 (other) except space which is catcode 10. So you can not store a csname token such as `\unit` in a `str` Use the `tl` (token list) datatype.
7
https://tex.stackexchange.com/users/1090
685189
317,869
https://tex.stackexchange.com/questions/685194
0
When using one option of a `\str_case` for the case `noseperator` the returned string is empty. I do not understand why... ``` \documentclass{article} \RequirePackage{booktabs} \usepackage[mode=text, reset-text-series = false, separate-uncertainty, group-digits=integer, group-minimum-digits = 4]{siunitx} \sisetup{group-separator = {\,}, input-decimal-markers={,.}, output-decimal-marker = {,}} \ExplSyntaxOn \str_new:N \g__eur_length_str \NewDocumentCommand{\setcurrencyformat}{m} { \str_gset:Nn \g__eur_length_str { #1 } } \NewDocumentCommand{\EUR}{om} { \currency_print_value:nnn { #1 } { #2 } { € } } \NewDocumentCommand{\currency}{om} { \currency_print_value:nnn { #1 } { #2 } { } } \cs_new_protected:Nn \currency_print_value:nnn { \IfNoValueTF{#1} {% no optional argument \currency_print:Vnn \g__eur_length_str { #2 } { #3 } } {% optional argument present \currency_print:nnn { #1 } { #2 } { #3 } } } \tl_new:N \l__currency_temp_tl \cs_new_protected:Nn \currency_print:nnn { \str_if_eq:nnTF {#3} { } { % empty \tl_set:Nn \l__currency_temp_tl {} } { % not empty \tl_set:Nn \l__currency_temp_tl { \nobreakspace \unit{#3} } } \str_case:nn { #1 } { { full } { \num[group-separator = {.}, minimum-decimal-digits = 2]{#2} \tl_use:N \l__currency_temp_tl } { standard }{ \num[group-separator = {.}, round-mode = places, round-precision = 2]{#2} \tl_use:N \l__currency_temp_tl } { min } { \num[group-separator = {.}, round-mode = places, round-precision = 0]{#2} \tl_use:N \l__currency_temp_tl } { noseperator } { #2 \tl_use:N \l__currency_temp_tl } % <= returns nothing } } \cs_generate_variant:Nn \currency_print:nnn { V } \setcurrencyformat{full} \ExplSyntaxOff \begin{document} \currency[noseparator]{123.45678} (currency[noseparator]) % <= returns nothing \EUR[noseparator]{123.45678} (EUR[noseparator]) % <= returns nothing \currency{123.45678} (currency) \currency[full]{123.45678} (currency[full]) \end{document} ```
https://tex.stackexchange.com/users/281557
Argument not returned for some options
true
`noseperator` is not `noseparator`
1
https://tex.stackexchange.com/users/1090
685199
317,871
https://tex.stackexchange.com/questions/685206
0
I would like to insert an A1 sized, landscape oriented, PDF page into a LaTeX document that besides this page only has regular A4-sized portrait pages. I'm currently using the pdfpages package, but without much success. I tried: ``` \includepdf[width=33.2in,height=23.4in,landscape=true]{appendix/pdfs/filename.pdf} ``` but this only zooms in the content of the PDF to the stated dimensions without increasing the actual paper size. So the content does not fit on the page. It does rotate to landscape though! I read somewhere to try \eject, \pagewidth and \pageheight, but so far I've tried several different variations of this without the result I'm looking for. Can anyone help me out? Thanks a lot!
https://tex.stackexchange.com/users/279352
Having issues inserting an A1 size, landscape PDF page into LaTeX document
false
@TeddyvanJerry helped me with the solution! This worked: ``` \includepdf[fitpaper,landscape=true]{appendix/pdfs/b_grillagesarrangement.pdf} ```
0
https://tex.stackexchange.com/users/279352
685209
317,875
https://tex.stackexchange.com/questions/685165
0
I have this code ``` \documentclass{article} \usepackage{chemfig} \begin{document} \schemestart 2\chemfig{\charge{90:3pt={\tiny $-$1},90:8pt={\tiny $+$5}}{S}_2\charge{80:3pt={\tiny $-$2}}{O}^{2-}_{3 \, (aq)}} \arrow \chemfig{\charge{90:3pt={\tiny 0},90:8pt={\tiny $+$5}}{S}_4\charge{80:3pt={\tiny $-$2}}{O}^{2-}_{6 \, (aq)}} \+ 2\chemfig{e^{-}} \schemestop \end{document} ``` The problem here is that the numbers under sulfur and oxygen are different because the 4 and (aq) are under the 2- but I want it to be beneath the Oxygen exactly like at sulfur. Is there a way? I tried it with different curly brackets but I didn’t find a solution yet, can anyone help please?
https://tex.stackexchange.com/users/295942
Superscripted and subordinated Terms with chemfig
false
There are many superscripts and subscripts on these ions, which makes it confusing. One way of writing these ions, which is allowed by IUPAC, is to use parentheses around the ions. And that's enough to solve your problem. The only changes I made to your code were introducing the parentheses and repositioning the superscripts and subscripts. ``` \documentclass{article} \usepackage{chemfig} \begin{document} \schemestart 2\chemleft{(}\chemfig{\charge{90:3pt={\tiny $-$1},90:8pt={\tiny $+$5}}{S}_2\charge{80:3pt={\tiny $-$2}}{O}_{3}}\chemright{)^{2-}_{(aq)}} \arrow \chemleft{(}\chemfig{\charge{90:3pt={\tiny 0},90:8pt={\tiny $+$5}}{S}_4\charge{80:3pt={\tiny $-$2}}{O}_{6}}\chemright{)^{2-}_{(aq)}} \+ 2\chemfig{e^{-}} \schemestop \end{document} ```
2
https://tex.stackexchange.com/users/134993
685213
317,877
https://tex.stackexchange.com/questions/685201
1
Consider the following MCE: ``` \documentclass{article} \newcommand{\mynewcommand}{foo} \NewDocumentCommand{\MyNewDocumentCommand}{}{bar} \ExplSyntaxOn \iow_term:x {mynewcommand=\mynewcommand} \iow_term:x {MyNewDocumentCommand=\MyNewDocumentCommand} \ExplSyntaxOff \begin{document} \begin{itemize} \item \verb|\mynewcommand|=\mynewcommand \item \verb|\MyNewDocumentCommand|=\MyNewDocumentCommand \end{itemize} \end{document} ``` When it is compiled, what it is displayed: * in the resulting PDF is expected: ``` • \mynewcommand=foo • \MyNewDocumentCommand=bar ``` * in the terminal is expected for `\mynewcommand` but is unexpected for `\MyNewDocumentCommand`: ``` mynewcommand=foo MyNewDocumentCommand=\MyNewDocumentCommand ``` Why, in the terminal, the `⟨code⟩` of `\NewDocumentCommand{⟨cmd⟩}{⟨arg spec⟩}{⟨code⟩}` isn't displayed, whereas the `⟨code⟩` of `\newcommand{⟨cmd⟩}[⟨num⟩][⟨default⟩]{⟨code⟩}` is displayed?
https://tex.stackexchange.com/users/18401
Why the ⟨code⟩ of \NewDocumentCommand{⟨cmd⟩}{⟨arg spec⟩}{⟨code⟩} isn't displayed in the terminal?
true
If you use `\newcommand\macro` then the `\macro` is defined using TeX primitives `\long\def\macro`. The macro is expanded inside `\edef` and inside `\write` and `\message` primitives, i.e. when you write an information into the terminal or log file. On the other hand, if you use `\NewDocumentCommand\macro` then the macro is defined by TeX primitives `\protected\def\macro` (and the macro body is more complicated in this case). When the `\macro` is defined as `\protected` then it is expanded in typesetting context but it isn't expanded in `\edef`, `\write`, `\message`.
3
https://tex.stackexchange.com/users/51799
685224
317,882
https://tex.stackexchange.com/questions/685223
1
i have a large matrix that goes of the pdf when compliled. a suggestion to use `\resizebox{0.94\textwidth}{!}{%$...$}` which i followed but this causes my remaining work to have large vertical spaces in between. The Matrix cannot be changed and must appear as it is. If you have a suggestion that wouldn't require > > `\resizebox`, it will be greatly appreciated but all the elements of it must appear as it is. > > > ``` \documentclass[fleqn]{book} %%CreatedwithwxMaxima22.04.0 \setlength{\parskip}{\medskipamount} \setlength{\parindent}{0pt} \usepackage{iftex} \ifPDFTeX %PDFLaTeXorLaTeX \usepackage[utf8]{inputenc} \usepackage[T1]{fontenc} \DeclareUnicodeCharacter{00B5}{\ensuremath{\mu}} \else %XeLaTeXorLuaLaTeX \usepackage{fontspec} \fi \usepackage{graphicx} \usepackage{color} \usepackage{amsmath,amssymb,mathtools} \usepackage{grffile} \usepackage{ifthen} \newsavebox{\picturebox} \newlength{\pictureboxwidth} \newlength{\pictureboxheight} \newcommand{\HRule}{\rule{\linewidth}{0.5mm}} \newcommand{\includeimage}[1]{ \savebox{\picturebox}{\includegraphics{#1}} \settoheight{\pictureboxheight}{\usebox{\picturebox}} \settowidth{\pictureboxwidth}{\usebox{\picturebox}} \ifthenelse{\lengthtest{\pictureboxwidth>.95\linewidth}} { \includegraphics[width=.95\linewidth,height=.80\textheight,keepaspectratio]{#1} } { \ifthenelse{\lengthtest{\pictureboxheight>.80\textheight}} { \includegraphics[width=.95\linewidth,height=.80\textheight,keepaspectratio]{#1} } { \includegraphics{#1} } } } \newlength{\thislabelwidth} \DeclareMathOperator{\abs}{abs} \definecolor{labelcolor}{RGB}{100,0,0} \begin{document} {\begin{equation}\label{mat} \hspace*{-0.5cm} \renewcommand\arraystretch{2.25} \medmuskip=0mu \setlength\arraycolsep{2.5pt} % default: 5pt \resizebox{1.35\textwidth}{!}{% $D=\begin{bmatrix} 1 &{x_{n+1}-h} & {\bigg(x_{n+1}-h\bigg)^2} & {\bigg(x_{n+1}-h\bigg)^3} & {\bigg(x_{n+1}-h\bigg)^4} & {\bigg(x_{n+1}-h\bigg)^5} & {\bigg(x_{n+1}-h\bigg)^6} & {\bigg(x_{n+1}-h\bigg)^7} & {\bigg(x_{n+1}-h\bigg)^8} & {\bigg(x_{n+1}-h\bigg)^9}\\ 0 & 1 & 2 {\bigg(x_{n+1}-h\bigg)} & 3 {\bigg(x_{n+1} -h\bigg)^2} & 4 {\bigg(x_{n+1} -h\bigg)^3} & 5 {\bigg(x_{n+1} -h\bigg)^4} & 6 {\bigg(x_{n+1} -h\bigg)^5} & 7 {\bigg(x_{n+1} -h\bigg)^6} & 8 {\bigg(x_{n+1} -h\bigg)^7} & 9 {\bigg(x_{n+1} -h\bigg)^8}\\ 0 & 1 & 2 {x_{n+1}} & 3 {x_{n+1}^2} & 4 {x_{n+1}^3} & 5 {x_{n+1}^4} & 6 {x_{n+1}^5} & 7 {x_{n+1}^6} & 8 {x_{n+1}^7} & 9 {x_{n+1}^8}\\ 0 & 1 & 2{\bigg(x_{n+1}+ \frac{1}{2}h\bigg)} & 3{\bigg(x_{n+1}+ \frac{1}{2}h\bigg)^2} & 4{\bigg(x _{n+1}+ \frac{1}{2}h\bigg)^3} & 5{\bigg(x _{n+1}+ \frac{1}{2}h\bigg)^4} & 6{\bigg(x _{n+1}+ \frac{1}{2}h\bigg)^5} & 7{\bigg(x _{n+1}+ \frac{1}{2}h\bigg)^6} & 8{\bigg(x _{n+1}+ \frac{1}{2}h\bigg)^7} & 9{\bigg(x _{n+1}+ \frac{1}{2}h\bigg)^8}\\ 0 & 1 & 2 {\bigg(x_{n+1}+h\bigg)} & 3 {\bigg(x_{n+1} +h\bigg)^2} & 4 {\bigg(x_{n+1} +h\bigg)^3} & 5 {\bigg(x_{n+1} +h\bigg)^4} & 6 {\bigg(x_{n+1} +h\bigg)^5} & 7 {\bigg(x_{n+1} +h\bigg)^6} & 8 {\bigg(x_{n+1} +h\bigg)^7} & 9 {\bigg(x_{n+1} +h\bigg)^8}\\ 0 & 1 & 2 {\bigg(x _{n+1}+ \frac{3}{2}h\bigg)} & 3{\bigg(x _{n+1}+ \frac{3}{2}h\bigg)^2} & 4{\bigg(x _{n+1}+ \frac{3}{2}h\bigg)^3} & 5{\bigg(x _{n+1}+ \frac{3}{2}h\bigg)^4} & 6{\bigg(x _{n+1}+ \frac{3}{2}h\bigg)^5} & 7{\bigg(x _{n+1}+ \frac{3}{2}h\bigg)^6} & 8{\bigg(x _{n+1}+ \frac{3}{2}h\bigg)^7} & 9{\bigg(x _{n+1}+ \frac{3}{2}h\bigg)^8}\\ 0 & 1 & 2 {\bigg(x_{n+1} +2 h\bigg)} & 3 {\bigg(x_{n+1} +2 h\bigg)^2} & 4 {\bigg(x_{n+1} +2 h\bigg)^3} & 5 {\bigg(x_{n+1} +2 h\bigg)^4} & 6 {\bigg(x_{n+1} +2 h\bigg)^5} & 7 {\bigg(x_{n+1} +2 h\bigg)^6} & 8 {\bigg(x_{n+1} +2 h\bigg)^7} & 9 {\bigg(x_{n+1} +2 h\bigg)^8}\\ 0 & 1 & 2{\bigg(x_{n+1}+\frac{5}{2}h\bigg)} & 3{\bigg(x _{n+1}+ \frac{5}{2}h\bigg)^2} & 4{\bigg(x _{n+1}+ \frac{5}{2}h\bigg)^3} & 5{\bigg(x _{n+1}+ \frac{5}{2}h\bigg)^4} & 6{\bigg(x _{n+1}+ \frac{5}{2}h\bigg)^5} & 7{\bigg(x _{n+1}+ \frac{5}{2}h\bigg)^6} & 8{\bigg(x _{n+1}+ \frac{5}{2}h\bigg)^7} & 9{\bigg(x _{n+1}+ \frac{5}{2}h\bigg)^8}\\ 0 & 1 & 2 {\bigg(x_{n+1}+3h\bigg)} & 3 {\bigg(x_{n+1}+3h\bigg)^2} & 4 {\bigg(x_{n+1}+3h\bigg)^3} & 5 {\bigg(x_{n+1}+3h\bigg)^4} & 6 {\bigg(x_{n+1}+3h\bigg)^5} & 7 {\bigg(x_{n+1}+3h\bigg)^6} & 8 {\bigg(x_{n+1}+3h\bigg)^7} & 9 {\bigg(x_{n+1}+3h\bigg)^8}\\ 0 & 1 & 2 {\bigg(x _{n+1}+ \frac{7}{2}h\bigg)} & 3{\bigg(x _{n+1}+ \frac{7}{2}h\bigg)^2} & 4{\bigg(x _{n+1}+ \frac{7}{2}h\bigg)^3} & 5 {\bigg(x _{n+1}+ \frac{7}{2}h\bigg)^4} & 6 {\bigg(x _{n+1}+ \frac{7}{2}h\bigg)^5} & 7 {\bigg(x _{n+1}+ \frac{7}{2}h\bigg)^6} & 8 {\bigg(x _{n+1}+ \frac{7}{2}h\bigg)^7} & 9 {\bigg(x _{n+1}+ \frac{7}{2}h\bigg)^8} \end{bmatrix}$} \end{equation} \par} The determinant of the new $D$ matrix is: \begin{equation}det (B) =\frac{15380234690625 h}{64}h^{36}\end{equation} The inverse of {\eqref{mat}} is the $C$ matrix, which is calculated using \textbf{wxMaxima} codes as shown in the \textbf{Appendix}. Our sole interest in the $C$ matrix is its first row and the elements are: \end{document} ``` Also, can i use `\hspace*{}` or `\hspace` inside an equation enviroment and how can i use it for only a specific equation. ps: i am very new at latex, please explanations should be toddler-level. thanks
https://tex.stackexchange.com/users/295796
removing vertical space
false
Your example reports ``` Overfull \hbox (106.53506pt too wide) detected at line 70 ``` it is more readable if you avoid `\resizebox` and add some notation for sub terms ``` \documentclass[fleqn]{book} %%CreatedwithwxMaxima22.04.0 % probably better to use parskip package \setlength{\parskip}{\medskipamount} \setlength{\parindent}{0pt} \usepackage{iftex} \ifPDFTeX %PDFLaTeXorLaTeX % no \usepackage[utf8]{inputenc} \usepackage[T1]{fontenc} \DeclareUnicodeCharacter{00B5}{\ensuremath{\mu}} \else %XeLaTeXorLuaLaTeX % no need unless changing fonts \usepackage{fontspec} \fi \usepackage{graphicx} \usepackage{color} \usepackage{amsmath,amssymb,mathtools} % no \usepackage{grffile} \usepackage{ifthen} \newsavebox{\picturebox} \newlength{\pictureboxwidth} \newlength{\pictureboxheight} \newcommand{\HRule}{\rule{\linewidth}{0.5mm}} % you need % where %%% marked % there is no need for this as \includegraphics % already measures the natural size \newcommand{\includeimage}[1]{%%% \savebox{\picturebox}{\includegraphics{#1}} \settoheight{\pictureboxheight}{\usebox{\picturebox}} \settowidth{\pictureboxwidth}{\usebox{\picturebox}} \ifthenelse{\lengthtest{\pictureboxwidth>.95\linewidth}} {%%% \includegraphics[width=.95\linewidth,height=.80\textheight,keepaspectratio]{#1}%%% } {%%% \ifthenelse{\lengthtest{\pictureboxheight>.80\textheight}} {%%% \includegraphics[width=.95\linewidth,height=.80\textheight,keepaspectratio]{#1}%%% %%% } {%%% \includegraphics{#1}%%% } } } \newlength{\thislabelwidth} \DeclareMathOperator{\abs}{abs} \definecolor{labelcolor}{RGB}{100,0,0} \begin{document} Let $y(i)=x_{n+1}+ih$ {\footnotesize \setlength\arraycolsep{1.6pt} % default: 5pt \begin{multline}\label{mat} \hspace*{-0.5cm} \renewcommand\arraystretch{2.25} \medmuskip=0mu D={}\\ \begin{bmatrix} 1 &y(-1) & \!y(-1)^2\! & y(-1)^3 & y(-1)^4 & y(-1)^5 & y(-1)^6 & y(-1)^7 & y(-1)^8 & y(-1)^9\\ 0 & 1 & 2 y(-1)) & 3 y(-1)^2 & 4 y(-1)^3 & 5y(-1)^4 & 6 y(-1)^5 & 7 y(-1)^6 & 8 y(-1)^7 & 9 y(-1)^8\\ 0 & 1 & 2 y(0) & 3 y(0)^2 & 4 y(0)^3 & 5 y(0)^4 & 6 y(0)^5 & 7 y(0)^6 & 8 y(0)^7 & 9 y(0)^8\\ 0 & 1 & 2y( \frac{1}{2}) & 3y( \frac{1}{2})^2 & 4y( \frac{1}{2})^3 & 5y( \frac{1}{2})^4 & 6y( \frac{1}{2})^5 & 7y( \frac{1}{2})^6 & 8y( \frac{1}{2})^7 & 9y( \frac{1}{2})^8\\ 0 & 1 & 2 y(0) & 3 y(0)^2 & 4 y(0)^3 & 5 y(0)^4 & 6 y(0)^5 & 7 y(0)^6 & 8 y(0)^7 & 9 y(0)^8\\ 0 & 1 & 2 y( \frac{3}{2}) & 3y( \frac{3}{2})^2 & 4y( \frac{3}{2})^3 & 5y( \frac{3}{2})^4 & 6y( \frac{3}{2})^5 & 7y( \frac{3}{2})^6 & 8y( \frac{3}{2})^7 & 9y( \frac{3}{2})^8\\ 0 & 1 & 2 y(2 ) & 3 y(2 )^2 & 4 y(2 )^3 & 5 y(2 )^4 & 6 y(2 )^5 & 7 y(2 )^6 & 8 y(2 )^7 & 9 y(2 )^8\\ 0 & 1 & 2y(\frac{5}{2}) & 3y( \frac{5}{2})^2 & 4y( \frac{5}{2})^3 & 5y( \frac{5}{2})^4 & 6y( \frac{5}{2})^5 & 7y( \frac{5}{2})^6 & 8y( \frac{5}{2})^7 & 9y( \frac{5}{2})^8\\ 0 & 1 & 2 y(3) & 3 y(3)^2 & 4 y(3)^3 & 5 y(3)^4 & 6 y(3)^5 & 7 y(3)^6 & 8 y(3)^7 & 9 y(3)^8\\ 0 & 1 & 2 y( \frac{7}{2}) & 3y( \frac{7}{2})^2 & 4y( \frac{7}{2})^3 & 5 y( \frac{7}{2})^4 & 6 y( \frac{7}{2})^5 & 7 y( \frac{7}{2})^6 & 8 y( \frac{7}{2})^7 & 9 y( \frac{7}{2})^8 \end{bmatrix} \end{multline} } The determinant of the new $D$ matrix is: \begin{equation}det (B) =\frac{15380234690625 h}{64}h^{36}\end{equation} The inverse of {\eqref{mat}} is the $C$ matrix, which is calculated using \textbf{wxMaxima} codes as shown in the \textbf{Appendix}. Our sole interest in the $C$ matrix is its first row and the elements are: \end{document} ```
5
https://tex.stackexchange.com/users/1090
685228
317,885
https://tex.stackexchange.com/questions/685230
3
I’m trying to apply (edit: *in place*) a simple map to map the list `1,2,3` to `2,3,4` by adding 1 to each item. However, I can’t find a more elegant way than defining a new list for that. Can this code be improved? ``` \documentclass{article} \begin{document} \ExplSyntaxOn \clist_clear_new:N \l_blenderpoint_clist % Will be used to contain the list to sort \clist_set:Nx \l_blenderpoint_clist {1,2,3} My ~ list ~ is ~ \l_blenderpoint_clist \\ \clist_clear_new:N \l_blenderpoint_clist_two % Will be used to contain the list to sort \clist_map_inline:Nn \l_blenderpoint_clist { \clist_put_right:Nx \l_blenderpoint_clist_two {\int_eval:n{#1+1}} } \clist_set:Nx \l_blenderpoint_clist \l_blenderpoint_clist_two My ~ list ~ is ~ \l_blenderpoint_clist \ExplSyntaxOff \end{document} ```
https://tex.stackexchange.com/users/116348
Elegantly apply a map to all items of a clist (LaTeX3)
true
``` \documentclass{article} \ExplSyntaxOn \let\foo\clist_map_inline:nn \ExplSyntaxOff \begin{document} \foo{1,2,3}{\inteval{#1+1},} \end{document} ``` --- after the updated question, saving back to the list: ``` \documentclass{article} \ExplSyntaxOn \clist_new:N\l_blenderpoint_clist \clist_set:Nn\l_blenderpoint_clist{1,2,3} \clist_show:N\l_blenderpoint_clist \cs_new:Npn\l_add:n#1{\int_eval:n{#1+1},} \clist_set:Nx\l_blenderpoint_clist{\clist_map_function:NN\l_blenderpoint_clist\l_add:n} \clist_show:N\l_blenderpoint_clist \ExplSyntaxOff \begin{document} ``` log: ``` The comma list \l_blenderpoint_clist contains the items (without outer braces): > {1} > {2} > {3}. <recently read> } l.8 \clist_show:N\l_blenderpoint_clist ? The comma list \l_blenderpoint_clist contains the items (without outer braces): > {2} > {3} > {4}. <recently read> } l.11 \clist_show:N\l_blenderpoint_clist ? ```
3
https://tex.stackexchange.com/users/1090
685232
317,886
https://tex.stackexchange.com/questions/685230
3
I’m trying to apply (edit: *in place*) a simple map to map the list `1,2,3` to `2,3,4` by adding 1 to each item. However, I can’t find a more elegant way than defining a new list for that. Can this code be improved? ``` \documentclass{article} \begin{document} \ExplSyntaxOn \clist_clear_new:N \l_blenderpoint_clist % Will be used to contain the list to sort \clist_set:Nx \l_blenderpoint_clist {1,2,3} My ~ list ~ is ~ \l_blenderpoint_clist \\ \clist_clear_new:N \l_blenderpoint_clist_two % Will be used to contain the list to sort \clist_map_inline:Nn \l_blenderpoint_clist { \clist_put_right:Nx \l_blenderpoint_clist_two {\int_eval:n{#1+1}} } \clist_set:Nx \l_blenderpoint_clist \l_blenderpoint_clist_two My ~ list ~ is ~ \l_blenderpoint_clist \ExplSyntaxOff \end{document} ```
https://tex.stackexchange.com/users/116348
Elegantly apply a map to all items of a clist (LaTeX3)
false
Use a scratch clist. ``` \documentclass{article} \ExplSyntaxOn \clist_new:N \l__tborachangeclist_temp_clist % temporary \cs_new_protected:Nn \tbora_changeclist:Nn { \clist_clear:N \l__tborachangeclist_temp_clist \clist_map_inline:Nn #1 { \clist_put_right:Nx \l__tborachangeclist_temp_clist { #2 } } \clist_set_eq:NN #1 \l__tborachangeclist_temp_clist } %%% test \clist_new:N \l_tbora_list_clist \clist_set:Nn \l_tbora_list_clist { 1, 2, 3 } \tbora_changeclist:Nn \l_tbora_list_clist { \int_eval:n { #1 + 1 } } \clist_show:N \l_tbora_list_clist \tbora_changeclist:Nn \l_tbora_list_clist { -#1- } \clist_show:N \l_tbora_list_clist \ExplSyntaxOff \stop ``` The console will show ``` The comma list \l_tbora_list_clist contains the items (without outer braces): > {1} > {2} > {3}. <recently read> } l.22 \clist_show:N \l_tbora_list_clist ? The comma list \l_tbora_list_clist contains the items (without outer braces): > {2} > {3} > {4}. <recently read> } l.26 \clist_show:N \l_tbora_list_clist ? The comma list \l_tbora_list_clist contains the items (without outer braces): > {-2-} > {-3-} > {-4-}. <recently read> } ``` You might want to use sequences rather than clists: the former variable type is much more flexible. ``` \seq_set_from_clist:Nn \l_tmpa_seq { 1, 2, 3 } \seq_show:N \l_tmpa_seq \seq_set_map_x:NNn \l_tmpa_seq \l_tmpa_seq { \int_eval:n { #1 + 1 } } \seq_show:N \l_tmpa_seq \seq_set_map:NNn \l_tmpa_seq \l_tmpa_seq { -#1- } \seq_show:N \l_tmpa_seq ``` would output ``` The sequence \l_tmpa_seq contains the items (without outer braces): > {1} > {2} > {3}. <recently read> } l.6 \seq_show:N \l_tmpa_seq ? The sequence \l_tmpa_seq contains the items (without outer braces): > {2} > {3} > {4}. <recently read> } l.9 \seq_show:N \l_tmpa_seq ? The sequence \l_tmpa_seq contains the items (without outer braces): > {-2-} > {-3-} > {-4-}. <recently read> } ```
3
https://tex.stackexchange.com/users/4427
685233
317,887
https://tex.stackexchange.com/questions/685230
3
I’m trying to apply (edit: *in place*) a simple map to map the list `1,2,3` to `2,3,4` by adding 1 to each item. However, I can’t find a more elegant way than defining a new list for that. Can this code be improved? ``` \documentclass{article} \begin{document} \ExplSyntaxOn \clist_clear_new:N \l_blenderpoint_clist % Will be used to contain the list to sort \clist_set:Nx \l_blenderpoint_clist {1,2,3} My ~ list ~ is ~ \l_blenderpoint_clist \\ \clist_clear_new:N \l_blenderpoint_clist_two % Will be used to contain the list to sort \clist_map_inline:Nn \l_blenderpoint_clist { \clist_put_right:Nx \l_blenderpoint_clist_two {\int_eval:n{#1+1}} } \clist_set:Nx \l_blenderpoint_clist \l_blenderpoint_clist_two My ~ list ~ is ~ \l_blenderpoint_clist \ExplSyntaxOff \end{document} ```
https://tex.stackexchange.com/users/116348
Elegantly apply a map to all items of a clist (LaTeX3)
false
Here's a trick I've used a couple of times in similar situations. We define a core function that applies a map to one clist and stores it in another, with the clist being passed in as an `n` type parameter. So this has argument specifier `NnN` where the first `N` is the new clist, the `n` is the original clist, and the last `N` is the map function to be applied. Then we define a variant of this with specifier `NVN` so that we can pass a clist *variable* as the second parameter. Lastly, we define a wrapper around this which uses the *same* clist for both the first and second arguments. In effect, we pass the same clist to the core function but once as pass-by-reference and once as pass-by-value. This duplicates the clist and allows us to assign to it while also reading it. From the programmers point of view then the duplication is all handled by the LaTeX3 expansion routines and so is hidden from view. Note that this only works with types that can be passed-by-value, such as clists (which are secretly token lists), token lists, integers, and a few others. I don't think it would work easily with a more complicated object like a prop or a seq (I'm sure you could get it to work, but it might be sensitive to how those are stored). ``` \documentclass{article} %\url{https://tex.stackexchange.com/q/685230/86} \ExplSyntaxOn \cs_new_protected_nopar:Npn \apply_map_to_clist:NnN #1#2#3 { \clist_clear:N #1 \clist_map_inline:nn {#2} { \clist_put_right:Nx #1 {#3 {##1}} } } \cs_generate_variant:Nn \apply_map_to_clist:NnN {NVN} \cs_new_protected_nopar:Npn \apply_map_to_clist:NN #1#2 { \apply_map_to_clist:NVN #1#1#2 } \clist_clear_new:N \l_blenderpoint_clist \clist_set:Nx \l_blenderpoint_clist {1,2,3} \clist_show:N \l_blenderpoint_clist \cs_new_nopar:Npn \add_one:n #1 {\int_eval:n {#1+1}} \apply_map_to_clist:NN \l_blenderpoint_clist \add_one:n \clist_show:N \l_blenderpoint_clist \ExplSyntaxOff \begin{document} \end{document} ``` This produces the following on the terminal: ``` The comma list \l_blenderpoint_clist contains the items (without outer braces): > {1} > {2} > {3}. <recently read> } l.21 \clist_show:N \l_blenderpoint_clist The comma list \l_blenderpoint_clist contains the items (without outer braces): > {2} > {3} > {4}. <recently read> } l.25 \clist_show:N \l_blenderpoint_clist ``` Note that in this implementation, the map function has to be expandable. I'm sure that there are ways around this, say if the map function assigned some variable that then got stored in the clist.
3
https://tex.stackexchange.com/users/86
685235
317,888
https://tex.stackexchange.com/questions/685201
1
Consider the following MCE: ``` \documentclass{article} \newcommand{\mynewcommand}{foo} \NewDocumentCommand{\MyNewDocumentCommand}{}{bar} \ExplSyntaxOn \iow_term:x {mynewcommand=\mynewcommand} \iow_term:x {MyNewDocumentCommand=\MyNewDocumentCommand} \ExplSyntaxOff \begin{document} \begin{itemize} \item \verb|\mynewcommand|=\mynewcommand \item \verb|\MyNewDocumentCommand|=\MyNewDocumentCommand \end{itemize} \end{document} ``` When it is compiled, what it is displayed: * in the resulting PDF is expected: ``` • \mynewcommand=foo • \MyNewDocumentCommand=bar ``` * in the terminal is expected for `\mynewcommand` but is unexpected for `\MyNewDocumentCommand`: ``` mynewcommand=foo MyNewDocumentCommand=\MyNewDocumentCommand ``` Why, in the terminal, the `⟨code⟩` of `\NewDocumentCommand{⟨cmd⟩}{⟨arg spec⟩}{⟨code⟩}` isn't displayed, whereas the `⟨code⟩` of `\newcommand{⟨cmd⟩}[⟨num⟩][⟨default⟩]{⟨code⟩}` is displayed?
https://tex.stackexchange.com/users/18401
Why the ⟨code⟩ of \NewDocumentCommand{⟨cmd⟩}{⟨arg spec⟩}{⟨code⟩} isn't displayed in the terminal?
false
I'm not sure why you'd expect that output. For instance ``` \iow_term:x { LaTeX=\LaTeX } ``` will stop with a weird error ``` ! Undefined control sequence. \S@10 ->\gdef \tf@size {10}\gdef \sf@size {7}\gdef \ssf@size {5} ``` If you want to use `\NewDocumentCommand` to define a container for some text (but you shouldn't), then do ``` \NewExpandableDocumentCommand{\MyNewDocumentCommand}{}{bar} ``` and now ``` \iow_term:x {MyNewDocumentCommand=\MyNewDocumentCommand} ``` will indeed produce ``` MyNewDocumentCommand=bar ``` I'm not sure what would this be useful for.
1
https://tex.stackexchange.com/users/4427
685240
317,891
https://tex.stackexchange.com/questions/685242
2
I have a super simple document, and I'm using pdfLaTeX on Windows 10 with MiKTeX. ``` \documentclass[12pt]{article} \begin{document} \section{Some section heading} Some body text \end{document} ``` This works, but I'd like to hide the "numbers" before my section heading. Sadly, my real document has quite a few of these, so I can't easily do it by hand. So, I add `\renewcommand{\section}{\section*}` after my `\documentclass` in hopes that I can redefine `\section` as `\section*`. ``` \documentclass[12pt]{article} \renewcommand{\section}{\section*} \begin{document} \section{Some section heading} Some body text \end{document} ``` But, when I try this, I get `TeX capacity exceeded, sorry [input stack size=10000]. \section` When I manually do the replacement, it compiles fine, but I'd like to avoid using Find + Replace here, so how can I do this with `\renewcommand` (or a different command that does this)?
https://tex.stackexchange.com/users/267218
Why does \renewcommand{ ... }{ ... } not work with \section (or \subsection)?
false
`\section*` is `\section *` the command looks for a `*` it is not part of the name, so you have programmed a non terminating loop `\section` -> `\section*` -> `\section**` ->... eventually you have 10000 `*` flooding the input buffer stack and get the error you showed.
7
https://tex.stackexchange.com/users/1090
685244
317,893
https://tex.stackexchange.com/questions/685185
5
The official repository of LuaTeX seems to be located on a private [GitLab site, here](https://gitlab.lisn.upsaclay.fr/texlive/luatex). It doesn't appear to allow contributions, not even in the form of defect reports or similar. While this is unconventional for a FLOSS project -- and per its license it is one -- and I appreciate and comprehend the remarks from the [FAQ](https://www.luatex.org/faq.html) I was wondering about these items in particular: 1. Several of the points mentioned around the topic of contributions and even user feedback appear out of date (both sockets and UTF-8 no longer seem to be a concern; ancient versions seem to be referenced; `trunk` ist referenced instead of the `master` default branch). 2. Having specific plans and a specific design doesn't generally preclude outside contributions. The only thing it does is to provide a boundary within which contributions *should* (?) be welcome. 3. Small team of decision-makers doesn't preclude outside contributors or contributions. I've even heard of instances where FLOSS projects gained new core team members by taking in contributions and promoting regular high-quality contributors. Considering that the upstream project -- as per their own statements -- doesn't seem to be inclined to take any outside contributions, is there *any* way to contribute *at all*? In particular I imagine the TeXlive project could be willing to maintain patches rebased against the upstream (just a guess with lots of wishful thinking).
https://tex.stackexchange.com/users/3925
How can I contribute to LuaTeX?
true
(Mostly copied from [my answer on Meta](https://tex.meta.stackexchange.com/a/10071/270600). And sorry, this answer is a little long/rambly.) #### Responses to the question > > The official repository of LuaTeX seems to be located on a private [GitLab site, here](https://gitlab.lisn.upsaclay.fr/texlive/luatex). > > > Yes, the main "upstream" repo is indeed <https://gitlab.lisn.upsaclay.fr/texlive/luatex>. Throughout the year, commits/updates are made to this repo. However, sometimes changes are made directly to <https://tug.org/svn/texlive/trunk/Build/source/>. Occasionally, the GitLab repo pulls in the changes from the TL repo, then once a year (ish) the TL repo pulls in the changes from the GitLab repo. > > It doesn't appear to allow contributions, not even in the form of defect reports or similar. > > > The GitLab site doesn't allow any contributions directly, but the LuaTeX team still accepts them. > > and I appreciate and comprehend the remarks from the [FAQ](https://www.luatex.org/faq.html) > > > Most of luatex.org is pretty old, so I wouldn't take anything there too literally. The story here is a little complicated, but here's a short version. LuaTeX started when NTS was going to be the next big thing, but NTS ultimately failed because there was more discussion than actual coding. This was a big problem since computers had changed a lot since 1982, but the only major new engine was pdfTeX, and TeX couldn't afford to stagnate if it wanted to survive. Also, LuaTeX was originally developed only for ConTeXt. So at the start, LuaTeX gained whatever features that it needed for it to work with ConTeXt. Pretty much every previous TeX engine had near-perfect backwards compatibility with Knuth's original TeX, but LuaTeX intentionally had a few minor backwards incompatibilities. These incompatibilities are to this day controversial. These days, things are much different. At the start, LuaTeX would change radically from year-to-year; now, there haven't been any major changes for about 5 years. At the start, LuaTeX was entirely driven by ConTeXt's needs; now, the most recent update broke ConTeXt to fix bugs with LaTeX and Plain. > > 1. Several of the points mentioned around the topic of contributions and even user feedback appear out of date (both sockets and UTF-8 no longer seem to be a concern; ancient versions seem to be referenced; trunk ist referenced instead of the master default branch). > > > Correct, this is all ancient. > > 2. Having specific plans and a specific design doesn't generally preclude outside contributions. The only thing it does is to provide a boundary within which contributions should (?) be welcome. > > > 3. Small team of decision-makers doesn't preclude outside contributors or contributions. I've even heard of instances where FLOSS projects gained new core team members by taking in contributions and promoting regular high-quality contributors. > > > This was written back when LuaTeX was only for ConTeXt, and to this day ConTeXt has very different wants/needs compared to the other TeX engines. Generally speaking, some of the loudest users in the TeX community want nothing to ever change, but this conflicts with ConTeXt's goal of continuous improvement. Outside contributions are *definitely* welcome in LuaTeX; I made a first-time contribution (bug fix) two weeks ago. And if you look through the changelogs, LuaTeX still adds new features every year or so. > > Considering that the upstream project -- as per their own statements -- doesn't seem to be inclined to take any outside contributions, > > > Yeah, I agree that this page makes them look semi-hostile to outsiders. But the LuaTeX team (these days, Luigi and sometimes Hans) are actually quite friendly. Keep in mind that there are also some language/cultural issues here too. > > is there any way to contribute at all? > > > Send a patch (in an attachment, not inline) or a bug report to [`dev-luatex@ntg.nl`](https://mailman.ntg.nl/mailman/listinfo/dev-luatex) (current archive is stale, [use this one instead](https://www.mail-archive.com/dev-luatex@ntg.nl/maillist.html)). If it's something simple/obvious, Luigi will usually merge/fix it in about a day (although it won't end up in a binary until the next annual TL release). If it's a feature request or something more complicated, then it will probably take some more time. Generally speaking, LuaTeX doesn't like to add new features anymore, but anything simple or important has decent odds at being accepted. Patches generally aren't needed for bug reports, but they'll help a lot for a feature request. > > In particular I imagine the TeXlive project could be willing to maintain patches rebased against the upstream > > > TL never patches upstream projects (except for things like `web2c`, `kpathsea`, `pdftex`, etc. where TL itself is the upstream). But if you did manage to get a patch into TL, it would eventually get pulled back into the main LuaTeX repo. #### Other responses > > [me] How do you build/install LuaTeX from source? > > > Assuming that you already have a newish TL installation, the commands below should replace your current `luatex` binaries with new ones compiled from `master`: ``` $ git clone --depth 1 //gitlab.lisn.upsaclay.fr/texlive/luatex.git $ cd luatex $ ./build.sh --parallel --luahb # cp build/texk/web2c/luatex build/texk/web2c/luahbtex "$(kpsewhich --var-value=SELFAUTOLOC)" # fmtutil-sys --byengine luahbtex # fmtutil-sys --byengine luatex ``` There isn't really any developer documentation, so you're kind of on your own for the rest. (You can email me `echo bXNldmVuIGF0IHRlbHVzIGRvdCBuZXQK | base64 -d` if you have any questions here. I'm just a random user—not on the LuaTeX team or anything—but I *might* be able to answer a few questions if you get stuck anywhere.) > > [[0xC0000022L]](https://tex.meta.stackexchange.com/questions/10069/on-topic-or-not-how-to-contribute-to/10071?noredirect=1#comment29573_10071) Joseph Wright suggested <https://tug.org/mailman/listinfo/lualatex-dev>, would that also be okay for patches? > > > That list is designed for discussing things like `luaotfload`, `luatexbase`, `fontspec`, etc., so it's not exactly the right place to post patches. But Luigi is the only one who is applying patches right now, he appears to be active on the list, and anything in LuaTeX will ultimately affect LuaLaTeX, so it should be fine. > > [[Joseph Wright]](https://tex.meta.stackexchange.com/questions/10069/on-topic-or-not-how-to-contribute-to/10071?noredirect=1#comment29566_10070) On the specifics of LuaTeX, the FAQ date from about 2006/7, so the situation is not quite as described: that was when things were very much developmental. LuaTeX is largely 'done', but changes can and are made: you are likely looking for the [LuaTeX dev mailing list](https://tug.org/mailman/listinfo/lualatex-dev). (Like much of the TeX ecosystem, LuaTeX development discussion is still much more active on mailing lists than e.g. GitHub issues.) > > > I agree with all of this. > > [[mickep]](https://tex.meta.stackexchange.com/questions/10069/on-topic-or-not-how-to-contribute-to/10071?noredirect=1#comment29571_10069) luatex is as far as I know frozen (no new functionality, supposed to be stable). There is the luatex-dev mailing list for bug reports and similar. Maybe that is how the developers prefer to communicate? It is nice that you want to help, maybe asking on the luatex-dev list if there is anything to help with is the best thing to do? > > > LuaTeX [claims to be frozen since TL2019](https://www.luatex.org/roadmap.html), but this isn't quite true. If you look through the [TeX Live Guide](https://tug.org/texlive/doc/texlive-en/texlive-en.html#x1-880009.1.16), LuaTeX has added a few minor features every year. Just in TL2023 (released 3 months ago) it added a new primitive. Nothing major will be added, but they still seem to be willing to add small new features if they think that it's important enough. [[originally from a comment on Meta]](https://tex.meta.stackexchange.com/questions/10069/on-topic-or-not-how-to-contribute-to/10071?noredirect=1#comment29572_10069) > > [[Joseph Wright]](https://tex.meta.stackexchange.com/questions/10069/on-topic-or-not-how-to-contribute-to/10071?noredirect=1#comment29568_10070) BTW, I see that <https://luatex.org/roadmap.html> has a pretty clear statement at the end about the status - perhaps you are looking to contribute to LuaMetaTeX? > > > Contributing to LuaMetaTeX is definitely an option, but keep in mind that 1. LuaMetaTeX pretty much only works with ConTeXt. [There is a way to make it work with LaTeX and Plain](https://github.com/zauguin/luametalatex), but this is only if you are very adventurous and willing to do lots of debugging. Probably nothing that you're too interested in. 2. LuaMetaTeX generally only adds features that Hans wants to use in ConTeXt. It is certainly possible to to get patches into LuaMetaTeX (I've sent in a few tiny patches), but you'll need to persuade Hans that it's a good feature. In some ways this is easier since no one is concerned about backwards compatibility or how useful it is to other people, but this is also trickier since if Hans wants a feature, he has usually already added it himself. > > [[mickep]](https://tex.stackexchange.com/questions/685185/how-can-i-contribute-to-luatex#comment1699869_685185) It is nice that you want to help, maybe asking on the luatex-dev list if there is anything to help with is the best thing to do?" After all, there you will also reach the people actually involved. > > > [[0xC0000022L]](https://tex.stackexchange.com/questions/685185/how-can-i-contribute-to-luatex#comment1699877_685185) Makes little sense to approach someone saying "Hey, I have this brilliant idea. But you gotta implement it". Also I don't just need to get this into a shape to be "presentable" but also to think about it from all sides and consider potential issues such as backwards compatibility concerns. > > > It's a very low volume mailing list, and everyone is generally pretty friendly, so as long as you aren't too pushy or demanding, I don't see any problem asking on the list—even without having an implementation ready to go. > > [[mickep]](https://tex.stackexchange.com/questions/685185/how-can-i-contribute-to-luatex#comment1699906_685185) In fact, are you sure that luatex is the right project to contribute to? There is maybe more work going on with tagging. I don't know if you are into math, but many people would love to see more work on the unicode-math package. Just to give a few directions... > > > I think that this is related to [this question](https://tex.stackexchange.com/q/684792/270600), which would definitely need to go into the LuaTeX core binary. FWIW, I think that there's a good chance that LuaTeX would add what you're talking about in that question there. They'd certainly appreciate a patch, but what you're asking for is maybe simple enough that they'd accept a mere feature request.
3
https://tex.stackexchange.com/users/270600
685252
317,897
https://tex.stackexchange.com/questions/685255
3
Similar to [this](https://tex.stackexchange.com/questions/225517/subequations-with-main-equation-number) question, how can I get the `subequations` environment to give me `number.number` style labels, e.g., labels like `1.1` and `1.2`? How can I do so locally (i.e., not for the entire document)?
https://tex.stackexchange.com/users/144086
change subequations labelling to '1.1'
true
Locally ======= Just put `\def\theequation{\theparentequation.\arabic{equation}}%` after `\begin{subequations}`. Globally ======== Put the code below after `\usepackage{amsmath}`. ``` \makeatletter \renewenvironment{subequations}{% \refstepcounter{equation}% \protected@edef\theparentequation{\theequation}% \setcounter{parentequation}{\value{equation}}% \setcounter{equation}{0}% % \def\theequation{\theparentequation\alph{equation}}% \def\theequation{\theparentequation.\arabic{equation}}% \ignorespaces }{% \setcounter{equation}{\value{parentequation}}% \ignorespacesafterend } \makeatother ```
5
https://tex.stackexchange.com/users/238422
685258
317,898
https://tex.stackexchange.com/questions/685255
3
Similar to [this](https://tex.stackexchange.com/questions/225517/subequations-with-main-equation-number) question, how can I get the `subequations` environment to give me `number.number` style labels, e.g., labels like `1.1` and `1.2`? How can I do so locally (i.e., not for the entire document)?
https://tex.stackexchange.com/users/144086
change subequations labelling to '1.1'
false
(edited answer to address OP's follow-up request) You could use the command `\patchcmd`, which is provided by the [etoolbox](https://www.ctan.org/pkg/etoolbox) package, to "patch" the `\subequations` macro of the [amsmath](https://www.ctan.org/pkg/amsmath) package: ``` \patchcmd\subequations{\alph{equation}}{.\arabic{equation}}{}{} ``` Put this command in the preamble to make the change global. If you want to keep the change local to a particular instance of a `subequations` environment, I suggest you enclose the patching command shown above and the `subequations` environment of interest in a TeX group, e.g., via ``` \begingroup \patchcmd\subequations{\alph{equation}}{.\arabic{equation}}{}{} \begin{subequations} ... \end{subequations} \endgroup ``` --- ``` \documentclass{article} \usepackage{amsmath} % for 'subequations' environment \usepackage{etoolbox} % for '\patchcmd' macro % the scope of the following instruction is *global* \patchcmd\subequations{\alph{equation}}{.\arabic{equation}}{}{} \begin{document} \begin{subequations} \begin{gather} a+b=c \\ d+e=f \end{gather} \end{subequations} \end{document} ```
6
https://tex.stackexchange.com/users/5001
685260
317,900
https://tex.stackexchange.com/questions/685257
0
My latex file looks roughly like this: ``` ... \usepackage{listings} ... \lstinputlisting{F4_01fig2dev.ptx} ... ``` and the file `F4_01fig2dev.ptx` is to be created. In fact I want to build with `latexmk`. Normally the technique is, to make `latexmk` run a latex processor in `scrollmode` finding out the missing files, create the missing files with additional rules and then rerun the latex processor. If I embed the file with `\input{F4_01fig2dev.ptx}` or with `\includegraphics` (using the graphicx package) or with `\import` (using the import package), the usual technique with `latexmk` works. It does not work with `\lstinputlisting`. Originally, I told here that the reason is that for some reason `\lstinputlisting` does not respect `scrollmode`, but this is not the difference. I don't want to make another wrong suspicion, but i observed that the FLS files don't include the file to be included in any case, so no difference. But the log file is a bit different: ``` ! Package Listings Error: File `F4_01fig2dev(.ptx)' not found. ``` for the `listings` package versus ``` ! LaTeX Error: File `F4_01fig2dev.ptx' not found. ``` for the other kinds of inclusions. Maybe `latexmk` does not recognize the ending that way. I must say, I find `listings` package more precise. Ok, now either `latexmk` changes or `listings` package changes or I do some workaround. I thought of conditional code, bypassing if the file does not exist. Any other thoughts? As cabohah suggested, I shall add my `.latexmkrc` file. I will post in full length, ``` #!/usr/bin/env perl # to create pdf via lualatex #$pdflatex = 'lualatex -file-line-error %O %S'; # PDF-generating modes are: # 1: pdflatex, as specified by $pdflatex variable (still largely in use) # 2: postscript conversion, as specified by the $ps2pdf variable (useless) # 3: dvi conversion, as specified by the $dvipdf variable (useless) # 4: lualatex, as specified by the $lualatex variable (best) # 5: xelatex, as specified by the $xelatex variable (second best) $pdf_mode = 4;# specifies creation of pdf via lualatex # If additional parameters must be passed to lualatex #'svg' package. # It converts raw SVG files to the PDF+PDF_TEX combo using InkScape. # $lualatex = "lualatex --shell-escape"; # note that -recorder is implicitly added $latex2pdfOptions = "-interaction=nonstopmode -synctex=1 -shell-escape"; $lualatex = "lualatex $latex2pdfOptions %O %S"; #$postscript_mode = $dvi_mode = 0; # to configure bibtex $bibtex_use=2; # this cannot be done according to the according latex maven plugin, # because the according parameter maxNumReRunsLatex may be set to -1 # which signifies an infinite number of runs. $max_repeat=30; # default are tex and eps, but could also be pdf and ptx and mps # Currently, all those files are given with explicit endings, # so no extensions to be added. #add_input_ext(''); # It is what it seems to be: clean inludes what was generated by cus $cleanup_includes_cusdep_generated = 1; $cleanup_includes_generated = 1; #$makeindex = 'makeindex %O -o %D %S'; # the default # TBD: clarify: xdv and dvi seem to be internal. # maybe missing other extensions in conjunction with synctex $clean_ext .= " %R.synctex.gz"; # bbl does not work #@generated_exts = (@generated_exts, 'lol', 'bbl', 'glo', 'ist') #print "Hello!" #foreach (@generated_exts) { #print "Generated exts: $_\n"; #} #print "clean_ext\n"; # Here @generated_exts is ('aux', 'fls', 'log', # generated by latex already # 'toc', 'lof', 'lot', 'out', # generated by latex conditionally # 'idx', 'ind', 'blg', 'ilg', # concerning indices # # strange enough: nothing for bibtex # 'xdv', 'bcf' # extensions ext to be deleted by latexmk -c # Note that the file names are %R.ext. # this may cause problems with extensions containing a dot. # Also this is not general enough # if the generated file deviates from %R by more than an extension. # In this case, use $clean_ext$ # Here, $clean_ext is empty. # list of listings, whereas lof and lot are already present. push @generated_exts, "lol"; push @generated_exts, "dvi", "xdv"; # for beamer class push @generated_exts, "nav", "snm", "vrb"; # why are .ist and xdy not under generated_exts? # note that currently, either %R or what is present is the extension only! # this does not make sense very much. # $clean_ext .= " stateMachine.log"; does not work, because stateMachine.log is the extension! # should be under indexing $clean_ext .= " %R.ist %R.xdy %R-*.ind %R-*.idx %R-*.ilg %R-*.ind"; add_cus_dep('fig', 'ptx', 0, 'fig2dev'); sub fig2dev { $file = $_[0]; print("$file"); rdb_add_generated("$file.eps", "$file.pdf", "$file.ptx"); my $GenOptions = ""; my $PtxOptions = ""; my $PdfEpsOptions = ""; print("create from $file.fig"); rdb_add_generated("$file.ptx", "$file.pdf", "$file.eps"); #fig2dev -L pstex <fig2devGenOptions> <fig2devPdfEpsOptions> xxx.fig xxx.eps #fig2dev -L pdftex <fig2devGenOptions> <fig2devPdfEpsOptions> xxx.fig xxx.pdf #fig2dev -L pdftex_t <fig2devGenOptions> <fig2devPtxOptions> -p xxx xxx.fig xxx.ptx my $ret1 = system("fig2dev -L pstex $GenOptions $PdfEpsOptions $file.fig $file.eps"); my $ret2 = system("fig2dev -L pdftex $GenOptions $PdfEpsOptions $file.fig $file.pdf"); my $ret3 = system("fig2dev -L pdftex_t $GenOptions $PtxOptions -p $file $file.fig $file.ptx"); return ($ret1 or $ret2 or $ret3); } add_cus_dep('gp', 'ptx', 0, 'gnuplot'); sub gnuplot { $file = $_[0]; print("create from $file.gp"); rdb_add_generated("$file.ptx", "$file.pdf", "$file.eps"); my $nuplotOptions = ""; my $ret1 = system("gnuplot -e \"set terminal cairolatex pdf $gnuplotOptions;\ set output '$file.ptx';\ load '$file.gp'\""); # my $ret2 = system("gnuplot -e \"set terminal cairolatex eps $gnuplotOptions;\ # set output '$file.ptx';\ # load '$file.gp'\""); return $ret; } # metapost rule from http://tex.stackexchange.com/questions/37134 #add_cus_dep('mp', 'mps', 0, 'mpost'); add_cus_dep('mp', 'mps', 0, 'mpost'); sub mpost { my $file = $_[0]; print("create from $file.mp"); rdb_add_generated("$file.mps", "$file.fls", "$file.log"); my ($name, $path) = fileparse($file); pushd($path); my $return = system("mpost -interaction=nonstopmode -recorder -s prologues=2 -s 'outputtemplate=\"%j.mps\"' $name"); popd(); return $return; } add_cus_dep('svg', 'ptx', 0, 'inkscape'); sub inkscape { my $file = $_[0]; print("create from $file.svg"); rdb_add_generated("$file.ptx", "$file.pdf"); my $ret1 = system("inkscape -D --export-filename=$file.pdf --export-latex $file.svg "); #my $ret2 = system("inkscape -D --export-filename=$file.eps --export-latex $file.svg "); #use File::Copy; # This works only for pdf, not for eps. #unlink($file.pdf_tex) or die "cannot unlink $file.pdf_tex"; rename("$file.pdf_tex", "$file.ptx");# or die "cannot move $file.pdf_tex"; return $ret1;# or $ret2; } # graphics for xfig (not appropriate for mixed tex/pdf) # add_cus_dep('fig', 'pdf', 0, 'fig2pdf'); # sub fig2pdf { # system( "fig2dev -Lpdf \"$_[0].fig\" \"$_[0].pdf\"" ); # } # use splitindex $makeindex = 'internal splitindex'; sub splitindex { # Use splitindex instead of makeindex. # The splitindex programe starts from an .idx file, makes a set of # other .idx files for separate indexes, and then runs makeindex to # make corresponding .ind files. # However, it is possible that the document uses the splitindex # package, but in a way compatible with the standard methods # compatible with makeindex, i.e., with a single index and with the # use of the \printindex command. # Then we need to invoke makeindex. # In addition, latexmk assumes that makeindex or its replacement makes # an .ind file from an .idx file, and latexmk gives an error if it # doesn't exist, we need to make an .ind file. # Both problems are solved by running makeindex and then splitindex. # Note: errors are returned by makeindex and splitindex for things # like a missing input file. No error is returned for lines in an # input file that are in an incorrect format; they are simply # ignored. So no problem is caused by lines in the .idx file # that are generated by splitindex in a format incompatible with # makeindex. my $ret1 = system( "makeindex", $$Psource ); my $ret2 = system( "splitindex", $$Psource ); return $ret1 || $ret2; } add_cus_dep( 'acn', 'acr', 0, 'makeglossaries' ); add_cus_dep( 'glo', 'gls', 0, 'makeglossaries' ); push @generated_exts, 'glo', 'gls', 'glg'; push @generated_exts, 'acn', 'acr', 'alg'; push @generated_exts, "ist"; # index stylefile created by the glossaries package #$clean_ext .= " acr acn alg glo gls glg";# TBD: clarify: better in @generated_exts? sub makeglossaries { my ($base_name, $path) = fileparse( $_[0] ); my @args = ( "-q", "-d", $path, $base_name ); if ($silent) { unshift @args, "-q"; } return system "makeglossaries", "-d", $path, $base_name; } sub run_makeglossaries { my ($base_name, $path) = fileparse( $_[0] ); #handle -outdir param by splitting path and file, ... pushd $path; # ... cd-ing into folder first, then running makeglossaries ... if ( $silent ) { # system "makeglossaries -q '$base_name'"; #unix system "makeglossaries", "-q", "$base_name"; #windows } else { # system "makeglossaries '$base_name'"; #unix system "makeglossaries", "$base_name"; #windows }; popd; # ... and cd-ing back again } # !!! ONLY WORKS WITH VERSION 4.54 or higher of latexmk #TBD: take into account: modified: # '$_[0]'-> # ############# # # makeindex # # ############# # @ist = glob("*.ist"); # if (scalar(@ist) > 0) { # $makeindex = "makeindex -s $ist[0] %O -o %D %S"; # } # glossaries new with bib2gls # push @generated_exts, 'glstex', 'glg'; # add_cus_dep('aux', 'glstex', 0, 'run_bib2gls'); # sub run_bib2gls { # if ( $silent ) { # my $ret = system "bib2gls --silent --group $_[0]"; # } else { # my $ret = system "bib2gls --group $_[0]"; # }; # my ($base, $path) = fileparse( $_[0] ); # if ($path && -e "$base.glstex") { # rename "$base.glstex", "$path$base.glstex"; # } # # Analyze log file. # local *LOG; # $LOG = "$_[0].glg"; # if (!$ret && -e $LOG) { # open LOG, "<$LOG"; # while (<LOG>) { # if (/^Reading (.*\.bib)\s$/) { # rdb_ensure_file( $rule, $1 ); # } # } # close LOG; # } # return $ret; # } $pythontex = 'pythontexW %R';#'pythontexW %O %R'; push @generated_exts, "pytxcode", "plg"; push @generated_exts, "depytx", "dplg"; $clean_ext .= " pythontex-files-%R/* pythontex-files-%R"; #$extra_rule_spec{'pythontex'} = [ 'internal', '', 'mypythontex', "%Y%R.pytxcode", "%Ypythontex-files-%R/%R.pytxmcr", "%R", 1 ]; $extra_rule_spec{'pythontex'} = [ 'internal', '', 'mypythontex', "%R.pytxcode", "pythontex-files-%R/%R.pytxmcr", "%R", 1 ]; sub mypythontex { my $result_dir = $aux_dir1."pythontex-files-$$Pbase"; my $ret = Run_subst( $pythontex, 2 ); rdb_add_generated( glob "$result_dir/*" ); #my $fh = new FileHandle $$Pdest, "r"; open( my $fh, "<", $$Pdest ); if ($fh) { print "path: $ENV{PATH}"; while (<$fh>) { if ( /^%PythonTeX dependency:\s+'([^']+)';/ ) { print "Found pythontex dependency '$1'\n"; rdb_ensure_file( $rule, $aux_dir1.$1 ); } } undef $fh; } else { warn "mypythontex: I could not read '$$Pdest'\n", " to check dependencies\n"; } return $ret; } # for htlatex push @generated_exts, "4tc", "4ct", "tmp", "xref", "css", "idv", "lg"; # TBD: for -C remove also html and xhtml # TBD: check that this plugin also removes all these extensions.. think of lg. # biblatex # push @generated_exts, "run.xml";# does run.xml work? # $clean_ext .= " %R-blx.bib"; ```
https://tex.stackexchange.com/users/60463
`latexmk`can include files created during the `latexmk` run, except with `lstinputlistings`
false
You can use the command in `functional` to judge file if exist. ``` \documentclass{article} \usepackage{functional} \usepackage{listings} \NewDocumentCommand{\LstIfExistInputListing}{m}{\fileIfExistT{#1}{\lstinputlisting{#1}}} \begin{document} \fileIfExistT{F4_01fig2dev.ptx}{\lstinputlisting{F4_01fig2dev.ptx}} or \LstIfExistInputListing{F4_01fig2dev.ptx} \end{document} ```
2
https://tex.stackexchange.com/users/238422
685261
317,901
https://tex.stackexchange.com/questions/685262
0
I would like to setup a command for adding inline math in text paragraphs. In that command, I want to change some style properties, like change the color of the equation. Fox example: ``` The value of $x = 2 + 3$ is $x=5$. ``` I would like to do. ``` The value of \Mimath{x = 2 + 3} is \Mimath{x=5}. ``` I through I could start with something like this: ``` \newcommand*\Mimath[1]{ $ #1 $ } ``` But that gives an error in TexStudio: ``` Undefined control sequence. ...lection of objects whatsoever. A set \Mimath ``` How can I create that type of command?
https://tex.stackexchange.com/users/296700
Create a command for inline math, and apply color to math output
true
This works for me, I hope for you too: ``` \documentclass[12pt]{article} \usepackage{xcolor} \newcommand*\Mimath[2][black]{{\color{#1} $ #2 $}\color{black} } \begin{document} The value of \Mimath[red]{y=x+5} The value of \Mimath[blue]{y=x+5} The value of \Mimath[magenta]{y=x+5} The value of \Mimath{y=x+5} \end{document} ```
1
https://tex.stackexchange.com/users/269938
685263
317,902
https://tex.stackexchange.com/questions/685262
0
I would like to setup a command for adding inline math in text paragraphs. In that command, I want to change some style properties, like change the color of the equation. Fox example: ``` The value of $x = 2 + 3$ is $x=5$. ``` I would like to do. ``` The value of \Mimath{x = 2 + 3} is \Mimath{x=5}. ``` I through I could start with something like this: ``` \newcommand*\Mimath[1]{ $ #1 $ } ``` But that gives an error in TexStudio: ``` Undefined control sequence. ...lection of objects whatsoever. A set \Mimath ``` How can I create that type of command?
https://tex.stackexchange.com/users/296700
Create a command for inline math, and apply color to math output
false
You can use `\everymath{\color{blue}}`. Here is a [minimimal working example](https://tex.meta.stackexchange.com/q/228/250119): ``` \documentclass{amsart} \usepackage{xcolor} \everymath{\color{blue}} \begin{document} The value of $x = 2 + 3$ is $x=5$. \[ \int2x\,dx=x^2+C \] \end{document} ``` that produces: As the MWE shows, this colours only inline mathematics. If you want to colour displayed equations as well use `\everydisplay{\color{blue}}`.
0
https://tex.stackexchange.com/users/234252
685265
317,903
https://tex.stackexchange.com/questions/685223
1
i have a large matrix that goes of the pdf when compliled. a suggestion to use `\resizebox{0.94\textwidth}{!}{%$...$}` which i followed but this causes my remaining work to have large vertical spaces in between. The Matrix cannot be changed and must appear as it is. If you have a suggestion that wouldn't require > > `\resizebox`, it will be greatly appreciated but all the elements of it must appear as it is. > > > ``` \documentclass[fleqn]{book} %%CreatedwithwxMaxima22.04.0 \setlength{\parskip}{\medskipamount} \setlength{\parindent}{0pt} \usepackage{iftex} \ifPDFTeX %PDFLaTeXorLaTeX \usepackage[utf8]{inputenc} \usepackage[T1]{fontenc} \DeclareUnicodeCharacter{00B5}{\ensuremath{\mu}} \else %XeLaTeXorLuaLaTeX \usepackage{fontspec} \fi \usepackage{graphicx} \usepackage{color} \usepackage{amsmath,amssymb,mathtools} \usepackage{grffile} \usepackage{ifthen} \newsavebox{\picturebox} \newlength{\pictureboxwidth} \newlength{\pictureboxheight} \newcommand{\HRule}{\rule{\linewidth}{0.5mm}} \newcommand{\includeimage}[1]{ \savebox{\picturebox}{\includegraphics{#1}} \settoheight{\pictureboxheight}{\usebox{\picturebox}} \settowidth{\pictureboxwidth}{\usebox{\picturebox}} \ifthenelse{\lengthtest{\pictureboxwidth>.95\linewidth}} { \includegraphics[width=.95\linewidth,height=.80\textheight,keepaspectratio]{#1} } { \ifthenelse{\lengthtest{\pictureboxheight>.80\textheight}} { \includegraphics[width=.95\linewidth,height=.80\textheight,keepaspectratio]{#1} } { \includegraphics{#1} } } } \newlength{\thislabelwidth} \DeclareMathOperator{\abs}{abs} \definecolor{labelcolor}{RGB}{100,0,0} \begin{document} {\begin{equation}\label{mat} \hspace*{-0.5cm} \renewcommand\arraystretch{2.25} \medmuskip=0mu \setlength\arraycolsep{2.5pt} % default: 5pt \resizebox{1.35\textwidth}{!}{% $D=\begin{bmatrix} 1 &{x_{n+1}-h} & {\bigg(x_{n+1}-h\bigg)^2} & {\bigg(x_{n+1}-h\bigg)^3} & {\bigg(x_{n+1}-h\bigg)^4} & {\bigg(x_{n+1}-h\bigg)^5} & {\bigg(x_{n+1}-h\bigg)^6} & {\bigg(x_{n+1}-h\bigg)^7} & {\bigg(x_{n+1}-h\bigg)^8} & {\bigg(x_{n+1}-h\bigg)^9}\\ 0 & 1 & 2 {\bigg(x_{n+1}-h\bigg)} & 3 {\bigg(x_{n+1} -h\bigg)^2} & 4 {\bigg(x_{n+1} -h\bigg)^3} & 5 {\bigg(x_{n+1} -h\bigg)^4} & 6 {\bigg(x_{n+1} -h\bigg)^5} & 7 {\bigg(x_{n+1} -h\bigg)^6} & 8 {\bigg(x_{n+1} -h\bigg)^7} & 9 {\bigg(x_{n+1} -h\bigg)^8}\\ 0 & 1 & 2 {x_{n+1}} & 3 {x_{n+1}^2} & 4 {x_{n+1}^3} & 5 {x_{n+1}^4} & 6 {x_{n+1}^5} & 7 {x_{n+1}^6} & 8 {x_{n+1}^7} & 9 {x_{n+1}^8}\\ 0 & 1 & 2{\bigg(x_{n+1}+ \frac{1}{2}h\bigg)} & 3{\bigg(x_{n+1}+ \frac{1}{2}h\bigg)^2} & 4{\bigg(x _{n+1}+ \frac{1}{2}h\bigg)^3} & 5{\bigg(x _{n+1}+ \frac{1}{2}h\bigg)^4} & 6{\bigg(x _{n+1}+ \frac{1}{2}h\bigg)^5} & 7{\bigg(x _{n+1}+ \frac{1}{2}h\bigg)^6} & 8{\bigg(x _{n+1}+ \frac{1}{2}h\bigg)^7} & 9{\bigg(x _{n+1}+ \frac{1}{2}h\bigg)^8}\\ 0 & 1 & 2 {\bigg(x_{n+1}+h\bigg)} & 3 {\bigg(x_{n+1} +h\bigg)^2} & 4 {\bigg(x_{n+1} +h\bigg)^3} & 5 {\bigg(x_{n+1} +h\bigg)^4} & 6 {\bigg(x_{n+1} +h\bigg)^5} & 7 {\bigg(x_{n+1} +h\bigg)^6} & 8 {\bigg(x_{n+1} +h\bigg)^7} & 9 {\bigg(x_{n+1} +h\bigg)^8}\\ 0 & 1 & 2 {\bigg(x _{n+1}+ \frac{3}{2}h\bigg)} & 3{\bigg(x _{n+1}+ \frac{3}{2}h\bigg)^2} & 4{\bigg(x _{n+1}+ \frac{3}{2}h\bigg)^3} & 5{\bigg(x _{n+1}+ \frac{3}{2}h\bigg)^4} & 6{\bigg(x _{n+1}+ \frac{3}{2}h\bigg)^5} & 7{\bigg(x _{n+1}+ \frac{3}{2}h\bigg)^6} & 8{\bigg(x _{n+1}+ \frac{3}{2}h\bigg)^7} & 9{\bigg(x _{n+1}+ \frac{3}{2}h\bigg)^8}\\ 0 & 1 & 2 {\bigg(x_{n+1} +2 h\bigg)} & 3 {\bigg(x_{n+1} +2 h\bigg)^2} & 4 {\bigg(x_{n+1} +2 h\bigg)^3} & 5 {\bigg(x_{n+1} +2 h\bigg)^4} & 6 {\bigg(x_{n+1} +2 h\bigg)^5} & 7 {\bigg(x_{n+1} +2 h\bigg)^6} & 8 {\bigg(x_{n+1} +2 h\bigg)^7} & 9 {\bigg(x_{n+1} +2 h\bigg)^8}\\ 0 & 1 & 2{\bigg(x_{n+1}+\frac{5}{2}h\bigg)} & 3{\bigg(x _{n+1}+ \frac{5}{2}h\bigg)^2} & 4{\bigg(x _{n+1}+ \frac{5}{2}h\bigg)^3} & 5{\bigg(x _{n+1}+ \frac{5}{2}h\bigg)^4} & 6{\bigg(x _{n+1}+ \frac{5}{2}h\bigg)^5} & 7{\bigg(x _{n+1}+ \frac{5}{2}h\bigg)^6} & 8{\bigg(x _{n+1}+ \frac{5}{2}h\bigg)^7} & 9{\bigg(x _{n+1}+ \frac{5}{2}h\bigg)^8}\\ 0 & 1 & 2 {\bigg(x_{n+1}+3h\bigg)} & 3 {\bigg(x_{n+1}+3h\bigg)^2} & 4 {\bigg(x_{n+1}+3h\bigg)^3} & 5 {\bigg(x_{n+1}+3h\bigg)^4} & 6 {\bigg(x_{n+1}+3h\bigg)^5} & 7 {\bigg(x_{n+1}+3h\bigg)^6} & 8 {\bigg(x_{n+1}+3h\bigg)^7} & 9 {\bigg(x_{n+1}+3h\bigg)^8}\\ 0 & 1 & 2 {\bigg(x _{n+1}+ \frac{7}{2}h\bigg)} & 3{\bigg(x _{n+1}+ \frac{7}{2}h\bigg)^2} & 4{\bigg(x _{n+1}+ \frac{7}{2}h\bigg)^3} & 5 {\bigg(x _{n+1}+ \frac{7}{2}h\bigg)^4} & 6 {\bigg(x _{n+1}+ \frac{7}{2}h\bigg)^5} & 7 {\bigg(x _{n+1}+ \frac{7}{2}h\bigg)^6} & 8 {\bigg(x _{n+1}+ \frac{7}{2}h\bigg)^7} & 9 {\bigg(x _{n+1}+ \frac{7}{2}h\bigg)^8} \end{bmatrix}$} \end{equation} \par} The determinant of the new $D$ matrix is: \begin{equation}det (B) =\frac{15380234690625 h}{64}h^{36}\end{equation} The inverse of {\eqref{mat}} is the $C$ matrix, which is calculated using \textbf{wxMaxima} codes as shown in the \textbf{Appendix}. Our sole interest in the $C$ matrix is its first row and the elements are: \end{document} ``` Also, can i use `\hspace*{}` or `\hspace` inside an equation enviroment and how can i use it for only a specific equation. ps: i am very new at latex, please explanations should be toddler-level. thanks
https://tex.stackexchange.com/users/295796
removing vertical space
true
As I mentioned in my comment, your matrix as it is, even if you use `tiny font size for it, cannot be fit in page. Among mentioned option here I shoe a possible way when you: * allow to split matrix into two parts * enables that each part protrude outer text block border (red lines indicate page layout) ``` \documentclass[fleqn]{book} %\usepackage{geometry} %---------------- show page layout. don't use in a real document! \usepackage{showframe} \renewcommand\ShowFrameLinethickness{0.15pt} \renewcommand*\ShowFrameColor{\color{red}} %---------------------------------------------------------------% \usepackage[strict]{changepage} \setlength{\parskip}{\medskipamount} \setlength{\parindent}{0pt} \usepackage{iftex} \ifPDFTeX %PDFLaTeXorLaTeX \usepackage[T1]{fontenc} \DeclareUnicodeCharacter{00B5}{\ensuremath{\mu}} \else %XeLaTeXorLuaLaTeX \usepackage{fontspec} \fi \usepackage{graphicx} \usepackage{color} \usepackage{nccmath, amssymb, mathtools} \setlength\mathindent{0pt} \begin{document} \begin{adjustwidth*}{}{-\dimexpr\marginparsep+\marginparwidth} \begin{multline} % first part of matrix D=\left[\begin{matrix*}[l] 1 &{x_{n+1}-h} & {\Bigl(x_{n+1}-h\Bigr)^2} & {\Bigl(x_{n+1}-h\Bigr)^3} & {\Bigl(x_{n+1}-h\Bigr)^4} & {\Bigl(x_{n+1}-h\Bigr)^5} \\ 0 & 1 & 2 {\Bigl(x_{n+1}-h\Bigr)} & 3 {\Bigl(x_{n+1} -h\Bigr)^2} & 4 {\Bigl(x_{n+1} -h\Bigr)^3} & 5 {\Bigl(x_{n+1} -h\Bigr)^4} \\ 0 & 1 & 2 {x_{n+1}} & 3 {x_{n+1}^2} & 4 {x_{n+1}^3} & 5 {x_{n+1}^4} \\ 0 & 1 & 2{\Bigl(x_{n+1}+ \frac{1}{2}h\Bigr)} & 3{\Bigl(x_{n+1}+ \frac{1}{2}h\Bigr)^2} & 4{\Bigl(x _{n+1}+ \frac{1}{2}h\Bigr)^3} & 5{\Bigl(x _{n+1}+ \frac{1}{2}h\Bigr)^4} \\ 0 & 1 & 2 {\Bigl(x_{n+1}+h\Bigr)} & 3 {\Bigl(x_{n+1} +h\Bigr)^2} & 4 {\Bigl(x_{n+1} +h\Bigr)^3} & 5 {\Bigl(x_{n+1} +h\Bigr)^4} \\ 0 & 1 & 2 {\Bigl(x _{n+1}+ \frac{3}{2}h\Bigr)} & 3{\Bigl(x _{n+1}+ \frac{3}{2}h\Bigr)^2} & 4{\Bigl(x _{n+1}+ \frac{3}{2}h\Bigr)^3} & 5{\Bigl(x _{n+1}+ \frac{3}{2}h\Bigr)^4} \\ 0 & 1 & 2 {\Bigl(x_{n+1} +2 h\Bigr)} & 3 {\Bigl(x_{n+1} +2 h\Bigr)^2} & 4 {\Bigl(x_{n+1} +2 h\Bigr)^3} & 5 {\Bigl(x_{n+1} +2 h\Bigr)^4} & \\ 0 & 1 & 2{\Bigl(x_{n+1}+\frac{5}{2}h\Bigr)} & 3{\Bigl(x _{n+1}+ \frac{5}{2}h\Bigr)^2} & 4{\Bigl(x _{n+1}+ \frac{5}{2}h\Bigr)^3} & 5{\Bigl(x _{n+1}+ \frac{5}{2}h\Bigr)^4} \\ 0 & 1 & 2 {\Bigl(x_{n+1}+3h\Bigr)} & 3 {\Bigl(x_{n+1}+3h\Bigr)^2} & 4 {\Bigl(x_{n+1}+3h\Bigr)^3} & 5 {\Bigl(x_{n+1}+3h\Bigr)^4} \\ 0 & 1 & 2 {\Bigl(x _{n+1}+ \frac{7}{2}h\Bigr)} & 3{\Bigl(x _{n+1}+ \frac{7}{2}h\Bigr)^2} & 4{\Bigl(x _{n+1}+ \frac{7}{2}h\Bigr)^3} & 5 {\Bigl(x _{n+1}+ \frac{7}{2}h\Bigr)^4} \end{matrix*}\right.\quad\dotsm \\ % second part of matrix \dotsm\quad\left.\begin{matrix*}[l] {\Bigl(x_{n+1}-h\Bigr)^5} & {\Bigl(x_{n+1}-h\Bigr)^6} & {\Bigl(x_{n+1}-h\Bigr)^7} & {\Bigl(x_{n+1}-h\Bigr)^8} & {\Bigl(x_{n+1}-h\Bigr)^9}\\ 5 {\Bigl(x_{n+1} -h\Bigr)^4} & 6 {\Bigl(x_{n+1} -h\Bigr)^5} & 7 {\Bigl(x_{n+1} -h\Bigr)^6} & 8 {\Bigl(x_{n+1} -h\Bigr)^7} & 9 {\Bigl(x_{n+1} -h\Bigr)^8}\\ 5 {x_{n+1}^4} & 6 {x_{n+1}^5} & 7 {x_{n+1}^6} & 8 {x_{n+1}^7} & 9 {x_{n+1}^8}\\ 5{\Bigl(x _{n+1}+ \frac{1}{2}h\Bigr)^4} & 6{\Bigl(x _{n+1}+ \frac{1}{2}h\Bigr)^5} & 7{\Bigl(x _{n+1}+ \frac{1}{2}h\Bigr)^6} & 8{\Bigl(x _{n+1}+ \frac{1}{2}h\Bigr)^7} & 9{\Bigl(x _{n+1}+ \frac{1}{2}h\Bigr)^8}\\ 5 {\Bigl(x_{n+1} +h\Bigr)^4} & 6 {\Bigl(x_{n+1} +h\Bigr)^5} & 7 {\Bigl(x_{n+1} +h\Bigr)^6} & 8 {\Bigl(x_{n+1} +h\Bigr)^7} & 9 {\Bigl(x_{n+1} +h\Bigr)^8}\\ 5{\Bigl(x _{n+1}+ \frac{3}{2}h\Bigr)^4} & 6{\Bigl(x _{n+1}+ \frac{3}{2}h\Bigr)^5} & 7{\Bigl(x _{n+1}+ \frac{3}{2}h\Bigr)^6} & 8{\Bigl(x _{n+1}+ \frac{3}{2}h\Bigr)^7} & 9{\Bigl(x _{n+1}+ \frac{3}{2}h\Bigr)^8}\\ 5 {\Bigl(x_{n+1} +2 h\Bigr)^4} & 6 {\Bigl(x_{n+1} +2 h\Bigr)^5} & 7 {\Bigl(x_{n+1} +2 h\Bigr)^6} & 8 {\Bigl(x_{n+1} +2 h\Bigr)^7} & 9 {\Bigl(x_{n+1} +2 h\Bigr)^8}\\ 5{\Bigl(x _{n+1}+ \frac{5}{2}h\Bigr)^4} & 6{\Bigl(x _{n+1}+ \frac{5}{2}h\Bigr)^5} & 7{\Bigl(x _{n+1}+ \frac{5}{2}h\Bigr)^6} & 8{\Bigl(x _{n+1}+ \frac{5}{2}h\Bigr)^7} & 9{\Bigl(x _{n+1}+ \frac{5}{2}h\Bigr)^8}\\ 5 {\Bigl(x_{n+1}+3h\Bigr)^4} & 6 {\Bigl(x_{n+1}+3h\Bigr)^5} & 7 {\Bigl(x_{n+1}+3h\Bigr)^6} & 8 {\Bigl(x_{n+1}+3h\Bigr)^7} & 9 {\Bigl(x_{n+1}+3h\Bigr)^8}\\ 5 {\Bigl(x _{n+1}+ \frac{7}{2}h\Bigr)^4} & 6 {\Bigl(x _{n+1}+ \frac{7}{2}h\Bigr)^5} & 7 {\Bigl(x _{n+1}+ \frac{7}{2}h\Bigr)^6} & 8 {\Bigl(x _{n+1}+ \frac{7}{2}h\Bigr)^7} & 9 {\Bigl(x _{n+1}+ \frac{7}{2}h\Bigr)^8} \end{matrix*}\right] \end{multline} \end{adjustwidth*}\par The determinant of the new $D$ matrix is: \begin{equation} \det (B) =\frac{15380234690625 h}{64}h^{36} \end{equation} The inverse of {\eqref{mat}} is the $C$ matrix, which is calculated using \textbf{wxMaxima} codes as shown in the \textbf{Appendix}. Our sole interest in the $C$ matrix is its first row and the elements are: \end{document} ```
1
https://tex.stackexchange.com/users/18189
685289
317,914
https://tex.stackexchange.com/questions/685247
0
I am beginner at TeX and my goal is simply to add thanks text to the lower left corner. Also, I **don't** want any marker. For article document my code (below) works well. However when I change document class to IEEEtran the line above thanks text is removed. How can I add horizontal line as expected while using IEEETran. Edit: I used an indirect solution. Line can be inserted by changing the line as, > > \author{Author Name\thanks{`\hrule\vspace{2mm}`Thanks to text}} > > > ``` \documentclass[conference]{IEEEtran} %\documentclass{article} \usepackage{breqn} \usepackage{amsthm} \usepackage{float} \usepackage{amsmath} \usepackage{amssymb} \usepackage{subfigure} \usepackage{booktabs} \usepackage{cite} \usepackage{hyperref} \usepackage{cleveref} \usepackage{xcolor} \usepackage{multirow} \usepackage{multicol} \usepackage{tabu} \usepackage{booktabs} \usepackage{lipsum} \IEEEoverridecommandlockouts \makeatletter \def\thanks#1{\protected@xdef\@thanks{\@thanks \protect\footnotetext{#1}}} \makeatother \begin{document} \title{Title} \author{Author Name\thanks{Thanks to text}} \maketitle \IEEEpeerreviewmaketitle \begin{abstract} \lipsum[1] \end{abstract} \section{Introduction} \IEEEPARstart{T}{}he \lipsum[1-6] \end{document} ```
https://tex.stackexchange.com/users/296569
Overriding thanks command in IEEETran document
true
For `IEEEtran` class you can redefine `\footnoterule`. The following code show how `\footnoterule` command work when `compsoc` option is used. ``` \def\footnoterule{\relax\if@IEEEenableoneshotfootnoterule \kern-5pt \hbox to \columnwidth{\hfill\vrule width 0.5\columnwidth height 0.4pt\hfill} \kern4.6pt \global\@IEEEenableoneshotfootnoterulefalse \else \relax \fi} ``` This code can be adapted for your needs as follows: ``` \makeatletter \renewcommand\footnoterule{\relax\kern-5pt \hrule \kern4.6pt} \makeatother ``` Full MWE: ``` \documentclass[conference]{IEEEtran} \usepackage{lipsum} \IEEEoverridecommandlockouts \makeatletter \def\thanks#1{\protected@xdef\@thanks{\@thanks \protect\footnotetext{#1}}} \makeatother \makeatletter \renewcommand\footnoterule{\relax\kern-5pt \hrule \kern4.6pt} \makeatother \begin{document} \title{Title} \author{Author Name\thanks{Thanks to text}} \maketitle \IEEEpeerreviewmaketitle \begin{abstract} \lipsum[1] \end{abstract} \section{Introduction} \IEEEPARstart{T}{}he \lipsum[1-7] \end{document} ```
1
https://tex.stackexchange.com/users/42803
685291
317,916
https://tex.stackexchange.com/questions/685278
0
I am a total newbie so I appreciate all your answers as simple as possible. I want to have in my entire document all examples to be "non-floating", it means when I write: *The following example shows this: IMAGE* ...so I want it to be fixed there, below, centred. Is there any way to make that setting permanent in the header of the document?
https://tex.stackexchange.com/users/296443
Non-floating graphics by default
false
* Make yourself more familiar with LaTeX! Read some introductory text about it. For example [No so Short Introduction ...](https://tobi.oetiker.ch/lshort/lshort.pdf) or [LaTeX for beginners](https://typeset.io/resources/learn-latex-beginners-step-by-step-guide/). * Latex is not Word, it care for nice typography ... * Please, consider comments below question * MWE (Minimal Working Example) below show, what can happen, if you not use `floats` in your document: (red lines show page layout) ``` \documentclass{article} \usepackage{tikz} % for show images \usetikzlibrary{ducks} % for show images \usepackage{caption} \usepackage{lipsum} \begin{document} \lipsum[66] \begin{center} \begin{tikzpicture}[scale=4] \duck[glasses=red] \end{tikzpicture} \captionof{figure}{Prof. Duck disagree that his picture not appear in float environment} \end{center} \lipsum[66] \begin{center} \captionof{table}{Prof. Duck also disagree that tables are not in float environment} \begin{tabular}{|c|c|c|c|} \hline \begin{tikzpicture} \duck[graduate, xscale=-1] \end{tikzpicture} & \begin{tikzpicture} \duck[graduate] \end{tikzpicture} & \begin{tikzpicture}[scale=3] \duck[squareglasses] \end{tikzpicture} \\ \hline \end{tabular} \end{center} \lipsum[1-4] \end{document} ``` Similar result you will get if you will use floats with `[H]` options: ``` \documentclass{article} \usepackage{tikz} % for show images \usetikzlibrary{ducks} % for show images \usepackage{caption} \usepackage{float} % for removing floating of floats \usepackage{lipsum} \begin{document} \lipsum[66] \begin{figure}[H] % <--- \centering \begin{tikzpicture}[scale=4] \duck[glasses=red] \end{tikzpicture} \caption{Prof. Duck disagree that his picture not appear in float environment} \end{figure} \lipsum[66] \begin{table}[H] % <--- \centering \caption{Prof. Duck also disagree that tables are not in float environment} \begin{tabular}{|c|c|c|c|} \hline \begin{tikzpicture} \duck[graduate, xscale=-1] \end{tikzpicture} & \begin{tikzpicture} \duck[graduate] \end{tikzpicture} & \begin{tikzpicture}[scale=3] \duck[squareglasses] \end{tikzpicture} \\ \hline \end{tabular} \end{table} \lipsum[1-4] \end{document} ``` At both example observe empty space at bottom of the first page!
4
https://tex.stackexchange.com/users/18189
685294
317,917
https://tex.stackexchange.com/questions/467651
4
to make my problem visible, I have created following simple file: ``` \documentclass[a4paper,12pt]{article} \usepackage{musixtex} \setlength{\parindent}{0em} \begin{document} \begin{music} \startpiece \notes\nq{hgf}\enotes\alaligne \notes\nq{hgf}\enotes \endpiece \end{music} \end{document} ``` Processing this with `latex file` `musixflx file` `latex file` gives a rather nasty output, because between the clef and the first note in the first line, there is nearly no space. The problem does not occur in subsequent lines, and it does not occur when using `\startextract ... \endextract` instead of `\startpiece ... \endpiece`, but this is no option for `\startextract` allows only one line of music. Has anybody any idea, why this happen, and how to fix it? Best regards, Volker
https://tex.stackexchange.com/users/178511
MusiXTeX within LaTeX does not insert space before first note
false
You can also say ``` \startpiece\addspace{1.2pt}% ``` or ``` \startpiece\addspace{0.5mm}% ``` or even a negative value ``` \startpiece\addspace{-0.05cm}% ``` That gives you more flexibility. But don't forget the `%`.
0
https://tex.stackexchange.com/users/206750
685295
317,918
https://tex.stackexchange.com/questions/685303
2
For my class (teaching at university) I use a TeX document to provide the assignments and excercises for every week as shown below. ``` \documentclass{report} \usepackage{titlesec} \titlelabel{\thetitle~} \titleformat{\chapter}[hang]{\color{blue}\Large\bfseries}{Exercise \thechapter\,--\,}{0sp}{\color{blue}}[] \begin{document} \chapter{Topic of Week 1} \section{Task 1} \section{Task 2} \chapter{Topic of Week 2} \section{Task 1} \section{Task 2} \end{document} ``` This generates chapter headings such as *Excercise 1 - Topic of Week 1*. Now I need a solution to split a chapter across two weeks, i.e. it should result in * Excercise 1A - Topic of Week 1 * Excercise 1B - Remainder of Week 1 Since thas `\sections` are the tasks I switch to `\section` and `\subsection` as the overall structure should remain the same. Actually I'd like to add a new `\chapter{Remainder of Week 1}` but do not (visibly) increase the chapter counter. Any ideas?
https://tex.stackexchange.com/users/61585
Subdividing chapters into A, B, ... without using sections
false
I'm not sure, that I understand, what you expect. Maybe you just search for `\chapter*`. But maybe you want something like the following, which would need to change the class: ``` \documentclass{scrreprt} \usepackage{color} \renewcommand*{\chapterformat}{Exercise \thechapter\,--\,} \addtokomafont{chapter}{\color{blue}} \DeclareNewSectionCommand[% see the KOMA-Script manual for more information style=chapter, level=\chapternumdepth,% same level as chapter beforeskip:=chapter,% same value as of chapter afterskip:=chapter,% same value as of chapter font:=chapter,% same value as of chapter counterwithin=chapter,% same value as of chapter ]{subchapter} \DeclareTOCStyleEntry[entryformat:=chapter,indent:=chapter,numwidth:=chapter,numwidth+=.5em,pagenumberformat:=chapter,beforeskip:=chapter]{chapter}{subchapter}% may be useful for the ToC; see the KOMA-Script manual for more information \renewcommand*{\thesubchapter}{\thechapter\Alph{subchapter}} \renewcommand*{\subchapterformat}{Exercise \thesubchapter\,--\,} \begin{document} \refstepcounter{chapter}% unfortunately needed, if the numbering should not be 1, 1A, 1B but 1A, 1B without a 1 before \subchapter{Topic of Week 1} \section{Task 1} \section{Task 2} \subchapter{Remainder of Week 1} \section{Task 3} \section{Task 4} \chapter{Topic of Week 2} \section{Task 1} \section{Task 2} \end{document} ``` But maybe you want also 1A.1, 1A.2, 1B.1, 1B.2 for the section numbering? In this case, you could use something like this: ``` \documentclass{report} \usepackage{color} \usepackage{titlesec} \titlelabel{\thetitle~} \titleformat{\chapter}[hang]{\color{blue}\Large\bfseries}{Exercise \thechapter\,--\,}{0sp}{\color{blue}}[] \newcounter{realchapter} \newenvironment{subtopic}{% \clearpage \refstepcounter{chapter}% \setcounter{realchapter}{\value{chapter}}% \renewcommand{\thechapter}{\therealchapter\Alph{chapter}}% \setcounter{chapter}{0}% }{% \clearpage } \begin{document} \begin{subtopic} \chapter{Topic of Week 1} \section{Task 1} \section{Task 2} \chapter{Remainder of Week 1} \section{Task 1} \section{Task 2} \end{subtopic} \chapter{Topic of Week 2} \section{Task 1} \section{Task 2} \end{document} ```
0
https://tex.stackexchange.com/users/277964
685308
317,923
https://tex.stackexchange.com/questions/685310
1
I am trying to recreate this Beamer document using Quarto: **Beamer:** ``` \documentclass[dvipsnames]{beamer} \title{test} \begin{document} \begin{frame} \frametitle{Here is a slide} Here is {\color{ForestGreen}{forestgreen}} \end{frame} \end{document} ``` **Quarto:** ``` --- title: test format: beamer: beameroption: dvipsnames --- # Here is a slide Here is {\color{ForestGreen}{forestgreen}} ``` This generates the error: `Package keyval Error: dvipsnames undefined.` Maybe I misunderstand `beameroption`? How do I pass a class option to Beamer?
https://tex.stackexchange.com/users/15615
How to color specific text using beamer format in Quarto
true
Beamer options are for things like activating notes etc. See e.g. section "19.3 Specifying Which Notes and Frames Are Shown" of the beamer user guide to see some examples. To pass options on the xcolor package, you want to use a class option: ``` --- title: test format: beamer: classoption: - '`xcolor={dvipsnames}`{=latex}' --- # Here is a slide Here is {\color{ForestGreen}{forestgreen}} ```
1
https://tex.stackexchange.com/users/36296
685311
317,925
https://tex.stackexchange.com/questions/685312
0
I am trying to draw a bold diameter symbol. I imported the diameter symbol by the package `wasysym`as shown in [this answer](https://tex.stackexchange.com/a/551355/260914) and looked at several ways how to use bold math symbols as shown [here](https://tex.stackexchange.com/questions/297253/norm-symbol-have-different-sizes-in-equation) and [here](https://tex.stackexchange.com/questions/595/how-can-i-get-bold-math-symbols), yet none of them seemed to work for me. How can I achieve this?
https://tex.stackexchange.com/users/260914
How can I draw a bold diameter symbol?
true
You did not show what you tried or what error you got, but wasy is available in bold ``` \documentclass{article} \usepackage{amsmath,amsthm,amssymb} \usepackage{wasysym} % for the diameter command \begin{document} \begin{equation} \text{\diameter} \neq \textbf{\diameter} \end{equation} \end{document} ```
2
https://tex.stackexchange.com/users/1090
685313
317,926
https://tex.stackexchange.com/questions/685303
2
For my class (teaching at university) I use a TeX document to provide the assignments and excercises for every week as shown below. ``` \documentclass{report} \usepackage{titlesec} \titlelabel{\thetitle~} \titleformat{\chapter}[hang]{\color{blue}\Large\bfseries}{Exercise \thechapter\,--\,}{0sp}{\color{blue}}[] \begin{document} \chapter{Topic of Week 1} \section{Task 1} \section{Task 2} \chapter{Topic of Week 2} \section{Task 1} \section{Task 2} \end{document} ``` This generates chapter headings such as *Excercise 1 - Topic of Week 1*. Now I need a solution to split a chapter across two weeks, i.e. it should result in * Excercise 1A - Topic of Week 1 * Excercise 1B - Remainder of Week 1 Since thas `\sections` are the tasks I switch to `\section` and `\subsection` as the overall structure should remain the same. Actually I'd like to add a new `\chapter{Remainder of Week 1}` but do not (visibly) increase the chapter counter. Any ideas?
https://tex.stackexchange.com/users/61585
Subdividing chapters into A, B, ... without using sections
true
Here's an option just using `titlesec`: ``` \documentclass{report} \usepackage{titlesec,xcolor} \titlelabel{\thetitle~} \titleformat{\chapter} [hang] {\color{blue}\Large\bfseries} {Exercise \thechapter\,--\,} {0sp} {\color{blue}} [] \titleclass{\splitchapter}{top}[\part] \newcounter{splitchapter} \renewcommand{\thesplitchapter}{\thechapter\Alph{splitchapter}} \titleformat{\splitchapter} [hang] {\ifnum\value{splitchapter}=1\refstepcounter{chapter}\else\fi \color{blue}\Large\bfseries} {Exercise \thesplitchapter\,--\,} {0sp} {\color{blue}} [] % copied from titlesec doc \titlespacing*{\splitchapter}{0pt}{50pt}{40pt} % reset splitchapter counter at each chapter \AddToHook{cmd/chapter/before}{\setcounter{splitchapter}{0}} \begin{document} \chapter{a chapter} \section{abc} \section{abc} \splitchapter{a split chapter} \section{abc} \section{abc} \splitchapter{another split chapter} \section{abc} \section{abc} \chapter{another chapter} \section{abc} \section{abc} \splitchapter{split} \section{abc} \end{document} ```
1
https://tex.stackexchange.com/users/208544
685314
317,927
https://tex.stackexchange.com/questions/685298
1
I want to submit an article to a journal and it has its own template with its own document class (available [here](https://files.taylorandfrancis.com/rqufLatex.zip?_gl=1*y573ft*_ga*Nzc0OTc0MzIxLjE2ODM3MzE4MzI.*_ga_0HYE8YG0M6*MTY4MzczMTgzMy4xLjEuMTY4MzczMTg4MS4wLjAuMA..&_ga=2.116220869.274835176.1683731833-774974321.1683731832)). I can compile the tex file into a pdf (although with error messages), but the references don't show up (they are in a separate bib file). Consider the following working example (I use the template's bib file): ``` \documentclass{rQUF2e} \begin{document} \title{Whatever} \author{Whoever} \maketitle \begin{abstract} Blablabla \end{abstract} \section{Introduction} To estimate the risk-free term structure, do this \citep{ed84}. \bibliographystyle{rQUF} \bibliography{rQUFguide} \end{document} ``` The following error message appears: This is BibTeX, Version 0.99d (TeX Live 2022) The top-level auxiliary file: proba.aux The style file: rQUF.bst Database file #1: references.bib Warning--I didn't find a database entry for "[" (There was 1 warning) Process exited normally In the pdf, the `\citep{ed84}` command appears as [?,]]ed84. I am unable to fix this and a topic with a similar problem didn't help. I also tried with the journal's example tex file and bib file, but the same happens. I tried it in Texstudio under Windows 10 and Mac OS Ventura 13.2.1.
https://tex.stackexchange.com/users/229544
Bibtex error: I didn't find a database entry for "["
true
What you posted is not an error, it's just a warning from `bibtex`. The are numerous errors when compiling the main file, starting with: ``` ! LaTeX Error: Command \negmedspace already defined. Or name \end... illegal, see p.192 of the manual. ``` and ending with a worrying ``` ! Extra \endgroup. \document ->\endgroup \ifx \@unusedoptionlist \@empty \else \@latex@warning@... l.3 \begin{document} ``` If you look closely, the "package" you are pointing to is **overriding** system files, namely: ``` amsbsy.sty amsfonts.sty amsmath.sty amssymb.sty epsfig.sty graphicx.sty natbib.sty rotating.sty subfigure.sty ``` which is a no-no. If I remove all that files (so using the distribution's one), there are fewer errors, but the `Extra endgroup` error stays, and now there is a new one (on the second run) ``` (./proba.bbl ! Undefined control sequence. <argument> \@bibsetup {0}\global \c@NAT@ctr \z@ l.1 \begin{thebibliography}{0} ``` which explains why the bibliography is not built. **CONCLUSION:** The class is utterly broken, you have to talk to the journal's editors. **BUT THERE IS A WORKAROUND** If you read the source, the class has been last updated in 2014, and it has used the policy of modifying internal things. [If you add the line (thanks to David Carlisle)](https://chat.stackexchange.com/transcript/message/63544587#63544587) ``` \RequirePackage[2018-12-01]{latexrelease} ``` *before* the `documentclass`, so that the LaTeX kernel is "backported" to the past, the compilation works, so if you compile, call `bibtex`, and compile two times more you'll have: Still, the format is broken and seems unmaintained since 2014, which is a lot of time...
4
https://tex.stackexchange.com/users/38080
685316
317,928
https://tex.stackexchange.com/questions/685319
4
``` \documentclass{article} \usepackage{amsmath} \ExplSyntaxOn \clist_map_inline:nn { aaa, bbb, ccc } { \exp_args:Nco \DeclareMathOperator { #1 } { #1 } } \ExplSyntaxOff \begin{document} $\aaa$ $\bbb$ $\ccc$ \end{document} ``` I can expand the arguments of `\DeclareMathOperator` but not `\DeclareMathOperator*`. How to expand the arguments of `\DeclareMathOperator*`?
https://tex.stackexchange.com/users/238422
How to expand function with star using latex3?
true
Notwithstanding that it's common to say that `\DeclareMathOperator*` is a variant of `\DeclareMathOperator` (the same for all such commands), the command is just `\DeclareMathOperator`, which looks ahead to see whether `*` follows or not. Whether you write ``` \DeclareMathOperator*{\aaa}{aaa} ``` or ``` \DeclareMathOperator *{\aaa}{aaa} ``` is completely immaterial: there are two tokens before the `{`. So in your case you have to jump over two tokens, not just one. ``` \documentclass{article} \usepackage{amsmath} \ExplSyntaxOn \clist_map_inline:nn { aaa, bbb, ccc } { \exp_args:NNc \DeclareMathOperator * { #1 } { #1 } } \ExplSyntaxOff \begin{document} \[ \aaa_{1\le i\le n} \bbb_{1\le j\le n} \ccc_{1\le k\le n} \] \end{document} ``` You just want `\exp_args:Nc` for the “no star” part. And `o` is useless, *unless* you want to use a macro expanding to a name, but that would be weird.
5
https://tex.stackexchange.com/users/4427
685321
317,929
https://tex.stackexchange.com/questions/685326
1
I'm currently using the following code to produce a certain style of section and subsection. I'd really appreciate some help fixing the following issues: Firstly, I'd like both the red section number box and the blue subsection number box to be right aligned in the left margin (which doesn't seem to appear in showframe - why?) without the makeshift use of the \hspace command (this is the best I can manage so far, but it isn't perfect). Secondly, I'd like the box containing the titles of the section and subsection to extend as far as the end of the line of text underneath, but no further. Currently, it seems to overrun. How do I fix this? ``` \documentclass{article} \usepackage[margin=2.5cm,showframe]{geometry} \usepackage[explicit]{titlesec} \usepackage{tikz} \titleformat{\section} {\normalfont\Large\bfseries} {\llap{\tikz[baseline=(a.base)]\node[draw=red!20,fill=white,inner sep=5pt,text height=1.5ex,text depth=-1ex, line width = 2pt](a){\thesection}; \hspace{0.25cm}}} {0em} {\tikz[baseline=(a.base)]\node[fill=red!20,inner sep=6pt,text width=\linewidth-4pt,text height=1.5ex,text depth=-1ex, shading=axis,shading angle=0,left color=red!20,right color=white](a){\centering #1};} \titleformat{\subsection} {\normalfont\large\bfseries} {\llap{\tikz[baseline=(a.base)]\node[draw=blue!20,fill=white,inner sep=5pt,text height=1.5ex,text depth=-1ex, line width = 2pt](a){\thesubsection}; \hspace{0.275cm}}} {0em} {\tikz[baseline=(a.base)]\node[fill=blue!20,inner sep=6pt,text width=\linewidth-4pt,text height=1.5ex,text depth=-1ex, shading=axis,shading angle=0,left color=blue!20,right color=white](a){\centering #1};} \begin{document} \chapter{A chapter} \section{Introduction} \subsection{A subsection} Lorem ipsum dolor sit amet, consectetur adipiscing elit. Suspendisse aliquet magna sed erat tempus, sit amet maximus est tristique. \end{document} ```
https://tex.stackexchange.com/users/83183
Issues on length and position of tikz boxes in titlesec
true
Use `text width={\linewidth-12pt}` to get a node with appropriate width, because you need to subtract twice the `inner sep` of 6pt. Also, better not place `\hspace` inside the `\tikz` command. Note that a negative `text depth` does nothing here. ``` \documentclass{article} \usepackage[margin=2.5cm, showframe]{geometry} \usepackage[explicit]{titlesec} \usepackage{tikz} \titleformat{\section} {\normalfont\Large\bfseries} {\hspace*{-0.275cm}\llap{\tikz[baseline=(a.base)]{ \node[draw=red!20, fill=white, inner sep=5pt, text height=1.5ex, text depth=0pt, line width=2pt] (a) {\thesection}; }}} {0.275cm} {\tikz[baseline=(a.base)]{ \node[fill=red!20, inner sep=6pt, text width={\linewidth-12pt}, text height=1.5ex, text depth=0pt, shading=axis, shading angle=0, left color=red!20, right color=white] (a) {#1}; }} \titleformat{\subsection} {\normalfont\large\bfseries} {\hspace*{-0.275cm}\llap{\tikz[baseline=(a.base)]{ \node[draw=blue!20, fill=white, inner sep=5pt, text height=1.5ex, text depth=0pt, line width=2pt] (a){\thesubsection}; }}} {0.275cm} {\tikz[baseline=(a.base)]{ \node[fill=blue!20, inner sep=6pt, text width={\linewidth-12pt}, text height=1.5ex, text depth=0pt, shading=axis, shading angle=0, left color=blue!20, right color=white] (a) {#1}; }} \begin{document} \chapter{A chapter} \section{Introduction} \subsection{A subsection} Lorem ipsum dolor sit amet, consectetur adipiscing elit. Suspendisse aliquet magna sed erat tempus, sit amet maximus est tristique. \end{document} ```
2
https://tex.stackexchange.com/users/47927
685337
317,932
https://tex.stackexchange.com/questions/685333
2
I was very surprised when I noticed that there was a package on CTAN for the centernot command. Specifically, what is the difference between `\@centernot` and `\c@ncel` (which is part of Plain TeX)?
https://tex.stackexchange.com/users/nan
Why is there a package for centernot?
true
`\c@ncel` (used in the default `\notin`) is ``` \def\c@ncel#1#2{\m@th\ooalign{$\hfil#1\mkern1mu/\hfil$\crcr$#1#2$}} ``` Note this doesn't take care of `\mathrel` spacing or subscript size, so is used wrapped such as ``` \DeclareRobustCommand \notin{\mathrel{\m@th\mathpalette\c@ncel\in}} ``` Conversely `\@centerdot` uses a different centering mechanism and applies `\mathrel` ``` \newcommand*{\centernot}{% \mathpalette\@centernot } \def\@centernot#1#2{% \mathrel{% \rlap{% \settowidth\dimen@{$\m@th#1{#2}$}% \kern.5\dimen@ \settowidth\dimen@{$\m@th#1=$}% \kern-.5\dimen@ $\m@th#1\not$% }% {#2}% }% } ``` it also uses `\not` rather than `/` for the /. So like many other packages they are different implementations with similar use cases. ``` \documentclass{article} \usepackage{amssymb} \usepackage{centernot} \makeatletter \DeclareRobustCommand\cnot[1]{\mathrel{\m@th\mathpalette\c@ncel#1}} \begin{document} $ A \centernot\subset B $ $ A \cnot\subset B $ $ A \centernot\rightarrow B $ $ A \cnot\rightarrow B $ \end{document} ```
3
https://tex.stackexchange.com/users/1090
685342
317,935
https://tex.stackexchange.com/questions/685345
0
Where can I find a table which shows the LaTeX commands for each Unicode Character if such a command exists? For example the LaTeX command for `∈` is `\in`
https://tex.stackexchange.com/users/178952
Where can I find a table which shows the LaTeX commands for each Unicode Character?
false
Here is a table, but this is a community wiki and needs to be edited to be complete. | LaTeX | Unicode Escape Sequence | Human Readable | | --- | --- | --- | | `\alpha` | `\u03B1` | α | | `A` | `\u0391` | Α | | `\approx` | `\u2248` | ≈ | | `\ast` | `\u2217` | ∗ | | `\alpha` | `\03B1` | α | | `\beta` | `\u3b2` | β | | `\bigcap` | `\u22c2` | ⋂ | | `\circ` | `\u2218` | ∘ | | `\cdot` | `\u22c5` | ⋅ | | `\cdots` | `\u22ef` | ⋯ | | `\???` | `\u21ab` | ↫ | | `\???` | `\u21ac` | ↬ | | `\???` | `\u21b6` | ↶ | | `\???` | `\u21b7` | ↷ | | `\???` | `\u21ba` | ↺ | | `\cwopencirclearrow` | `\u21bb` | ↻ | Rows are sorted based on the leftmost letter in the LaTeX command if case (lower or upper) did not matter and all backlashes are ignored.
-2
https://tex.stackexchange.com/users/178952
685346
317,937
https://tex.stackexchange.com/questions/685226
1
Using the package `acro`, I would like to avoid the short form of my acronyms to appear in bold in the printed acronym list. When defining the short form, I could specify that I want it in `normalfont`, but this keeps the short form to appear in italics whe I am in such an environment. Is there another way? ``` \documentclass{article} \usepackage{acro} \DeclareAcronym{abc}{short=\normalfont{ABC},long=Alphabetical} \begin{document} \printacronyms This works fine: \acf{abc}. \textit{However, when writing in italics, I want the short form to be in italics, too: \acf{abc}---this fails.} \end{document} ```
https://tex.stackexchange.com/users/295779
Avoid bold font in acronym list
false
You should prefer ``` \DeclareAcronym{abc}{short=ABC,long=Alphabetical,short-format=\normalfont} ``` to apply formatting to a specific acronym. But that doesn't help here, the bold is hard-coded through the `description` environment. You could (in a group as necessary) apply a formatting to all acronyms ``` \acsetup{format/short=\normalfont,format/replace=false} \printacronyms ``` where `format/replace` is needed to ensure `\normalfont` is applied even if an acronym has its own `short-format` which would otherwise override any global `format/short`. Or you could modify the `description` environment, which is easiest with [`enumitem`](https://ctan.org/pkg/enumitem) ``` \setlist[description]{font=\normalfont} \printacronyms ``` The effects of which you can see with ``` \documentclass{article} \usepackage{enumitem} \usepackage{acro} \DeclareAcronym{abc}{short=ABC,long=Alphabetical} \DeclareAcronym{abd}{short=ABD,long=Not alphabetical,short-format=\itshape} \begin{document} \acf{abc} \acf{abd} \textit{\acf{abc} \acf{abd}} \printacronyms {\acsetup{format/short=\normalfont} \printacronyms} {\acsetup{format/short=\normalfont,format/replace=false} \printacronyms} {\setlist[description]{font=\normalfont} \printacronyms} \end{document} ```
2
https://tex.stackexchange.com/users/106162
685347
317,938
https://tex.stackexchange.com/questions/685329
0
In the picture of the following code, how I can adjust vertically the captions “C” and “D” (in fact, I want to pull down the caption “D” a little bit). With thanks. ``` \documentclass[10pt,xcolor={dvipsnames,table}]{beamer} \mode<article> % only for the article version { \usepackage{fullpage} \usepackage{hyperref} } \mode<presentation> { %\setbeamertemplate{background canvas}[vertical shading][bottom=red!10,top=blue!10] \setbeamercovered{transparent} \usefonttheme{serif} \usecolortheme{crane} } \setbeamercovered{dynamic} \setbeamertemplate{items}[circle] \usepackage{tikz} \usetikzlibrary{tikzmark,positioning,fit,backgrounds,shapes.geometric} \newcommand\drawnestedsets[4]{ % initial position \def\position{#1} % number of sets \def\nbsets{#2} % list of sets \def\listofnestedsets{#3} % reversed list of colors \def\reversedlistofcolors{#4} % position and draw labels of sets \coordinate (circle-0) at (#1); \coordinate (set-0) at (#1); \foreach \set [count=\c] in \listofnestedsets { \pgfmathtruncatemacro{\cminusone}{\c - 1} % label of current set (below previous nested set) \node[below=3pt of circle-\cminusone,inner sep=0] (set-\c) {\set}; % current set (fit current label and previous set) \node[circle,inner sep=0,fit=(circle-\cminusone)(set-\c)] (circle-\c) {}; } % draw and fill sets in reverse order \begin{scope}[on background layer] \foreach \col[count=\c] in \reversedlistofcolors { \pgfmathtruncatemacro{\invc}{\nbsets-\c} \pgfmathtruncatemacro{\invcplusone}{\invc+1} \node[circle,draw,fill=\col,inner sep=0, fit=(circle-\invc)(set-\invcplusone)] {}; } \end{scope} } \begin{document} \begin{frame} \begin{tikzpicture} \drawnestedsets{0,-1}{4}{A, B,C,D}{blue!50,red!50,yellow!50,orange} \end{tikzpicture} \end{frame} \end{document} ```
https://tex.stackexchange.com/users/295544
Adjusting caption in a tikz picture
false
Here is an alternate macro that only requires the center coordinate of the smallest circle, together with a list of entries of the form `<label>/<color>`. The macro counts the number of sets, which should be listed from largest to smallest and stores the result in `\numsets`, then calculates the `yshift` for the center of each circle and the label position. The label of the smallest circle is not shifted so the conditional `\b==1?1:0` (if b=1 return 1 else return 0) is used. ``` \documentclass[10pt,xcolor={dvipsnames,table}]{beamer} \mode<article> % only for the article version { \usepackage{fullpage} \usepackage{hyperref} } \mode<presentation> { %\setbeamertemplate{background canvas}[vertical shading][bottom=red!10,top=blue!10] \setbeamercovered{transparent} \usefonttheme{serif} \usecolortheme{crane} } \setbeamercovered{dynamic} \setbeamertemplate{items}[circle] \usepackage{tikz} \newcommand\drawnestedsets[2]{\begin{scope}[scale=.7, transform shape] \foreach \n[count=\k] in {#2} {\xdef\numsets{\k}} \foreach \setname/\setcolor[ count=\c, evaluate=\c as \b using \numsets-\c+1, evaluate=\c as \lshift using {-(4*\b-3-(\b==1?1:0))/8}, evaluate=\c as \cshift using -.25*(\b-1) ] in {#2}{ \node[draw, fill=\setcolor, circle, minimum size=\b cm, label={[yshift=\lshift cm]center:\setname}] at ([yshift=\cshift cm]#1){}; }\end{scope} } \begin{document} \begin{frame} \begin{tikzpicture} \drawnestedsets{0,-1}{D/blue!50, C/red!50, B/yellow!50, A/orange} \end{tikzpicture} \end{frame} \end{document} ```
0
https://tex.stackexchange.com/users/125871
685348
317,939
https://tex.stackexchange.com/questions/148693
5
Sometimes when I write some text, I mistakingly put space before dot/comma or I forget to put space after dot/comma. I would like LaTeX to remove all space before dots and add space after punctuation. For example: "This is some text . This is some text" should be "This is some text. This is some text" and "This is some text.This is some text" should be "This is some text. This is some text" I'm from Europe.
https://tex.stackexchange.com/users/42290
How to automatically remove space before punctuation and adding after sign?
false
I don't know whether the original poster is still around, but this might come in handy for some people. Please use with caution. Although I tried to handle exclusion of delimiters inside control sequences or digital values, you still may occasionally need to manually disable the rule set when needed. (See the provided `\AutospaceOn`/`\AutospaceOff` switch. You can of course create finer-grained, *rule-by-rule* toggling instead.) Also, **Autospace mode must not be in ON state when the document ends**, lest you should receive a `package logreq` **error**: make sure to use an `\AutospaceOff` at the end of the document. Note: this collides with `pgfutil`: if ever you use within `tikz` e.g. `postaction`, make sur to disable `Autospace` through `\AutospaceOff` beforehand and reactivate it afterwards through `\AutospaceOn`. ``` % !TEX TS-program = lualatex \documentclass{article} \usepackage{luacode} \begin{luacode*} function comma_space(s) s = string.gsub(s, "[%s~]*,", ",") s = string.gsub(s, ",(%a)", function(x) if x == "\\footnote" or x == "\\footnotemark" then return "," .. x else return ", " .. x end end) return s end function period_space(s) s = string.gsub(s, "(%.)[%s~]*(%D)", function(x, y) if x == "\\footnote" or x == "\\footnotemark" or string.match(y, "%d") then return x .. y else return x .. " " .. y end end) return s end function colon_space(s) s = string.gsub(s, "[%s~]*:", ":") s = string.gsub(s, ":(%a)", function(x) if x == "\\footnote" or x == "\\footnotemark" then return ":" .. x else return ": " .. x end end) return s end function semicolon_space(s) s = string.gsub(s, "[%s~]*;", ";") s = string.gsub(s, ";(%a)", function(x) if x == "\\footnote" or x == "\\footnotemark" then return ";" .. x else return "; " .. x end end) return s end function quote_space(s) s = string.gsub(s, "\"[%s~]+", "``") s = string.gsub(s, "[%s~]+\"", "''") s = string.gsub(s, "«([^%s~])", "«\\,%1") s = string.gsub(s, "([^%s~])»", "%1\\,»") return s end function autospace(line) if string.sub(line, 1, 1) == "\\" then local command = string.match(line, "\\(%w+)") if string.sub(command, 1, 4) == "text" then line = string.gsub(line, "(%s*)(%b{})", function(space, arg) return space .. autospace(arg) end) end else line = comma_space(line) line = period_space(line) line = colon_space(line) line = semicolon_space(line) line = string.gsub(line, "[%s~]+(%p)", "%1") line = quote_space(line) end return line end \end{luacode*} \newcommand{\AutospaceOn}{ \directlua{luatexbase.add_to_callback("process_input_buffer", autospace, "autospace")} } \newcommand{\AutospaceOff}{ \directlua{luatexbase.remove_from_callback("process_input_buffer", "autospace")} } % You may create more refined toggles, e.g. \AutoCommaspaceOn by adding specific functions such as comma_space instead of the global autospace function. \begin{document} \AutospaceOn \textit{" This is a test,no space before the comma but space after .No space before the period but space after .And this is a test :no space before the colon but space after .And this is a test ; no space before the semicolon but should be after the semicolon .This is a test «for French quotes» . "} \vspace{2.99ex} % As you can see, no undesirable space is added after the decimal point. \textbf{" This is a test,no space before the comma but space after .No space before the period but space after .And this is a test :no space before the colon but space after .And this is a test ;\footnote{test} no space before the semicolon but should be after the semicolon .This is a test «for French quotes» . "} \vspace{2.99ex} % As you can see, no undesirable space is added after the decimal point. This is a test,~no space added before a tilde;~no space:~no space.~No space. \vspace{2.99ex} % As you can see, no undesirable space is added after the decimal point. No space between punctuation and a footnote mark,\footnote{test} no space;\footnote{test} no space:\footnote{test} no space\footnote{test}. \vspace{2.99ex} % As you can see, no undesirable space is added after the decimal point. \AutospaceOff " This is a test ,no space before the comma but space after .No space before the period but space after .\footnote{essai} And this is a test :\footnote{essai} no space before the colon but space after .And this is a test ;\footnote{essai} no space before the semicolon but should be after the semicolon .This is a test «for French quotes» . " \end{document} ``` **Edit** Now if you want to avoid unwanted auto-spaces before `footnote` marks, and add support for tildes and text-formatting commands, the code should be modified the following way. ``` % !TEX TS-program = lualatex \documentclass{article} \usepackage{luacode} \begin{luacode*} function comma_space(s) s = string.gsub(s, "[%s~]*,", ",") s = string.gsub(s, ",(%a)", function(x) if x == "\\footnote" or x == "\\footnotemark" then return "," .. x else return ", " .. x end end) return s end function period_space(s) s = string.gsub(s, "(%.)[%s~]*(%D)", function(x, y) if x == "\\footnote" or x == "\\footnotemark" or string.match(y, "%d") then return x .. y else return x .. " " .. y end end) return s end function colon_space(s) s = string.gsub(s, "[%s~]*:", ":") s = string.gsub(s, ":(%a)", function(x) if x == "\\footnote" or x == "\\footnotemark" then return ":" .. x else return ": " .. x end end) return s end function semicolon_space(s) s = string.gsub(s, "[%s~]*;", ";") s = string.gsub(s, ";(%a)", function(x) if x == "\\footnote" or x == "\\footnotemark" then return ";" .. x else return "; " .. x end end) return s end function quote_space(s) s = string.gsub(s, "\"[%s~]+", "``") s = string.gsub(s, "[%s~]+\"", "''") s = string.gsub(s, "«([^%s~])", "«\\,%1") s = string.gsub(s, "([^%s~])»", "%1\\,»") return s end function autospace(line) if string.sub(line, 1, 1) == "\\" then local command = string.match(line, "\\(%w+)") if string.sub(command, 1, 4) == "text" then line = string.gsub(line, "(%s*)(%b{})", function(space, arg) return space .. autospace(arg) end) end else line = comma_space(line) line = period_space(line) line = colon_space(line) line = semicolon_space(line) line = string.gsub(line, "[%s~]+(%p)", "%1") line = quote_space(line) end return line end \end{luacode*} \newcommand{\AutospaceOn}{ \directlua{luatexbase.add_to_callback("process_input_buffer", autospace, "autospace")} } \newcommand{\AutospaceOff}{ \directlua{luatexbase.remove_from_callback("process_input_buffer", "autospace")} } % You may create more refined toggles, e.g. \AutoCommaspaceOn by adding specific functions such as comma_space instead of the global autospace function. \begin{document} \AutospaceOn \textit{" This is a test ,no space before the comma but space after .No space before the period but space after .\footnote{test} And this is a test :\footnote{test} no space before the colon but space after .And this is a test ;\footnote{test} no space before the semicolon but should be after the semicolon .This is a test «for French quotes» . "} \vspace{2.99ex} % As you can see, no undesirable space is added after the decimal point. \textbf{" This is a test ,no space before the comma but space after .No space before the period but space after .\footnote{test} And this is a test :\footnote{test} no space before the colon but space after .And this is a test ;\footnote{test} no space before the semicolon but should be after the semicolon .This is a test «for French quotes» . "} \vspace{2.99ex} % As you can see, no undesirable space is added after the decimal point. \AutospaceOff " This is a test ,no space before the comma but space after .\footnote{essai}No space before the period but space after .\footnote{essai} And this is a test :\footnote{essai} no space before the colon but space after .And this is a test ;\footnote{essai} no space before the semicolon but should be after the semicolon .This is a test «for French quotes» . " \end{document} ```
1
https://tex.stackexchange.com/users/262813
685355
317,942
https://tex.stackexchange.com/questions/685349
2
How do I pair **Old Standard** (for alphabets and digits) and **Asana-Math** (for the rest of the math) in order to write antique looking math?
https://tex.stackexchange.com/users/296021
Pairing two fonts for antique looking math
true
Something like this? Sample text taken from [this question](https://tex.stackexchange.com/q/425098/208544). ``` \documentclass{article} \pagestyle{empty} \usepackage{amsmath} \DeclareMathOperator\Res{Res} \newcommand*\diff{\mathop{}\!\mathup{d}} \usepackage{amsthm} \newtheorem{theorem}{Theorem} \usepackage{unicode-math} \setmainfont{Old Standard} \setmathfont{Asana Math} \setmathfont{Old Standard Italic}[range=it] \setmathfont{Old Standard}[range=up] \setmathfont{Old Standard Bold Italic}[range=bfit] \begin{document} \begin{theorem}[Residue theorem] Let $f$ be analytic in the region $G$ except for the isolated singularities $a_1,a_2,\dots,a_m$. If $\gamma$ is a closed rectifiable curve in $G$ which does not pass through any of the points $a_k$ and if $\gamma\approx 0$ in $G$, then \[ \frac{1}{2\pi i} \int\limits_\gamma f\Bigl(x^{\mathbf{N}\in\mathbb{C}^{N\times 10}}\Bigr) = \sum_{k=1}^m n(\gamma;a_k)\Res(f;a_k)\,. \] \end{theorem} \begin{theorem}[Maximum modulus] Let $G$ be a bounded open set in $\BbbC$ and suppose that $f$ is a continuous function on $G^-$ which is analytic in $G$. Then \[ \max\{\, |f(z)|:z\in G^- \,\} = \max\{\, |f(z)|:z\in \partial G \,\}\,. \] \end{theorem} First some large operators both in text: $\iiint\limits_{Q}f(x,y,z) \diff x \diff y \diff z$ and $\prod_{\gamma\in\Gamma_{\bar{C}}}\partial(\tilde{X}_\gamma)$;\ and also on display \[ \iiiint\limits_{Q}f(w,x,y,z) \diff w \diff x \diff y \diff z \leq \oint_{\partial Q} f'\Biggl(\max\Biggl\{ \frac{\Vert w\Vert}{\vert w^2+x^2\vert}; \frac{\Vert z\Vert}{\vert y^2+z^2\vert}; \frac{\Vert w\oplus z\Vert}{\vert x\oplus y\vert} \Biggr\}\Biggr)\,. \] \end{document} ```
1
https://tex.stackexchange.com/users/208544
685356
317,943
https://tex.stackexchange.com/questions/685341
1
I'm trying to make siunitx interpret a number stored in a separate file on disk, but `\num{\input{number.txt}}` fails with the following error message: `Argument of \@iinput has an extra }.` Is there another way to do this? --- MWE (assuming a file called "number.txt" exists on disk and its content is a number such as 1 in my case): ``` \documentclass{article} \usepackage{siunitx} \begin{document} \num{\input{number.txt}} \end{document} ```
https://tex.stackexchange.com/users/182557
Siuntix \num in combination with \input fails with "Argument of \@iinput has an extra }."
false
There is a simple example. You should read the doc of `tabularray` and `siunitx`. `num.txt`: ``` 6.618 & 287.1854 & 998.7116 & 163.1364 & 512.8064 & 291.2459 \\ 518.5163 & 853.7523 & 80.038 & 94.076 & 271.9311 & 268.8729 \\ 563.1559 & 20.6741 & 491.2001 & 665.8677 & 386.862 & 2.2473 \\ 316.0299 & 614.1185 & 23.327 & 964.3642 & 238.9255 & 65.4116 \\ 923.5761 & 944.643 & 155.7276 & 973.4626 & 951.6755 & 891.3304 \\ ``` ``` \documentclass{article} \usepackage{tabularray} \UseTblrLibrary{siunitx} \UseTblrLibrary{functional} \begin{document} \begin{tblr} [evaluate=\fileInput] { colspec={*{6}{Q[si={table-format=3.4},c,m]}}, hlines,vlines, } \fileInput{num.txt} \end{tblr} \end{document} ```
1
https://tex.stackexchange.com/users/238422
685360
317,944
https://tex.stackexchange.com/questions/685366
3
I'm getting a `Citation 'test' on page 1 undefined on input line 6.` error for the below example on Overleaf. I've looked at many other questions and I can't find the error. Any ideas? ``` \documentclass{article} \usepackage{biblatex} \begin{document} \cite{test} \begin{thebibliography}{99} \bibitem{test} bibtest \end{thebibliography} \end{document} ```
https://tex.stackexchange.com/users/296771
"Citation X on page X undefined on input line X" error with super minimal example
true
`biblatex` requires another data format with`\refsection`, `\datalist`, `\entry` and `\field` etc., but not a `thebibliography` environment with `\bibitem`. So loading package `biblatex` but using a `thebibliography` environment — either manually edited or created by `bibtex` with another document — does not work. In other words: You cannot mix the package with a manually created `thebibliography` environment. Instead you should use a `bib` file and run `biber`: ``` \documentclass{article} \usepackage{biblatex} \addbibresource{biblatex-examples.bib} \begin{document} Test: \cite{aksin}, \autocite{aksin}, \parencite{aksin}, \footcite{aksin} (the last one is nonsense with the default cite style, but could be useful, e.g., with \texttt{cite=authoryear} option). \printbibliography \end{document} ``` or manually: ``` \documentclass{article} \begin{document} \cite{test} \begin{thebibliography}{99} \bibitem{test} bibtest \end{thebibliography} \end{document} ``` If you are interesting in converting an already existing `thebibliography` environment into a `bib` file, see: [Convert from a textplain reference to bibtex](https://tex.stackexchange.com/q/233442/277964).
4
https://tex.stackexchange.com/users/277964
685368
317,948
https://tex.stackexchange.com/questions/685366
3
I'm getting a `Citation 'test' on page 1 undefined on input line 6.` error for the below example on Overleaf. I've looked at many other questions and I can't find the error. Any ideas? ``` \documentclass{article} \usepackage{biblatex} \begin{document} \cite{test} \begin{thebibliography}{99} \bibitem{test} bibtest \end{thebibliography} \end{document} ```
https://tex.stackexchange.com/users/296771
"Citation X on page X undefined on input line X" error with super minimal example
false
As caboah told you, your MWE works without `biblatex`: ``` \documentclass{article} \begin{document} \cite{test} \begin{thebibliography}{99} \bibitem{test} bibtest \end{thebibliography} \end{document} ``` If you would like to use `biblatex`, you have to create a `.bib` file, for example `mybib.bib`: ``` @article{test, title={This is a test}, author={Paulinho, van Duck}, journal={Quack University Journal}, volume={10}, pages={16--30}, date={2023-03-11}, url={https://www.quackforyou.com} } ``` and then add it to your document with `\addbibresource{mybib.bib}`: ``` \documentclass{article} \usepackage[english]{babel} \usepackage{csquotes} \usepackage{biblatex} \usepackage{xurl} \usepackage{hyperref} \addbibresource{mybib.bib} \begin{document} \cite{test} \printbibliography \end{document} ```
0
https://tex.stackexchange.com/users/101651
685371
317,950
https://tex.stackexchange.com/questions/685369
4
Clearly talking about: > > \sqrt[n]{x} > > > here!
https://tex.stackexchange.com/users/296021
What was the reason behind using sqrt (square root) to name the nth root command?
true
Note, that the author of TeX D. Knuth created the macro `\sqrt` only for square root in the basic plain TeX macro collection. The root with given power is provided by `\root number\of {argument}` in plain TeX. Both macros are based on the `\radical` TeX primitive which selects appropriate size of required symbol and adds vertical line over the given argument. Only LaTeX introduced the optional argument in the `\sqrt` macro and the mention about `\root number\of` was removed from LaTeX documentation. But the `\root` macro works in LaTeX just like in plain TeX.
6
https://tex.stackexchange.com/users/51799
685372
317,951
https://tex.stackexchange.com/questions/685359
1
I am trying to make ConTeXt do the hyphenations native to the Bahasa Indonesia language. I do not have any MWE, but I am relying on default English hyphenation and overriding incorrect hyphenation using `\hyphenation` followed by a list of hyphenated words. It becomes tedious for long documents. Is there a way to do that automatically?
https://tex.stackexchange.com/users/283822
Hyphenation of Bahasa Indonesia language in ConTeXt
true
Assuming a Unix system with TeX Live installed (this will work with the LMTX standalone too, but you need TL for the pattern files): ``` cd $(mktemp -d) mtxrun --script pattern --path=$(dirname $(kpsewhich hyph-en-us.tex)) --destination=. --specification=id,hyph-id,indonesian --convert rm ./lang-us.lua sudo cp ./lang-id.lua $(dirname $(mtxrun --find-file lang-us.lua | head -1)) context --luatex --make context --make ``` I can't read Indonesian, but it appears to work based off of this ad-hoc test document: ``` \installlanguage[id][default=en,patterns=id] \mainlanguage[id] % \mainlanguage[en] % compare with id to confirm that the words get much shorter \starttext \EveryPar{\hsize=0pt} \chapter{\TeX} Dari Wikipedia bahasa Indonesia, ensiklopedia bebas Untuk bantuan menampilkan rumus matematika di Wikipedia, lihat Bantuan:Menampilkan rumus. Artikel ini bukan mengenai LaTeX. TeX, juga ditulis sebagai TeX, sistem typesetting (penyusunan huruf) yang dirancang dan ditulis oleh Donald Knuth, dan pertama kali dirilis pada tahun 1978. TeX adalah cara populer untuk menyusun rumus matematika yang kompleks; TeX telah dicatat sebagai salah satu sistem tipografi digital yang paling canggih. TeX banyak digunakan dalam dunia akademis, terutama dalam matematika, ilmu komputer, ekonomi, ilmu politik, teknik, linguistik, fisika, statistika, dan psikologi kuantitatif. TeX telah lama menggantikan troff Unix, sistem pemformatan yang sebelumnya disukai di sebagian besar instalasi Unix. TeX juga digunakan untuk banyak tugas penyusunan huruf lainnya, terutama dalam bentuk LaTeX, ConTeXt, dan paket makro lainnya. TeX dirancang dengan dua tujuan utama: untuk memungkinkan siapa pun menghasilkan buku berkualitas tinggi dengan usaha yang minimal, dan untuk menyediakan sistem yang akan memberikan hasil yang persis sama di semua komputer kapanpun (bersama dengan bahasa Metafont untuk deskripsi font dan keluarga typeface Computer Modern). TeX adalah perangkat lunak gratis, yang membuatnya dapat diakses oleh berbagai pengguna. \section{Sejarah} Ketika volume pertama dari buku The Art of Computer Programming karya Knuth diterbitkan pada tahun 1968, buku ini diketik dengan menggunakan hot metal typesetting pada mesin Monotype. Metode ini, yang berasal dari abad ke-19, menghasilkan "gaya klasik" yang disukai oleh Knuth. Ketika edisi kedua diterbitkan, pada tahun 1976, seluruh buku harus diketik lagi karena teknologi Monotype sebagian besar telah digantikan oleh phototypesetting, dan font asli tidak lagi tersedia. Ketika Knuth menerima cetak coba dari buku baru pada tanggal 30 Maret 1977, dia menemukan bahwa kualitas buku tersebut lebih rendah. Kecewa dengan cetak coba edisi kedua dari jilid kedua, dia termotivasi untuk merancang sistem penyusunan hurufnya sendiri. Knuth melihat untuk pertama kalinya output dari sistem penyusunan huruf digital berkualitas tinggi, dan menjadi tertarik pada tipografi digital. Pada tanggal 13 Mei 1977, ia menulis memo untuk dirinya sendiri yang menjelaskan fitur dasar TeX. Dia berencana untuk menyelesaikannya pada masa cuti panjangnya pada tahun 1978, tetapi bahasa tersebut tidak sempat "frozen" (siap digunakan) sampai tahun 1989, lebih dari sepuluh tahun kemudian. Guy Steele kebetulan berada di Universitas Stanford selama musim panas 1978, ketika Knuth mengembangkan versi pertama TeX. Ketika Steele kembali ke Institut Teknologi Massachusetts pada musim gugur itu, dia menulis ulang input/output (I/O) TeX untuk dijalankan di sistem operasi Incompatible Timesharing System (ITS). Versi pertama TeX, yang disebut TeX78, ditulis dalam bahasa pemrograman SAIL untuk dijalankan pada PDP-10 di bawah sistem operasi WAITS milik Stanford. \subsection{WEB dan pemrograman literasi} Untuk versi TeX yang lebih baru, Knuth menemukan konsep pemrograman literasi (literate programming), sebuah cara untuk menghasilkan kode sumber yang dapat dikompilasi dan dokumentasi cross-linked yang diketik dalam TeX, dari berkas asli yang sama. Bahasa yang digunakan disebut WEB dan menghasilkan program dalam DEC PDP-10 Pascal. \subsection{TeX82} TeX82, versi baru TeX yang ditulis ulang dari awal, diterbitkan pada tahun 1982. Di antara perubahan lainnya, algoritma tanda hubung (hypenation) yang asli digantikan oleh algoritma baru yang ditulis oleh Frank Liang. TeX82 juga menggunakan aritmetika fixed-point, bukan floating-point, untuk memastikan hasil yang sama di berbagai perangkat keras komputer yang berbeda, dan menyertakan bahasa pemrograman Turing-lengkap yang nyata, setelah lobi intens oleh Guy Steele. Pada tahun 1989, Donald Knuth merilis versi baru TeX dan Metafont. Terlepas dari keinginannya untuk menjaga kestabilan program, Knuth menyadari bahwa 128 karakter yang berbeda untuk input teks tidak cukup untuk mengakomodasi bahasa asing; perubahan utama dalam TeX versi 3.0 (juga disebut TeX90) adalah kemampuan untuk bekerja dengan input 8-bit, memungkinkan 256 karakter berbeda dalam input teks. Sejak versi 3, TeX telah menggunakan sistem penomoran versi yang istimewa, yakni pembaruan ditunjukkan dengan menambahkan digit ekstra di akhir desimal, sehingga nomor versi secara asimtotik mendekati π. Ini adalah cerminan dari fakta bahwa TeX sekarang sangat stabil, dan hanya pembaruan kecil yang diantisipasi. Versi TeX saat ini adalah 3.141592653; terakhir diperbarui pada tahun 2021. Desainnya dibekukan (frozen) setelah versi 3.0, dan tidak ada fitur baru atau perubahan mendasar yang akan ditambahkan, jadi semua versi yang lebih baru hanya akan berisi perbaikan kutu. Meskipun Donald Knuth sendiri telah menyarankan beberapa area di mana TeX dapat ditingkatkan, dia mengindikasikan bahwa dia sangat yakin bahwa memiliki sistem yang tidak berubah dan yang akan menghasilkan output yang sama sekarang juga di masa depan, lebih penting daripada memperkenalkan fitur baru. Untuk alasan ini, dia telah menyatakan bahwa "perubahan yang benar-benar terakhir (yang akan dilakukan setelah kematian saya)" adalah mengubah nomor versi menjadi π, di mana semua bug yang tersisa akan menjadi fitur. Demikian juga, versi Metafont setelah 2.0 secara asimtotik mendekati e (saat ini di 2.7182818), dan perubahan serupa akan diterapkan setelah kematian Knuth. \subsection{Domain publik} Karena kode sumber TeX pada dasarnya berada dalam domain publik (lihat di bawah), programmer lain diperbolehkan (dan secara eksplisit didorong) untuk meningkatkan sistem, tetapi diharuskan menggunakan nama lain untuk mendistribusikan TeX yang dimodifikasi, yang berarti bahwa kode sumber masih dapat berkembang. Sebagai contoh, proyek Omega dikembangkan setelah tahun 1991, terutama untuk meningkatkan kemampuan typesetting multibahasa TeX. Knuth menciptakan versi modifikasi "tidak resmi", seperti TeX-XeT, yang memungkinkan pengguna untuk mencampur teks yang ditulis dalam sistem penulisan kiri-ke-kanan dan kanan-ke-kiri dalam dokumen yang sama. \section{Penggunaan TeX} Dalam beberapa bidang teknis seperti ilmu komputer, matematika, teknik dan fisika, TeX telah menjadi standar de facto. Ribuan buku telah diterbitkan menggunakan TeX, termasuk buku-buku yang diterbitkan oleh Addison-Wesley, Cambridge University Press, Elsevier, Oxford University Press, dan Springer. Banyak jurnal di bidang ini diproduksi menggunakan TeX atau LaTeX, yang memungkinkan penulis untuk mengirimkan naskah mentah mereka yang ditulis dalam TeX. Sementara banyak publikasi di bidang lain, termasuk kamus dan publikasi hukum, telah diproduksi menggunakan TeX, namun belum sesukses di bidang yang lebih teknis, karena TeX terutama dirancang untuk mengetik matematika. Ketika dia mendesain TeX, Donald Knuth tidak percaya bahwa satu sistem penyusunan huruf tunggal akan sesuai dengan kebutuhan semua orang; sebagai gantinya, dia mendesain banyak pengait di dalam program sehingga memungkinkan untuk menulis ekstensi, dan merilis kode sumbernya, dengan harapan bahwa penerbit akan merancang versi yang menyesuaikan dengan kebutuhan mereka sendiri. Meskipun ekstensi semacam itu telah dibuat (termasuk beberapa oleh Knuth sendiri), kebanyakan orang telah memperluas TeX hanya dengan menggunakan makro dan TeX tetap menjadi sistem yang terkait dengan penyusunan huruf teknis. \section{Sistem penyusunan huruf} Perintah TeX biasanya dimulai dengan garis miring terbalik dan dikelompokkan dengan kurung kurawal. Hampir semua sifat sintaksis TeX dapat diubah dengan cepat (on the fly), yang membuat input TeX sulit diurai oleh apa pun kecuali TeX itu sendiri. TeX adalah bahasa berbasis makro dan token: banyak perintah, termasuk sebagian besar perintah yang ditentukan pengguna, diperluas (expanded) dengan cepat sampai hanya token yang tidak dapat diekspansi yang tersisa, yang kemudian dieksekusi. Ekspansi itu sendiri praktis bebas dari efek samping. Rekursi ekor dari makro tidak membutuhkan memori, dan konstruksi if-then-else tersedia. Hal ini membuat TeX menjadi bahasa Turing-lengkap bahkan pada tingkat ekspansi. Sistem ini dapat dibagi menjadi empat tingkat: yang pertama, karakter dibaca dari file input dan diberi kode kategori (kadang-kadang disebut dengan "catcode"). Kombinasi garis miring terbalik (sebenarnya, karakter apa pun dari kategori nol) yang diikuti oleh huruf (karakter kategori 11) atau satu karakter lain digantikan oleh token control-sequence. Dalam hal ini, tahap ini seperti analisis leksikal, meskipun tidak membentuk angka dari digit. Pada tahap berikutnya, urutan kontrol yang dapat diperluas (seperti kondisional atau makro yang didefinisikan) digantikan oleh teks penggantinya. Masukan untuk tahap ketiga adalah aliran karakter (termasuk yang memiliki makna khusus) dan urutan kontrol yang tidak dapat diperluas (biasanya tugas dan perintah visual). Di sini, karakter-karakter tersebut dirangkai menjadi sebuah paragraf, dan algoritma pemecah paragraf TeX bekerja dengan mengoptimalkan breakpoints di seluruh paragraf. Tahap keempat memecah daftar vertikal baris dan materi lainnya ke dalam halaman. Sistem TeX memiliki pengetahuan yang tepat tentang ukuran semua karakter dan simbol, dan dengan menggunakan informasi ini, sistem ini menghitung pengaturan optimal huruf per baris dan baris per halaman. Kemudian sistem menghasilkan file DVI ("DeVice Independent") yang berisi lokasi akhir dari semua karakter. File DVI ini kemudian dapat dicetak langsung dengan driver printer yang sesuai, atau dapat dikonversi ke format lain. Saat ini, pdfTeX sering digunakan, yang melewati pembuatan DVI sama sekali. Sistem TeX dasar memahami sekitar 300 perintah, yang disebut primitif. Perintah-perintah tingkat rendah ini jarang digunakan secara langsung oleh pengguna, dan sebagian besar fungsionalitas disediakan oleh file format (memory image TeX yang di-predump setelah koleksi makro besar telah dimuat). Format default asli Knuth, yang menambahkan sekitar 600 perintah, adalah Plain TeX. Format yang paling banyak digunakan adalah LaTeX, awalnya dikembangkan oleh Leslie Lamport, yang menggabungkan gaya dokumen untuk buku, surat, slide, dll.; juga menambahkan dukungan untuk referensi dan penomoran otomatis bagian dan persamaan. Format lain yang banyak digunakan, AMS-TeX, diproduksi oleh American Mathematical Society dan menyediakan banyak perintah yang lebih ramah pengguna, yang dapat diubah oleh jurnal-jurnal agar sesuai dengan format gaya mereka. Sebagian besar fitur AMS-TeX dapat digunakan di LaTeX dengan menggunakan "paket AMS" (misalnya, amsmath, amssymb) dan "kelas dokumen AMS" (misalnya, amsart, amsbook). Hal ini kemudian disebut sebagai AMS-LaTeX. Format lain termasuk ConTeXt, yang digunakan terutama untuk penerbitan desktop dan sebagian besar ditulis oleh Hans Hagen di Pragma. \subsection{Cara kerja} Contoh program Hello world dalam TeX biasa adalah: \starttyping Hello, World \bye % menandai akhir file; tidak ditampilkan dalam output akhir \stoptyping Teks program ini mungkin berada dalam file myfile.tex, karena .tex adalah ekstensi file yang umum untuk file TeX biasa. Secara default, semua yang mengikuti tanda persen pada suatu baris adalah komentar, dan diabaikan oleh TeX. Menjalankan TeX pada file ini (misalnya, dengan mengetik tex myfile.tex dalam antarmuka baris perintah, atau dengan memanggilnya dari antarmuka pengguna grafis) akan membuat file output yang disebut myfile.dvi, yang mewakili konten halaman dalam format independen perangkat (DVI, device independent format). File DVI kemudian dapat dilihat di layar atau dikonversi ke format yang sesuai untuk salah satu dari berbagai printer yang driver perangkatnya ada (dukungan printer umumnya bukan fitur sistem operasi pada saat TeX dibuat). Knuth mengatakan bahwa tidak ada yang melekat pada TeX yang membutuhkan DVI sebagai format output, dan versi TeX yang lebih baru, terutama pdfTeX, XeTeX dan LuaTeX, semuanya mendukung output langsung ke PDF. \subsection{Contoh matematika} (Contoh-contoh di sini tidak benar-benar di-render dengan TeX; jarak spasi, ukuran karakter, dan yang lainnya mungkin berbeda). TeX menyediakan sintaks teks yang berbeda khusus untuk rumus matematika. Misalnya, rumus kuadrat (yang merupakan solusi dari persamaan kuadrat) ditulis: Markup Tampilan hasil \starttyping Rumus kuadrat adalah $-b \pm \sqrt{b^2 - 4ac} \over 2a$ \bye \stoptyping Rumus dicetak dengan cara seseorang akan menulisnya dengan tangan, atau dengan mengetik persamaan. Dalam dokumen, mode matematika dimulai dengan simbol \type{$}, kemudian memasukkan rumus dalam sintaks TeX, dan ditutup lagi dengan \type{$}. Knuth menjelaskan dengan bercanda bahwa dia memilih tanda dolar untuk menunjukkan awal dan akhir mode matematika di TeX biasa karena typesetting matematika secara tradisional seharusnya mahal. Tampilan matematika (matematika yang disajikan rata-tengah pada baris baru) dihasilkan dengan cara serupa tetapi menggunakan \type{$$} bukan simbol \type{$} tunggal. Sebagai contoh, di atas dengan rumus kuadratik dalam tampilan matematika: Markup Tampilan hasil \starttyping The quadratic formula is $$-b \pm \sqrt{b^2 - 4ac} \over 2a$$ \bye \stoptyping \section{Aspek} Perangkat lunak TeX menggabungkan beberapa aspek yang tidak tersedia, atau kualitasnya lebih rendah, dalam program penyusunan huruf (typesetting) lainnya pada saat TeX dirilis. Beberapa inovasi didasarkan pada algoritma yang menarik, dan telah menghasilkan beberapa tesis untuk mahasiswa Knuth. Walaupun beberapa penemuan ini sekarang telah disertakan ke dalam program typesetting lainnya; yang lain, seperti aturan untuk spasi matematis, masih unik. \subsection{Spasi matematika} Karena tujuan utama dari bahasa TeX adalah penyusunan huruf berkualitas tinggi untuk penerbit buku, Knuth memberikan banyak perhatian pada aturan spasi untuk rumus matematika. Dia mengambil tiga sistem yang dia anggap sebagai standar keunggulan untuk tipografi matematika: buku-buku yang disusun oleh penerbit Addison-Wesley Publishing (penerbit The Art of Computer Programming) di bawah pengawasan Hans Wolf; edisi jurnal matematika Acta Mathematica yang berasal dari sekitar tahun 1910; dan salinan Indagationes Mathematicae, sebuah jurnal matematika Belanda. Knuth mencermati kertas-kertas cetak ini untuk memilah dan mencari seperangkat aturan untuk spasi. Sementara TeX menyediakan beberapa aturan dasar dan alat yang diperlukan untuk menentukan spasi yang tepat, parameter yang-tepat bergantung pada font yang digunakan untuk mengeset rumus. Misalnya, jarak spasi untuk font Computer Modern telah disetel dengan tepat selama bertahun-tahun dan sekarang sudah diatur; tetapi ketika font lain digunakan oleh Knuth untuk pertama kalinya (seperti AMS Euler), parameter jarak spasi baru harus ditentukan. Penyusunan huruf matematika di TeX menuai beberapa kritik, terutama yang berkaitan dengan detail teknis metrik font, yang dirancang di era ketika perhatian yang signifikan diperlukan pada persyaratan penyimpanan data. Hal ini mengakibatkan beberapa "hack" di beberapa lokasi, yang pada gilirannya membutuhkan "hack" lainnya. Pada tingkat estetika, hasil render bentuk akar (radical) juga dikritik. Spesifikasi font matematika OpenType sebagian besar meminjam dari TeX, tetapi memiliki beberapa fitur/peningkatan baru. \stoptext ``` The long-term solution is to request that ConTeXt distributes hyphenation patterns for Indonesian by sending an email to the ConTeXt list, [`ntg-context@ntg.nl`](https://mailman.ntg.nl/mailman/listinfo/ntg-context).
0
https://tex.stackexchange.com/users/270600
685374
317,953
https://tex.stackexchange.com/questions/685341
1
I'm trying to make siunitx interpret a number stored in a separate file on disk, but `\num{\input{number.txt}}` fails with the following error message: `Argument of \@iinput has an extra }.` Is there another way to do this? --- MWE (assuming a file called "number.txt" exists on disk and its content is a number such as 1 in my case): ``` \documentclass{article} \usepackage{siunitx} \begin{document} \num{\input{number.txt}} \end{document} ```
https://tex.stackexchange.com/users/182557
Siuntix \num in combination with \input fails with "Argument of \@iinput has an extra }."
true
You can read the file contents to a macro (`\tmp` in the example above) and then use it as a macro argument (but `\tmp` must be expanded by `\expandafter`). ``` \documentclass{article} \usepackage{siunitx} {\catcode`\@=11 \gdef\readfile#1{{\endlinechar=-1 \everyeof={\end}\expandafter\readfileA\@@input{#1}}} \gdef\readfileA#1\end{\gdef\tmp{#1}} } \begin{document} \readfile{number.txt}\expandafter\num\expandafter{\tmp} \end{document} ```
1
https://tex.stackexchange.com/users/51799
685377
317,955
https://tex.stackexchange.com/questions/685386
3
I am using a Beamer theme (Singapore) that is using Miniframes for the header. This header will contain section names, but not their number. What I would like ================= I would like to include the section numbers alongside the section name. It looks like this: ``` First section Second section Another section o o o o o o o o o o o ``` I would like it to look like this: ``` 1 First section 2 Second section 3 Another section o o o o o o o o o o o ``` What I tried ============ I tried looking how it is done (in `beamerouterthememiniframes.sty`), and this seems to be how the header is defined in Miniframes : ``` \defbeamertemplate*{headline}{miniframes theme} {% \begin{beamercolorbox}[colsep=1.5pt]{upper separation line head} \end{beamercolorbox} \begin{beamercolorbox}{section in head/foot} \vskip2pt\insertnavigation{\paperwidth}\vskip2pt \end{beamercolorbox}% \ifbeamer@theme@subsection% \begin{beamercolorbox}[colsep=1.5pt]{middle separation line head} \end{beamercolorbox} \begin{beamercolorbox}[ht=2.5ex,dp=1.125ex,% leftskip=.3cm,rightskip=.3cm plus1fil]{subsection in head/foot} \usebeamerfont{subsection in head/foot}\insertsubsectionhead \end{beamercolorbox}% \fi% \begin{beamercolorbox}[colsep=1.5pt]{lower separation line head} \end{beamercolorbox} } ``` If I understand well, it is the `\insertnavigation` tag that does the job of printing section names. I am stuck here, since I can’t just add section numbers (with `\thesection` I think). Question ======== How do I include section numbers with the section name ?
https://tex.stackexchange.com/users/17972
Beamer miniframes: how to include section number alongside section name?
true
You could redefine the `\sectionentry` to include the number: ``` \documentclass{beamer} \usetheme{Singapore} \makeatletter \def\sectionentry#1#2#3#4#5{% section number, section title, page \beamer@xpos=0\relax% \beamer@ypos=1\relax% \beamer@ypos@offset=0\relax% \ifnum#5=\c@part% \beamer@section@set@min@width% \box\beamer@sectionbox\hskip1.875ex plus 1fill% \setbox\beamer@sectionbox= \hbox{\def\insertsectionhead{#1~#2}% \def\insertsectionheadnumber{#1}% \def\insertpartheadnumber{#5}% {% \usebeamerfont{section in head/foot}\usebeamercolor[fg]{section in head/foot}% \ifnum\c@section=#1% \hyperlink{Navigation#3}{{\usebeamertemplate{section in head/foot}}}% \else% \hyperlink{Navigation#3}{{\usebeamertemplate{section in head/foot shaded}}}% \fi}% }% \ht\beamer@sectionbox=1.875ex% \dp\beamer@sectionbox=0.75ex% \fi\ignorespaces} \makeatother \begin{document} \section{title} \begin{frame} abc \end{frame} \section{title} \begin{frame} content... \end{frame} \end{document} ```
3
https://tex.stackexchange.com/users/36296
685387
317,959
https://tex.stackexchange.com/questions/685396
0
For instance, `\legend` in a `pgfplots` bar chart. But in general, it would help as well. In this particular case because I'm [trying to build a legend outside an `axis` environment](https://tex.stackexchange.com/questions/685283/graph-legend-is-shared-by-two-subfigures-how-can-i-make-sure-it-overlays-the-se). I was hoping there'd be a better way than to go trawling through all of GitHubs folders.
https://tex.stackexchange.com/users/269662
How do I access the code that underlies a specific LaTeX package command?
true
As a general answer: You can always retrieve its .sty or .cls file on your system, or from the ctan repository, and inspect the file, well best its copy. Use your favorite ASCII editor with useful syntax highlighting. Also, many packages describe their code in detail by mixing code with documentation. Be prepared to go through long files.
4
https://tex.stackexchange.com/users/245790
685397
317,962
https://tex.stackexchange.com/questions/685394
0
I have this equation that goes off page when complied. its so large that `\tiny` doesn't cut it. I need to use resize box but the equation is in an align environment. equation needs to be labelled as a block, is that possible? ps: the equation cannot be changed any suggestions? ``` \documentclass[a4paper,12pt]{book} \usepackage{graphicx} \usepackage[inner=3.8cm, outer=1.3cm, top=2.5cm, bottom=1.2cm]{geometry} %\usepackage[utf8]{inputenc} % that's the default nowadays \usepackage[T1]{fontenc} % <-- new \usepackage{amssymb,mathtools} \allowdisplaybreaks \begin{document} \begin{align*} c_{11}&=1\\ c_{12}&=-\frac{160 {x_{n+1}^9}+2520 h {x_{n+1}^8}+16560 {h^2} {x_{n+1}^7}+58800 {h^3} {x_{n+1}^6}+121842 {h^4} {x_{n+1}^5}+147735 {h^5} {x_{n+1}^4}+98010 {h^6} {x_{n+1sing}^3}+28350 {h^7} {x_{n+1}^2}-473977 {h^9}}{2041200 {h^8}}\\ c_{13}&=\frac{320 {x_{n+1}^9}+4680 h {x_{n+1}^8}+27360 {h^2} {x_{n+1}^7}+78960 {h^3} {x_{n+1}^6}+102564 {h^4} {x_{n+1}^5}-9135 {h^5} {x_{n+1}^4}-197940 {h^6} {x_{n+1}^3}-237330 {h^7} {x_{n+1}^2}-113400 {h^8} {x_{n+1}}+343921 {h^9}}{113400 {h^8}}\\ c_{14}&=-\frac{1120 {x_{n+1}^9}+15750 h {x_{n+1}^8}+86760 {h^2} {x_{n+1}^7}+225750 {h^3} {x_{n+1}^6}+223524 {h^4} {x_{n+1}^5}-171675 {h^5} {x_{n+1}^4}-578340 {h^6} {x_{n+1}^3}-396900 {h^7} {x_{n+1}^2}+594011 {h^9}}{85050 {h^8}}\\ c_{15}&=\frac{560 {x_{n+1}^{9}}+7560 h {x_{n+1}^{8}}+39240 {{h}^{2}} {x_{n+1}^{7}}+92400 {{h}^{3}} {x_{n+1}^{6}}+68607 {{h}^{4}} {x_{n+1}^{5}}-101745 {{h}^{5}} {x_{ n+1}^{4}}-210735 {{h}^{6}} {x_{n+1}^{3}}-99225 {{h}^{7}} {x_{n+1}^{2}}+203338 {{h}^{9}}}{18900 {{h}^{8}}} \\ c_{16}&=-\frac{1120 {x_{n+1}^{9}}+14490 h {x_{n+1}^{8}}+70920 {{h}^{2}} {x_{n+1}^{7}}+152250 {{h}^{3}} {x_{n+1}^{6}}+84924 {{h}^{4}} {x_{n+1}^{5}}-191205 {{h}^{5}} {x_{n+1}^{4}}-310380 {{h}^{6}} {x_{n+1}^{3}}-132300 {{h}^{7}} {x_{n+1}^{2}}+310181 {{h}^{9}}}{28350 {{h}^{8}}}\\ c_{17}&=\frac{2240 {x_{n+1}^{9}}+27720 h {x_{n+1}^{8}}+128160 {{h}^{2}} {x_{n+1}^{7}}+253680 {{h}^{3}} {x_{n+1}^{6}}+109116 {{h}^{4}} {x_{n+1}^{5}}-336735 {{h}^{5}} {x_{n+1}^{4}}-487620 {{h}^{6}} {x_{n+1}^{3}}-198450 {{h}^{7}} {x_{n+1}^{2}}+501889 {{h}^{9}}}{68040 {{h}^{8}}}\\ c_{18}&=-\frac{160 {x_{n+1}^{9}}+1890 h {x_{n+1}^{8}}+8280 {{h}^{2}} {x_{n+1}^{7}}+15330 {{h}^{3}} {x_{n+1} ^{6}}+5292 {{h}^{4}} {x_{n+1}^{5}}-21105 {{h}^{5}} {x_{n+1}^{4}}-28620 {{h}^{6}} {x_{n+1}^3}-11340 {{h}^{7}} {x_{n+1}^{2}}+30113 {{h}^{9}}}{9450 {h^8}}\\ c_{19}&=\frac{1120 {x_{n+1}^9}+12600 h {x_{n+1}^8}+52560 {h^2} {x_{n+1}^7}+92400 {h^3} {x_{n+1}^6}+26334 {h^4} {x_{n+1}^5}-130725 {h^5} {x_{n+1}^4}-169890 {h^6} {x_{n+1}^3}-66150 {h^7} {x_{n+1}^2}+181751 {h^9}}{226800 {h^8}}\\ c_{(10)}&=-\frac{160 {x_{n+1}^9}+1710 h {x_{n+1}^8}+6840 {h^2} {x_{n+1}^7}+11550 {h^3} {x_{n+1}^6}+2772 {h^4} {x_{n+1}^5}-16695 {h^5} {x_{n+1}^4}-21060 {h^6} {x_{n+1}^3}-8100 {h^7}{x_{n+1}^2}+22823 {h^9}}{255150{h^8}} \end{align*} \end{document} ```
https://tex.stackexchange.com/users/295796
can i use resize box in align
true
Give up with those unreadable long fractions and split the numerators. In the code below I removed all unnecessary braces. ``` \documentclass[a4paper,12pt]{book} \usepackage[T1]{fontenc} % <-- new \usepackage[inner=3.8cm, outer=1.3cm, top=2.5cm, bottom=1.2cm]{geometry} \usepackage{amssymb,mathtools} \begin{document} \begin{align*} c_{11}&=1\\ c_{12}&=-\frac{1}{2041200h^8}\bigl( \begin{aligned}[t] & 160 x_{n+1}^9 + 2520 h x_{n+1}^8 + 16560 h^2 x_{n+1}^7 + 58800 h^3 x_{n+1}^6 \\ & + 121842 h^4x_{n+1}^5+147735h^5x_{n+1}^4 + 98010 h^6 x_{n+1}^3 \\ & + 28350 h^7 x_{n+1}^2 - 473977 h^9 \bigr) \end{aligned} \\ c_{13}&=\frac{1}{113400 h^8} \bigl( \begin{aligned}[t] & 320 x_{n+1}^9 + 4680 h x_{n+1}^8 + 27360 h^2 x_{n+1}^7 + 78960 h^3 x_{n+1}^6 \\ & + 102564 h^4 x_{n+1}^5 - 9135 h^5 x_{n+1}^4 - 197940 h^6 x_{n+1}^3 \\ & - 237330 h^7 x_{n+1}^2 - 113400 h^8 x_{n+1} + 343921 h^9 \bigr) \end{aligned} \end{align*} \end{document} ``` Fix the following lines in a similar way. Compare with what you'd get using `\resizebox`.
4
https://tex.stackexchange.com/users/4427
685398
317,963
https://tex.stackexchange.com/questions/685394
0
I have this equation that goes off page when complied. its so large that `\tiny` doesn't cut it. I need to use resize box but the equation is in an align environment. equation needs to be labelled as a block, is that possible? ps: the equation cannot be changed any suggestions? ``` \documentclass[a4paper,12pt]{book} \usepackage{graphicx} \usepackage[inner=3.8cm, outer=1.3cm, top=2.5cm, bottom=1.2cm]{geometry} %\usepackage[utf8]{inputenc} % that's the default nowadays \usepackage[T1]{fontenc} % <-- new \usepackage{amssymb,mathtools} \allowdisplaybreaks \begin{document} \begin{align*} c_{11}&=1\\ c_{12}&=-\frac{160 {x_{n+1}^9}+2520 h {x_{n+1}^8}+16560 {h^2} {x_{n+1}^7}+58800 {h^3} {x_{n+1}^6}+121842 {h^4} {x_{n+1}^5}+147735 {h^5} {x_{n+1}^4}+98010 {h^6} {x_{n+1sing}^3}+28350 {h^7} {x_{n+1}^2}-473977 {h^9}}{2041200 {h^8}}\\ c_{13}&=\frac{320 {x_{n+1}^9}+4680 h {x_{n+1}^8}+27360 {h^2} {x_{n+1}^7}+78960 {h^3} {x_{n+1}^6}+102564 {h^4} {x_{n+1}^5}-9135 {h^5} {x_{n+1}^4}-197940 {h^6} {x_{n+1}^3}-237330 {h^7} {x_{n+1}^2}-113400 {h^8} {x_{n+1}}+343921 {h^9}}{113400 {h^8}}\\ c_{14}&=-\frac{1120 {x_{n+1}^9}+15750 h {x_{n+1}^8}+86760 {h^2} {x_{n+1}^7}+225750 {h^3} {x_{n+1}^6}+223524 {h^4} {x_{n+1}^5}-171675 {h^5} {x_{n+1}^4}-578340 {h^6} {x_{n+1}^3}-396900 {h^7} {x_{n+1}^2}+594011 {h^9}}{85050 {h^8}}\\ c_{15}&=\frac{560 {x_{n+1}^{9}}+7560 h {x_{n+1}^{8}}+39240 {{h}^{2}} {x_{n+1}^{7}}+92400 {{h}^{3}} {x_{n+1}^{6}}+68607 {{h}^{4}} {x_{n+1}^{5}}-101745 {{h}^{5}} {x_{ n+1}^{4}}-210735 {{h}^{6}} {x_{n+1}^{3}}-99225 {{h}^{7}} {x_{n+1}^{2}}+203338 {{h}^{9}}}{18900 {{h}^{8}}} \\ c_{16}&=-\frac{1120 {x_{n+1}^{9}}+14490 h {x_{n+1}^{8}}+70920 {{h}^{2}} {x_{n+1}^{7}}+152250 {{h}^{3}} {x_{n+1}^{6}}+84924 {{h}^{4}} {x_{n+1}^{5}}-191205 {{h}^{5}} {x_{n+1}^{4}}-310380 {{h}^{6}} {x_{n+1}^{3}}-132300 {{h}^{7}} {x_{n+1}^{2}}+310181 {{h}^{9}}}{28350 {{h}^{8}}}\\ c_{17}&=\frac{2240 {x_{n+1}^{9}}+27720 h {x_{n+1}^{8}}+128160 {{h}^{2}} {x_{n+1}^{7}}+253680 {{h}^{3}} {x_{n+1}^{6}}+109116 {{h}^{4}} {x_{n+1}^{5}}-336735 {{h}^{5}} {x_{n+1}^{4}}-487620 {{h}^{6}} {x_{n+1}^{3}}-198450 {{h}^{7}} {x_{n+1}^{2}}+501889 {{h}^{9}}}{68040 {{h}^{8}}}\\ c_{18}&=-\frac{160 {x_{n+1}^{9}}+1890 h {x_{n+1}^{8}}+8280 {{h}^{2}} {x_{n+1}^{7}}+15330 {{h}^{3}} {x_{n+1} ^{6}}+5292 {{h}^{4}} {x_{n+1}^{5}}-21105 {{h}^{5}} {x_{n+1}^{4}}-28620 {{h}^{6}} {x_{n+1}^3}-11340 {{h}^{7}} {x_{n+1}^{2}}+30113 {{h}^{9}}}{9450 {h^8}}\\ c_{19}&=\frac{1120 {x_{n+1}^9}+12600 h {x_{n+1}^8}+52560 {h^2} {x_{n+1}^7}+92400 {h^3} {x_{n+1}^6}+26334 {h^4} {x_{n+1}^5}-130725 {h^5} {x_{n+1}^4}-169890 {h^6} {x_{n+1}^3}-66150 {h^7} {x_{n+1}^2}+181751 {h^9}}{226800 {h^8}}\\ c_{(10)}&=-\frac{160 {x_{n+1}^9}+1710 h {x_{n+1}^8}+6840 {h^2} {x_{n+1}^7}+11550 {h^3} {x_{n+1}^6}+2772 {h^4} {x_{n+1}^5}-16695 {h^5} {x_{n+1}^4}-21060 {h^6} {x_{n+1}^3}-8100 {h^7}{x_{n+1}^2}+22823 {h^9}}{255150{h^8}} \end{align*} \end{document} ```
https://tex.stackexchange.com/users/295796
can i use resize box in align
false
I wouldn't use resizebox, rather split long numerator in two lines by use of the `\splitfrac` of `mathtools`: (red lines indicate page layout) Only first three lines: ``` \documentclass[a4paper,12pt]{book} \usepackage[inner=3.8cm, outer=1.3cm, top=2.5cm, bottom=1.2cm]{geometry} \usepackage[T1]{fontenc} % <-- new \usepackage{amssymb, mathtools} \allowdisplaybreaks \begin{document} \begin{align*} c_{11} & = 1\\ c_{12} & = -\frac{\splitfrac{160x_{n+1}^9 + 2520hx_{n+1}^8 + 16560h^2 x_{n+1}^7 + 58800h^3 x_{n+1}^6 + 121842h^4x_{n+1}^5 +} {147735h^5x_{n+1}^4 +98010h^6x_{n+1sing}^3 +28350h^7x_{n+1}^2 - 473977h^9}} {2041200h^8} \\[2ex] c_{13} & = \frac{\splitfrac{320x_{n+1}^9 +4680hx_{n+1}^8 + 27360h^2x_{n+1}^7 + 78960 h^3 x_{n+1}^6 + 102564h^4x_{n+1}^5 - } {9135h^5x_{n+1}^4 - 197940h^6x_{n+1}^3 - 237330h^7x_{n+1}^2 - 113400h^8 x_{n+1} + 343921 h^9}} {113400 {h^8}}%\\ \end{align*} \end{document} ```
2
https://tex.stackexchange.com/users/18189
685399
317,964
https://tex.stackexchange.com/questions/685390
0
I have the following table, and I can't seem to get it to distribute evenly to columns. What would be the easiest way to do this? Other problems seem to suggest `p{( 1/# of cols )\linewidth}` , but this doesn't seem to work for me ``` \begin{table}[t] \begin{tabular}{p{0.14\linewidth}|p{0.14\linewidth}p{0.14\linewidth}|p{0.14\linewidth}p{0.14\linewidth}|p{0.14\linewidth}p{0.14\linewidth}} % some data that's very long \end{tabular} \end{table} ``` For some reason, .14, which is approximately 1/7, is far too short of line width and .15 is also too short. Is there any automatic way to scale this? This is in the CVPR 2022 Paper Template, for reference.
https://tex.stackexchange.com/users/296771
Equally distribute line width to table columns with wrap
false
With `tabularx`: ``` \documentclass{article} \usepackage{tabularx} \begin{document} \begin{table}[ht] \begin{tabularx}{\linewidth}{X| XX| XX| XX} \hline 1 & 2 & 3 & 4 & 5 & 6 & 7 \\ \hline \end{tabularx} \end{table} \end{document} ``` (red lines indicate page layout) or with `tblr` of `tabularray` package: ``` \documentclass{article} \usepackage{tabularray} \begin{document} \begin{table}[ht] \begin{tblr}{hlines, colspec = {X|XX|XX|XX} } 1 & 2 & 3 & 4 & 5 & 6 & 7 \\ \end{tblr} \end{table} \end{document} ``` Result are almost the same. Differences are in the vertical space around cells contents.
3
https://tex.stackexchange.com/users/18189
685401
317,965
https://tex.stackexchange.com/questions/208014
9
I am trying to typeset the symbol for empty set and using the answer of [that question](https://tex.stackexchange.com/questions/22798/nice-looking-empty-set) I chose `\varnothing` but when I used it I got the symbol that is described to be `\emptyset` and vice versa. Also when I use the `amssymb` package I get these errors: ``` Command `\eth' already defined. Command `\digamma' already Command `\backepsilon' already ``` If I don't use`amssymb` it still happens the same regarding those 2 symbols. What is happening? How can I get the right symbol? (Meaning the `\varnothing`) ``` \documentclass[12pt]{article} \usepackage{fontspec} \setmainfont [ Ligatures=TeX, Extension=.otf, UprightFont=*, BoldFont=*Bold, ItalicFont=*It, BoldItalicFont=*BoldIt, Mapping=tex-text ]{GFSArtemisia} \setsansfont[Mapping=tex-text]{GFSArtemisia.otf} \usepackage[english,greek]{babel} \usepackage[fleqn]{amsmath} \usepackage{unicode-math} \begin{document} This is the problem: \vspace{1cm} $\varnothing \quad \emptyset$ \end{document} ```
https://tex.stackexchange.com/users/45524
Empty set symbols confused
false
Another way is to use the "msb" (?) font which is what is being used when `amssymb` package is loaded without `unicode-math`. Just open `amssymb.sty` and `amsfonts.sty` and copy the 2 lines, change `\varnothing` to `\varnothingold`. ``` %! TEX program = lualatex \documentclass{article} %\usepackage{amssymb} \usepackage{unicode-math} \DeclareSymbolFont{AMSb}{U}{msb}{m}{n} % not needed with \usepackage{amsfonts} or \usepackage{amssymb} \DeclareMathSymbol{\varnothingold} {\mathord}{AMSb}{"3F} \begin{document} $\varnothing$ $\varnothingold$ \end{document} ``` Output:
1
https://tex.stackexchange.com/users/250119
685413
317,972
https://tex.stackexchange.com/questions/685409
0
I have a presentation and I would like to offer a handout version, I got this code. But the problem is, it does automatically 4 frames on each page. Even if the Last page has just one slide, 4 frames are made and consequentially 3 are empty. How can I handle this "bug"? ``` % for Handout use: \pgfpagesuselayout{4 on 1}[a4paper,landscape,border shrink=5mm] \pgfpageslogicalpageoptions{1}{border code=\pgfusepath{stroke}} \pgfpageslogicalpageoptions{2}{border code=\pgfusepath{stroke}} \pgfpageslogicalpageoptions{3}{border code=\pgfusepath{stroke}} \pgfpageslogicalpageoptions{4}{border code=\pgfusepath{stroke}} ```
https://tex.stackexchange.com/users/235531
Handout framed, but end if slides end
false
Different approach: add a border to the background of every frame in handout mode: ``` \documentclass[ handout ]{beamer} \mode<handout>{ \usepackage{pgfpages} \pgfpagesuselayout{4 on 1}[a4paper,landscape,border shrink=5mm] \usepackage{tikz} \setbeamertemplate{background canvas}{ \begin{tikzpicture}[remember picture] \draw (current page.south west) rectangle (current page.north east); \end{tikzpicture} } } \begin{document} \begin{frame} abc \end{frame} \end{document} ```
2
https://tex.stackexchange.com/users/36296
685415
317,973