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/690727
2
I have a problem with the alignment of my subfigurs in a minipage-environment. My minimal example looks like this: ``` \documentclass{article} \usepackage[T1]{fontenc} \usepackage[utf8]{inputenc} \usepackage[demo]{graphicx} \usepackage{subcaption} \begin{document} \begin{figure} \begin{minipage}[b]{0.5\textwidth} \centering \subcaptionbox{Caption zu Bild1}{\includegraphics[height=4cm]{bild1}} \subcaptionbox{Caption zu Bild2}{\includegraphics[height=4cm]{bild2}} \end{minipage}% \begin{minipage}[b]{0.5\textwidth} \centering \subcaptionbox{Caption zu Bild3}{\includegraphics[height=8cm]{bild3}} \end{minipage} \caption{Caption gesamt} \label{fig:test} \end{figure} \end{document} ``` So this gives me three pictures, two in the first minipage and the third in the second. But the sequence is not what i want. Right now its pic a and b in first minipage and pic c in second. But i want pic a and c in first minipage and pic b in second. Any possibility to do that? Thanks a lot
https://tex.stackexchange.com/users/294008
Subfigure alignement in minipage-environment
false
> > But I want pic a and c in first `minipage` and pic b in second. > > > This may be achieved by interchanging the directives (and their associated sizing options) that place the images "Bild2" and "Bild3" and by incrementing/decrementing the `subfigure` counter suitably. ``` \documentclass{article} \usepackage[T1]{fontenc} %%\usepackage[utf8]{inputenc} % that's the default nowadays \usepackage[demo]{graphicx} \usepackage{subcaption} \begin{document} \begin{figure} \begin{minipage}[b]{0.475\textwidth} \centering \subcaptionbox{Caption zu Bild1}{\includegraphics[width=\linewidth]{bild1}} \medskip \stepcounter{subfigure} % increment the 'subfigure' counter by 1 \subcaptionbox{Caption zu Bild3}{\includegraphics[width=\linewidth]{bildc}} \end{minipage}% \hspace{\fill}% \addtocounter{subfigure}{-2} % decrement the 'subfigure' counter by 2 \begin{minipage}[b]{0.475\textwidth} \centering %% Choose the height of the image (e.g., 0.407\textheight) suitably: \subcaptionbox{Caption zu Bild2}{% \includegraphics[width=\linewidth,height=0.407\textheight]{bild2}} \end{minipage} \caption{Caption gesamt} \label{fig:test} \end{figure} \end{document} ```
0
https://tex.stackexchange.com/users/5001
690737
320,424
https://tex.stackexchange.com/questions/378488
18
I'm on Windows (seems like everyone else is using \*nix + latex, so I thought it's worth pointing out). When I run this command in the command prompt: ``` lualatex.exe --halt-on-error --interaction=nonstopmode -output-directory=C:\ C:\Users\uuu\AppData\Local\Temp\tmp9DE6.tex ``` The error I get is: ``` ! Font \TU/lmr/m/n/10=[lmroman10-regular]:+tlig; at 10pt not loadable: metric data not found or bad. <to be read again> relax l.105 \fontencoding\encodingdefault\selectfont 372 words of node memory still in use: 2 hlist, 1 rule, 1 dir, 4 glue, 47 glue_spec, 2 if_stack, 2 write, 1 pdf_col orstack nodes avail lists: 2:13,3:3,5:2,7:2,8:1,9:2 ! ==> Fatal error occurred, no output PDF file produced! Transcript written on tmp9DE6.log. ``` When I try to generate pdf file using TeXworks tool however, it's being generated properly. The question is - which command line options is it using to not have the same problem as cmd has? Or more general - what to do to make this problem go away? EDIT: Huh, didn't notice this earlier because of the amount of output, but one of the first things console is showing after running the above command, is: `module 'luaotfload-main' not found` Maybe that's the real problem? But what is the reason for it?
https://tex.stackexchange.com/users/137670
! Font \TU/lmr/m/n/10=[lmroman10-regular]:+tlig; at 10pt not loadable
false
I solved this problem by explicitly installing the `texlive-luatex` package. On Arch Linux, the command for this installation would be ``` sudo pacman -S texlive-luatex ```
1
https://tex.stackexchange.com/users/223178
690738
320,425
https://tex.stackexchange.com/questions/685511
1
The following code inserts line break only after two words, that is, after "Some text". If you remove the `quote` environment in the example, that doesn't happen. It's as if latex couldn't break lines within `\emph{. . .}`. Does somebody know what's causing this? The problem happens both with `pdflatex` and `lualatex`. I use the latest mactex (texlive 2023) and update the installation using `tlmgr` quite often. ``` \documentclass[14pt,aspectratio=1609]{beamer} \begin{document} \begin{frame}{Slide title} \begin{itemize} \item Some text \emph{if abcdefghijklm is large and fast enough} than on classical composers. \begin{quote} hello \end{quote} % <- comment out \end{itemize} \end{frame} \end{document} ```
https://tex.stackexchange.com/users/44271
beamer inserts line break at strange place
true
If you place the `quote` within the same paragraph as the item body, it will have both the indent from the itemize list and from the list used internally in `quote`. As a result, the (in your example invisible) colourbox around the `quote` is too wide to fit in the reminder of the page. To avoid this problem, leave an empty line before the `quote` to make sure it starts in a new paragraph: ``` \documentclass[14pt,aspectratio=1609]{beamer} \begin{document} \begin{frame}{Slide title} \begin{itemize} \item Some text \emph{if abcdefghijklm is large and fast enough} than on classical composers. \begin{quote} hello \end{quote} % <- comment out \end{itemize} \end{frame} \end{document} ```
1
https://tex.stackexchange.com/users/36296
690742
320,427
https://tex.stackexchange.com/questions/690702
1
For some reasons, I need to choose one or two character to delimit placeholders in LaTeX3 strings, like: ``` I like ``NAME`OF`FRUITS`` ``` in order to allow a safer replace (hence the doubling of the first and last symbol to get rid of ambiguity) + easy reading. But finding a good character is not that easy: * Many characters have special meanings for LaTeX and babel that redefine many characters, like `^`, `_`, `-`, `;`, `~`, `#`, `@`… I’d prefer to avoid using them to avoid espace nightmares. And I don’t know all packages, and I’m sure that some popular packages can redefine other chars. * I’m thinking that non-ascii characters might be an issue since they might be interpreted differently on different computers. In particular, I don’t know if `°` could be a valid choice. Is there a list of character that are basically as safe as letters to use? **EDIT** Here is a more concrete use case I want to consider. I basically want to be sure that no matter what is around `\robExtGetPlaceholder{__VEGETABLE__}`, the `_` should not be turned into another symbol, even after loading a popular package. ``` \documentclass{article} \ExplSyntaxOn \seq_clear_new:N \l_robExt_placeholders_seq % Make sure that the placeholder is in the list \l_robExt_placeholders_seq. % This should automatically be called by other tools \NewDocumentCommand{\robExtAddPlaceholderToList}{m}{ \seq_put_left:Nn \l_robExt_placeholders_seq { #1 } } \NewDocumentCommand{\robExtPlaceholderFromContent}{mm}{ \str_gset:cn { l_robExt_placeholder_#1_str } {#2} \message{aaaaaaaaaaaaa#1} \robExtAddPlaceholderToList{#1} } \NewDocumentCommand{\robExtDebugPlaceholder}{sm}{ \message{Placeholder ~ #2 ~ contains: ~ \use:c{l_robExt_placeholder_#2_str}} \IfBooleanTF{#1}{\cs_show:c { l_robExt_placeholder_#2_str }}{} } \NewDocumentCommand{\robExtGetPlaceholder}{m}{ \use:c{l_robExt_placeholder_#1_str} } \NewDocumentCommand{\robExtDebugPlaceholdersContents}{s}{ \message{List ~ of ~ placeholders:} \seq_map_inline:Nn \l_robExt_placeholders_seq {\robExtDebugPlaceholder{##1}} \IfBooleanTF{#1}{\cs_show:N \l_robExt_placeholders_seq}{} } %% I also have other commands, for instance to replace placeholders etc... \ExplSyntaxOff \begin{document} \robExtPlaceholderFromContent{__FRUIT__}{Orange} \robExtPlaceholderFromContent{__SENTENCE__}{I like __FRUIT__ and __VEGETABLE__} $\robExtPlaceholderFromContent{__VEGETABLE__}{Salad}$ \robExtDebugPlaceholdersContents* Does it mean that whatever think is put around the get placeholder here, it will still be interpreted correctly? (no escape, no weird replacement of the character with another character…) $1 + \robExtGetPlaceholder{__FRUIT__} + \robExtGetPlaceholder{__VEGETABLE__}$ \end{document} ```
https://tex.stackexchange.com/users/116348
Safe character to use as a separator in string
true
In full genenerality the answer is > > There is no safe character. > > > A slightly more helpful answer would be > > Only you can say which are the safe (sequences of) characters. You can use any sequence guaranteed not to appear as data. > > > The bullet points on your question don't seem that relevant, babel, input encodings, etc (mostly) only matter if you are typesetting, but here you are just delimiting substrings. You may think of `°` as a degree sign character, but to pdftex that is the two character tokens C2 B0 and it's just safe to use as a delimiter if the two bytes C2 B0 will never appear in the delimited string. If you double it then the delimiter is the four tokens C2 B0 C2 B0 and the answer is the same, this is safe to use as a delimiter so long as the four bytes C2 B0 C2 B0 do not appear in the data to be delimited. The same is true of higher characters to pdftex is not a duck but the four bytes F0 9F A6 86 and you can use `...` as the delimiter so long as those four bytes do not appear in `...` You can also use multiple bytes of printable ascii, eg `[[....]]` delimits `...` safely so long as you ensure `...` never includes `[[` or `]]`. The details here are for classic 8bit tex such as latex or pdflatex, but the main point of the answer would be the same with xelatex or lualatex.
3
https://tex.stackexchange.com/users/1090
690748
320,431
https://tex.stackexchange.com/questions/690754
1
Similar to [edit the minimum length of \hfill](https://tex.stackexchange.com/questions/306427/edit-the-minimum-length-of-hfill), but I want to keep a maximum spacing so that elements are not too separated. I also need two other `\hfill` to center the line. ``` \documentclass{article} \usepackage{float} \newcommand{\smarthfill}{\hfill} % change this \begin{document} \begin{figure}[H] \hfill1\smarthfill2\hspace*{\fill} \end{figure} should work as \begin{figure}[H] \hfill1\qquad2\hspace*{\fill} \end{figure} while \begin{figure}[H] \hfill\rule{0.49\textwidth}{10pt}\smarthfill\rule{0.49\textwidth}{10pt}\hspace*{\fill} \end{figure} should work as \begin{figure}[H] \hfill\rule{0.49\textwidth}{10pt}\hfill\rule{0.49\textwidth}{10pt}\hspace*{\fill} \end{figure} more tests: \begin{figure}[H] \hfill\rule{0.40\textwidth}{10pt}\smarthfill\rule{0.40\textwidth}{10pt}\hspace*{\fill} \end{figure} \begin{figure}[H] \hfill\rule{0.40\textwidth}{10pt}\hfill\rule{0.40\textwidth}{10pt}\hspace*{\fill} \end{figure} \begin{figure}[H] \hfill\rule{0.25\textwidth}{10pt}\smarthfill\rule{0.25\textwidth}{10pt}\smarthfill\rule{0.25\textwidth}{10pt}\hspace*{\fill} \end{figure} \begin{figure}[H] \hfill\rule{0.25\textwidth}{10pt}\hfill\rule{0.25\textwidth}{10pt}\hfill\rule{0.25\textwidth}{10pt}\hspace*{\fill} \end{figure} \end{document} ```
https://tex.stackexchange.com/users/199226
edit the maximum length of \hfill
false
As far as I can tell you want ``` \newcommand{\smarthfill}{\hspace{2em minus 2em}} % change this ``` so a space of 2em that will shrink to 0pt if needed. If you want the space to balance with the outer spaces you need to make them all have the same (finite) stretch component, so replacing hfill by hspace 0pt plus .5\textwidth for example, you will see the "b" version on line 3 of each figure is quite close to your requested spacing (on line 4). ``` \documentclass{article} \usepackage{float} \newcommand{\smarthfill}{\hfill} % change this \newcommand{\smarthfilla}{\nolinebreak\hspace{2em minus 2em}} % change this \newcommand{\smarthfillb}{\nolinebreak\hspace{.1em plus 1.9em}} % change this \begin{document} \begin{figure}[H] X\dotfill X \hfill1\smarthfill2\hspace*{\fill} \hfill1\smarthfilla2\hspace*{\fill} \hspace*{0pt plus.5\textwidth}1\smarthfillb2\hspace*{0pt plus.5\textwidth}\hspace*{-0pt plus -1fil} \hfill1\qquad2\hspace*{\fill} \end{figure} while \begin{figure}[H] \hfill\rule{0.49\textwidth}{10pt}\smarthfill\rule{0.49\textwidth}{10pt}\hspace*{\fill} \hfill\rule{0.49\textwidth}{10pt}\smarthfilla\rule{0.49\textwidth}{10pt}\hspace*{\fill} \hspace*{0pt plus.5\textwidth}\rule{0.49\textwidth}{10pt}\smarthfillb\rule{0.49\textwidth}{10pt}\hspace*{0pt plus.5\textwidth}\hspace*{-0pt plus -1fil} \hfill\rule{0.49\textwidth}{10pt}\hfill\rule{0.49\textwidth}{10pt}\hspace*{\fill} \end{figure} \end{document} ```
1
https://tex.stackexchange.com/users/1090
690756
320,432
https://tex.stackexchange.com/questions/690729
0
Is there anyway to use a predefined reledmac standard of two-column footnote inside a paracol environment. While the two-column paracol does provide its own two-column footnote (which works fine), I have to use a journal pre-defined reledmac footnote style exclusively. What I need is for paracol footnote to be disabled and all footnotes to follow the pre-set reledmac style (thereby, avoiding the four-columned footnote style seen below). NOTE: I realise I can take the \footnoteAtexts out of the paracol environment and thereby get the desired two-column footnote, but as the paracol text I am working with spans several pages (and can't be broken up), putting the footnoteAtexts outside the paracol environment causes the footnotes to be typset a whole lot later from where the footnoteAmarks appear. Many thanks. ``` \documentclass[a4paper,10pt]{article} \usepackage{polyglossia} \defaultfontfeatures{Ligatures=TeX} \setmainfont[Ligatures=TeX, Mapping=tex-text, Numbers=OldStyle]{TeX Gyre Pagella} \usepackage[nocritical, noend, series={A}]{reledmac} \usepackage{setspace} \arrangementX[A]{twocol} \beforenotesX{2em plus 1.5em minus 1.5em} \usepackage{paracol} \usepackage{lipsum} \setlength{\parindent}{0pt} \begin{document} \begin{paracol}{2} test\footnoteAmark[1]\bigskip \lipsum[3]\bigskip test2\footnoteAmark[2]\bigskip \switchcolumn \lipsum[5] \footnoteAtext[1]{{\lipsum[2]}} \footnoteAtext[2]{{\lipsum[1]}} \end{paracol} \end{document} ```
https://tex.stackexchange.com/users/45627
reledmac footnote style in paracol environment
false
Not an solution, but an even more bewildering experiment. ``` \documentclass[a4paper,10pt]{article} \usepackage{polyglossia} \defaultfontfeatures{Ligatures=TeX} \setmainfont[Ligatures=TeX, Mapping=tex-text, Numbers=OldStyle]{TeX Gyre Pagella} \usepackage[nocritical, noend, series={A}]{reledmac} \usepackage{setspace} \arrangementX[A]{twocol} \beforenotesX{2em plus 1.5em minus 1.5em} \usepackage{paracol} \usepackage{lipsum} \setlength{\parindent}{0pt} \begin{document} \begin{paracol}{2} test\footnoteAmark[1]\bigskip \lipsum[3]\bigskip test2\footnoteAmark[2]\bigskip \switchcolumn \lipsum[5] \footnoteAtext[1]{\parbox[t]{\linewidth}{\lipsum[2]}} \footnoteAtext[2]{\parbox[t]{\linewidth}{\lipsum[1]}} \end{paracol} \end{document} ```
0
https://tex.stackexchange.com/users/34505
690761
320,434
https://tex.stackexchange.com/questions/690762
0
I am getting this error in my table, but I don’t know why? ``` \begin{table*}[htbp] \caption{ Average } \label{tab_5.1} \centering \scalebox{0.8}{ \begin{tabular}{lcccccc} \toprule Method & DBLP-1 & DBLP-2 & Reddit & Brain & Epinions &Facebook\\ \midrule A-LUSTC$_{1}$ & \textbf{0.9268}\pm {0.0089} & 0.9398\pm{0.0029} & \textbf{0.9487}\pm{0.0012} & 0.5518\pm{0.0023} & 0.7212\pm{0.0365} &\textbf{0.8525}\pm{0.0165}\\ %\hline A-LUSTC$_{2}$ & 0.8844\pm{0.0139} & \textbf{0.9733}\pm{0.0025} & 0.9383\pm{0.0011} & 0.5361\pm{0.0022} & 0.7181\pm{0.2012} & 0.8365\pm{0.0012}\\ %\hline LUSTC & 0.9149\pm{0.0190} & 0.9636\pm {0.0001} & 0.9371\pm{0.0110} & 0.5110\pm{0.0170} & \textbf{0.8923}\pm{0.0016}& 0.8231\pm{0.0110}\\ %\hline GG& 0.6520\pm{0.1201} & 0.8866\pm{0.0045} & 0.9035\pm{0.0030} & 0.5165\pm{0.0025} & 0.6391\pm{0.0034} & 0.6074\pm{0.0023}\\ %\hline MM& 0.5470\pm{0.0056} & 0.7567\pm{0.0021} & 0.9018\pm{0.0410} & 0.5210\pm {0.0245} & 0.6672\pm {0.0320}& 0.5008\pm{0.0235}\\ %\hline RRR& 0.5724\pm{0.1030} & 0.8542\pm{0.0221} & 0.9085\pm{0.0038} & 0.5173\pm{0.0036} & 0.4972\pm{0.0036}&0.5060\pm{0.0016}\\ %\hline TTT& 0.8133\pm{0.0057} & 0.9132\pm{0.0022} & 0.9175\pm{0.0007} &\textbf{0.7809}\pm{0.0019} & 0.8214\pm{0.0041}&0.7840\pm{0.0034}\\ % \hline QQQ& 0.8130\pm{0.0043} & 0.8923\pm{0.0191} & 0.8575\pm{0.0055} & 0.7392\pm{0.0043} & 0.7395\pm{0.0005}& 0.7924\pm{0.0012}\\ \bottomrule \end{tabular}} \end{table*} ```
https://tex.stackexchange.com/users/230857
Missing $ inserted? Why?
true
Just change $\pm$. Have a look to the following code: ``` \documentclass[twocolumn]{article} \usepackage{caption} \usepackage{booktabs} \usepackage{graphicx} \begin{document} \begin{table*}[htbp] \caption{Average} \label{tab_5.1} \centering \scalebox{0.8}{ \begin{tabular}{lcccccc} \toprule Method & DBLP-1 & DBLP-2 & Reddit & Brain & Epinions & Facebook \\ \midrule A-LUSTC$_{1}$ & \textbf{0.9268}$\pm$0.0089 & 0.9398$\pm$0.0029 & \textbf{0.9487}$\pm$0.0012 & 0.5518$\pm$0.0023 & 0.7212$\pm$0.0365 & \textbf{0.8525}$\pm$0.0165 \\ A-LUSTC$_{2}$ & 0.8844$\pm$0.0139 & \textbf{0.9733}$\pm$0.0025 & 0.9383$\pm$0.0011 & 0.5361$\pm$0.0022 & 0.7181$\pm$0.2012 & 0.8365$\pm$0.0012 \\ LUSTC & 0.9149$\pm$0.0190 & 0.9636$\pm$0.0001 & 0.9371$\pm$0.0110 & 0.5110$\pm$0.0170 & \textbf{0.8923}$\pm$0.0016 & 0.8231$\pm$0.0110 \\ GG & 0.6520$\pm$0.1201 & 0.8866$\pm$0.0045 & 0.9035$\pm$0.0030 & 0.5165$\pm$0.0025 & 0.6391$\pm$0.0034 & 0.6074$\pm$0.0023 \\ MM & 0.5470$\pm$0.0056 & 0.7567$\pm$0.0021 & 0.9018$\pm$0.0410 & 0.5210$\pm$0.0245 & 0.6672$\pm$0.0320 & 0.5008$\pm$0.0235 \\ RRR & 0.5724$\pm$0.1030 & 0.8542$\pm$0.0221 & 0.9085$\pm$0.0038 & 0.5173$\pm$0.0036 & 0.4972$\pm$0.0036 & 0.5060$\pm$0.0016 \\ TTT & 0.8133$\pm$0.0057 & 0.9132$\pm$0.0022 & 0.9175$\pm$0.0007 & \textbf{0.7809}$\pm$0.0019 & 0.8214$\pm$0.0041 & 0.7840$\pm$0.0034 \\ QQQ & 0.8130$\pm$0.0043 & 0.8923$\pm$0.0191 & 0.8575$\pm$0.0055 & 0.7392$\pm$0.0043 & 0.7395$\pm$0.0005 & 0.7924$\pm$0.0012 \\ \bottomrule \end{tabular} } \end{table*} \end{document} ``` Which produces the next output:
1
https://tex.stackexchange.com/users/183803
690763
320,435
https://tex.stackexchange.com/questions/690750
2
I use ``` \usepackage{natbib} \bibliographystyle{abbrv} ``` I also have the following reference: ``` @article{RN22, author = {Liu, Shiang-Tai and Kao, Chiang}, title = {Fuzzy measures for correlation coefficient of fuzzy numbers}, journal = {Fuzzy Sets and Systems}, year = {2002}, type = {Journal Article} } ``` How can I cite this reference as `Liu and Kao [22]` instead of as "just" `[22]`?
https://tex.stackexchange.com/users/300471
How do I build a specific citation call-out style using the 'abbrv' bib style? I use the 'natbib' package
false
The ancient `abbrv` bibliography style can only generate pure numeric-style citation call-outs. Fortunately, since you already employ the `natbib` citation management package, an easy solution is at hand: First, change ``` \usepackage{natbib} \bibliographystyle{abbrv} ``` to ``` \usepackage[numbers,square]{natbib} \bibliographystyle{abbrvnat} ``` `abbrvnat` is natbib's reimplementation of the venerable `abbrv` style, with some useful add-ons such as recognizing and knowing what to do with fields such as `url` and `isbn`. (Instead of `abbrvnat`, one could also use the `plainnat` or `elsarticle-num-names` bib styles -- and probably a few others as well.) Second, be sure to use `\citet` -- not `\cite`, and not `\citep` either -- go create citation call-outs. --- ``` \documentclass{article} \begin{filecontents}[overwrite]{mybib.bib} @article{RN22, author = {Liu, Shiang-Tai and Kao, Chiang}, title = {Fuzzy measures for correlation coefficient of fuzzy numbers}, journal = {Fuzzy Sets and Systems}, year = {2002}, type = {Journal Article} } \end{filecontents} \usepackage[numbers,square]{natbib} \bibliographystyle{abbrvnat} \begin{document} \noindent \citet{RN22} \bibliography{mybib} \end{document} ```
2
https://tex.stackexchange.com/users/5001
690768
320,438
https://tex.stackexchange.com/questions/578471
1
I am currently looking for a **tool** that converts a unicode code to TeX/LaTeX. Actually I have not found nothing. There are many tools on the web that transform a symbol from LaTeX to unicode but not the vice versa. In case there is not a tool, I have thought this: is it possible to generate a LaTeX code that transforms a *unicode symbol* into LaTeX commands? For example I have alfa in unicode and I would to obtain `\alpha`. I can only use `pdfLaTeX` to compile my `.tex` file.
https://tex.stackexchange.com/users/117876
Tool from unicode to LaTeX or to generate a LaTeX code that transforms a unicode symbol to LaTeX
false
I have found this [unicodeit.net](https://www.unicodeit.net/). I have waited 2 years, 6 months to have at least a link:
0
https://tex.stackexchange.com/users/117876
690776
320,443
https://tex.stackexchange.com/questions/86292
10
How can I produce a bold arrow in the package `\xymatrix`? I've tried with `\ar@{\bf{->}}[r]` and similar alternatives without success.
https://tex.stackexchange.com/users/11156
Bold arrows in xymatrix
false
This doesn't answer the question directly but if you just want to **emphasize** some arrows you could use the style `\ar@{=>}` with `\xymatrix` and `\usepackage[all{xy}`.
0
https://tex.stackexchange.com/users/35175
690784
320,445
https://tex.stackexchange.com/questions/690785
9
I would like to use Times New Roman as the default font for the text in a book I have put together. After checking this site, it seems that all I have to do is type `\usepackage{times}` in the preamble. I did this and it seems to work. My question is: Is there anything else (or something different) I should invoke in the preamble? I ask because the post which instructed to this this was rather old and I want to make sure there is nothing different I should be doing. Finally, may I assume that the *Times New Roman* font I use is in the public domain and am free to publish the said book with the said Times New Roman font? How may I check to be certain?
https://tex.stackexchange.com/users/266798
On Using Times New Roman as the Default Font
false
The more up-to-date package for a Times-like font is [`newtx`](https://ctan.org/pkg/newtx), which is a successor to `times` through a series of intermediate and now obsolete packages. The fonts upon which `newtx` is based are available for unrestricted use (although the package can support some non-free fonts.) Refer to the package documentation for more specific details of the fonts and pointers to license text. Depending on which engine you use and on what features you are after, various invocations are possible (see [documentation](http://mirrors.ctan.org/fonts/newtx/doc/newtxdoc.pdf)), but the simplest is just to do ``` \documentclass{article} \usepackage{newtx} \begin{document} ```
10
https://tex.stackexchange.com/users/119566
690786
320,446
https://tex.stackexchange.com/questions/690785
9
I would like to use Times New Roman as the default font for the text in a book I have put together. After checking this site, it seems that all I have to do is type `\usepackage{times}` in the preamble. I did this and it seems to work. My question is: Is there anything else (or something different) I should invoke in the preamble? I ask because the post which instructed to this this was rather old and I want to make sure there is nothing different I should be doing. Finally, may I assume that the *Times New Roman* font I use is in the public domain and am free to publish the said book with the said Times New Roman font? How may I check to be certain?
https://tex.stackexchange.com/users/266798
On Using Times New Roman as the Default Font
false
You can use the [`fontspec`](https://ctan.org/pkg/fontspec) package to use any Windows or system Font! Here is a MWE of it’s usage: ``` \documentclass{article} \usepackage{fontspec} \setmainfont{Times New Roman} \begin{document} Times New Roman font! \end{document} ``` This [post](https://tex.stackexchange.com/questions/593104/how-to-use-fontspec-in-details) shows some of its capabilities! The only caveat with this solution, is that `fontspec` has to be run under LuaTeX or XeTeX and not regular LaTeX, but at least it works! Regarding the usability of Times New Roman... I honestly don't know, I'd assume is good to use as is since it's packed with all Windows builds but... maybe ask the [Law Stack Exchange](https://law.stackexchange.com/)?
1
https://tex.stackexchange.com/users/300379
690787
320,447
https://tex.stackexchange.com/questions/690788
0
I am writing a document that involves a table of information for many sections, something like: ``` \textbf{Details:} \begin{table}[H] \begin{center} \begin{tabularx}{\linewidth}{|X|c|c|c|c|c|} \hline \textbf{Number} & \textbf{Location} & \textbf{Duration (hr)} & \textbf{Labour (\$)} & \textbf{Equipment Hire/Purchase (\$)} & \textbf{Consumables (\$)} & \textbf{Total (\$)}\\ \hline 1 & In-house & 0.5 & 39 & 0 & 0 & 39\\ 2 & Out-house1 & 1 & 78 & 1000 & 500 & 1578\\ 3 & Out-house2 & 1.5 & 78 & 800 & 700 & 1617\\ \hline \end{tabularx} \end{center} \end{table} ``` However, the data in the table needs to be summarized later for about 50 of these small tables, only to include the 'Location' 'Duration (hr)' and 'Total ($)' columns. I have two requirements: 1. set the entries in the table as a variable that can be called on later, so I only need to enter the values in the individual tables once which then automatically get updated in the summary 2. the entries should be math operable (ie I should be able to only need to enter the first 4 numerical values and the total should be automatically calculated My idea was something along the lines of: ``` \textbf{Details:} \begin{table}[H] \begin{center} \begin{tabularx}{\linewidth}{|X|c|c|c|c|c|c|} \hline \textbf{Number} & \textbf{Location} & \textbf{Duration (hr)} & \textbf{Labour (\$)} & \textbf{Equipment Hire/Purchase (\$)} & \textbf{Consumables (\$)} & \textbf{Total (\$)}\\ \hline \entry{1}{1}{1} & \entry{1}{2}{In-house} & \entry{1}{3}{0.5} & \entry{1}{4}{\entry{1}{3} * 78} & \entry{1}{5}{0} & \entry{1}{6}{0} & \entry{1}{7}{\entry1{4} + \entry{1}{5} + \entry1{6}}\\ % etc \hline \end{tabularx} \end{center} \end{table} ``` Which I can later use in a different table like this: ``` \textbf{Summary:} \begin{table}[H] \begin{center} \begin{tabularx}{\linewidth}{|X|c|c|c|} \hline \textbf{Number} & \textbf{Location} & \textbf{Cost (\$)} & \textbf{Duration (Hr)}\\ \hline \entry{1}{1} & \entry{1}{2} & \entry{1}{7} & \entry{1}{3}\\ \entry{2}{1} & \entry{2}{2} & \entry{2}{7} & \entry{2}{3}\\ \entry{3}{1} & \entry{3}{2} & \entry{3}{7} & \entry{3}{3}\\ \entry{4}{1} & \entry{4}{2} & \entry{4}{7} & \entry{4}{3}\\ % etc \mulitcolumn{2}{r|}{Total} & sum(\entry{all}{7}) & sum(\entry{all}{3})\\ \hline \end{tabularx} \end{center} \end{table} ``` I Have tried ``` \newcommand{\name}[1]{\def\showname{#1}} ``` which only worked if the `\showname` was called within the same table but not in a different one (despite the `\newcommand` being in the pre-amble) Any help is appreciated and thank you for your help!
https://tex.stackexchange.com/users/300500
Variables set within tables and reused later in the document
false
I had posted this on reddit and got a response linking to gdef. After looking into this I found [the edit to this comment](https://tex.stackexchange.com/a/477002/300500) was exactly what I was after
1
https://tex.stackexchange.com/users/300500
690794
320,452
https://tex.stackexchange.com/questions/690785
9
I would like to use Times New Roman as the default font for the text in a book I have put together. After checking this site, it seems that all I have to do is type `\usepackage{times}` in the preamble. I did this and it seems to work. My question is: Is there anything else (or something different) I should invoke in the preamble? I ask because the post which instructed to this this was rather old and I want to make sure there is nothing different I should be doing. Finally, may I assume that the *Times New Roman* font I use is in the public domain and am free to publish the said book with the said Times New Roman font? How may I check to be certain?
https://tex.stackexchange.com/users/266798
On Using Times New Roman as the Default Font
true
You mention that you want to use Times New Roman font (from Microsoft) but when you use `\usepackage{times}` then you use Times font, not Times New Roman. It is explained more exactly below. Times font was designed by Stanley Morison in 1931 for purpose of the newly established newspaper Times. This font has been digitized later by more font foundries: * Microsoft: Times New Roman, it is part of Windows system and typographers say that it is the worst re-implementation of Times. It isn't free. * Adobe: Font Times, it was a part of each PostScript RIP designed by Adobe. It belongs to 35 standard fonts in PostScript. They are not free. If you buy a device with PostScript RIP, then you can use them at this device. Documents needn't to download the font because the font is ready to use when printing by PostScript RIP. It is good implementation of Times, but it was originally designed in Type1 PostScript format (today obsolete) and mostly without accented Latin letters. * URW: Nimbus Roman No9, it is relatively good re-implementation of Times. It is part of Ghostscript, a free implementation of PostScript RIP which is running in Linux systems (not in printing devices). If you are using TeX with standard configuration then `\usepackage{times}` downloads this Nimbus Roman No9 font, because the configuration is based on free fonts and old TeX engines uses their individual font world independent on fonts in the system. So, even if you happen to be using MS Windows with Times New Roman font, it isn't used. * TeXGyre: Termes, it is very good implementation of Times. It is free and it was available in new (and now commonly used) format OpenType. It is part of typical TeX distributions (for example TeXlive). If you are using a Unicode-aware TeX engine (LuaTeX, XeTeX), then Termes is best choice for using Morison's Times font. For example, if you are using OpTeX, then the preamble looks like: ``` \fontfam[Termes] ``` or ``` \fontfam[Times] ``` The second one is only alias to Termes and you can re-configure it if you buy a non-free re-implementation of Times. But there is no reason to do it because Termes is very good. Much better than Times New Roman, for example. If you are using LaTeX with Unicode-aware TeX engine then you can use `\usepackage{fontspec}` and then set Termes by `\setmainfont` in your preamble.
14
https://tex.stackexchange.com/users/51799
690797
320,453
https://tex.stackexchange.com/questions/3090
78
This isn't a real question, so I'm marking it community wiki. When I was new to LaTeX, I thought that the `\usepackage` command worked much like the `#include` command of the C language: just put whatever you need in the preamble, in whatever order you like. But then bugs began to bite me and I realised, with growing horror, that commutative packages seem to be the exception rather than the rule. [They](https://tex.stackexchange.com/questions/1863/which-packages-should-be-loaded-after-hyperref-instead-of-before) [appear](https://tex.stackexchange.com/questions/2859/should-the-fontenc-package-be-loaded-before-or-after-font-packages) so [often](https://tex.stackexchange.com/questions/2835/possible-conflicts-with-fixltx2e) that I think it would be useful to have a list here of problematic interactions between pairs of packages, and their correct order. Also, a question for amusement: I want to know if there exists three packages `A`, `B` and `C`, such that `A` has to be included before `B` and `B` needs to be included before `C`, but `C` needs to be included before `A`.
https://tex.stackexchange.com/users/1035
Packages that need to be included in a specific order
false
The big list is available at <https://github.com/mhelvens/latex-pkgloader/blob/master/pkgloader-recommended.sty> with explanations. Example: ``` %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% % % A list of recommended rules derived from % <http://mirrors.dotsrc.org/ctan/macros/latex/contrib/glossaries/glossaries-user.pdf>, % <http://mirrors.dotsrc.org/ctan/macros/latex/contrib/glossaries/glossariesbegin.pdf>: % % \begin{macrocode} \Load {hyperref} before {glossaries} if loaded because {otherwise terms won't be clickable hyperlinks} \Load {glossaries} after {babel,polyglossia,inputenc, fontenc,doc} if loaded because {the glossaries documentation explicitly says to do so} % \end{macrocode} % %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% ``` Since this is an open source project, pull requests updating the knowledgebase are very welcome!
2
https://tex.stackexchange.com/users/9075
690803
320,457
https://tex.stackexchange.com/questions/39181
78
Is there a possibility to draw large integral signs? I have found the package [`bigints`](http://ctan.org/tex-archive/macros/latex/contrib/bigints) but I have the feeling it is not very professional... Any better idea?
https://tex.stackexchange.com/users/4594
Big integral sign
false
A trick for producing extensible upright integrals using LuaLaTeX is demonstrated in the [documentation](http://mirrors.ctan.org/fonts/newcomputermodern/doc/newcm-doc.pdf) of the [New Computer Modern](https://ctan.org/pkg/newcomputermodern) package. It defines the slot uni222B (integral) as a delimiter. ``` \documentclass{article} \usepackage{fontsetup} \begin{document} \[ \Uleft \Udelimiter 0 0 "222B \begin{pmatrix} 1\\2\\3\\4\\5\\6\\7\\8\\9\\10\\11\\12\\13\\14\\15\\16\\17\\18\\19\\20 \end{pmatrix} \Uright. \] \end{document} ``` This trick can be used for other fonts as well, such as xcharter, stixtwo, concrete, tex-gyre-math fonts, gfsneohellenic\*, kpfonts, etc. It does not seem to work for fonts such as erewhon and fira. I don't know why. The length of the integral symbol and the brackets varies according to the font. \*The matrix brackets collide at the top in this font.
2
https://tex.stackexchange.com/users/128462
690804
320,458
https://tex.stackexchange.com/questions/690814
2
In [a recent post](https://tex.stackexchange.com/q/689376/110998), @AWE reports that using the packages `verse` and `songs` in the same document leads to a clash: > > Package songs Error: Encountered \beginverse without first seeing a \beginsong line. > > > How can this be fixed? ``` \documentclass{article} \usepackage{verse} \newcommand{\attrib}[1]{\nopagebreak{\raggedleft\footnotesize #1\par}} \usepackage[chorded]{songs} \noversenumbers \begin{document} \poemtitle{Mathematics} \settowidth{\versewidth}{Than Tycho Brahe, or Erra Pater:} \begin{verse}[\versewidth] In mathematics he was greater \\ Than Tycho Brahe, or Erra Pater: \\ For he, by geometric scale, \\ Could take the size of pots of ale;\\ Resolve, by sines and tangents straight, \\ If bread or butter wanted weight; \\ And wisely tell what hour o’ the day \\ The clock does strike, by Algebra. \end{verse} \attrib{Samuel Butler (1612--1680)} \songsection{Worship Songs} \begin{songs}{} \beginsong{Doxology}[by={Louis Bourgeois and Thomas Ken}, sr={Revelation 5:13}, cr={Public domain.}, index={Praise God, from Whom all blessings flow}] \beginverse \[G]Praise God, \[D]from \[Em]Whom \[Bm]all \[Em]bless\[D]ings \[G]flow; \[G]Praise Him, all \[D]crea\[Em]tures \[C]here \[G]be\[D]low; \[Em]Praise \[D]Him \[G]a\[D]bove, \[G]ye \[C]heav'n\[D]ly \[Em]host; \[G]Praise Fa\[Em]ther, \[D]Son, \[Am]and \[G/B G/C]Ho\[D]ly \[G]Ghost. \[C]A\[G]men. \endverse \endsong \end{songs} \end{document} ```
https://tex.stackexchange.com/users/110998
Conflict between packages verse and songs
true
LaTeX defines an environment `verse`, and both packages redefine it in incompatible ways. To fix it, proceed as follows: 1. Load the `verse` package first. ``` \usepackage{verse} ``` 2. Rename the `verse` environment to `poemverse`. ``` \let\poemverse\verse \let\endpoemverse\endverse ``` 3. Load the `songs` package. 4. Whenever you need the `verse` environment of the `verse` package, use `poemverse` instead. ``` \begin{poemverse} ... \end{poemverse} ``` ``` \documentclass{article} \usepackage{verse} \let\poemverse\verse \let\endpoemverse\endverse \newcommand{\attrib}[1]{\nopagebreak{\raggedleft\footnotesize #1\par}} \usepackage[chorded]{songs} \noversenumbers \begin{document} \poemtitle{Mathematics} \settowidth{\versewidth}{Than Tycho Brahe, or Erra Pater:} \begin{poemverse}[\versewidth] In mathematics he was greater \\ Than Tycho Brahe, or Erra Pater: \\ For he, by geometric scale, \\ Could take the size of pots of ale;\\ Resolve, by sines and tangents straight, \\ If bread or butter wanted weight; \\ And wisely tell what hour o’ the day \\ The clock does strike, by Algebra. \end{poemverse} \attrib{Samuel Butler (1612--1680)} \songsection{Worship Songs} \begin{songs}{} \beginsong{Doxology}[by={Louis Bourgeois and Thomas Ken}, sr={Revelation 5:13}, cr={Public domain.}, index={Praise God, from Whom all blessings flow}] \beginverse \[G]Praise God, \[D]from \[Em]Whom \[Bm]all \[Em]bless\[D]ings \[G]flow; \[G]Praise Him, all \[D]crea\[Em]tures \[C]here \[G]be\[D]low; \[Em]Praise \[D]Him \[G]a\[D]bove, \[G]ye \[C]heav'n\[D]ly \[Em]host; \[G]Praise Fa\[Em]ther, \[D]Son, \[Am]and \[G/B G/C]Ho\[D]ly \[G]Ghost. \[C]A\[G]men. \endverse \endsong \end{songs} \end{document} ```
2
https://tex.stackexchange.com/users/110998
690815
320,463
https://tex.stackexchange.com/questions/690818
5
Look at this code: ``` \documentclass{article} \begin{document} \ExplSyntaxOn \tl_set:Nn\l__foo{a a a b a a a} \regex_replace_all:nnN { a (.+) a }{ [ \1 ] } \l__foo \regex_replace_all:nnN { a (.+) a }{ [ \1 ] } \l__foo \regex_replace_all:nnN { a (.+) a }{ [ \1 ] } \l__foo \l__foo \ExplSyntaxOff \end{document} ``` It renders: ``` [[[b]]] ``` As you see, I have to use `\regex_replace_all` three times. It's an obvious code duplication. Moreover, it would not be acceptable when the input (`a a a b a a a`) would not be a constant but a parameter of a command. How can I get rid of code duplication and make sure `\regex_replace_all` is applied to the text until it stops changing? Please, don't suggest to change the regular expression, it's just a motivating example, my real use case is different.
https://tex.stackexchange.com/users/1449
How to apply \regex_replace_all until the text stops changing?
true
you can use the `T` form that runs the true branch if a match was made: ``` \documentclass{article} \begin{document} \ExplSyntaxOn \tl_set:Nn\l__foo{a a a b a a a} \cs_new:Npn\foo_aux: { \regex_replace_all:nnNT { a (.+) a }{ [ \1 ] } \l__foo \foo_aux: } \foo_aux: \l__foo \ExplSyntaxOff \end{document} ```
5
https://tex.stackexchange.com/users/1090
690820
320,464
https://tex.stackexchange.com/questions/690811
2
Package `geometry` allows specification of paper height, e.g., `\geometry{paperheight=782mm}`, What about dynamically adjusting paper height — How to dynamically increase paper height, rather than breaking pages? LaTeX has page breaking logic, tweak to increase paper height by length necessary to avoid break.
https://tex.stackexchange.com/users/300519
Dynamically increasing paper height, rather than breaking page
false
Observing 16383pt [limit](https://tex.stackexchange.com/a/87935/300519) on page height ``` \usepackage{geometry} \geometry{paperwidth=174mm,paperheight=16383pt,margin=8mm} ``` dynamically increase when attempting page break ``` \usepackage{everyshi} \EveryShipout{% \pdfpageheight=\pagetotal \advance\pdfpageheight by 16mm %top and bottom margin \advance\pdfpageheight by \textheight \advance\pdfpageheight by -\pagegoal } ``` (Variant of <https://tex.stackexchange.com/a/49712/300519> for my purposes.)
0
https://tex.stackexchange.com/users/300519
690821
320,465
https://tex.stackexchange.com/questions/689518
1
I have the following code that does not compile if I try to add a looseness flag on the loop on $Z\_2$. How to change the looseness of the loop? Note that the code compiles after removing the looseness flag. ``` \documentclass[]{beamer} \usetheme{Madrid} \usepackage{amsfonts} \usepackage{amsmath,amssymb,bm} \usepackage{mathtools} \usepackage{multirow} \usepackage{float} \usepackage{pgfplots} \usepgfplotslibrary{fillbetween} \usepackage{xcolor} \usepackage{caption} \usepackage{subcaption} \usepackage{tikz} \usetikzlibrary{automata,arrows.meta, positioning} \tikzset{ ->, % makes the edges directed >=stealth, % makes the arrow heads bold node distance=3cm, % specifies the minimum distance between two nodes. Change if necessary. every state/.style={thick, fill=gray!10}, % sets the properties for each ’state’ node initial text=$ $, % sets the text that appears on the start arrow } \begin{document} \begin{frame} \begin{tikzpicture} \node[] (z1) at (0,0) { }; \node[right = 3cm of z1] (z2) {}; \draw (z1) edge node[midway,above] {$a$} (z2); \draw (z2) edge[loop right,looseness=33] node[above,outer sep=4pt,pos=0.2] {$a$} (); \end{tikzpicture} \end{frame} \end{document} ``` The error message that I get is: ``` ! Package pgf Error: No shape named `' is known. See the pgf package documentation for explanation. Type H <return> for immediate help. ... l.39 \end{frame} ```
https://tex.stackexchange.com/users/249901
Unable to change looseness in loops
false
Specifying `looseness = 33` overwrites the `to path` set by the internal `loop` style used by `loop right`. If we change the definition of the `loop` it seems to work properly. Alternatively, just specify the start coordinate again as a target. If you want all loops to have that looseness, adjust the `every loop` style instead: ``` every loop/.append style={looseness=33} ``` Usually, the nodes to be used with loops are bigger and mostly circular which is where the default looseness and/or the min distance seem to be just right. Code ---- ``` \documentclass[tikz]{standalone} \usetikzlibrary{arrows.meta, positioning} \tikzset{ loop/.code={% overwrite default, what will it break? \let\tikztotarget\tikztostart, \pgfkeysalso{looseness=8,min distance=+5mm,every loop}}} \begin{document} \begin{tikzpicture}[>=Stealth, node distance=3cm] \node[draw] (z1) {}; \node[draw, right = 3cm of z1] (z2) {}; \path (z1) edge node[midway,above] {$a$} (z2) (z2) edge[loop right, looseness=33] node[above, outer sep=4pt, pos=0.2] {$a$} () % edge[help lines, loop right] () % compare with default ; \end{tikzpicture} \end{document} ``` Output ------
1
https://tex.stackexchange.com/users/16595
690823
320,467
https://tex.stackexchange.com/questions/690828
1
I have this simple code: ``` \documentclass[12pt]{article} \usepackage{tikz} \usetikzlibrary{calendar} \begin{document} \begin{tikzpicture} \calendar [ dates=2023-07-01 to 2023-09-last, week list,inner sep=2pt,month label above centered, month text=\%mt \%y0 ]; \end{tikzpicture} \end{document} ``` Is it possible to have each month on a separate page? Can I put `\newpage` somewhere in the code? Actually, I have a longer code, this is only MWE. I want to incorporate the desired answer into my larger project... Thanks all!
https://tex.stackexchange.com/users/230245
LaTeX calendar: how to force each month to be on a separate page
true
You can't (easily) split a tikzpicture across package. So instead of drawing everything in one tikzpicture, you could use a separate `tikzpicture` for each month: ``` \documentclass[12pt]{article} \usepackage{tikz} \usetikzlibrary{calendar} \begin{document} \foreach \mo in {07,08,09}{ \begin{tikzpicture} \calendar [ dates=2023-\mo-01 to 2023-\mo-last, week list,inner sep=2pt,month label above centered, month text=\%mt \%y0 ]; \end{tikzpicture} \newpage } \end{document} ```
3
https://tex.stackexchange.com/users/36296
690829
320,469
https://tex.stackexchange.com/questions/690834
0
I am preparing a beamer presentation and I need to insert in the slide some graphs build with the tikz method. However, they cover the full frame while I want this graphs to be smaller. How can I do this? Here's the code I am using : ``` \begin{column}{0.5\textwidth} \begin{tikzpicture} \begin{axis}[clip=false,xmin=0, xmax=5, ymin=0, ymax=3,axis lines=middle,xlabel=$t$,ylabel=$\Dot{r}(t)$,ytick={0},xtick={2,4},yticklabels={$0$},xticklabels={$t_1$,$t_f$},xticklabel style={anchor= north}] \addplot[blue,domain=0:2]{x}; \addplot[red,domain=2:4]{-x+4}; \end{axis} \end{tikzpicture} \end{column} ```
https://tex.stackexchange.com/users/300524
How to reduce the size of the tikz build images in a beamer presentation?
true
You could change the width like this: ``` \documentclass{beamer} \usepackage{pgfplots} \begin{document} \begin{frame} \begin{columns} \begin{column}{0.5\textwidth} \pgfplotsset{width=\linewidth} \begin{tikzpicture} \begin{axis}[clip=false,xmin=0, xmax=5, ymin=0, ymax=3,axis lines=middle,xlabel=$t$,ylabel=$\Dot{r}(t)$,ytick={0},xtick={2,4},yticklabels={$0$},xticklabels={$t_1$,$t_f$},xticklabel style={anchor= north}] \addplot[blue,domain=0:2]{x}; \addplot[red,domain=2:4]{-x+4}; \end{axis} \end{tikzpicture} \end{column} \begin{column}{.5\textwidth} Some text over in the other column \end{column} \end{columns} \end{frame} \end{document} ```
1
https://tex.stackexchange.com/users/36296
690835
320,472
https://tex.stackexchange.com/questions/690840
1
There is a trailing dot after the section number in the `beamer` table of contents, section entry. How can I get rid of it? Here is an MWE: ``` \documentclass{beamer} \setbeamertemplate{section in toc}[sections numbered] \setbeamertemplate{subsection in toc}[subsections numbered] \setbeamertemplate{subsubsection in toc}[subsubsections numbered] \title{Presentation} \author{John Doe} \date{\today} \begin{document} \frame{\titlepage} \part{Introduction} \frame{\partpage} \begin{frame}\frametitle{Table of Contents} \tableofcontents \end{frame} \section{General} \frame{\sectionpage} \subsection{Less General} \frame{\subsectionpage} \section{Specific} \frame{\sectionpage} \subsection{More Specific} \frame{\subsectionpage} \end{document} ```
https://tex.stackexchange.com/users/1053
Trailing dot after section number, table of contents
true
You could redefine the `section in toc` template like this: ``` \documentclass{beamer} \makeatletter \setbeamertemplate{section in toc}{% \leavevmode% % prevents the period to be printed with the first/last section option \ifnum\beamer@tempcount>\beamer@toclastsection \else \ifnum\beamer@tempcount>0 \inserttocsectionnumber\space \fi\fi% \inserttocsection\par% } \makeatother \setbeamertemplate{subsection in toc}[subsections numbered] \setbeamertemplate{subsubsection in toc}[subsubsections numbered] \title{Presentation} \author{John Doe} \date{\today} \begin{document} \frame{\titlepage} \part{Introduction} \frame{\partpage} \begin{frame}\frametitle{Table of Contents} \tableofcontents \end{frame} \section{General} \frame{\sectionpage} \subsection{Less General} \frame{\subsectionpage} \section{Specific} \frame{\sectionpage} \subsection{More Specific} \frame{\subsectionpage} \end{document} ```
1
https://tex.stackexchange.com/users/36296
690841
320,473
https://tex.stackexchange.com/questions/690842
0
I need a regular expression for `\regex_replace_all` that matches a string that starts with `A`, ends with `B`, and doesn't contain `CBC` inside. This one doesn't work: ``` \documentclass{article} \begin{document} \ExplSyntaxOn \tl_set:Nn\foo{foo A xxxx B bar} \regex_replace_all:nnN { A ((?!CBC).)+ B }{ replaced } \foo \foo \ExplSyntaxOff \end{document} ``` I expect it to render `foo replaced bar`. However, no replacement happens. To my knowledge `A ((?!CBC).)+ B` is a correct regexp. I see this in the log: ``` LaTeX Warning: Unknown special group '(?! ...' in a regular expression. ```
https://tex.stackexchange.com/users/1449
How to match a string that doesn't include a substring?
true
``` \documentclass{article} \begin{document} \ExplSyntaxOn \tl_set:Nn\foo{foo A xxxx B bar} \regex_replace_all:nnN {A([^C]*(C[^B]|CB[^C])?)*B }{ replaced } \foo \foo \ExplSyntaxOff \end{document} ```
1
https://tex.stackexchange.com/users/1090
690845
320,474
https://tex.stackexchange.com/questions/690782
1
I am a beginner in terms of my knowledge of LaTeX and am attempting to create a longtable that spans two consecutive pages using longtblr within tabularray. By default, the alignment of the table caption is set to center. Furthermore, the separator between the caption text and label is ":" I was wondering how to change the alingment of the label and the caption to left. I would also like to change the separator to "." but I can't figure out how to do this based on my code, part of which I have pasted below: ``` \NewTblrTheme{fancy}{ \SetTblrStyle{caption-tag}{font=\bfseries\fontsize{10}{12}\selectfont} \SetTblrStyle{caption-sep}{font=\bfseries\fontsize{10}{12}\selectfont} \SetTblrStyle{caption-text}{font=\fontsize{10}{12}\selectfont} } \begin{longtblr}[ theme=fancy, caption = {Your table caption here}, label = {tbl:mytable}, ]{ colspec={X[1]X[3]}, rowhead=1, %row{1}={font=\bfseries, bg=white, fg=black}, rowsep=0.5ex, %column{1}={font=\bfseries}, width=0.9\linewidth} } ``` I would be very grateful for the help. Thank you!
https://tex.stackexchange.com/users/300494
tabularray with longtblr, how to change alignment of caption and caption separator
false
Turns out that, while [`tabularray`](https://ctan.org/pkg/tabularray) is a great package to do nice tables… it is not the most beginner friendly one when it comes to customization, as it relies on LaTeX3 syntax, which can be a jump in difficulty when someone is used to LaTeX2e. I also can’t take full credit on this solution, since the one who actually took the work to show working modification on the source code was TheEndofTheWorld in [this post](https://tex.stackexchange.com/questions/627585/package-tabularray-and-side-caption). But here goes something that may help you! ``` \usepackage{tabularray} \usepackage{xcolor} % Only if you want to color the cells \begin{document} % Edits on the tabularray defaults \ExplSyntaxOn \DefTblrTemplate{caption-sep}{default}{.\enskip} % Change ":" to "." \DefTblrTemplate{caption}{default} % Entire caption setup {% \hbox_set:Nn \l__tblr_caption_box{% \UseTblrTemplate{caption-tag}{default} \UseTblrTemplate{caption-sep}{default} \UseTblrTemplate{caption-text}{default} } \dim_compare:nNnTF{\box_wd:N \l__tblr_caption_box} > {\hsize} {% \UseTblrAlign{caption} \UseTblrIndent{caption} \hbox_set:Nn \l__tblr_caption_left_box{% \UseTblrTemplate{caption-tag}{default} \UseTblrTemplate{caption-sep}{default} } \hangindent = \box_wd:N \l__tblr_caption_left_box \hangafter = 1 \UseTblrHang{caption} \leavevmode \hbox_unpack:N \l__tblr_caption_box \par }{% \centering \makebox[\hsize][l]{\box_use:N \l__tblr_caption_box} % "c" to "l" \par } } \ExplSyntaxOff % Your custom style! \NewTblrTheme{fancy}{% \SetTblrStyle{caption-tag}{font=\bfseries\fontsize{10}{12}\selectfont} \SetTblrStyle{caption-sep}{font=\bfseries\fontsize{10}{12}\selectfont} \SetTblrStyle{caption-text}{font=\fontsize{10}{12}\selectfont} } \begin{longtblr}[% theme = fancy, caption = {A fancy caption here}, label = {tbl:mytable} ]{% hlines, vlines, colspec = {X[1]X[3]}, rowhead = 1, rowsep = 0.5ex, width = 0.9\linewidth, row{1} = {font=\bfseries, bg=white, fg=black}, column{1} = {font=\bfseries} } Header & Second header\\ First column & Second column\\ First column & Second column\\ First column & Second column\\ First column & Second column\\ \end{longtblr} \end{document} ``` And this example yields the following table. So… what is going on? There are two modification on the “default” table loaded by `tabularray` here. The first on line 10 where the original said this... ``` \DefTblrTemplate{caption-sep}{default}{:\enskip} ``` And now we change it to this! ``` \DefTblrTemplate{caption-sep}{default}{.\enskip} ``` The contents of the last brackets tell what separator we are using. The `\enskip` command is just a hit of the space bar, but it can be pretty much edited to whatever. ~~Don’t quote me on this, but in theory, setting the second bracket to “fancy” and pasting this before your original definition should have worked, but I have no idea why it didn’t on my end and is probably an issue with my build so… I’m just using dynamite to get rid of a fly because… hey! It works!~~ Line 11 contains the entire definition of the default caption, so wether we like it or not, we have to re-write everything in there to avoid making something crash. Therefore, lines 12 to 32 as exactly as the source code is. Line 34 has the edit you need. The original line was this. ``` \makebox[\hsize][c]{\box_use:N \l__tblr_caption_box} ``` And now we have this! ``` \makebox[\hsize][l]{\box_use:N \l__tblr_caption_box} ``` The parameter in `\makebox` tells you the orientation of the contents. The original was `c` for centered, and now we use `l` for left! ~~Again, this all should work without moving the defaults on line 11 to “fancy” but… for some odd reason I can’t get it to work and I’m still scratching my head over why so… dynamite time it is!~~ I know this is not the easiest solution, but I hope that helps you edit what you need for your project!
0
https://tex.stackexchange.com/users/300379
690847
320,475
https://tex.stackexchange.com/questions/690846
1
I have a number of Roman names. I'd like to sort them by middle name (*gens*) which is much more useful than by first or last. Is this possible? ``` \documentclass[a4paper]{article} \usepackage{imakeidx} \makeindex[title=Index of Romans] \begin{document} Here I reference Marcus Tullius Cicero\index{Marcus Tullius Cicero} and Gaius Julius Caesar.\index{Gaius Julius Caesar} I'd like the index entry to appear sorted by the middle part of the name (Gaius \textit{Pompeius} Magnus); it is not a viable solution to list it as Pompeius, Gaius Magnus\index{Pompeius, Gaius Magnus} as this lists names in the order 2, 1, 3, which is odd. That is, it should be sorted as \textit{Pompeius Magnus, Gaius} but appear as \textit{Gaius Pompeius Magnus}. %Thus these should sort in order of the middle name: \index{Derek Al Cicero} \index{Charlie Ben Cicero} \index{Ben Charlie Cicero} \index{Al Derek Cicero} \printindex \end{document} ```
https://tex.stackexchange.com/users/36728
Sort index entries by middle name
true
You can separate a sort key and print form with `@` ``` \documentclass[a4paper]{article} \usepackage{imakeidx} \makeindex[title=Index of Romans] \newcommand\rindex[1]{\xrindex#1\relax} \def\xrindex#1 #2 #3\relax{\index{#2 #1 #3@#1 #2 #3}} \begin{document} Here I reference Marcus Tullius Cicero\rindex{Marcus Tullius Cicero} and Gaius Julius Caesar.\rindex{Gaius Julius Caesar} I'd like the index entry to appear sorted by the middle part of the name (Gaius \textit{Pompeius} Magnus); it is not a viable solution to list it as Pompeius, Gaius Magnus\rindex{Gaius Pompeius Magnus} as this lists names in the order 2, 1, 3, which is odd. That is, it should be sorted as \textit{Pompeius Magnus, Gaius} but appear as \textit{Gaius Pompeius Magnus}. %Thus these should sort in order of the middle name: \rindex{Derek Al Cicero} \rindex{Charlie Ben Cicero} \rindex{Ben Charlie Cicero} \rindex{Al Derek Cicero} \printindex \end{document} ```
2
https://tex.stackexchange.com/users/1090
690848
320,476
https://tex.stackexchange.com/questions/690839
5
Assuming I have a table like this, ``` \documentclass{article} \usepackage{amsmath} % for "\text" macro \newcommand{\smbullet}{{\scriptscriptstyle\bullet}} \begin{document} \begin{table*}[!htb] \centering \begin{tabular}{c c c c c c c }\hline $ H$ & VB-3 & VB-2 & VB-1&CB+1&CB+2&\\\hline 1 & 2 & 3 & a &b & c \\ 1 & 2 & 3 & d &e & f \\ 1 & 2 & 3 & g &h & i \\ a & b & c & 1 & 2 & 3 \\ d & e & f & 1 &2 & 3 \\ g & h & i & 1 &2 & 3 \\ \end{tabular} \end{table*} \end{document} ``` How do I put a brackets to the upper right 3x3 matrix and lower left 3x3 and instead of inputs from a to i, just insert a bracket with H inside.
https://tex.stackexchange.com/users/300527
How to put square brackets inside a table?
true
With `nicematrix`. ``` \documentclass{article} \usepackage{nicematrix} \begin{document} \begin{table*}[!htb] \centering \begin{NiceTabular}{c c c c c c}[first-row] \hline $ H$ & VB-3 & VB-2 & VB-1&CB+1&CB+2\\ \hline 1 & 2 & 3 & \Block{3-3}{H} & & \\ 1 & 2 & 3 & & & \\ 1 & 2 & 3 & & & \\ \Block{3-3}{H} & & & 1 & 2 & 3 \\ & & & 1 &2 & 3 \\ & & & 1 &2 & 3 \\ \CodeAfter \SubMatrix[{1-4}{3-6}][extra-height=-3pt,xshift=-2mm] \SubMatrix[{4-1}{6-3}][extra-height=-3pt] \end{NiceTabular} \end{table*} \end{document} ``` You need several compilations (because `nicematrix` uses PGF/Tikz nodes under the hood).
6
https://tex.stackexchange.com/users/163000
690855
320,478
https://tex.stackexchange.com/questions/690839
5
Assuming I have a table like this, ``` \documentclass{article} \usepackage{amsmath} % for "\text" macro \newcommand{\smbullet}{{\scriptscriptstyle\bullet}} \begin{document} \begin{table*}[!htb] \centering \begin{tabular}{c c c c c c c }\hline $ H$ & VB-3 & VB-2 & VB-1&CB+1&CB+2&\\\hline 1 & 2 & 3 & a &b & c \\ 1 & 2 & 3 & d &e & f \\ 1 & 2 & 3 & g &h & i \\ a & b & c & 1 & 2 & 3 \\ d & e & f & 1 &2 & 3 \\ g & h & i & 1 &2 & 3 \\ \end{tabular} \end{table*} \end{document} ``` How do I put a brackets to the upper right 3x3 matrix and lower left 3x3 and instead of inputs from a to i, just insert a bracket with H inside.
https://tex.stackexchange.com/users/300527
How to put square brackets inside a table?
false
You can insert the left/right brace manually, knowing the height of the rows you're working with. In your case, with the matrices spanning 3 rows, place the left/right braces on the middle row, `\smash`ed. ``` \documentclass{article} \usepackage{booktabs} \begin{document} \begin{tabular}{ *{6}{c} } \toprule $H$ & $VB - 3$ & $VB - 2$ & $VB - 1$ & $CB + 1$ & $CB + 2$ \\ \midrule 1 & 2 & 3 & a & b & c \\ \llap{\smash{$\left[\vphantom{\begin{array}{c} 1 \\ 1 \\ 1 \end{array}}\right.$}}1 & 2 & 3\rlap{\smash{$\left.\vphantom{\begin{array}{c} 3 \\ 3 \\ 3 \end{array}}\right]$}} & d & e & f \\ 1 & 2 & 3 & g & h & i \\ a & b & c & 1 & 2 & 3 \\ d & e & f & \llap{\smash{$\left[\vphantom{\begin{array}{c} 1 \\ 1 \\ 1 \end{array}}\right.$}}1 & 2 & 3\rlap{\smash{$\left.\vphantom{\begin{array}{c} 3 \\ 3 \\ 3 \end{array}}\right]$}} \\ g & h & i & 1 & 2 & 3 \\ \bottomrule \end{tabular} \end{document} ```
5
https://tex.stackexchange.com/users/5764
690858
320,480
https://tex.stackexchange.com/questions/690856
0
Thanks to [David Carlisle](https://tex.stackexchange.com/questions/690846/sort-index-entries-by-middle-name#690848) who assisted me in sorting index entries by middle name. Now I'd like the associated sub-entries not to repeat the text of the entry: thus the entry would read as ``` Gaius Julius Sneezer Hayfever, 1 March, 1 ``` Rather than repeating the entry each time. ``` \documentclass[a4paper]{article} \usepackage{imakeidx} \makeindex[title=Index of Romans] \newcommand\rindex[1]{\xrindex#1\relax} \def\xrindex#1 #2 #3\relax{\index{#2 #1 #3@#1 #2 #3}} \begin{document} This is text. \rindex{Gaius Julius Sneezer!Hayfever} \rindex{Gaius Julius Sneezer!March} \rindex{Marcus Tullius Snifero!Allergies} \rindex{Marcus Tullius Snifero!Dust} \printindex \end{document} ```
https://tex.stackexchange.com/users/36728
suppress repetition of entry in subentry with imakeidx
true
I introduced a second command for the `!` cases, you could of course get more complicated and use a single command with some testing, but I'd keep it simple. ``` \documentclass[a4paper]{article} \usepackage{imakeidx} \makeindex[title=Index of Romans] \newcommand\rrindex[1]{\xrrindex#1\relax} \def\xrrindex#1 #2 #3!#4\relax{\index{#2 #1 #3@#1 #2 #3!#4}} \begin{document} This is text. \rrindex{Gaius Julius Sneezer!Hayfever} \rrindex{Gaius Julius Sneezer!March} \rrindex{Marcus Tullius Snifero!Allergies} \rrindex{Marcus Tullius Snifero!Dust} \printindex \end{document} ```
1
https://tex.stackexchange.com/users/1090
690859
320,481
https://tex.stackexchange.com/questions/690843
0
I tried to use a custom defined command, which uses `\marginpar`, inside `\section`. According to another [SE post](https://tex.stackexchange.com/questions/195335), I have to `\protect` it. But after some trial and error in my custom package, it breaks if I include `hyperref`. Is there some fix for this? ``` \documentclass{article} %\usepackage{hyperref} \newcounter{clecturesep} \newcommand*{\lecturesep}[1]{% \stepcounter{clecturesep}% \marginpar{\small% Lect.~\theclecturesep{}\\ {#1} }% } \begin{document} \lecturesep{11.07.23} % Works as expected % Only works if we comment out hyperref \section{Heeeeeeeeeeeeeaaaaaaaaaaaadeeeeeeeeeeeeer\protect\lecturesep{11.07.23}} \end{document} ```
https://tex.stackexchange.com/users/172890
Aligning `\marginpar` with section title
false
I would suggest making your `\lecturesep` part of the formatting of the section title, instead being part of the section title, to avoid [the issue that Ulrike pointed out](https://tex.stackexchange.com/questions/690843/aligning-marginpar-with-section-title#comment1714377_690843) One option is to use `titlesec` ``` \documentclass{article} \usepackage{titlesec} \usepackage{hyperref} \newcounter{clecturesep} \newcommand*{\lecturesep}[1]{% \stepcounter{clecturesep}% \marginpar{\small% Lect.~\theclecturesep{}\\ {#1} }% } \titleformat{\section}{\normalfont\Large\bfseries}{\thesection}{1em}{\showlecturedate\gdef\showlecturedate{}} \titlespacing*{\section} {0pt}{3.5ex plus 1ex minus .2ex}{2.3ex plus .2ex} \newcommand\showlecturedate{} \newcommand\datedsection[1]{\def\showlecturedate{\lecturesep{#1}}\section} \begin{document} \tableofcontents \vspace{10pt} \datedsection{11.07.23}[short title]{long title} \datedsection{11.08.23}{long title titletitletitle titletitle title} \section[another]{longer title titletitletitletitle titletitle} \datedsection{11.09.23}*{a title} \end{document} ``` which yields If instead you want to avoid `titlesec`, with the `article` class you can define ``` \documentclass{article} \usepackage{hyperref} \newcounter{clecturesep} \newcommand*{\lecturesep}[1]{% \stepcounter{clecturesep}% \marginpar{\small% Lect.~\theclecturesep{}\\ {#1} }% } \makeatletter \newcommand\datedsection[1]{\@startsection {section}{1}{\z@}% {-3.5ex \@plus -1ex \@minus -.2ex}% {2.3ex \@plus.2ex}% {\normalfont\Large\bfseries\lecturesep{#1}}} \makeatother \begin{document} \tableofcontents \vspace{10pt} \datedsection{11.07.23}[short title]{long title} \datedsection{11.08.23}{long title titletitletitle titletitle title} \section[another]{longer title titletitletitletitle titletitle} \section{longer title} \datedsection{11.09.23}*{another section} \end{document} ``` which also builds fine with `hyperref` and yields
1
https://tex.stackexchange.com/users/119
690860
320,482
https://tex.stackexchange.com/questions/686023
4
Is there a package or option that starts alternating row colors from within a table, so that no matter how many manually-colored rows are inserted, the alternating can be started again with the *same* color each time? (In a single table, I want to manually color a few "heading" rows, each followed by an undetermined number of alternating gray/white rows -- always starting with gray.)
https://tex.stackexchange.com/users/182238
Call alternating row colors from within the table?
false
EDIT With the latest version of `nicematrix` (v. 6.21 2023-07-14), you have a command `\rowcolors` which may be used in a row of the tabular. ``` \documentclass{article} \usepackage{nicematrix} \begin{document} The command \verb|\myrowcolors{gray!50}{white}| is in the third row. \begin{center} \begin{NiceTabular}{lcr}[colortbl-like] \rowcolor{red!50} Table head1 & Table head1 & Table head1\\ \rowcolor{green!50} Table head2 & Table head2 & Table head2\\ \rowcolors{gray!50}{white}% odd & odd & odd \\ even & even & even\\ odd & odd & odd \\ even & even & even\\ odd & odd & odd \\ even & even & even\\ \end{NiceTabular} \end{center} \bigskip The command \verb|\myrowcolors{gray!50}{white}| is in the fourth row. \begin{center} \begin{NiceTabular}{lcr}[colortbl-like] \rowcolor{red!50} Table head1 & Table head1 & Table head1\\ \rowcolor{green!50} Table head2 & Table head2 & Table head2\\ odd & odd & odd \\ \rowcolors{gray!50}{white} even & even & even\\ odd & odd & odd \\ even & even & even\\ odd & odd & odd \\ even & even & even\\ \end{NiceTabular} \end{center} \end{document} ``` --- The package `nicematrix` does not provide such feature for its environment `{NiceTabular}` but it's possible to program it. ``` \documentclass{article} \usepackage{nicematrix,tikz} \ExplSyntaxOn \makeatletter \cs_new_protected:Nn \__pantigny_rowcolors:nnn { \int_step_inline:nnn { #1 } { \int_use:N \c@iRow } { \tikz \fill [color= \int_if_even:nTF { ##1 - #1 } { #2 } { #3 } ] (##1-|1) rectangle (\int_eval:n { ##1 + 1 } -|last) ; } } \NewDocumentCommand { \myrowcolors } { m m } { \tl_gput_right:Nx \g_nicematrix_code_before_tl { \__pantigny_rowcolors:nnn { \int_use:N \c@iRow } { #1 } { #2 } } } \makeatother \ExplSyntaxOff \begin{document} The command \verb|\myrowcolors{gray!50}{white}| is in the third row. \begin{center} \begin{NiceTabular}{lcr}[colortbl-like] \rowcolor{red!50} Table head1 & Table head1 & Table head1\\ \rowcolor{green!50} Table head2 & Table head2 & Table head2\\ \myrowcolors{gray!50}{white}% odd & odd & odd \\ even & even & even\\ odd & odd & odd \\ even & even & even\\ odd & odd & odd \\ even & even & even\\ \end{NiceTabular} \end{center} \bigskip The command \verb|\myrowcolors{gray!50}{white}| is in the fourth row. \begin{center} \begin{NiceTabular}{lcr}[colortbl-like] \rowcolor{red!50} Table head1 & Table head1 & Table head1\\ \rowcolor{green!50} Table head2 & Table head2 & Table head2\\ odd & odd & odd \\ \myrowcolors{gray!50}{white}% even & even & even\\ odd & odd & odd \\ even & even & even\\ odd & odd & odd \\ even & even & even\\ \end{NiceTabular} \end{center} \end{document} ```
0
https://tex.stackexchange.com/users/163000
690870
320,488
https://tex.stackexchange.com/questions/602102
0
Apparently `\subsection{Impact of the Tiananmen Square Massacre and China's standing in the international community}` gets an `overfull \hbox (0.844 too wide)` message. I didn't know there was a word limit to the subsection argument. What am I supposed to do in this situation? Is there no workaround? The`overfull` however does not impact anything directly. I'm not sure what potential "bad" effects if may even have on my document
https://tex.stackexchange.com/users/235908
How can I fix necessarily wordy overfull \hbox (badness xxxx) errors?
false
Something I have used is force a line break inside the title. Depends on the package been used, usually `\\` would get the job done.
0
https://tex.stackexchange.com/users/246082
690876
320,491
https://tex.stackexchange.com/questions/32704
26
Is there a `minipage`-like environment that allows pagebreaks? Everything I can find is about avoiding page breaks (which `minipage` does well) but I want to indent a whole section, which is convenient to do by wrapping the section in `minipage` as `\leftskip` is overtaken by the environment enclosing this section.
https://tex.stackexchange.com/users/3602
Minipage that allows page breaks?
false
For completion purpose, here comes another alternative that doesn't need any aditional package. Start a group in which you put the text to have the desired margins set as follows: ``` { \leftskip=3cm %You can also use other units of glue. \rightskip=2cm This text will have margins adjusted for the parameters as desired. They specify glue to be inserted at the left and right of every line in a paragraph. Breakpages happens. After the group ends, the former margins are restored. You can also create a newenvironment for various uses of this. } ``` Plain TeX also has the `\narrower` macro, described in the TeXbook, that increases both `\leftskip` and `\rightskip` by the current `\parindent`: ``` {\narrower\smallskip This paragraph will have narrower lines than the surrounding paragraphs do, because it uses the ``narrower'' feature of plain \TeX. The former margins will be restored after this group ends. This may be useful for quoting lengthy passages from a book.\smallskip } ``` Note it is necessary to end the paragraph before ending the group with a blank line or a `\par`, for example, otherwise the effect disappear. **Reference and more information**: Donald E. Knuth, The TEXbook, chapter 14 "How TeX Breaks Paragraphs into Lines".
2
https://tex.stackexchange.com/users/176597
690882
320,494
https://tex.stackexchange.com/questions/147114
13
I have revised a manuscript in LyX, and as requested by the journal editor, coloured the new text in red. Once I completed the revision I exported to LaTeX to do the final tweaking of the manuscript. I now have a revised manuscript in pdf format with all changes marked up in red text. The problem is that I also need a unmarked up version (with red text removed). I can remove the red coloring in the LyX file, but then need to re-export and re-tweak the entire document whenever I make a small change. Because the color text was added in LyX I have `\textcolor{red}{Words and more words}` scattered all throughout the document. Can someone give me a clue to an efficient way to strip out the `\textcolor{red}` tags and the corresponding `{}` throughout the Latex file? I've tried searching online but have not managed to find an answer yet.
https://tex.stackexchange.com/users/41773
Advice on an efficient method to strip out color tags from LaTeX
false
If you upload your LaTeX file to Overleaf and enable `vim` keybindings, you can type ``` <Esc> :s/\\textcolor\{red\}//g<Enter> ``` to remove all the `\\textcolor{red}`. I used Overleaf because I assume 'canonical' implies 'can be used irrespective of OS' and this doesn't require even Windows users to install anything extra. However, I can't quite figure out what variant of regular expressions Overleaf is using, so I couldn't match even the simplest of the corresponding `{}` pairs in Overleaf. However, with `sed` or the variant featured in Kile, for example, you should be able to remove most of those, too. In Kile, say, you could also review and approve each match prior to replacement. Note that I tested this with a regular LaTeX file. I didn't test with LyX, so I'm assuming it spits out something reasonably standard. This said, I'm honestly not sure this merits a canonical answer unless LyX is peculiarly dependent on this kind of appearance-based markup. The obvious (LaTeX) approach is to define a macro which you toggle between making its argument red and not doing so in the preamble. But perhaps that's hard to do in LyX. I'm also not sure what a 'canonical' answer means here.
0
https://tex.stackexchange.com/users/39222
690883
320,495
https://tex.stackexchange.com/questions/690819
0
The following is a mwe: ``` % !TEX encoding = UTF-8 Unicode % !TEX program = lualatex % !BIB program = biber \begin{filecontents}[overwrite]{\jobname.bib} @customa{a, type = {type1}, author = {Familyname, Givenname}, title = {Title}, date = {2000}, } @customa{b, type = {type2}, author = {Institution A}, title = {Title}, date = {3000}, } @customa{c, type = {type3}, author = {Institution B}, title = {Title}, date = {1000}, } \end{filecontents} \documentclass{article} \usepackage[style=authortitle]{biblatex} \addbibresource{\jobname.bib} \DeclareBibliographyDriver{customa}{% \usebibmacro{bibindex}% \usebibmacro{begentry}% \printnames{author}% \newunit\newblock \usebibmacro{title}% \newunit\newblock \printdate% \usebibmacro{finentry}} \begin{document} \nocite{*} \printbibliography \end{document} ``` The `author` field contains both personal names (with first and last names) and institutions. For various reasons, I preferred to use the same field instead of separate fields (like `author` and `institution`). Therefore, under certain conditions, `author` field must be wrapped in an extra pair of curly braces to prevent data parsing from treating them as personal names which are to be dissected into their components (see §2.3.3 of the biblatex Guide). Since the value of the `type` field determines the "type" of the author (personal name or institution name), the "pseudo-conditions" regarding sourcemapping are as follows: ``` IF entrytype = customa; field "type" is defined and its value <> "type1"; THEN wrap the field "author" in an extra pair of curly braces; ELSE nothing ``` So, what are the `\step`s to be set in `\DeclareSourcemap`?
https://tex.stackexchange.com/users/287680
How to wrap "author" field through biber sourcemapping?
true
I really don't think this is a good idea since it makes for very inconsistent markup in the `.bib` file. "Corporate authors" ([Using a 'corporate author' in the "author" field of a bibliographic entry (spelling out the name in full)](https://tex.stackexchange.com/q/10808/35864)) should always be protected an additional pair of curly braces in name fields. Either use curly braces correctly and consistently for all entry types or pick a different field if `author` does not fit the semantics. That said, here is a sourcemap that uses RegExp replacement to add an additional pair of curly braces to `author` fields for `@customa` entries with a `type` field not equal to `type1`. ``` \documentclass{article} \usepackage[style=authortitle]{biblatex} \DeclareSourcemap{ \maps[datatype=bibtex]{ \map{ \pertype{customa} \step[fieldsource=type, final] \step[fieldsource=type, notmatch=\regexp{\Atype1\Z}, final] \step[fieldsource=author, match=\regexp{\A(.*)\Z}, replace=\regexp{\{$1\}}] } } } \DeclareBibliographyDriver{customa}{% \usebibmacro{bibindex}% \usebibmacro{begentry}% \printnames{author}% \newunit\newblock \usebibmacro{title}% \newunit\newblock \printdate% \usebibmacro{finentry}} \begin{filecontents}{\jobname.bib} @customa{a, type = {type1}, author = {Givenname Familyname}, title = {Title}, date = {2000}, } @customa{b, type = {type2}, author = {Institution A}, title = {Title}, date = {3000}, } @customa{c, type = {type3}, author = {Institution B}, title = {Title}, date = {1000}, } @customa{d, author = {Grivenname Flamilyname}, title = {Title}, date = {4000}, } \end{filecontents} \addbibresource{\jobname.bib} \begin{document} \nocite{*} \printbibliography \end{document} ```
1
https://tex.stackexchange.com/users/35864
690889
320,497
https://tex.stackexchange.com/questions/690873
0
I would like to edit a custom cite command to check whether or not a prenote is specified. At the moment, it looks like this: ``` \DeclareCiteCommand{\MyCommand} { \usebibmacro{prenote} % } { some stuff % } {} { \usebibmacro{postnote} % \adddot % } ``` Is it possible to check the presence of an argument and change the precode accordingly? Like print `A` if there is no argument and `B` if an argument is specified. I have a second problem related to this: when I use \MyCommand[argument]{resource}, the argument gets printed at the end of the command just before the dot, as a postnote. Is there a way to force LaTeX to consider that a single argument should be considered as a prenote and thus printed at the beginning?
https://tex.stackexchange.com/users/209343
Add prenote argument in DeclareCiteCommand
true
Within `\DeclareCiteCommand` and friends the prenote and postnote arguments can be accessed as if they were fields from the `.bib` file. So you can test for the presence or absence of `prenote` with `\iffieldundef`. ``` \documentclass[british]{article} \usepackage[T1]{fontenc} \usepackage{babel} \usepackage{csquotes} \usepackage[backend=biber, style=authoryear]{biblatex} \usepackage{xcolor} \DeclareFieldFormat{red}{\textcolor{red}{#1}} \DeclareCiteCommand{\MyCommand} {\iffieldundef{prenote} {\printtext[red]{replacement for prenote}% \setunit{\prenotedelim}} {\usebibmacro{prenote}}} {\printtext{something here}} {\multicitedelim} {\usebibmacro{postnote}} \addbibresource{biblatex-examples.bib} \begin{document} \MyCommand{sigfridsson} \MyCommand[post]{sigfridsson} \MyCommand[pre][post]{sigfridsson} \MyCommand[pre][]{sigfridsson} \printbibliography \end{document} ```
1
https://tex.stackexchange.com/users/35864
690890
320,498
https://tex.stackexchange.com/questions/690887
1
I'm using XeLaTeX and Overleaf as my editor. I want to use the `listings` package to list my LaTeX codes. I can properly list most normal codes using the my style below, but when I try to list some lines in my preamble, there would be a lot of errors. (e.g. Undefined control sequence. LaTeX Error: Environment lstlisting undefined. LaTeX Error: Missing \begin{document}. ...etc) Are there any ways to list the `\documentclass` without corrupting the PDF? Should I use `\verb` instead? Here is my code: ``` \documentclass[11pt, a4paper]{article} \usepackage{listings,xcolor} \definecolor{code-keyword-color}{rgb}{0.61, 0.14, 0.58} % purple \definecolor{code-comment-color}{rgb}{0.36, 0.42, 0.47} % gray \definecolor{code-string-color}{rgb}{0.77, 0.1, 0.09} % orange \definecolor{code-identifier-color}{rgb}{0.42, 0.21, 0.66} %purple \lstdefinestyle{mystyle}{ basicstyle=\ttfamily\footnotesize, numbers=left, % Position of line numbers numberstyle=\sffamily\scriptsize, % Style of line numbers stepnumber=1, % Margin between line numbers numbersep=5pt, % Margin between line numbers and text tabsize=2, extendedchars=true, % Lets you use non-ASCII characters; for 8-bits encodings only, does not work with UTF-8 breaklines=true, % Lines will be wrapped breakatwhitespace=false, % Sets if automatic breaks should only happen at whitespace keepspaces=true, % keeps spaces in text, useful for keeping indentation of code (possibly needs columns=flexible) showspaces=false, % show spaces everywhere adding particular underscores; it overrides 'showstringspaces' showstringspaces=false, % underline spaces within strings only showtabs=false % show tabs within strings adding particular underscores captionpos=t, % Caption position: top escapeinside={\%*}{*)}, % If you want to add LaTeX within your code backgroundcolor=\color{white}, commentstyle=\itshape\color{code-comment-color}, keywordstyle=\color{code-keyword-color}, identifierstyle=\color{code-identifier-color}, stringstyle=\color{code-string-color}, language=[LaTeX]TeX } \lstset{style=mystyle} \begin{document} \title{title} \author{name} \date{date} \maketitle % this works \begin{lstlisting} \begin{equation} E=mc^2 \end{equation} \end{lstlisting} % this does not work \begin{lstlisting} \documentclass[11pt, a4paper]{article} \end{lstlisting} \end{document} ```
https://tex.stackexchange.com/users/244525
Cannot List documentclass Using the Listings Package
true
This is due to the mechanics of how Overleaf choose files to compile. When a main document is not specified in Overleaf, the compiler will try to compile the current file when "Compile" is executed. When a main document is specified, Overleaf will **still** try to compile the current file if this document contains the string `\documentclass`, regardless which line it is, or whether it begins in a new line. My workaround is to typeset this via `\texttt{\textbackslash documentclass}`, or `\verb!\!\verb!documentclass!`. Reference: Overleaf - Set Main Document <https://www.overleaf.com/learn/how-to/Set_Main_Document>
2
https://tex.stackexchange.com/users/245808
690893
320,499
https://tex.stackexchange.com/questions/690892
0
Is it possible to add an entry to the index that is 'passim'? This is used to mean "everywhere" or "throughout". So you'd have something like: > > Frege, Gottlob, *passim* > > > TIA.
https://tex.stackexchange.com/users/300285
LaTeX Indices: 'passim'
true
[I guess](https://tex.meta.stackexchange.com/q/228/277964), you are using MakeIndex and either package `makeidx` or `imakeidx`. In this case, you could use the *page number formatting feature* similar to adding a *see*, e.g., ``` \documentclass{article} \usepackage{imakeidx}% or just makeidx but imakeidx does the makeindex run automatically \makeindex \newcommand*{\passim}[1]{\textit{passim}} \begin{document} \index{Frege, Gottlob|passim} Just one more index entry: Franz Frege\index{Frege, Franz} \printindex \end{document} ``` See the `makeindex` manual for more information about using `|` (resp. the configured *encap character*). If this does not answer your question, please ask a new one with more details, i.e., a [minimal working example](https://tex.meta.stackexchange.com/q/228/277964), that can be used to understand and reproduce your problem.
0
https://tex.stackexchange.com/users/277964
690894
320,500
https://tex.stackexchange.com/questions/690907
3
When I define the Rust language in TeX Live 2023’s `lstlisting` like this: ``` \begin{lstlisting}[language=Rust] let config_redis_string: String = env::var("REDIS_URL").expect("redis url missing"); \end{lstlisting} ``` it does not seem to support the [Rust](https://www.rust-lang.org/) language. Is it possible to add support for `Rust`?
https://tex.stackexchange.com/users/69600
Does lstlisting support Rust?
true
Using the style from <https://github.com/denki/listings-rust> , the following seems to work fine: ``` \documentclass{article} \usepackage{listings, listings-rust} \begin{document} \begin{lstlisting}[language=Rust] let config_redis_string: String = env::var("REDIS_URL").expect("redis url missing"); \end{lstlisting} \end{document} ```
7
https://tex.stackexchange.com/users/36296
690908
320,505
https://tex.stackexchange.com/questions/690905
5
I'm trying to work with dates in Latex (via Overleaf) with the `datetime2` and `pdfgantt` packages. I have created a command to increment a date using `\DTMsavejulianday`. The below code shows that it is correctly computing the date, but it is not happy when passing the computed date into the `pdfgantt` package. In overleaf when I try to use the result of the `\startDatePlusDays` command it complains `missing number, being treated as zero`. Put simply, `\DTMsavedate` creates dates I can use, but `\DTMsavejulianday` does not. Where am I going wrong? **MWE**: ``` \documentclass[tikz]{standalone} \usepackage[calc]{datetime2} \usepackage{pgfgantt} \begin{document} \DTMsavedate{StartDate}{2023-10-02} \DTMsavedate{EndDate}{2023-10-22} % a command to add some days to a date \newcount\daycount \newcommand{\startDatePlusDays}[1]{% \DTMsaveddateoffsettojulianday{StartDate}{#1}\daycount% \DTMsavejulianday{newDate}{\number\daycount}% \DTMusedate{newDate}% } \newcommand\startDate{\DTMusedate{StartDate}} \newcommand\theEndDate{\DTMusedate{EndDate}} \newcommand\anotherEndDate{\startDatePlusDays{20}} %these look OK when printed theEndDate is \theEndDate\\ anotherEndDate is \anotherEndDate\\ %So why is anotherEndDate being treated as zero? \begin{ganttchart}[hgrid, vgrid, inline, time slot format=isodate]{\startDate}{\theEndDate} \gantttitlecalendar{month=name, day} \ganttnewline \ganttbar{This works}{\startDate}{\theEndDate}\\ \ganttbar{This does not}{\startDate}{\anotherEndDate}\\ \end{ganttchart} \end{document} ```
https://tex.stackexchange.com/users/300579
How to calculate dates to pass as arguments to pdfgantt?
true
Your diagnosis is not quite correct: there is nothing wrong with `\DTMsavejulianday`. The fundamental issue has to do with the expansion of several of the `\DTM...` macros. For example, if you had rewritten your preamble as follows: ``` \newcount\daycount \newcommand{\startDatePlusDays}[1]{% \DTMsaveddateoffsettojulianday{StartDate}{#1}\daycount% \DTMsavejulianday{newDate}{\number\daycount}% %\DTMusedate{newDate}% <= NOTE: \startDatePlusDays now just saves to newDate } \newcommand\startDate{\DTMusedate{StartDate}} \newcommand\theEndDate{\DTMusedate{EndDate}} \startDatePlusDays{15} % <= sets newDate \newcommand\anotherEndDate{\DTMusedate{newDate}} % <= uses newDate ``` then the code compiles perfectfly fine. But if you had defined `\theEndDate` as ``` \newcommand\theEndDate{\DTMsavedate{EndDate}{2023-10-22}\DTMusedate{EndDate}} ``` You would get exactly the same error you got before. The following makes for a workable interface: ``` \documentclass[tikz]{standalone} \usepackage[calc]{datetime2} \usepackage{pgfgantt} \begin{document} \DTMsavedate{StartDate}{2023-10-02} \DTMsavedate{EndDate}{2023-10-22} % a command to add some days to a date and save it \newcount\daycount \newcommand{\saveStartDatePlusDays}[2]{% \DTMsaveddateoffsettojulianday{StartDate}{#1}\daycount% \DTMsavejulianday{#2}{\number\daycount}% } \newcommand\startDate{\DTMusedate{StartDate}} \newcommand\theEndDate{\DTMusedate{EndDate}} \newcommand\gantoffset[2]{% \saveStartDatePlusDays{#2}{tempdate}% \ganttbar{#1}{\startDate}{\DTMusedate{tempdate}}% } \begin{ganttchart}[hgrid, vgrid, inline, time slot format=isodate]{\startDate}{\theEndDate} \gantttitlecalendar{month=name, day} \ganttnewline \ganttbar{This works}{\startDate}{\theEndDate}\\ \gantoffset{This also works}{15}\\ \gantoffset{This does too!}{13} \end{ganttchart} \end{document} ```
5
https://tex.stackexchange.com/users/119
690916
320,508
https://tex.stackexchange.com/questions/690932
1
I am working on importing physics lab manuals that were written in TeX to Overleaf so that our faculty can collaborate and update the content. Everything is working flawlessly, except for inserting images. The images were added using the commands `\figure\midfigure` and `\figure\topfigure` originally in Tex, but Overleaf is not rendering the .eps images (regardless of compiler and latexmkrc settings). The definitions I've found for \figure and \midfigure are as follows: ``` \def\figure#1,#2x#3.{\par\vbox to#2bp{\vss \special{psfile="figures/#1" voffset=0 hoffset=#3 vscale=100 hscale=100}}} ``` ``` \def\figure#1"#2" #3 to #4, #5.{\global\advance\fignum by1 #1 \oldpicheight=#3bp \picheight=#4 \scaling=\picheight \multiply\scaling by100 \divide\scaling by\oldpicheight \vbox to#4{\vss\special{psfile="../figures/#2" voffset=0 hoffset=#5 hscale=\number\scaling vscale=\number\scaling\ }} \ifx\relax\thecaption\else{\narrower\narrower\noindent\thecaption\par}\fi \endinsert \global\let\thecaption=\relax} % Syntax: \topfig"name.jpg" <height>[in pixels] to <height>[on page], <hoffset> "caption" ``` ``` \def\topfig{\figure\topinsert} % \topfig "filename" {old height in points} to {new height}, {hoffset}. \def\midfig{\figure\midinsert} \def\pagefig{\figure\pageinsert} ``` *The workaround I have found is using LaTeX packages via:* `\input miniltx.tex` `\input graphicx.sty` And by replacing the image code with something like this: `\includegraphics[height=4.5in,width=5.5in]{figures/Titlepicture.eps}` **All of pictures are now showing, but unfortunately, some of these pictures need a horizontal offset and I can't figure out how to add that. I tried to incorporate the figure environment like in this tutorial (<https://www.overleaf.com/learn/latex/Inserting_Images>) but had no luck. The new code is working great except for not being able to add a horizontal offset. I tried variations of `\centerline` and `\centering` with no success. Thank you!** On Overleaf, I'm using the LaTex compiler with TeX live version 2020 (legacy). The original code says it was written in XeTex. Here is my latexmkrc file: ``` #$latex = 'tex %O %S'; # to use Knuth's original TeX engine #$latex = 'pdftex %O %S'; # to use the pdfTeX engine #$latex = 'luatex %O %S'; # to use the LuaTeX engine $latex = 'xetex %O %S'; # to use the XeTeX engine ```
https://tex.stackexchange.com/users/300595
Plain TeX Image Workaround For Lab Manuals
false
The first `\figure` definition is probably been override so it has no use. The thing needs to be updated is the second `\figure`. Since there are some dependency not know I have not run test samples my self, but this macro should be compatible with the original one. ``` \def\figure#1"#2" #3 to #4, #5.{\global\advance\fignum by1 #1 \oldpicheight=#3bp \picheight=#4 \scaling=\picheight \divide\scaling by\oldpicheight \vbox to #4{\vss\leavevmode\kern#5pt\includegraphics[scale=\number\scaling]{../figures/#2}} \ifx\relax\thecaption\else{\narrower\narrower\noindent\thecaption\par}\fi \endinsert \global\let\thecaption=\relax} % Syntax: \topfig"name.jpg" <height>[in pixels] to <height>[on page], <hoffset> "caption" ``` However if you want to get rid of the old macros, which I think you should do, you may reference my previous answer. --- **Previous answer:** It seems the manuals requires XeTeX to be compiled, and `\figure` seems to be a custom made macro. You problem with the figures not horizontally align is because `graphicx` itself does not middle align images. You can to that by using `\centerline{#1}` which is essentially the same as something like `\hbox{\hfil#1\hfil}`. My workaround would be redefine `\figure` to use `graphicx` package. I implemented the macro by purely guessing about the `\midfigure` means use plain TeX's `\midinsert` and `\topfigure` means use `\topinsert` and based on what I use to insert figures in pdfTeX. You may adapt the third argument if you don't need the caption, and maybe include `\includegraphics` inside the macro if not going to adjust size of pictures. The example below tested on Overleaf with XeTeX, although I didn't test agains EPS specifically but it should work. latexmkrc: ``` $latex = 'xetex %O %S'; ``` ``` \input graphicx \def\figure#1#2#3{% \edef\instr{\string#1} \edef\midfigstr{\string\midfigure} \edef\topfigstr{\string\topfigure} \ifx\instr\midfigstr \midinsert \else \ifx\instr\topfigstr \topinsert \else \errmessage{What is #1?} \fi\fi \centerline{#2}\par \centerline{#3}\endinsert} This is good. Text Text$\ldots$ \figure\midfigure{\includegraphics{a.png}}{Figure 1: this is an image.} \vfil\eject %new page This is good. Text Text$\ldots$ \figure\topfigure{\includegraphics{a.png}}{Ok.} \bye ``` First page (`\midfigure`) Second page (`\topfigure`)
0
https://tex.stackexchange.com/users/246082
690935
320,517
https://tex.stackexchange.com/questions/690686
1
I'm using this macro to scale my pgfplots to a desired size: ``` \newsavebox{\measuredSize} \newcounter{int} \newcommand{\resizeToMeasure}[3]{% \pgfmathsetmacro{\pgfplotswidthtarget}{#2}% \pgfmathsetmacro{\pgfplotswidth}{#2}% \pgfmathsetmacro{\pgfplotsheighttarget}{#3}% \pgfmathsetmacro{\pgfplotsheight}{#3}% \setcounter{int}{1}% \loop% \addtocounter{int}{1}% \begin{lrbox}{\measuredSize}% \tikzset{external/export next=false,external/optimize=false}% \input{#1}% \end{lrbox}% \pgfmathsetmacro{\pgfplotswidth}{\pgfplotswidth+\pgfplotswidthtarget-\wd\measuredSize}% \pgfmathsetmacro{\pgfplotsheight}{\pgfplotsheight+\pgfplotsheighttarget-\ht\measuredSize}% \ifnum \value{int}<\nIter \repeat \filename@parse{#1} \tikzsetnextfilename{\filename@base} \input{#1}} ``` However, when recompling without making changes to a `pgfplots` file I don't want to loop over that file again but just use the created pdf from the `external` library. So I thought it would be a nice idea to make a manual check for that file and omit the loop once the file is up to date. In the library source code I found that `\def\tikzexternal@externalizefig@systemcall@uptodatecheck#1` makes that check and takes the content of the `tikzpicture` as the argument #1. Now my problem is, I cannot find out how the library reads the tikzpicture to put it in that function. Here's a MWE: ``` \documentclass{standalone} \usepackage{tikz} \usepackage{pgfplots} \pgfplotsset{compat=newest} \usepackage{filecontents} \usetikzlibrary{external} \makeatletter \newsavebox{\measuredSize} \newcounter{int} \newcommand{\resizeToMeasure}[3]{% \pgfmathsetmacro{\pgfplotswidthtarget}{#2}% \pgfmathsetmacro{\pgfplotswidth}{#2}% \pgfmathsetmacro{\pgfplotsheighttarget}{#3}% \pgfmathsetmacro{\pgfplotsheight}{#3}% \setcounter{int}{1}% \loop% \addtocounter{int}{1}% \begin{lrbox}{\measuredSize}% \tikzset{external/export next=false,external/optimize=false}% \input{#1}% \end{lrbox}% \pgfmathsetmacro{\pgfplotswidth}{\pgfplotswidth+\pgfplotswidthtarget-\wd\measuredSize}% \pgfmathsetmacro{\pgfplotsheight}{\pgfplotsheight+\pgfplotsheighttarget-\ht\measuredSize}% \ifnum \value{int}<5 \repeat \filename@parse{#1} \tikzsetnextfilename{\filename@base} \input{#1}} \makeatother \begin{document} \begin{filecontents*}{tikzpicture01.tikz} \begin{tikzpicture} \begin{axis}[ height=\pgfplotsheight, width=\pgfplotswidth ] \addplot coordinates { ( 1.5, 1.28 ) ( 1.75, 1.43 ) ( 2.0, 1.59 ) ( 2.25, 1.75 ) ( 2.5, 1.91 ) ( 2.75, 2.07 ) ( 3.0, 2.23 ) }; \end{axis} \end{tikzpicture} \end{filecontents*} \resizeToMeasure{tikzpicture01.tikz}{7cm}{7cm} \end{document} ```
https://tex.stackexchange.com/users/272334
Tikz Externalize: Manual up-to-date check
true
Ok, I figured out a solution how to make that manual up-to-date check. Unfortunately, I couldn't find a way to use the interal macros from the `external` library but therefore wrote my own macro `\make@uptodate@check` that is very similar to the ones used in the package. ``` \def\make@uptodate@check#1{ \def\scanText{}% \def\name@tikzpicture{tikzpicture}% \CatchFileDef{\myTikz}{#1}{}% \long\def\collect@tikz@from@begin##1\begin##2{% \def\name@environment@begin{##2}% \ifx\name@environment@begin\name@tikzpicture% \expandafter\collect@tikz@after@begin% \else% \expandafter\collect@tikz@from@begin% \fi% } \long\def\collect@tikz@after@begin##1\end##2{% \def\name@environment@end{##2}% \ifx\name@tikzpicture\name@environment@end% \g@addto@macro\scanText{##1} \else% \g@addto@macro\scanText{##1\end{##2}}% \expandafter\collect@tikz@after@begin% \fi% } \expandafter\collect@tikz@from@begin\myTikz \filename@parse{#1}% \tikzsetnextfilename{\filename@base}% \expandafter\tikzexternal@check@uptodate@mode\expandafter{\scanText}% } ``` For checking if the picture has to be updated, it extracts the content from the `tikzpicture` environment and passes it to `\tikzexternal@check@uptodate@mode` from the `external` library which also updates `\tikzexternal@file@isuptodate`. Then in `resizeToMeasure` it checks if the file is up-to-date to skip the for loop and directly insert the pdf file. Here is a full MWE: ``` \documentclass{article} \usepackage{tikz} \usepackage{catchfile} \usepackage{pgfplots} \usetikzlibrary{external} % \tikzexternalize \makeatletter \def\make@uptodate@check#1{ \def\scanText{}% \def\name@tikzpicture{tikzpicture}% \CatchFileDef{\myTikz}{#1}{}% \long\def\collect@tikz@from@begin##1\begin##2{% \def\name@environment@begin{##2}% \ifx\name@environment@begin\name@tikzpicture% \expandafter\collect@tikz@after@begin% \else% \expandafter\collect@tikz@from@begin% \fi% } \long\def\collect@tikz@after@begin##1\end##2{% \def\name@environment@end{##2}% \ifx\name@tikzpicture\name@environment@end% \g@addto@macro\scanText{##1} \else% \g@addto@macro\scanText{##1\end{##2}}% \expandafter\collect@tikz@after@begin% \fi% } \expandafter\collect@tikz@from@begin\myTikz \filename@parse{#1}% \def\tikzexternal@curfilename{\tikzexternal@filenameprefix\filename@base}% \expandafter\tikzexternal@check@uptodate@mode\expandafter{\scanText}% } \def\pgfmathsetglobalmacro#1#2{\pgfmathparse{#2}% \global\let#1\pgfmathresult} \newsavebox{\measuredSize} \newcounter{int} \newcommand{\resizeToMeasure}[3]{% \pgfmathsetglobalmacro{\pgfplotswidthtarget}{#2}% \pgfmathsetglobalmacro{\pgfplotswidth}{#2}% \pgfmathsetglobalmacro{\pgfplotsheighttarget}{#3}% \pgfmathsetglobalmacro{\pgfplotsheight}{#3}% \make@uptodate@check{#1}% \filename@parse{#1}% \iftikzexternal@file@isuptodate% \typeout{File is up to date! No loop needed!}% \tikzsetnextfilename{\filename@base} \input{#1}% \else% \typeout{Update File!}% \setcounter{int}{1} \loop \typeout{1} \addtocounter{int}{1} \begin{lrbox}{\measuredSize}\tikzset{external/export next=false,external/optimize=false}\input{#1}\end{lrbox}% \typeout{2} \pgfmathsetglobalmacro{\pgfplotswidth}{\pgfplotswidth+\pgfplotswidthtarget-\wd\measuredSize}% \pgfmathsetglobalmacro{\pgfplotsheight}{\pgfplotsheight+\pgfplotsheighttarget-\ht\measuredSize}% \typeout{3} \ifnum \value{int}<3% \repeat% \tikzset{external/force remake} \tikzsetnextfilename{\filename@base} \input{#1}% \fi% } \makeatother \begin{document} \begin{filecontents*}{tikzpicture01.tikz} \begin{tikzpicture} \begin{axis}[ height=\pgfplotsheight, width=\pgfplotswidth ] \addplot coordinates { ( 1.5, 1.28 ) ( 1.75, 1.43 ) ( 2.0, 1.59 ) ( 2.25, 1.75 ) ( 2.5, 1.91 ) ( 2.75, 2.07 ) ( 3.0, 2.23 ) }; \end{axis} \end{tikzpicture} \end{filecontents*} \resizeToMeasure{tikzpicture01.tikz}{7cm}{7cm} \end{document} ```
0
https://tex.stackexchange.com/users/272334
690941
320,521
https://tex.stackexchange.com/questions/690656
1
There was a problem to slightly change the macro described in [Expandable macro that extracts the first character of UTF-8/cyrillic string without additional packages](https://tex.stackexchange.com/questions/631869/expandable-macro-that-extracts-the-first-character-of-utf-8-cyrillic-string-with) for the argument which may contain two or more words. That is, for example, for the argument Vladimir Fedorovich it would return V.F., and for Владимир Фёдорович - В.Ф. Here is a working example by the highly respected **David Carlisle** for a one-word argument (of course it can contain many words, but only the first letter of the first word will be extracted): ``` \documentclass{article} \usepackage[T2A]{fontenc} \usepackage[utf8]{inputenc} \usepackage[russian]{babel} \makeatletter \newcommand{\firstof}[1]{\expandafter\checkfirst#1\@nil} \def\checkfirst#1{% \ifx\UTFviii@two@octets#1% \expandafter\gettwooctets \else \expandafter\@car\expandafter#1% \fi } \def\gettwooctets#1#2#3\@nil{\UTFviii@two@octets#1#2} \makeatother \begin{document} \firstof{Vladimir} \firstof{Владимир} \end{document} ``` I need the `\firstof{Vladimir Fedorovich}` macro call to return `V.F.` and the call `\firstof{Владимир Фёдорович}` - `В.Ф.`. But theoretically, there can be more than 2 words in the argument. I will be grateful for help.
https://tex.stackexchange.com/users/73294
Expandable macro that extracts the first characters of many words for UTF-8/cyrillic or UTF-8/ASCII string without additional packages
false
With `expl3` there is `\text_map_inline:nn` that can do what you want. The idea is to just break the mapping after the first item, adding the desired period. ``` \documentclass{article} \usepackage[T2A]{fontenc} \usepackage[utf8]{inputenc} \usepackage[russian]{babel} \ExplSyntaxOn \NewDocumentCommand{\firstof}{m} { \crosfield_firstof:n { #1 } } \seq_new:N \l__crosfield_firstof_items_seq \cs_new_protected:Nn \crosfield_firstof:n { % split the input at spaces \seq_set_split:Nnn \l__crosfield_firstof_items_seq { ~ } { #1 } % extract the first item and add a period \seq_map_function:NN \l__crosfield_firstof_items_seq \__crosfield_firstof:n } \cs_new_protected:Nn \__crosfield_firstof:n {% map the elements, breaking after the first \text_map_inline:nn { #1 } { ##1 \text_map_break:n { . } } } \ExplSyntaxOff \begin{document} \firstof{Vladimir} \firstof{Владимир} \firstof{Vladimir Fedorovich} \firstof{Владимир Фёдорович} \end{document} ``` Borrowing some code from Skillmon's answer we can get expandability. ``` \documentclass{article} \usepackage[T2A]{fontenc} \usepackage[utf8]{inputenc} \usepackage[russian]{babel} \ExplSyntaxOn \NewExpandableDocumentCommand{\firstof}{m} { \crosfield_firstof:n { #1 } } \cs_new:Npn \crosfield_firstof:n #1 { \exp_not:e { \__crosfield_firstof:n { #1 } } } \group_begin: \cs_set:Npn \__crosfield_tmp:n #1 { \cs_new:Nn \__crosfield_firstof:n { \__crosfield_firstof_item:w ##1 #1 % #1 is a space \q_recursion_tail #1 % #1 is a space \q_recursion_stop } } \__crosfield_tmp:n { ~ } \group_end: \cs_generate_variant:Nn \__crosfield_firstof:n { e } \cs_new:Npn \__crosfield_firstof_item:w #1 ~ { \quark_if_recursion_tail_stop:n { #1 } \text_map_function:nN { #1 } \__crosfield_firstof_do:n \__crosfield_firstof_item:w } \cs_new:Nn \__crosfield_firstof_do:n { #1 \text_map_break:n { . } } \ExplSyntaxOff \begin{document} \firstof{Vladimir} \firstof{Владимир} \firstof{Vladimir Fedorovich} \firstof{Владимир Фёдорович} \edef\test{\firstof{Владимир Фёдорович}} \show\test \end{document} ``` The `\show` command will print ``` > \test=macro: ->В.Ф.. ``` on the console, witnessing the full expandability.
3
https://tex.stackexchange.com/users/4427
690944
320,524
https://tex.stackexchange.com/questions/690802
1
I have a problem with setting up the glossaries package in my latex project. The project is build up from different files: thesis.tex preambel.tex versuch.tex (this is a file for the glossary entries) (further tex-files for each chapter) The main problem is, that the glossary is not being printed. Might be, that some other problems are attached to it, which i don't know about. These are the mentioned files, i have copied the whole file and marked the parts dealing with the glossary with two stars \*\* thesis.tex contains: ``` % Sprache für das Dokument festlegen \newcommand{\hsmasprache}{de} % de oder en für Deutsch oder Englisch % Preambel mit Einstellungen importieren \input{preambel} % Dokumenteninfos importieren \input{docinfo.tex} % Literatur-Datenbank \addbibresource{literatur.bib} % BibLaTeX-Datei mit Literaturquellen einbinden \bibliography{literatur} % Anfang des Dokuments \begin{document} \frontmatter % Römische Ziffern für die "Front-Matter" \setcounter{page}{0} \changefont{phv}{m}{n} % Helvetica für den Fließtext \renewcommand{\rmdefault}{phv} % Titelblatt \input{titelblatt} % Inhaltsverzeichnis erzeugen \setcounter{tocdepth}{3} \setcounter{secnumdepth}{3} \cleardoublepage \pdfbookmark{\contentsname}{Contents} \tableofcontents % Korrigiert Nummerierung bei mehrseitigem Inhaltsverzeichnis \cleardoublepage \newcounter{frontmatterpage} \setcounter{frontmatterpage}{\value{page}} % Arabische Zahlen für den Hauptteil \mainmatter **% Abkürzungsverzeichnis %\addchap{\hsmaabbreviations} %\input{kapitel/abkuerzungen} \printglossaries %\input{versuch}** % Den Hauptteil mit vergrößertem Zeilenabstand setzen \onehalfspacing % ------------------------------------------------------------------ % Hauptteil der Arbeit \input{kapitel/kapitel1} % Externe Datei einbinden %\input{kapitel/kapitel2} %\input{kapitel/kapitel3} % ------------------------------------------------------------------ \label{lastpage} % Neue Seite \cleardoublepage % Backmatter mit normalem Zeilenabstand setzen \singlespacing % Römische Ziffern für die "Back-Matter", fortlaufend mit "Front-Matter" \pagenumbering{roman} \setcounter{page}{\value{frontmatterpage}} % Tabellenverzeichnis erzeugen \cleardoublepage \phantomsection \addcontentsline{toc}{chapter}{\hsmalistoftables} \listoftables % Abbildungsverzeichnis erzeugen \cleardoublepage \phantomsection \addcontentsline{toc}{chapter}{\hsmalistoffigures} \listoffigures % Listingverzeichnis erzeugen. Wenn Sie keine Listings haben, % entfernen Sie einfach diesen Teil. % \cleardoublepage % \phantomsection % \addcontentsline{toc}{chapter}{\hsmalistings} % \lstlistoflistings % Literaturverzeichnis erzeugen \begingroup \cleardoublepage \begin{flushleft} \let\clearpage\relax % Fix für leere Seiten (issue #25) \printbibliography \end{flushleft} \endgroup % Index ausgeben. Wenn Sie keinen Index haben, entfernen Sie einfach % diesen Teil. Die meisten Abschlussarbeiten haben *keinen* Index. %\cleardoublepage %\phantomsection %\addcontentsline{toc}{chapter}{\hsmaindex} %\printindex % Anhang. Wenn Sie keinen Anhang haben, entfernen Sie einfach % diesen Teil. %\appendix %\input{kapitel/anhang-a} %\input{kapitel/anhang-b} \end{document} ``` preambel.tex: ``` % Dokumententyp und benutzte Pakete \documentclass[open=right, % Kapitel darf nur auf rechten Seite beginnen paper=a4, % DIN-A4-Papier fontsize=12pt, % Schriftgöße headings=small, % Kleine Überschriften headsepline=true, % Trennlinie am Kopf der Seite footsepline=false, % Keine Trennlinie am Fuß der Seite bibliography=totoc, % Literaturverzeichnis in das Inhaltsverzeichnis aufnehmen twoside=off, % Doppelseitiger Druck - auf off stellen für einseitig DIV=7, % Verhältnis der Ränder zum bedruckten Bereich chapterprefix=true, % Kapitel x vor dem Kapitelnamen cleardoublepage=plain]{scrbook} % Pakete einbinden, die benötigt werden \usepackage{ifthen} % Logische Bedingungen mit ifthenelse \usepackage{scrlayer-scrpage} % Erweiterte Einstellungen an scrbook zulassen \usepackage[utf8]{inputenc} % Dateien in UTF-8 benutzen \usepackage[T1]{fontenc} % Zeichenkodierung \usepackage{graphicx} % Bilder einbinden \usepackage{enumitem} % Eigene Listen definieren können \usepackage{setspace} % Abstände korrigieren \usepackage{tikz} \usepackage{textgreek} \usepackage{float} % Setzen von Optionen abhängig von der gewählten Sprache. Die Sprache wird % in thesis.tex gesetzt. \ifthenelse{\equal{\hsmasprache}{de}} % {% \usepackage[main=ngerman, english]{babel} % Deutsche Sprachunterstützung \usepackage[autostyle=true,german=quotes]{csquotes} % Deutsche Anführungszeichen \usepackage[pagebackref=false,german]{hyperref} % Hyperlinks \newcommand{\hsmasortlocale}{de_DE} % Sortierung der Literatur }% {% \usepackage[main=english, ngerman]{babel} % Englische Sprachunterstützung \usepackage[autostyle=true,english=american]{csquotes} % Englische Anführungszeichen \usepackage[pagebackref=false,english]{hyperref} % Hyperlinks \newcommand{\hsmasortlocale}{en_US} % Sortierung der Literatur }% \usepackage{xcolor} % Unterstützung für Farben \usepackage{amsmath} % Mathematische Formeln \usepackage{amsfonts} % Mathematische Zeichensätze \usepackage{amssymb} % Mathematische Symbole \usepackage{float} % Fließende Objekte (Tabellen, Grafiken etc.) \usepackage{booktabs} % Korrekter Tabellensatz %\usepackage[printonlyused]{acronym} % Abkürzungsverzeichnis [nur verwendete Abkürzungen] **\usepackage{glossaries} \makeglossaries \loadglsentries{versuch}** \usepackage{makeidx} % Sachregister \usepackage{multicol} \usepackage{listings} % Quelltexte \usepackage{listingsutf8} % Quelltexte in UTF8 \usepackage[hang,font={sf,footnotesize},labelfont={footnotesize,bf}]{caption} % Beschriftungen \usepackage[scaled]{helvet} % Schrift Helvetia laden \usepackage[absolute]{textpos} % Absolute Textpositionen (für Deckblatt) \usepackage{calc} % Berechnung von Positionen \usepackage{blindtext} % Blindtexte \usepackage[bottom=40mm,left=35mm,right=35mm,top=30mm]{geometry} % Ränder ändern \usepackage{scrhack} % tocbasic Warnung entfernen \usepackage[all]{hypcap} % Korrekte Verlinkung von Floats \usepackage{tabularx} % Spezielle Tabellen \usepackage{longtable,lscape} \usepackage{adjustbox} \usepackage{color} \usepackage{transparent} \usepackage{subfig} %\usepackage{pgfplots} \newcolumntype{Y}{>{\raggedright\arraybackslash}p} \usepackage[backend=biber, isbn=false, % ISBN nicht anzeigen, gleiches geht mit nahezu allen anderen Feldern sortlocale=\hsmasortlocale, % Sortierung der Einträge für Deutsch % de_DE: für Deutsch % en_US: für Englisch autocite=inline, % regelt Aussehen für \autocite % inline: Zitat in Klammern (\parancite) % footnote: Zitat in Fußnoten (\footcite) % plain: Zitat direkt ohne Klammern (\cite) style=alphabetic, % Legt den Stil für die Zitate fest % ieee: Zitate als Zahlen [1] % alphabetic: Zitate als Kürzel und Jahr [Ein05] % authoryear: Zitate Author und Jahr [Einstein (1905)] hyperref=true, % Hyperlinks für Zitate firstinits=true % Vornamen abkürzen (Maier, M. anstatt Maier, Markus)? % true: abkürzen % false: nicht abkürzen ]{biblatex} % Literaturverwaltung mit BibLaTeX \usepackage{rotating} % Seiten drehen \usepackage{harveyballs} % Harveyballs \usepackage{chngcntr} % Counter (Zähler) ändern können - für Fußnotennummern % Einstellungen zu den Fußnoten \renewcommand{\footnotesize}{\fontsize{9}{10}\selectfont} % Größe der Fußnoten \setlength{\footnotesep}{8pt} % Abstand zwischen den Fußnoten % Kommentieren Sie diese Zeile ein, wenn Sie eine "durchlaufende" Nummerierung bei den % Fußnoten wünschen, d.h. wenn die Fußnoten nicht bei jedem Kapitel wieder bei 1 % beginnen sollen. %\counterwithout{footnote}{chapter} \setlength{\bibitemsep}{1em} % Abstand zwischen den Literaturangaben \setlength{\bibhang}{2em} % Einzug nach jeweils erster Zeile % Trennung von URLs im Literaturverzeichnis (große Werte [> 10000] verhindern die Trennung) \defcounter{biburlnumpenalty}{10} % Strafe für Trennung in URL nach Zahl \defcounter{biburlucpenalty}{500} % Strafe für Trennung in URL nach Großbuchstaben \defcounter{biburllcpenalty}{500} % Strafe für Trennung in URL nach Kleinbuchstaben % Farben definieren \definecolor{linkblue}{RGB}{0, 0, 100} \definecolor{linkblack}{RGB}{0, 0, 0} \definecolor{comment}{RGB}{63, 127, 95} \definecolor{darkgreen}{RGB}{14, 144, 102} \definecolor{darkblue}{RGB}{0,0,168} \definecolor{darkred}{RGB}{128,0,0} \definecolor{javadoccomment}{RGB}{0,0,240} % Einstellungen für das Hyperlink-Paket \hypersetup{ colorlinks=true, % Farbige links verwenden % allcolors=linkblue, linktoc=all, % Links im Inhaltsverzeichnis linkcolor=linkblack, % Querverweise citecolor=linkblack, % Literaturangaben filecolor=linkblack, % Dateilinks urlcolor=linkblack % URLs } %Java-Script spezifisch: \definecolor{lightgray}{rgb}{.9,.9,.9} \definecolor{darkgray}{rgb}{.4,.4,.4} \definecolor{purple}{rgb}{0.65, 0.12, 0.82} \lstdefinelanguage{JavaScript}{ keywords={typeof, new, true, false, catch, function, return, null, catch, switch, var, if, in, while, do, else, case, break}, keywordstyle=\color{blue}\bfseries, ndkeywords={class, export, boolean, throw, implements, import, this}, ndkeywordstyle=\color{darkgray}\bfseries, identifierstyle=\color{black}, sensitive=false, comment=[l]{//}, morecomment=[s]{/*}{*/}, commentstyle=\color{purple}\ttfamily, stringstyle=\color{red}\ttfamily, morestring=[b]', morestring=[b]" } % Einstellungen für Quelltexte \lstset{ language=JavaScript, extendedchars=true, xleftmargin=0.2cm, basicstyle=\footnotesize\ttfamily, keywordstyle=\color{darkgreen}, identifierstyle=\color{darkblue}, commentstyle=\color{comment}, stringstyle=\color{darkred}, tabsize=2, lineskip={2pt}, columns=flexible, inputencoding=utf8, captionpos=b, breakautoindent=true, breakindent=2em, breaklines=true, prebreak=, postbreak=, numbers=none, numberstyle=\tiny, showspaces=false, % Keine Leerzeichensymbole showtabs=false, % Keine Tabsymbole showstringspaces=false,% Leerzeichen in Strings morecomment=[s][\color{javadoccomment}]{/**}{*/}, literate={Ö}{{\"O}}1 {Ä}{{\"A}}1 {Ü}{{\"U}}1 {ß}{{\ss}}2 {ü}{{\"u}}1 {ä}{{\"a}}1 {ö}{{\"o}}1 } \urlstyle{same} % Einstellungen für Überschriften \renewcommand*{\chapterformat}{% \Large\chapapp~\thechapter % Große Schrift \vspace{0.3cm} % Abstand zum Titel des Kapitels } % Abstände für die Überschriften setzen \renewcommand{\chapterheadstartvskip}{\vspace*{2.6cm}} \renewcommand{\chapterheadendvskip}{\vspace*{1.5cm}} % Vertikale Abstände für die Überschriften etwas verkleinern \RedeclareSectionCommand[ beforeskip=-1.8\baselineskip, afterskip=0.25\baselineskip]{section} \RedeclareSectionCommand[ beforeskip=-1.8\baselineskip, afterskip=0.15\baselineskip]{subsection} \RedeclareSectionCommand[ beforeskip=-1.8\baselineskip, afterskip=0.15\baselineskip]{subsubsection} % In der Kopfzeile nur die kurze Kapitelbezeichnung (ohne Kapitel davor) \renewcommand*\chaptermarkformat{\thechapter\autodot\enskip} \automark[chapter]{chapter} % Einstellungen für Schriftarten \setkomafont{pagehead}{\normalfont\sffamily} \setkomafont{pagenumber}{\normalfont\sffamily} \setkomafont{paragraph}{\sffamily\bfseries\small} \setkomafont{subsubsection}{\sffamily\itshape\bfseries\small} \addtokomafont{footnote}{\footnotesize} \setkomafont{chapter}{\LARGE\selectfont\bfseries} % Wichtige Abstände \setlength{\parskip}{0.2cm} % 2mm Abstand zwischen zwei Absätzen \setlength{\parindent}{0mm} % Absätze nicht einziehen \clubpenalty = 10000 % Keine "Schusterjungen" \widowpenalty = 10000 % Keine "Hurenkinder" \displaywidowpenalty = 10000 % Keine "Hurenkinder" % Siehe: https://de.wikipedia.org/wiki/Hurenkind_und_Schusterjunge % Index erzeugen \makeindex % Einfacher Font-Wechsel über dieses Makro \newcommand{\changefont}[3]{ \fontfamily{#1} \fontseries{#2} \fontshape{#3} \selectfont} % Eigenes Makro für Bilder. Das label (für \ref) ist dann einfach % der Name der Bilddatei \newcommand{\bild}[3]{ \begin{figure}[ht] \centering \includegraphics[width=#2]{#1} \caption{#3} \label{#1} \end{figure}} % Wo liegt Sourcecode? \newcommand{\srcloc}{src/} % Wo sind die Bilder? \graphicspath{{bilder/}} % Makros für typographisch korrekte Abkürzungen \newcommand{\zb}[0]{z.\,B.} \newcommand{\dahe}[0]{d.\,h.} \newcommand{\ua}[0]{u.\,a.} % Flags für Veröffentlichung und Sperrvermerk \newboolean{hsmapublizieren} \newboolean{hsmasperrvermerk} % Tabellenzellen mit mehreren Zeilen \newcolumntype{L}{>{\raggedright\arraybackslash}X} \newcolumntype{b}{l} \newcolumntype{s}{>{\hsize=.3\hsize}l} \newcolumntype{F}{>{\hsize=\dimexpr2\hsize+2\tabcolsep+\arrayrulewidth\relax}X} % Checklisten mit zwei Ebenen \newlist{checklist}{itemize}{2} \setlist[checklist]{label=$\square$} ``` versuch.tex: ``` \newglossaryentry{LIP} {name=lip, description={Lippe ist ein Kreis} } ``` chapter1.tex: ``` \gls{LIP} ``` The link in chapter1 is being made, but it just leads me to the beginning of the pdf. I tried different approaches like using \makenoidxglossaries and \printnoidxglossaries; trying to use \input{versuch} to print it out Any help would be much appreciated, thank you
https://tex.stackexchange.com/users/300511
Latex Glossaries in separate files doesn't work
false
**This is not an answer but it is too long for a comment** It is hard to tell exactly what is going on with such a long code, possibly full of stuff not necessary to show your problem. Always try to post a [MWE](https://tex.meta.stackexchange.com/q/228/140456). An example showing how to use `glossaries` package is: ``` \documentclass{article} \usepackage{hyperref} \usepackage{glossaries} \makeglossaries \newglossaryentry{LIP} {name=lip, description={Lippe ist ein Kreis} } \begin{document} \gls{LIP} \printglossary \end{document} ``` The order is important! Glossary entries should be after `\makeglossaries`, `glossaries` package should be loaded after `hyperref` and both should be almost the last two packages in your preamble (see [here](https://tex.stackexchange.com/q/1863/140456) for some details). Finally the compilation chain should be: ``` pdflatex filename.tex makeglossaries filename pdflatex filename.tex pdflatex filename.tex ``` More information can be found in the documentation of the package and you can see some working examples (with different styles) in [Dickymaw Books](https://www.dickimaw-books.com/gallery/index.php?topic=glossaries#glossaries). --- If the commentary is not useful, just let me know and I delete it to avoid confusion.
1
https://tex.stackexchange.com/users/140456
690945
320,525
https://tex.stackexchange.com/questions/690914
0
I am attempting to draw an Argand diagram, with a circle centred at (0, −16*π*), radius 16*π*. The issues are that my diagram has the real and imaginary axes adjacent to the axis, but I would like the labels to be directly above the imaginary axis for Im and directly to the right of the real axis (currently it is appearing above the real axis. I also want to have the axes labelled in terms of pi so they go like −32*π*, −16*π*, 0, 16*π*, 32*π*. Currently I haven't managed to get my axes in terms of *π*. Here is a snippet of my code: ``` \begin{tikzpicture} \begin{axis}[ xmin=-32*pi, xmax=32*pi, ymin=-32*pi*i, ymax=32*pi*i, axis equal, axis lines=middle, xlabel=Re\{$\mathcal{A}(s)$\}, ylabel=Im\{$\mathcal{A}(s)$\}, disabledatascaling] \fill [opacity=0.2] (0,-16*pi) circle [radius=16*pi]; \end{axis} \end{tikzpicture} \end{center} ```
https://tex.stackexchange.com/users/300109
Latex drawing Argand Diagram with axes in terms of pi?
false
You could just draw it directly. This one is done with `lualatex` using the built-in [Metapost](http://www.tug.org/metapost.html) language. You need to compile this with `lualatex`. ``` \documentclass[border=5mm]{standalone} \usepackage{luamplib} \begin{document} \mplibtextextlabel{enable} \begin{mplibcode} beginfig(1); numeric pi; 72 pi = 288; % this is an arbitrary scale, so that pi is drawn as 4pt % define the axes path real, imag; real = (left -- right) scaled 36 pi; imag = real rotated 90; % fullcircle paths have unit *diameter* path C; C = fullcircle scaled 32 pi shifted (0, -16 pi); fill C withcolor 7/8[blue, white]; % add some labels -- not sure that zero is needed for i=-32, -16, 16, 32: draw (origin -- 3 down) shifted (i*pi, 0); label.bot("$" & decimal i & "\pi$", (i*pi, -3)); draw (origin -- 3 left) shifted (0, i*pi); label.lft("$" & decimal i & "\pi$", (-3, i*pi)); endfor % draw the axes drawarrow real; label.rt("$\mathcal{A}(s)$", point 1 of real); drawarrow imag; label.top("$\mathcal{A}(s)$", point 1 of imag); endfig; \end{mplibcode} \end{document} ``` Follow the link at the top to learn more about MP.
2
https://tex.stackexchange.com/users/15036
690952
320,529
https://tex.stackexchange.com/questions/690951
1
Does anyone know how to change the separator between author names when I cite them in the text? Let me explain better when I cite in the text the book it gives me as output "Karatzas `and` Shreve" but what I would like would be something like "Karatzas `e` Shreve". Basically I would like to replace the English word `and` with the Italian equivalent `e`. I see that there is the `\setcitestyle` command that accepts several parameters but none of them seems to give me a solution. I leave the following MWE ``` \documentclass[11pt, a4paper, final]{scrbook} \usepackage[usenames,dvipsnames]{xcolor} \usepackage{hyperref} \hypersetup{ hidelinks, linktocpage=false, colorlinks=true, citecolor=NavyBlue, linkcolor=NavyBlue, urlcolor=NavyBlue, } \usepackage[square]{natbib} \bibliographystyle{plainnat} \begin{document} \chapter{A Wonderful Chapter} As seen in \cite{ShreveKaratzas1991} \bibliography{reference.bib} \end{document} ``` and the `reference.bib` file ``` @book{ShreveKaratzas1991, edition = {2. ed}, isbn = {0-387-97655-8}, keywords = {Probabilità}, language = {eng}, publisher = {Springer}, series = {Graduate texts in mathematics}, title = {Brownian motion and stochastic calculus}, year = {1991}, author = {Karatzas, Ioannis and Shreve, Steven E.}, address = {New York}, booktitle = {Brownian motion and stochastic calculus}, } ``` Thank you to anyone who wants to help me out :)
https://tex.stackexchange.com/users/270888
How to change the conjunction word in citation call-outs?
true
One way is to start using Biblatex instead. Then it will use the language the text is in (if you state that for example by using the Babel package). Here is an example, where I haven't tried to exactly mimic what you currently have, but I did include a setting to use square parentheses, since you have that. ``` \documentclass{scrbook} \usepackage[italian]{babel} \usepackage[style=ext-authoryear, natbib]{biblatex} \DeclareInnerCiteDelims{textcite}{\bibopenbracket}{\bibclosebracket} \addbibresource{reference.bib} \begin{document} \chapter{A Wonderful Chapter} As seen in \citet{ShreveKaratzas1991} \printbibliography \end{document} ``` This will yield "Karatzas e Shreve [1991]".
1
https://tex.stackexchange.com/users/48251
690953
320,530
https://tex.stackexchange.com/questions/690836
1
I have a multi-language CV written in LuaLaTeX. To switch between the different languages I am using two Lua functions that are called through these TeX commands: ``` \directlua{code = require("code")} \newcommand{\lc}[1]{\directlua{code.sel_lang(#1)}} \newcommand{\setlang}{\directlua{code.set_lang()}} \begin{document} \setlang{} \lc{{ eng="Ravenna, Italy", ita="Ravenna, Italia", swe="Ravenna, Italien" }} \lc{{ eng="B.Sc.\\ in Computer Science", ita="Laurea triennale in Scienze Informatiche", swe="Kandidatexamen i datavetenskap" }} ``` The Lua code is the following: ``` -- Language Table local languages = {} languages["eng"] = "english" languages["ita"] = "italian" languages["swe"] = "swedish" -- Main Language local main_language = "english" -- Language defined in the jobname cmd parameter local cmd_language = string.sub(tex.jobname, -3) texio.write_nl("Command line language: "..cmd_language) local language = languages[cmd_language] -- Set language for TeX directives function set_document_language() texio.write_nl("Setting babel language") tex.sprint("\\selectlanguage{"..language.."}") end -- Print text in the desired language function select_language(langmap) if (langmap[cmd_language] == nil) then tex.sprint("!! Missing Text !!") end tex.sprint(langmap[cmd_language]) end return { sel_lang = select_language, set_lang = set_document_language } ``` This used to work with an older version of LuaLaTeX but now the "`\\`" after B.Sc. trigger the following error: ``` [\directlua]:1: invalid escape sequence near '"B.Sc.\A'. \lc #1->\directlua {code.sel_lang(#1)} ``` ### Attempt to fix the error To fix the error I have tried to pass the Lua function an escaped string instead: ``` \newcommand{\lc}[1]{\directlua{code.sel_lang("\luaescapestring{\unexpanded{#1}}")}} ``` and I have modified the Lua function as follows: ``` -- Print text in the desired language function select_language(langmap) texio.write_nl("String received:" ..langmap) --debug string = load("return "..langmap)() if (langmap[cmd_language] == nil) then tex.sprint("!! Missing Text !!") end tex.sprint(langmap[cmd_language]) end ``` but now I get errors like the following one: ``` String received:{ eng="ABOUT ME", ita="PRESENTAZIONE", swe="OM MIG" }...exmf-dist/tex/luatex/luaotfload/luaotfload-auxiliary.lua:970: attempt to call a nil value (field 'lower'). ``` where Lua is trying to call non-existent functions on the table structure. Can you give me an idea on how to proceed/what to try? I hope the issue is understandable and I apologize for any mistake and unclear explanation, I am not an expert in either Tex or Lua. Thank you very much!
https://tex.stackexchange.com/users/256530
Exchanging strings between TeX and Lua
true
The [luacode](https://www.ctan.org/pkg/luacode) package is probably best known for providing the `luacode` and `luacode*` environments. However, that's not all this package has to offer. In particular, it also provides three LaTeX macros for passing string variables from TeX to Lua. They are * `\luastring` -- fully expands its argument * `\luastringN` -- does *not* expand its argument * `\luastringO` -- expands its argument exactly *once* Importantly, the arguments of these macros are always treated as strings. E.g., `\luastring{1}` passes `1` as a *string* rather than as an *integer* to Lua. Using `\luastringN`, you could simplify ``` \newcommand{\lc}[1]{\directlua{code.sel_lang("\luaescapestring{\unexpanded{#1}}")} ``` to ``` \newcommand{\lc}[1]{\directlua{code.sel_lang(\luastringN{#1})}} ```
1
https://tex.stackexchange.com/users/5001
690957
320,532
https://tex.stackexchange.com/questions/690914
0
I am attempting to draw an Argand diagram, with a circle centred at (0, −16*π*), radius 16*π*. The issues are that my diagram has the real and imaginary axes adjacent to the axis, but I would like the labels to be directly above the imaginary axis for Im and directly to the right of the real axis (currently it is appearing above the real axis. I also want to have the axes labelled in terms of pi so they go like −32*π*, −16*π*, 0, 16*π*, 32*π*. Currently I haven't managed to get my axes in terms of *π*. Here is a snippet of my code: ``` \begin{tikzpicture} \begin{axis}[ xmin=-32*pi, xmax=32*pi, ymin=-32*pi*i, ymax=32*pi*i, axis equal, axis lines=middle, xlabel=Re\{$\mathcal{A}(s)$\}, ylabel=Im\{$\mathcal{A}(s)$\}, disabledatascaling] \fill [opacity=0.2] (0,-16*pi) circle [radius=16*pi]; \end{axis} \end{tikzpicture} \end{center} ```
https://tex.stackexchange.com/users/300109
Latex drawing Argand Diagram with axes in terms of pi?
true
Sometimes, it's just simpler to use TikZ directly. It's not a plot after all. The `x` and `y` key allows you to scale your *xyz* coordinate system. No need to get *π* involved here. The ticks are drawn in the canvas coordinate system so that they don't scale with the *xyz* coordinate system. The same is true for extending the axes about 10pt in all directions. Code ---- ``` \documentclass[tikz]{standalone} %\documentclass{article} %\usepackage{tikz} \usepackage{amsmath} \DeclareMathOperator{\mRe}{Re} \DeclareMathOperator{\mIm}{Im} \usetikzlibrary{arrows.meta} \begin{document} \begin{tikzpicture}[>=Latex, x=+1mm, y=+1mm] % π equals 1mm % 1. The circle \fill[gray!50] (down:16) circle[radius=16]; % 2. The axes \path[->, at end] % axes ([xshift=-10pt]left:32) edge node[right] {$\mRe\{\mathcal A(s)\}$} ([xshift=10pt]right:32) ([yshift=-10pt]down:32) edge node[above] {$\mIm\{\mathcal A(s)\}$} ([yshift=10pt] up:32); % 3. The ticks \foreach \j in {-32, -16, 16, 32}{ \draw[shift=(right:\j)] (down:2pt) node[below] {$\j\pi$} -- ( up:2pt); \draw[shift=( up:\j)] (left:2pt) node[left ] {$\j\pi$} -- (right:2pt); } \end{tikzpicture} \end{document} ``` Output ------
1
https://tex.stackexchange.com/users/16595
690958
320,533
https://tex.stackexchange.com/questions/66519
8
I have written a `beamer` presentation and I would like all the frames to have corresponding PDF bookmarks, much like as in this other question on here: [Beamer: how to make each frame appear in the PDF toc?](https://tex.stackexchange.com/questions/17230) . However, it seems that the answer given to that question makes every *slide* get a bookmark, so frames with `\pause`s which have multiple corresponding slides get duplicate bookmarks. (My understanding is that in `beamer`, a `frame` is the logical concept defined as everything between the `\begin{frame}` and `\end{frame}` and may be represented in the output as one or more `slide`s.) I include a minimum illustrative example, based on the previously referenced answer, which I compile with `pdflatex` (and my `\beamer@version`=`3.20`): ``` \documentclass{beamer} \usepackage{bookmark} \usepackage{etoolbox} \makeatletter \apptocmd{\beamer@@frametitle}{\bookmark[page=\the\c@page,level=3]{#1}}% {\message{** patching of \string\beamer@@frametitle succeeded **}}% {\message{** patching of \string\beamer@@frametitle failed **}}% \makeatother \begin{document} \begin{frame}{Title} Hello \pause world \end{frame} \end{document} ``` Result: a PDF with one frame but two slides, and *two* bookmarks, one for each *slide*. Wanted: a PDF with one frame but two slides, and *one* bookmark, one for each *frame*. I am surprised that the example doesn't work, as I would have thought that `\frametitle` (or rather its `\@dblarg` helper `\beamer@@frametitle`) would get called once per frame instead of (as it appears given the result) once per slide. (Is there any implementation documentation for beamer that might help me with this, as so far I've failed to find it?) Also, as my presentation is already written, I would like to avoid having to replace `\begin{frame}` with `\begin{myframe}` everywhere if possible (especially as some of my frames use the `\frametitle{Title}` syntax and others the `\begin{frame}{Title}` syntax of setting the frame title), and I'm aware that there will be a few difficulties in this approach.
https://tex.stackexchange.com/users/17427
Make each frame (not slide) appear in the PDF bookmarks with beamer
false
Here is a variant of David Carlisle's answer obtained by using `\pdfbookmark` in place of `\bookmark`. The advantage here is that we do not need to `\usepackage{bookmark}`. ``` \makeatletter \apptocmd{\beamer@@frametitle}{\only<1>{\pdfbookmark[3]{#1}{#1}}} {\message{** patching of \string\beamer@@frametitle succeeded **}} {\message{** patching of \string\beamer@@frametitle failed **}} \makeatother ```
1
https://tex.stackexchange.com/users/112411
690963
320,535
https://tex.stackexchange.com/questions/16204
81
I have to prepare my slides in latex. A quick search came up with different packages. Before start preparing, I need your experiences. I do not want to regret after learning one as I did, learning vim (now can not quit) instead of emacs. EDIT: After asking this question at that time, I start learning Beamer. Now I'm really happy with that, I created my own template and now it's easier just copying from my .tex files to beamer template. I recommend beamer for powerpoint users who are actively using latex .
https://tex.stackexchange.com/users/3115
Which package to use for presentations? Beamer, Prosper, or Other
false
I prefer OpTeX with `\slides` in the preamble. It is much more simple than beamer, the source code is more readable and transparent. See [OpTeX slides](http://petr.olsak.net/ftp/olsak/optex/op-slides.pdf) for more details. I have a lot of positive feedback from OpTeX users.
4
https://tex.stackexchange.com/users/51799
690966
320,537
https://tex.stackexchange.com/questions/690970
2
I have a .EPs file I need to include in my latex document. A previous answer suggested epstopdf. Also how can I incorporate shell-escapae into my preamble.
https://tex.stackexchange.com/users/295796
How to insert a eps file
false
``` \usepackage{graphicx} \begin{document} \includegraphics{filename.eps} ```
1
https://tex.stackexchange.com/users/121024
690973
320,539
https://tex.stackexchange.com/questions/690982
2
Given the following code ``` \documentclass[a4paper,20pt]{extarticle} \usepackage[utf8]{inputenc} \usepackage[T1]{fontenc} \usepackage[czech]{babel} \usepackage[czech]{translator} \usepackage{graphicx, comment, tikz} \usetikzlibrary{calendar, shapes.misc} \usepackage{pgfkeys,pgfcalendar} \usepackage{geometry} \geometry{ left=9mm, top=13mm, bottom=9mm, right=10mm } \newcounter{tgmymo} \setcounter{tgmymo}{0} \newcommand{\mymo}[4]{% \begin{minipage}{\textwidth}% \centering% \stepcounter{tgmymo} \includegraphics[width=#4\textwidth]{#3} \end{minipage} \vfill \begin{center} {\textsc{\pgfcalendarmonthname{\value{tgmymo}}} 2024} \end{center} \vfill \noindent \begin{minipage}[t][10cm][t]{.99\textwidth}\centering \begin{tikzpicture}[thick] \pgfcalendar{cal}{#1}{#2}{% \ifdate{workday}% {\tikzset{filling/.style={fill=black!05}}}% {\tikzset{filling/.style={fill=orange!20}}} %% \def\normal{\node (\pgfcalendarsuggestedname) at (\pgfcalendarcurrentweekday*2.52,0) [filling, rectangle,rounded corners, text width=.105\textwidth,text height=9.796mm ,align=right] {\\ \pgfcalendarcurrentday};}% %% \def\bday#1{\node (\pgfcalendarsuggestedname) at (\pgfcalendarcurrentweekday*2.52,0) [filling, rectangle, rounded corners, text width=.105\textwidth,text height=9.796mm, align=right] {\\ \textcolor{red}{#1} \textcolor{red}{\pgfcalendarcurrentday}};}% %% birthdays will come here \ifdate{equals=09-02}{\bday(mum)}{\normal}% %---end of birthdays \ifdate{Sunday}{\pgftransformyshift{-2.35cm}}{}% }; \end{tikzpicture}\end{minipage} \clearpage} \begin{document} \setlength\parindent{0pt} \pagestyle{empty} \mymo{2024-01-01}{2024-01-last}{example-image}{.55} \mymo{2024-02-01}{2024-02-last}{example-image}{.9} \mymo{2024-03-01}{2024-03-last}{example-image}{.55} \mymo{2024-04-01}{2024-04-last}{example-image}{.55} \mymo{2024-05-01}{2024-05-last}{example-image}{.9} \mymo{2024-06-01}{2024-06-last}{example-image}{.9} \mymo{2024-07-01}{2024-07-last}{example-image}{.55} \mymo{2024-08-01}{2024-08-last}{example-image}{.6} \mymo{2024-09-01}{2024-09-last}{example-image}{.485} \mymo{2024-10-01}{2024-10-last}{example-image}{.55} \mymo{2024-11-01}{2024-11-last}{example-image}{.55} \mymo{2024-12-01}{2024-12-last}{example-image}{.475} \end{document} ``` I want the `\bday` command to function. I want to pass one argument - the name of the person who has birthday on that particular day and I don't know the proper syntax. Thank you all ♥
https://tex.stackexchange.com/users/230245
Tikz Calendar - how to pass argument with '\def'
true
Let's see... 1. Use `\newcommand` for your `\normal` and `\bday` (it's LaTeX; try to avoid internal TeX things if you can). 2. When you call `\bday` use `{}` to delimit the argument (not `()`). 3. Define the macros at the top level; defining macros inside macros can be done, but it's tricky and unnecessary here. 4. I adjusted the macro `\bday` to produce the two-lines output I *think* you were looking for; not sure if I understood correctly. ``` \documentclass[a4paper,20pt]{extarticle} \usepackage[utf8]{inputenc} \usepackage[T1]{fontenc} \usepackage[czech]{babel} \usepackage[czech]{translator} \usepackage{graphicx, comment, tikz} \usetikzlibrary{calendar, shapes.misc} \usepackage{pgfkeys,pgfcalendar} \usepackage{geometry} \geometry{ left=9mm, top=13mm, bottom=9mm, right=10mm } \newcounter{tgmymo} \setcounter{tgmymo}{0} \newcommand\normal{% \node (\pgfcalendarsuggestedname) at (\pgfcalendarcurrentweekday*2.52,0) [filling, rectangle,rounded corners, text width=.105\textwidth,text height=9.796mm ,align=right] {\\ \pgfcalendarcurrentday}; }% %% \newcommand\bday[1]{% \node (\pgfcalendarsuggestedname) at (\pgfcalendarcurrentweekday*2.52,0) [filling, rectangle, rounded corners, text width=.105\textwidth,text height=9.796mm, align=right] { \textcolor{red}{#1}\\ \textcolor{red}{\pgfcalendarcurrentday}}; }% \newcommand{\mymo}[4]{% \begin{minipage}{\textwidth}% \centering% \stepcounter{tgmymo} \includegraphics[width=#4\textwidth]{#3} \end{minipage} \vfill \begin{center} {\textsc{\pgfcalendarmonthname{\value{tgmymo}}} 2024} \end{center} \vfill \noindent \begin{minipage}[t][10cm][t]{.99\textwidth} \centering \begin{tikzpicture}[thick] \pgfcalendar{cal}{#1}{#2}{% \ifdate{workday}% {\tikzset{filling/.style={fill=black!05}}}% {\tikzset{filling/.style={fill=orange!20}}} %% %% birthdays will come here \ifdate{equals=09-02}{\bday{mum}}{\normal}% %---end of birthdays \ifdate{Sunday}{\pgftransformyshift{-2.35cm}}{}% }; \end{tikzpicture} \end{minipage} \clearpage } \begin{document} \setlength\parindent{0pt} \pagestyle{empty} \mymo{2024-01-01}{2024-01-last}{example-image}{.55} \mymo{2024-02-01}{2024-02-last}{example-image}{.9} \mymo{2024-03-01}{2024-03-last}{example-image}{.55} \mymo{2024-04-01}{2024-04-last}{example-image}{.55} \mymo{2024-05-01}{2024-05-last}{example-image}{.9} \mymo{2024-06-01}{2024-06-last}{example-image}{.9} \mymo{2024-07-01}{2024-07-last}{example-image}{.55} \mymo{2024-08-01}{2024-08-last}{example-image}{.6} \mymo{2024-09-01}{2024-09-last}{example-image}{.485} \mymo{2024-10-01}{2024-10-last}{example-image}{.55} \mymo{2024-11-01}{2024-11-last}{example-image}{.55} \mymo{2024-12-01}{2024-12-last}{example-image}{.475} \end{document} ```
3
https://tex.stackexchange.com/users/38080
690984
320,546
https://tex.stackexchange.com/questions/690982
2
Given the following code ``` \documentclass[a4paper,20pt]{extarticle} \usepackage[utf8]{inputenc} \usepackage[T1]{fontenc} \usepackage[czech]{babel} \usepackage[czech]{translator} \usepackage{graphicx, comment, tikz} \usetikzlibrary{calendar, shapes.misc} \usepackage{pgfkeys,pgfcalendar} \usepackage{geometry} \geometry{ left=9mm, top=13mm, bottom=9mm, right=10mm } \newcounter{tgmymo} \setcounter{tgmymo}{0} \newcommand{\mymo}[4]{% \begin{minipage}{\textwidth}% \centering% \stepcounter{tgmymo} \includegraphics[width=#4\textwidth]{#3} \end{minipage} \vfill \begin{center} {\textsc{\pgfcalendarmonthname{\value{tgmymo}}} 2024} \end{center} \vfill \noindent \begin{minipage}[t][10cm][t]{.99\textwidth}\centering \begin{tikzpicture}[thick] \pgfcalendar{cal}{#1}{#2}{% \ifdate{workday}% {\tikzset{filling/.style={fill=black!05}}}% {\tikzset{filling/.style={fill=orange!20}}} %% \def\normal{\node (\pgfcalendarsuggestedname) at (\pgfcalendarcurrentweekday*2.52,0) [filling, rectangle,rounded corners, text width=.105\textwidth,text height=9.796mm ,align=right] {\\ \pgfcalendarcurrentday};}% %% \def\bday#1{\node (\pgfcalendarsuggestedname) at (\pgfcalendarcurrentweekday*2.52,0) [filling, rectangle, rounded corners, text width=.105\textwidth,text height=9.796mm, align=right] {\\ \textcolor{red}{#1} \textcolor{red}{\pgfcalendarcurrentday}};}% %% birthdays will come here \ifdate{equals=09-02}{\bday(mum)}{\normal}% %---end of birthdays \ifdate{Sunday}{\pgftransformyshift{-2.35cm}}{}% }; \end{tikzpicture}\end{minipage} \clearpage} \begin{document} \setlength\parindent{0pt} \pagestyle{empty} \mymo{2024-01-01}{2024-01-last}{example-image}{.55} \mymo{2024-02-01}{2024-02-last}{example-image}{.9} \mymo{2024-03-01}{2024-03-last}{example-image}{.55} \mymo{2024-04-01}{2024-04-last}{example-image}{.55} \mymo{2024-05-01}{2024-05-last}{example-image}{.9} \mymo{2024-06-01}{2024-06-last}{example-image}{.9} \mymo{2024-07-01}{2024-07-last}{example-image}{.55} \mymo{2024-08-01}{2024-08-last}{example-image}{.6} \mymo{2024-09-01}{2024-09-last}{example-image}{.485} \mymo{2024-10-01}{2024-10-last}{example-image}{.55} \mymo{2024-11-01}{2024-11-last}{example-image}{.55} \mymo{2024-12-01}{2024-12-last}{example-image}{.475} \end{document} ``` I want the `\bday` command to function. I want to pass one argument - the name of the person who has birthday on that particular day and I don't know the proper syntax. Thank you all ♥
https://tex.stackexchange.com/users/230245
Tikz Calendar - how to pass argument with '\def'
false
### Adaptations * define the commands `\normal` and `\bday` outside `\mymo` with `\newcommand` * use curly brackets here `\bday{mum}` * put the line break for `\bday` between the name and the day * I combined parameter 1 and 2 of `\mymo` to be `yyyy-mm` ### Code ``` \documentclass[a4paper,20pt]{extarticle} \usepackage[utf8]{inputenc} \usepackage[T1]{fontenc} \usepackage[czech]{babel} \usepackage[czech]{translator} \usepackage{graphicx, comment, tikz} \usetikzlibrary{calendar, shapes.misc} \usepackage{pgfkeys,pgfcalendar} \usepackage{geometry} \geometry{ left=9mm, top=13mm, bottom=9mm, right=10mm } \newcounter{tgmymo} \setcounter{tgmymo}{0} \newcommand{\normal}{% \node (\pgfcalendarsuggestedname) at (\pgfcalendarcurrentweekday*2.52,0) [filling, rectangle,rounded corners, text width=.105\textwidth,text height=9.796mm ,align=right] {\\ \pgfcalendarcurrentday}; } \newcommand{\bday}[1]{% \node (\pgfcalendarsuggestedname) at (\pgfcalendarcurrentweekday*2.52,0) [filling, rectangle, rounded corners, text width=.105\textwidth,text height=9.796mm, align=right] {\textcolor{red}{#1}\\ \textcolor{red}{\pgfcalendarcurrentday}}; } \newcommand{\mymo}[3]{% \begin{minipage}{\textwidth}% \centering% \stepcounter{tgmymo} \includegraphics[width=#3\textwidth]{#2} \end{minipage} \vfill \begin{center} {\textsc{\pgfcalendarmonthname{\value{tgmymo}}} 2024} \end{center} \vfill \noindent \begin{minipage}[t][10cm][t]{.99\textwidth}\centering \begin{tikzpicture}[thick] \pgfcalendar{cal}{#1-01}{#1-last}{% \ifdate{workday}% {\tikzset{filling/.style={fill=black!05}}}% {\tikzset{filling/.style={fill=orange!20}}} %% birthdays will come here \ifdate{equals=09-02}{\bday{mum}}{\normal}% %---end of birthdays \ifdate{Sunday}{\pgftransformyshift{-2.35cm}}{}% }; \end{tikzpicture} \end{minipage} \clearpage } \begin{document} \setlength\parindent{0pt} \pagestyle{empty} \mymo{2024-01}{example-image}{.55} \mymo{2024-02}{example-image}{.9} \mymo{2024-03}{example-image}{.55} \mymo{2024-04}{example-image}{.55} \mymo{2024-05}{example-image}{.9} \mymo{2024-06}{example-image}{.9} \mymo{2024-07}{example-image}{.55} \mymo{2024-08}{example-image}{.6} \mymo{2024-09}{example-image}{.485} \mymo{2024-10}{example-image}{.55} \mymo{2024-11}{example-image}{.55} \mymo{2024-12}{example-image}{.475} \end{document} ```
2
https://tex.stackexchange.com/users/123129
690985
320,547
https://tex.stackexchange.com/questions/690992
1
I'm using an already avaialble template of my university, and at the start of every frame there is the subtitle even if I don't write the \framesubtitle{} command. How can I remove such occurrence? EDIT: <https://www.overleaf.com/read/ybqzjzxhrvhr> this is the source.
https://tex.stackexchange.com/users/300524
How to remove the subtitle of a frame in a beamer presentation?
true
Your theme modifies the `\beamer@checkframetitle` macro to automatically add a subtitle. You can revert to the original beamer definition: ``` \documentclass{beamer} \usetheme{sintef} \makeatletter \def\beamer@checkframetitle{\@ifnextchar\bgroup\beamer@inlineframetitle{}} \makeatother \begin{document} \begin{frame} \frametitle{frametitle} test \end{frame} \end{document} ```
1
https://tex.stackexchange.com/users/36296
690993
320,550
https://tex.stackexchange.com/questions/690868
4
The source code of the Computer Modern slash is: ``` cmchar "Virgule (slash)"; beginchar("/",9u#,body_height#,paren_depth#); italcorr body_height#*slant-.5u#; adjust_fit(0,0); pickup rule.nib; rt x1=hround(w-u)+eps; top y1=h+eps; lft x2=hround u-eps; bot y2=-d-eps; draw z1--z2; % diagonal penlabels(1,2); endchar; ``` The corners are round. I would like to have sharp corners (but the same thickness); the slash shold be a parallelogramm. I found out that `crisp.nib` draws sharp corners but it has to be used with `pos1 ... pos2`. So I tried: ``` cmchar "Virgule (slash)"; beginchar("/",9u#,body_height#,paren_depth#); italcorr body_height#*slant-.5u#; adjust_fit(0,0); pickup crisp.nib; pos1(rule_thickness+2eps,-45); pos2(rule_thickness+2eps,-45); rt x1=hround(w-u)+eps; top y1=h+eps; lft x2=hround u-eps; bot y2=-d-eps; draw z1--z2; % diagonal penlabels(1,2); endchar; ``` But the slash disappears, it is only a onedimensional line, now. What is wrong? There are some Metafont tutorials but I did not find answers to some other questions: * What are `crisp.nib`, `fine.nib`, `rule.nib` exactly? * Why do some `.nib`s need assignments like `pos1(...); pos2(...), ...` and others not? Which ones do need that? * What is the difference between `fill` and `fill stroke`? * What are the arguments of `pos1(...)` exactly and how to find out the right values? Thanks for your help.
https://tex.stackexchange.com/users/125730
Sharp corners in Metafont?
true
I can't immediately answer the "What is wrong?" question, but you can get much of the detail that answers the other questions in the book [*Volume E: Computer Modern Typefaces*, D. Knuth, 1986](https://www-cs-faculty.stanford.edu/%7Eknuth/abcde.html#abcde), and in particular the appendix that explains `cmbase.mf`. If you don't have access to the book, you can get some idea of what it going on by reading the source, which you should find in your local TeX tree at `..texmf-dist/fonts/source/public/cm/cmbase.mf` ### Nibs The `.nib` variables are all copies of the built-in `pencircle` pen scaled to useful sizes: * `crisp.nib` is scaled to the value of the `crisp` parameter, which sets the diameter of serif corners * `tiny.nib` is scaled to `tiny`, which sets the diameter of rounded corners * `fine.nib` is scaled to `fine`, which sets the diameter of sharply rounded corners These are the three main pens used to draw Computer Modern. The parameters are set differently for roman, italic, bold, and so on. There is also `rule.nib` which is also a copy of `pencircle` scaled to `rule_thickness` -- this is a special-purpose pen used to draw maths symbols like `+`, `/`, and `=`. ### The `pos()` macro The `pos` macro is a generalization of the `penpos` macro in plain MF. It is defined like this: ``` newinternal currentbreadth; vardef pos@#(expr b,d) = if known b: if b<=currentbreadth: errmessage "bad pos"; fi fi (x@#r-x@#l,y@#r-y@#l)=(b-currentbreadth,0) rotated d; x@#=.5(x@#l+x@#r); y@#=.5(y@#l+y@#r) enddef; ``` The arguments are a suffix `@#` and two expressions `b` = breadth, and `d` = rotation. And it uses a global internal variable called `currentbreadth` which keeps track of the breadth of the current pen. If you unpick the macro, you will see that it creates two linked sets of three variables: `x@#`, `x@#l`, `x@#r`, and `y@#`, `y@#l`, `y@#r`, where `@#` is replaced by whatever suffix you use. So if you call `pos1(b, d)` the macro will define `x1`, `x1l`, `x1r`, `y1`, `y1l`, and `y1r`. Or rather it will define *some useful relationships* between them; in particular the six variables can be combined to define three points: `(x1l, y1l)`, `(x1r, y1r)`, and `(x1, y1)` -- through the usual plain MF convention that defines `z@#` as `(x@#, y@#)`, you can now refer to these three points as `z1l`, `z1r`, and `z1`, and they will be defined so that `z1` is exactly 1/2 way between `z1l` and `z1r` and that the distance between `z1l` and `z1r` will be `b` and the angle of rotation will be `d`. Note that you will still need to define the location of `z1` at this point -- all that `pos` has done is establish where to put `z1l` and `z1r` when `z1` is known... And what (you may ask) is the point of all this? The answer is that is sets up the `stroke` macro... ### The `stroke` macro The definition of the `stroke` macro in `cmbase.mf` is quite hard to understand at first, but the net result is that it turns a non-cyclic path like `z1 -- z2` into a cyclic box path that you can fill. In order for this to work, you have to define the extra `l` and `r` variable for each point. Which is what `pos@#` does. So provided you have already called `pos1` and `pos2`, then `stroke z1e -- z2e` will return the cyclic path ``` z1l -- z2l -- z2r -- z1r -- cycle ``` which you can pass to `fill`. So to answer the OP question the difference is * `fill z1e -- z2e;` is a mistake, you probably meant `draw z1 -- z2`. * `fill stroke z1e -- z2e` will fill the box `z1l -- z2l -- z2r -- z1r -- cycle` provided the `l` and `r` suffixes are properly defined. ### The answer So having got through all that, I *think* the answer to the question "What is wrong?" is that the `crisp.nib` is so small that you can't see the line when you do `draw z1--z2` at the end. The width may have rounded to a whole number of pixels equal to zero. So since you have set `pos1` and `pos2` you might try doing `fill stroke z1e--z2e` instead.
3
https://tex.stackexchange.com/users/15036
691003
320,552
https://tex.stackexchange.com/questions/691008
3
``` \documentclass[a4paper,oneside,12pt]{book} \begin{document} \def\s{(1/(2+sqrt(2)))} \s \end{document} ``` I want make a variable `\s` with the value `1/(2+sqrt(2))`. LaTeX cannot automatically compute `\s` as `0.29289321881`. How to define variable in LaTeX with value contain mathematical operator/ mathematical function?
https://tex.stackexchange.com/users/163815
Define variable in LaTeX with value contain mathematical operator
true
I suggest to use `\fpeval`, so ``` \edef\s{\fpeval{(1/(2+sqrt(2)))}} ``` will store ``` 0.2928932188134525 ``` in `\s`. However, if you have many of such constants, the naming becomes important: for instance you should not have `\c` as one of them, because you'd be redefining a basic LaTeX commands and may get very weird errors. A general rule is *not* to use `\def` unless you precisely know that the command you're defining is not already existing. I suggest to use a sort of namespace. ``` \documentclass{article} \ExplSyntaxOn % constant store \NewDocumentCommand{\CS}{mm} {% #1 = name, #2 = value \ongky_constant_store:nn { #1 } { #2 } } % constant use \NewExpandableDocumentCommand{\UC}{m} {% #1 = name \ongky_constant_use:n { #1 } } \cs_new_protected:Nn \ongky_constant_store:nn { \fp_gzero_new:c { g_ongky_constant_#1_fp } \fp_gset:cn { g_ongky_constant_#1_fp } { #2 } } \cs_new:Nn \ongky_constant_use:n { \fp_use:c { g_ongky_constant_#1_fp } } \ExplSyntaxOff \CS{s}{(1/(2+sqrt(2)))} \begin{document} \UC{s} \fpeval{(1/\UC{s}-2)^2} \end{document} ```
5
https://tex.stackexchange.com/users/4427
691012
320,555
https://tex.stackexchange.com/questions/691006
1
I am using XeLaTeX and `fontspec` and trying to insert a Turkish Lira symbol ₺ into my document. Minimal example: ``` \documentclass{report} \usepackage{fontspec} \usepackage{xspace} \newfontfamily\djvuserif{DejaVu Serif} \newcommand{\Lira}[0]{{\djvuserif ₺}\xspace} \begin{document} \Lira 2 \end{document} ``` It just outputs ? 2 (with the question mark in the DejaVu font!). How do I do this properly?
https://tex.stackexchange.com/users/295003
Inserting unicode character with fontspec does not work
false
The character is not available in DejaVu Serif. You can see what fonts on your system have it by using ``` albatross ₺ ``` from a command line. Here I use Noto Serif, you choose the one you like the most. But no hope with DejaVu Serif. ``` \documentclass{report} \usepackage{fontspec} \usepackage{xspace} \newfontfamily\lirafont{Noto Serif} \newcommand{\Lira}[0]{{\lirafont ₺}\xspace} \begin{document} \Lira 2 \end{document} ``` To be honest, I'd not use `\xspace`. ``` \documentclass{report} \usepackage{fontspec} \usepackage{xspace} \newfontfamily\lirafont{Noto Serif} \newcommand{\Lira}{{\lirafont ₺}} \newcommand{\TL}[1]{\Lira~#1} \begin{document} \Lira \TL{2} \end{document} ```
1
https://tex.stackexchange.com/users/4427
691014
320,557
https://tex.stackexchange.com/questions/691000
1
I have a general question, if I may: When using the `book` class for a self-published book, do I need to either add or take away from the default values for `\oddsidemargin` and `\evensidemargin`? I want to make sure there is enough white space for the binding of the book so that it does not obliterate any of the text. The dimensions of the book are 5.5" x 8.25".
https://tex.stackexchange.com/users/192836
Regarding Odd (Even) Side Margins in Book Class
false
You have actually asked two questions: First is: how to add binding offset to the document? You can use the [`geometry`](https://ctan.org/pkg/geometry?lang=en) package and specify a `bindingoffset`. The package documentation has a quick summary of all the lengths required. Second is: do I need to specify a binding offset? This is best answered by the FAQ from the printer of your book. For example, [Amazon's KDP](https://kdp.amazon.com/en_US/help/topic/GVBQ3CMEQW3W2VL6) provides minimum inner margin depends on the length of the book. A rule [found elsewhere on this website](https://tex.stackexchange.com/questions/249190/recommended-margin-and-binding-offset#comment592971_249190) suggests reserving ``` 0.5 * thickness of the book ``` as the binding offset. The thickness of course would depend on the number of pages and the type of paper used. Since you specifically asked about the *default* values from the `book` class: you can find out the default values by using the `layout` package as in [this Q+A](https://tex.stackexchange.com/questions/50258/margins-of-book-class). Compare that to the amount you need as suggested by the printer.
1
https://tex.stackexchange.com/users/119
691016
320,558
https://tex.stackexchange.com/questions/691015
1
This will sound like a strange question, but there is a rhyme and reason for it. Is there a way to have `fontspec` or XeTeX commands affect only letters of one case--say lowercase? For example, suppose you wanted to substitute all lowercase characters in one font with those in another. I think the answer is probably in some variation of David Carlisle's answer here: [Replace a single letter in xelatex](https://tex.stackexchange.com/questions/620088/replace-a-single-letter-in-xelatex). Is there an easy way to do this or will it need to be done character-by-character? I am interested in text mode. David already showed me how to do this in math mode. I am using OpenType text fonts.
https://tex.stackexchange.com/users/224317
Using fontspec or XeTeX commands to replace certain characters in font
true
Fill in all that you consider “lowercase”. ``` \documentclass{article} \usepackage{fontspec} \setmainfont{Libertinus Serif} \newfontfamily{\LCL}{Futura}% Lower Case Letters \XeTeXinterchartokenstate=1 \newXeTeXintercharclass\LOWERCASELETTERS \count255=\numexpr`a-1\relax \loop\ifnum\count255<`z \advance\count255 by 1 \XeTeXcharclass \count255 \LOWERCASELETTERS \repeat \XeTeXinterchartoks 0 \LOWERCASELETTERS {\begingroup\LCL} \XeTeXinterchartoks \LOWERCASELETTERS 0 {\endgroup} \XeTeXinterchartoks 4095 \LOWERCASELETTERS {\begingroup\LCL} \XeTeXinterchartoks \LOWERCASELETTERS 4095 {\endgroup} \begin{document} Some text AbCdE. \end{document} ``` If you want the substitution only for the main font, you can modify as follows. ``` \documentclass{article} \usepackage{fontspec} \setmainfont{Libertinus Serif}[ NFSSFamily=mainfont, ] \newfontfamily{\LCL}{Futura}% Lower Case Letters \XeTeXinterchartokenstate=1 \newXeTeXintercharclass\LOWERCASELETTERS \count255=\numexpr`a-1\relax \loop\ifnum\count255<`z \advance\count255 by 1 \XeTeXcharclass \count255 \LOWERCASELETTERS \repeat % some syntactic sugar \ExplSyntaxOn \NewDocumentCommand{\replacemainfont}{} { \str_if_eq:eeT { \use:c { f@family } } { mainfont } { \LCL } } \ExplSyntaxOff \XeTeXinterchartoks 0 \LOWERCASELETTERS {\begingroup\replacemainfont} \XeTeXinterchartoks \LOWERCASELETTERS 0 {\endgroup} \XeTeXinterchartoks 4095 \LOWERCASELETTERS {\begingroup\replacemainfont} \XeTeXinterchartoks \LOWERCASELETTERS 4095 {\endgroup} \begin{document} Some text AbCdE. \textsf{Some text AbCdE.} \texttt{Some text AbCdE.} \end{document} ```
0
https://tex.stackexchange.com/users/4427
691018
320,559
https://tex.stackexchange.com/questions/691019
2
``` \documentclass[a4paper,oneside,12pt]{book} \usepackage[left=3cm,right=2cm,top=2cm,bottom=2cm]{geometry} \begin{document} \edef\var{1} \if \var= 1 {var equal one} \else {var not equal one} \fi \end{document} ``` I try to define new variable `\var` with value `1`. Then I try to make if statement as the code above. But the result is `var not equal one`, instead of `var equal one`. Why this can happen?
https://tex.stackexchange.com/users/163815
Incorrect result of if statement in LaTeX
false
The `\if` conditional compares whether two macros are the same after expansion. Therefore, by deleting the equals sign and using ``` \if\var1 {var equal one} \else {var not equal one} \fi ``` you'll obtain your desired output, *var equal one*.
4
https://tex.stackexchange.com/users/91603
691021
320,560
https://tex.stackexchange.com/questions/691019
2
``` \documentclass[a4paper,oneside,12pt]{book} \usepackage[left=3cm,right=2cm,top=2cm,bottom=2cm]{geometry} \begin{document} \edef\var{1} \if \var= 1 {var equal one} \else {var not equal one} \fi \end{document} ``` I try to define new variable `\var` with value `1`. Then I try to make if statement as the code above. But the result is `var not equal one`, instead of `var equal one`. Why this can happen?
https://tex.stackexchange.com/users/163815
Incorrect result of if statement in LaTeX
true
Do not use "raw" TeX `\if...` tests, unless really needed. They are quite complex to understand. For example, even if [@gz839918's solution](https://tex.stackexchange.com/a/691021/38080) **does** work, in this case, it can be quite... surprising the output of ``` \edef\var{12} \if\var12 {var equal twelve} \else {var not equal twelve} \fi ``` See ? Use higher level constructs, like `\ifthenelse` offered by [the `ifthen` package](https://ctan.org/pkg/ifthen?lang=en): ``` \documentclass[a4paper,oneside,12pt]{book} \usepackage[left=3cm,right=2cm,top=2cm,bottom=2cm]{geometry} \usepackage{ifthen} \begin{document} \edef\var{12} \if\var12 {var equal twelve} \else {var not equal twelve} \fi \ifthenelse{\var = 12}{But really var is 12}{Not 12!} \end{document} ```
4
https://tex.stackexchange.com/users/38080
691023
320,561
https://tex.stackexchange.com/questions/60781
46
Consider that you are working on a standard that should be translated into some other languages. The document structure (figures, table structures, ...) is constant among languages. Is there any facility/technique/strategy/package to streamline multilingual documents production? Is it possible to use a [gettex](http://en.wikipedia.org/wiki/Gettext)-like method in (la)tex?
https://tex.stackexchange.com/users/13747
Managing multiple translation of a single document
false
Combining the answers of @darkled and @Bernardo with <https://latex.org/forum/viewtopic.php?t=10792> I came to the following solution: ``` \documentclass[10pt,a5paper]{article} \usepackage[utf8]{inputenc} \usepackage[TU]{fontenc} \usepackage[english,german,french]{babel} \newcommand\en[1]{\iflanguage{english}{#1}{}} \newcommand\de[1]{\iflanguage{german}{#1}{}} \newcommand\fr[1]{\iflanguage{french}{#1}{}} \begin{document} \selectlanguage{french} \en{English} \de{Deutsch} \fr{Français} \end{document} ``` Babel provides two interesting elements: `\selectalnguage{<language>}`, which you need for switching between built-in designations like "Table of Contents", "Inhaltsverzeichnis" and "Table de matières" anyways. The `\iflanguage{<selected language>}{<then>}{<else>}` acts like @darkled's solution, without having to define additional booleans, but querying the language selected by `\selectlanguage`.
0
https://tex.stackexchange.com/users/282677
691037
320,565
https://tex.stackexchange.com/questions/691031
1
I'd like to increment the date in the format [Day of week] [Day] [Month] [Year] by one each step, but I can't get the day of the week to increment. I've been looking at [this answer](https://tex.stackexchange.com/questions/625446/using-advdate-and-datetime2) but I can't get dow to advance properly. ``` \documentclass{article} \usepackage[british]{babel} \usepackage[useregional,showdow]{datetime2} \usepackage{advdate} \usepackage{etoolbox} \makeatletter \appto\FixDate{% \edef\@dtm@currentyear{\the\year}% \edef\@dtm@currentmonth{\the\month}% \edef\@dtm@currentday{\the\day}% % \edef\@dtm@currentdow{\the\dow}%?? } \makeatother \begin{document} \today \AdvanceDate[1] \today \AdvanceDate[1] \today \AdvanceDate[1] \today \AdvanceDate[1] \today \end{document} ```
https://tex.stackexchange.com/users/36728
advdate and datetime2 with day of week
true
Here's an alternative approach using only [`datetime2`](//ctan.org/pkg/datetime2): ``` \documentclass{article} \usepackage[british]{babel} \usepackage[useregional,showdow]{datetime2} \NewDocumentCommand{\TODAY}{}{% \DTMifsaveddate{now}{}{\DTMsavenow{now}}% If "now" date doesn't exist, set it \DTMusedate{now}% Print date } % Partly taken from https://tex.stackexchange.com/a/318012/5764 \newcount\daycount \NewDocumentCommand{\AdvanceTODAY}{ O{1} }{% \DTMsaveddateoffsettojulianday{now}{#1}\daycount% Identify Julian days \DTMsavejulianday{now}{\number\daycount}% Set new date } \begin{document} \TODAY \AdvanceTODAY% Defaults to advance 1 day \TODAY \AdvanceTODAY[1] \TODAY \AdvanceTODAY[2] \TODAY \end{document} ```
1
https://tex.stackexchange.com/users/5764
691041
320,566
https://tex.stackexchange.com/questions/690994
0
I need to insert a 2 columns long table in my document with a large amount of text on each cell of the second column. However, the final result has been a table covering 6 pages of the document. I have been trying to reduce the fontsize of the text inside the table, but so far, the only solution I found resulted in reducing the size of the table's caption as well, which looked weird. One of the solutions I tried is [this](https://tex.stackexchange.com/questions/682357/how-to-resize-the-font-size-in-a-longtblr-tabularray), but for some reason, I couldn't understand, it didn't work as expected. For now, the solution I'm using is to insert the `longtblr` environment inside `\begingroup`, and then set the fontsize of the text there. Is there a way to resize the text only in the cells, or some specific rows, keeping the original fontsize of the caption? MWE: ``` \documentclass[12pt, a4paper, twoside, english]{article} \usepackage[margin=2.5cm]{geometry} \usepackage{array,booktabs} \usepackage{tabularray} \UseTblrLibrary{booktabs} \usepackage{xcolor} \begin{document} The quick brown fox jumps over the lazy dog. The quick brown fox jumps over the lazy dog. \begingroup \fontsize{8pt}{8pt}\selectfont \begin{longtblr}[ caption = {Caption of the table.}, label = {tab:label}, ]{ Q[c,m]|X[l,m] } \hline row & some relatively long description so that the other entries can showboat their floatiness row & some relatively long description so that the other entries can showboat their floatiness row & some relatively long description so that the other entries can showboat their floatiness row & some relatively long description so that the other entries can showboat their floatiness row & some relatively long description so that the other entries can showboat their floatiness row & some relatively long description so that the other entries can showboat their floatiness row & some relatively long description so that the other entries can showboat their floatiness row & some relatively long description so that the other entries can showboat their floatiness row & some relatively long description so that the other entries can showboat their floatiness row & some relatively long description so that the other entries can showboat their floatiness row & some relatively long description so that the other entries can showboat their floatiness row & some relatively long description so that the other entries can showboat their floatiness row & some relatively long description so that the other entries can showboat their floatiness row & some relatively long description so that the other entries can showboat their floatiness row & some relatively long description so that the other entries can showboat their floatiness \end{longtblr} \endgroup The quick brown fox jumps over the lazy dog. The quick brown fox jumps over the lazy dog. \end{document} ```
https://tex.stackexchange.com/users/188408
Tabularray - resize text in rows of longtblr without resizing caption text
false
On the MWE there is a little mistake at the end of each row that makes compiling the document look a bit off. For `tabularray`, all rows have to end with `\\`, so this. ``` row & some relatively long description so that the other entries can showboat their floatiness ``` Should be like this! ``` row & some relatively long description so that the other entries can showboat their floatiness \\ ``` Now, I’m assuming that’s not the case in your real document. To force a particular column width on your columns, you only need to add the `wd` specification when using the `Q` column macros, so, in this example, line 18 should look like this: ``` colspec = {Q[c,m]|Q[l,m,wd=10cm]} ``` The `colspec` command is just to tell the package that this should only affect the column setup, it’s good to put it like that since later you may need to edit other stuff in that field that will not affect columns. The “`wd`” option forces the cells of that column to use that value as the maximum text box width, so feel free to change it as you like! Also, as you were asking, you can control a column font size via the `Q` macro using the `font` option, like this: ``` colspec={Q[c,m]|Q[l,m,wd=10cm,font=\tiny]} ``` Which makes the text on that column tiny! Of course you can do that via `\SetCell` inside the content to affect only one cell, but that’s up to you. Testing a more with the document, I think that the only error was the lack of `\\` on the rows, but hopefully that extra bit of info helps you to add more flavor to what you are cooking! Hope that helps a bit!
0
https://tex.stackexchange.com/users/300379
691044
320,567
https://tex.stackexchange.com/questions/691019
2
``` \documentclass[a4paper,oneside,12pt]{book} \usepackage[left=3cm,right=2cm,top=2cm,bottom=2cm]{geometry} \begin{document} \edef\var{1} \if \var= 1 {var equal one} \else {var not equal one} \fi \end{document} ``` I try to define new variable `\var` with value `1`. Then I try to make if statement as the code above. But the result is `var not equal one`, instead of `var equal one`. Why this can happen?
https://tex.stackexchange.com/users/163815
Incorrect result of if statement in LaTeX
false
Sorry, but you misunderstood what `\if` does. When TeX finds `\if`, it starts expanding the next tokens until finding two unexpandable ones that it eventually compares. So with `\if \var= 1` the comparison is between `1` and `=`, which are different as far as `\if` is concerned. The `1` that follows the `=` disappears as part of the false text. What you possibly want is `\ifnum` that again does full expansion until finding something like ``` <number><relation><number> ``` where `<number>` is anything that TeX can interpret as a number and `<relation>` is one of `<`, `=` or `>`. If you replace `\if` with `\ifnum` you get what you expect. But you need to be very careful. By the way, `\edef\var{1}` and `\def\var{1}` do exactly the same thing. ``` \documentclass{article} \def\var{1} \newcommand{\foo}{% \ifnum\var=1 this is the one case% \else this is the not one case% \fi } \begin{document} \foo\ and some text follows. \def\var{0} \foo\ and some text follows. \end{document} ``` Note the `%` that protect against endlines to be considered as spaces. ***Don't*** put `%` after the `1` in the first line. Exercise: guess where the following code fails. ``` \documentclass{article} \def\var{1} \newcommand{\foo}{% \ifnum\var=1% 123% \else 789% \fi } \begin{document} \foo\ and some text follows. \def\var{0} \foo\ and some text follows. \end{document} ```
3
https://tex.stackexchange.com/users/4427
691045
320,568
https://tex.stackexchange.com/questions/691039
0
I run `LuaLaTeX` in vscode with this trivial MVE ``` \documentclass[a4paper,12pt]{report} \begin{document} Hello World 2244 \end{document} ``` and get the error > > luaotfload-init.lua:301: system : no writeable cache path, quiting". > > > It runs ok with XeLaTeX. I have installed with [ansible-texlive](https://codeberg.org/ansible/texlive/src/branch/main/defaults/main.yml) and seen that it attempts to have no local `texmf` dir. Now I fear that my problem is caused by the `texmfcnf.lua` file. I have ``` return { content = { variables = { TEXMFHOME = "/usr/local/texlive/texmf-local", TEXMFVAR = "selfautoparent:/texmf-var", TEXMFCONFIG = "selfautoparent:/texmf-config", }, }, } ``` which seem to correspond to `texmf.cnf` ``` TEXMFHOME = /usr/local/texlive/texmf-local TEXMFVAR = $SELFAUTOPARENT/texmf-var TEXMFCONFIG = $SELFAUTOPARENT/texmf-config ``` Are these correct? If not, what should they contain? If yes, what else could be wrong?
https://tex.stackexchange.com/users/161067
Luaotfload: no writeable cache path error
false
My problem was indeed in the two config files. They should not contain anything - except for intentional differences to a standard installation. Thus I removed the all content in `texmf.cnf` and reduced `texmfcnf.lua` to ``` return { content = { variables = { }, }, } ``` Then I ran `luaotfload-tool --update` which built the font name database (in a writable cache!) and checked ``` kpsewhich -var-value=TEXMFCACHE ``` which points to a writable directory under my home dir: ``` /usr/local/texlive/2023/texmf-var:/home/frank/.texlive2023/texmf-var ```
0
https://tex.stackexchange.com/users/161067
691047
320,569
https://tex.stackexchange.com/questions/691034
1
I have many overlapping paths in a drawing and they end up passing over labels (I am not opposed to paths passing over paths). How can I put the label in the foreground, but keep it positioned on the path and sloped? Is there a way to do it with layers or the backgrounds library? For instance: ``` \node at (0,0) (1) {x}; \node at (2,2) (2) {y}; \node at (0,2) (3) {m}; \node at (2,0) (4) {n}; \begin{scope}[on background layer] \draw[->] (1) -- node[midway, sloped, fill=white] {-} (2); \draw[->] (3) -- node[near start, sloped, fill=white] {+} (4); \end{scope} ``` Here, I would want the `node[midway, sloped, fill=white] {-}` to go into the foreground so it isn't covered by the next path. Can this be accomplished in a way that every node is affected by some simple operation ideally? Something like `usetikzlibrary{all paths in background}`?
https://tex.stackexchange.com/users/236617
Tikz, overlapping paths draws over the labels. How to put labels in the foreground ahead of all the paths?
true
Using the code [from this great answer](https://tex.stackexchange.com/a/20426/47927), you can go the other way around and put the nodes onto a foreground layer. Then, you can use `every node` in the option list of the scope to apply this key to every node inside the scope: ``` \documentclass[border=10pt]{standalone} \usepackage{tikz} \usetikzlibrary{backgrounds} \pgfdeclarelayer{front} \pgfsetlayers{main, front} \makeatletter \pgfkeys{% /tikz/node on layer/.code={ \gdef\node@@on@layer{% \setbox\tikz@tempbox=% \hbox\bgroup\pgfonlayer{#1}\unhbox% \tikz@tempbox\endpgfonlayer\egroup% }% \aftergroup\node@on@layer } } \def\node@on@layer{\aftergroup\node@@on@layer} \makeatother \begin{document} \begin{tikzpicture} \node at (0,0) (1) {x}; \node at (2,2) (2) {y}; \node at (0,2) (3) {m}; \node at (2,0) (4) {n}; \begin{scope}[every node/.append style={node on layer={front}}] \draw[->] (1) to node[midway, sloped, fill=white] {$-$} (2); \draw[->] (3) to node[near start, sloped, fill=white] {$+$} (4); \end{scope} \end{tikzpicture} \end{document} ``` But I have to admit that I don't fully understand the code, so credit should go to Andrew Stacey!
1
https://tex.stackexchange.com/users/47927
691048
320,570
https://tex.stackexchange.com/questions/691017
2
Hi. I am creating a `beamer` presentation on Lewis dot structures. I got most of my code from this question ([Draw Lewis structures like a book](https://tex.stackexchange.com/questions/137227/draw-lewis-structures-like-a-book/137248#137248))... But then I got stuck with BH3...(3rd reaction). I am not sure if I can write BH3 (with double dots instead of bonds/lines) with the `chemformula package` or if I need to do it using the `chemfig` way. I tried recreating the BH3 structure with `chemfig`s `\Charge` command (commented out), wich outside the `align` environment seems to work, but if I paste it instead of the `\chlewis` command the document does not compile. Any help is appreciated. Thanks. ``` \documentclass{beamer} \usepackage{chemformula} \usepackage{elements} \usepackage{chemfig} \begin{document} \begin{frame}{MWE} \begin{align} \ch{ !(\elconf{H})( "\chlewis{0.}{H}" ) + !(\elconf{H})( "\chlewis{0.}{H}" ) & -> !(\writeelconf{2})( "\chlewis{0.}{H}" "\chlewis{180.}{H}" ) \\ %% !(\elconf{N})( "\chlewis{0.90:180.270.}{N}" ) + !(\elconf{O})( "\chlewis{0:90:180.270.}{O}" ) & -> !(\writeelconf{2,2+5}\writeelconf{2,2+6}) ( "\chlewis{0:90:180.}{N}" "\chlewis{45:180:315:}{O}" ) \\ %% !(\elconf{H})( "\chlewis{0.}{3H}" ) + !(\elconf{B})( "\chlewis{0.90.180.}{B}" ) & -> !(\writeelconf{2,2+4}) ( "\chlewis{0:90:180:}{B}" ) %!(\writeelconf{2,2+4}) ( "\chemfig[atom sep=1.25em]{H-[,,,,draw=none]\Charge{[circle]0=\:,90=\:,180=\:}{B}(-[:90,,,,draw=none]H)-[,,,,draw=none]H} " ) } \end{align} \end{frame} \end{document} ```
https://tex.stackexchange.com/users/297345
Lewis structure with chemfig inside chemformula inside align?
true
with `chemfig` and `elements` ``` \documentclass{beamer} \usepackage{elements} \usepackage{chemfig} \setchemfig{compound sep=7em, arrow offset=2em, + sep left=1.5em, + sep right=1.5em} \setcharge{.radius=0.2ex} \begin{document} \begin{frame}{MWE} \begin{align} \schemestart \chemname{\chemfig{\charge{0:1pt=\.}{H}}}{\scriptsize\elconf{H}} \+ \chemname{\chemfig{\charge{180:1pt=\.}{H}}}{\scriptsize\elconf{H}} \arrow(.mid east--.mid west){->[][][0.8pt]}[,1] \schemestop & \schemestart \chemname{\chemfig{\charge{0:1pt=\.}{H}-[,0.5,,,draw=none]\charge{180:1pt=\.}{H}}}{\scriptsize\writeelconf{2}} \schemestop \\[3ex] \schemestart \chemname{\chemfig{\charge{0:1pt=\.,90:1pt=\:,180:1pt=\.,270:1pt=\.}{N}}}{\scriptsize\elconf{N}} \+ \chemname{\chemfig{\charge{0:1pt=\:,90:1pt=\:,180:1pt=\.,270:1pt=\.}{O}}}{\scriptsize\elconf{O}} \arrow(.mid east--.mid west){->[][][0.8pt]}[,1] \schemestop & \schemestart \chemname{\chemfig{\charge{0:1pt=\:,90:1pt=\:,180:1pt=\.}{N}-[,0.5,,,draw=none]\charge{-45:0pt=\:,45:0pt=\:,180:1pt=\:}{O}}}{\scriptsize\writeelconf{2,2+5}\,\scriptsize\writeelconf{2,2+6}} \schemestop \\[2ex] \schemestart 3\,\chemname{\chemfig{\charge{0:1pt=\.}{H}}}{\scriptsize\elconf{H}} \+ \chemname{\chemfig{\charge{0:1pt=\.,90:1pt=\.,180:1pt=\.}{B}}}{\scriptsize\elconf{B}} \arrow(.mid east--.mid west){->[][][0.8pt]}[,1] \schemestop & \schemestart \chemname{\chemfig{H-[,0.4,,,draw=none]\charge{0:1pt=\:,90:1pt=\:,180:1pt=\:}{B}(-[2,0.4,,,draw=none]H)-[,0.4,,,draw=none]H}}{\scriptsize\writeelconf{2,2+4}} \schemestop \end{align} \end{frame} \end{document} ```
1
https://tex.stackexchange.com/users/186244
691051
320,573
https://tex.stackexchange.com/questions/691017
2
Hi. I am creating a `beamer` presentation on Lewis dot structures. I got most of my code from this question ([Draw Lewis structures like a book](https://tex.stackexchange.com/questions/137227/draw-lewis-structures-like-a-book/137248#137248))... But then I got stuck with BH3...(3rd reaction). I am not sure if I can write BH3 (with double dots instead of bonds/lines) with the `chemformula package` or if I need to do it using the `chemfig` way. I tried recreating the BH3 structure with `chemfig`s `\Charge` command (commented out), wich outside the `align` environment seems to work, but if I paste it instead of the `\chlewis` command the document does not compile. Any help is appreciated. Thanks. ``` \documentclass{beamer} \usepackage{chemformula} \usepackage{elements} \usepackage{chemfig} \begin{document} \begin{frame}{MWE} \begin{align} \ch{ !(\elconf{H})( "\chlewis{0.}{H}" ) + !(\elconf{H})( "\chlewis{0.}{H}" ) & -> !(\writeelconf{2})( "\chlewis{0.}{H}" "\chlewis{180.}{H}" ) \\ %% !(\elconf{N})( "\chlewis{0.90:180.270.}{N}" ) + !(\elconf{O})( "\chlewis{0:90:180.270.}{O}" ) & -> !(\writeelconf{2,2+5}\writeelconf{2,2+6}) ( "\chlewis{0:90:180.}{N}" "\chlewis{45:180:315:}{O}" ) \\ %% !(\elconf{H})( "\chlewis{0.}{3H}" ) + !(\elconf{B})( "\chlewis{0.90.180.}{B}" ) & -> !(\writeelconf{2,2+4}) ( "\chlewis{0:90:180:}{B}" ) %!(\writeelconf{2,2+4}) ( "\chemfig[atom sep=1.25em]{H-[,,,,draw=none]\Charge{[circle]0=\:,90=\:,180=\:}{B}(-[:90,,,,draw=none]H)-[,,,,draw=none]H} " ) } \end{align} \end{frame} \end{document} ```
https://tex.stackexchange.com/users/297345
Lewis structure with chemfig inside chemformula inside align?
false
It is possible to adjust the characteristics of the bonds before the \chemfig command, so as not to repeat these characteristics with each chemical bond. To write Lewis structures using ChemFig's \charge command: ``` \documentclass{article} \usepackage{chemfig} \begin{document} \setchemfig{atom sep=10pt, bond style={draw=none}} \chemfig{\charge{0=\: ,90=\:,180=\:}{B}(-[0]H)(-[2]H)(-[4]H)} \end{document} ```
3
https://tex.stackexchange.com/users/134993
691052
320,574
https://tex.stackexchange.com/questions/690911
0
I am writing a paper using Springer Nature latex template. I can compile the manuscript with no problems, and the manuscript has been accepted. Now, I was asked to provide date for the entries in the bibliography list, given that in the manuscript there is none. I am using the numbered vancouver reference style directly from sn-vancouver. Every entry in the .bib file has the data={}; field complete. I am not sure on which supporting file causes the problem: 'sn-jnl.cls' or 'sn-vancouver.bst'. math-phys style does not produce dates either. For example, the following entry in the .bib file gets me the reference which follows ``` @article{binetti_natural_2009, title = {The natural transparency and piezoelectric response of the Greta oto butterfly wing}, volume = {1}, issn = {1757-9694, 1757-9708}, url = {https://academic.oup.com/ib/article/1/4/324-329/5211402}, doi = {10.1039/b820205b}, pages = {324}, number = {4}, journaltitle = {Integrative Biology}, shortjournal = {Integr. Biol.}, author = {Binetti, Valerie R. and Schiffman, Jessica D. and Leaffer, Oren D. and Spanier, Jonathan E. and Schauer, Caroline L.}, urldate = {2023-05-24}, date = {2009}, langid = {english}, file = {Binetti 2009 Greta Oto transparency.pdf:C\:\\Users\\lenovo\\OneDrive\\Documentos\\Maestria\\Tesis\\Papers\\Alas mariposa\\Binetti 2009 Greta Oto transparency.pdf:application/pdf}, } ``` *Binetti VR, Schiffman JD, Leaffer OD, Spanier JE, Schauer CL. The natural trans- parency and piezoelectric response of the Greta oto butterfly wing;1(4):324. https:// doi.org/10.1039/b820205b.* Does anyone have an idea? Thank you.
https://tex.stackexchange.com/users/300582
Problem with Springer Reference style
false
Thee issue occured because the generated bibligraphy is in Biblatex format, and the template from Springer uses Bibtex. The fields are different, and this caused the error.
0
https://tex.stackexchange.com/users/300582
691053
320,575
https://tex.stackexchange.com/questions/691042
1
So the committee at my institution has some absurd formatting requirements on the thesis, and I am suppose to make corrections per their specifications to the default Table of Contents generated by LaTeX. They are: Instead of Contents, the heading must state: Table of Contents (currently, it reads Contents) Every entry in the TOC, even the chapter titles, must have leading dots to their page numbers (currently, the pages corresponding to the chapter titles are not by the dots) The page numbers, all of them, must be not in boldface (currently, the only pages corresponding to the chapter titles are boldfaced in mine) The chapter titles must be referenced in whole, meaning if it's Chapter 1: Introduction, as opposed to simply the entry saying "Introduction," it must read: Chater 1: Introduction. I am fairly clueless as to how to proceed, since I am very unfamiliar with those packages that customize the TOC. Please help!
https://tex.stackexchange.com/users/75687
Customizing various features in the table of contents
true
I’m sure this is not the best possible solution, and then again, here are more savvy people that can point to a proper package that can handle stuff globally. However, this one works fine for good ol’ regular `book` class, which is the one that requires the patch, so here it goes! ``` \documentclass{book} \makeatletter \renewcommand*{\l@chapter}[2]{% % Chapter label format \ifnum \c@tocdepth > \m@ne % Check: Maximum depth > -1 \addpenalty{-\@highpenalty}% % Encourage prior line breaking \vskip 1.0em \@plus\p@% % Prior vertical whitespace \setlength\@tempdima{1.5em}% % Set temporary length \begingroup % Begin closed group \parindent\z@ % No paragraph indentation \rightskip\@tocrmarg % Reserved right whitespace \parfillskip -\@tocrmarg % Prevent box from moving \leavevmode % Force horizontal mode \advance\leftskip\@tempdima % Left whitespace \hskip -\leftskip % First line alignment {\bfseries Chapter #1}% % Chapter name and format \nobreak % Avoid lineskip \leaders\hbox{$% % Command to replicate dots \m@th % Math mode for alignment \mkern\@dotsep mu % Whitespace before a dot \hbox{.}% % Dot separator \mkern\@dotsep mu % Whitespace after a dot $}% \hfill % Flush to the right \nobreak\hb@xt@\@pnumwidth{% % Chapter page’s number box \hss #2% % Page number with buffer }% \par % Insert line skip \penalty\@highpenalty % Return to default penalty \endgroup % End closed group \fi } \makeatother \renewcommand\contentsname{Table of Contents} % Table name \begin{document} \tableofcontents \chapter{One} \section{One-one} \subsection{One-one-one} \chapter{Two} \section{Two-one} \subsection{Two-one-one} \chapter{Three} \section{Three-one} \subsection{Three-one-one} \end{document} ``` Which produces the following! Now, this huge blob of code is just a patch to the `\l@chapter` command which is the responsible of creating the table of contents entry. All is commented so you can follow along, but the notable mentions are as follows. Line 16 holds the entry and its format, this is inside brackets so the bold does not escape to the page number. Line 21 has the separator set as the dot. You can change it, but if we do that, we have to do that for all the other entries so… a dot it stays. Line 26 holds the page number, if you need to format it, here is where. Line 34, which is outside the big blob, just redefines the contents name to Table of Contents. Again, you can change it to whatever. Something that I can’t figure out yet but I’m trying to: The proper “Chapter #: Something” with the colon. In this solution this is not as straight-forward to implement since the argument `#1` will load “`[Number] [Chapter name]`” as a whole block. I’m working on it, but hopefully for the little time I had this does what you need to do! Edit ---- I found the solution to the colon problem! However… this means we got to patch another mouthful of code, so here it goes the full version! ``` \documentclass{book} \makeatletter \def\@chapter[#1]#2{% % Regular chapter command \ifnum \c@secnumdepth > \m@ne % Check: Maximum depth > -1 \if@mainmatter % Verify if at the main matter \refstepcounter{chapter} % Ch. counter +1. Nested to 0 \addcontentsline{toc}{chapter}{% % Add to the Table of Contents \protect\numberline{\thechapter:}#1%% Contents and format } \else % Not at the main matter \addcontentsline{toc}{chapter}{% % Add to the Table of Contents #1% % Only optional text } \fi \else % If above maximum depth \addcontentsline{toc}{chapter}{% % Add to the Table of Contents #1% % Only optional text } \fi \chaptermark{#1}% % Store optional title \addtocontents{lof}{% % Add to the List of Figures \protect\addvspace{10\p@}% % Vertical whitespace } \addtocontents{lot}{% % Add to the List of Tables \protect\addvspace{10\p@}% % Vertical whitespace } \if@twocolumn % For two-columned documents \@topnewpage[% % Occupy both columns \@makechapterhead{#2}% % Generate the contents ] \else % For one-columned documents \@makechapterhead{#2}% % Generate the contents \@afterheading % Line skip after a heading \fi } \renewcommand*{\l@chapter}[2]{% % Chapter label format \ifnum \c@tocdepth > \m@ne % Check: Maximum depth > -1 \addpenalty{-\@highpenalty}% % Encourage prior line breaking \vskip 1.0em \@plus\p@% % Prior vertical whitespace \setlength\@tempdima{1.5em}% % Set temporary length \begingroup % Begin closed group \parindent\z@ % No paragraph indentation \rightskip\@tocrmarg % Reserved right whitespace \parfillskip -\@tocrmarg % Prevent box from moving \leavevmode % Force horizontal mode \advance\leftskip\@tempdima % Left whitespace \hskip -\leftskip % First line alignment {\bfseries Chapter #1}% % Chapter name and format \nobreak % Avoid lineskip \leaders\hbox{$% % Command to replicate dots \m@th % Math mode for alignment \mkern\@dotsep mu % Whitespace before a dot \hbox{.}% % Dot separator \mkern\@dotsep mu % Whitespace after a dot $}% \hfill % Flush to the right \nobreak\hb@xt@\@pnumwidth{% % Chapter page’s number box \hss #2% % Page number with buffer }% \par % Insert line skip \penalty\@highpenalty % Return to default penalty \endgroup % End closed group \fi } \makeatother \renewcommand\contentsname{Table of Contents} % Table name \begin{document} \tableofcontents \chapter{One} \section{One-one} \subsection{One-one-one} \chapter{Two} \section{Two-one} \subsection{Two-one-one} \chapter{Three} \section{Three-one} \subsection{Three-one-one} \end{document} ``` Which now yields this! Now, all this weird stuff that comes from lines 4 to 36 is directly from the source of the default [LaTeX2e classes documentation](https://www.latex-project.org/help/documentation/classes.pdf). Most of it is untouched, just pasted as-is to avoid crashing the intended functionality. The only patch on this blob is line 9, which as you can see, contains the colon! (The original one didn’t, that’s why in the last code #1 called the chapter as “`[Number] [Chapter name]`” while now the colon is between them! Again, apologies if this seems a bit messy, but with all the functions at hand, maybe you can modify this to your needs!
0
https://tex.stackexchange.com/users/300379
691054
320,576
https://tex.stackexchange.com/questions/690770
0
I want to display a block of code with ' and ` displaying as themselves and with evaluation of macros.The closest that I've been able to come was ``` \documentclass[b4paper]{article} \usepackage{alltt} \usepackage{upquote} \begin{document} Using alltt and upquote \begin{alltt} foo='Ren\'{e}' bar=`Ren\'{e}` \end{alltt} \end{document} ``` and ``` \documentclass[b4paper]{article} \usepackage{fancyvrb} \usepackage{upquote} \begin{document} Using upquote and fancyvrb \begin{verbatim} foo='Ren\'{e}' bar=`Ren\'{e}` \end{verbatim} ``` These correctly handle the **'**, **`** and **\**, but the text is not indented nor in a frame. I tried using upquote and fancyvrb with frame=single ``` \begin{verbatim}[frame=single] foo='Ren\'{e}' bar=`Ren\'{e}` \end{verbatim} \end{document} ``` These correctly handle the **'**, **`** and **\**, but the text is not indented nor in a frame. The placement of the optional parameter matches the fancyvrb documentation; [frame=single] is treated as the first text line in the environment. Putting the parameters in the other order gives me ``` ! Missing $ inserted <inserted text> $ l.16 ``` The error line seems to be \end{verbatim} The documentation for listings says that it is possible to escape LaTeX, but I have not been able to get that to work. I tried putting everything in a framed environment, but that interfered with alltt and fancyvrb. I have to edit the document on a platform that only supports two code pages per boot, and I need 437 and 850 there. So what is my best way forward?
https://tex.stackexchange.com/users/110591
How to display code in a frame with ASCII ' and ` and interpolation of macros
false
This worked: ``` \documentclass[b4paper]{article} \usepackage{alltt} \usepackage{framed} \usepackage{upquote} \begin{document} Using alltt \begin{alltt} foo='Ren\'{e}' bar=`Ren\'{e}` \end{alltt} Using framed alltt \begin{framed} \begin{alltt} foo='Ren\'{e}' bar=`Ren\'{e}` \end{alltt} \end{framed} \end{document} ``` I wanted to use fancyvrb, which lets me control the width, but it doesn't render properly. I'll use the stopgap above until I figure out how to escape to LaTeX in listings,
0
https://tex.stackexchange.com/users/110591
691061
320,578
https://tex.stackexchange.com/questions/691056
2
I'm using phantom to maintain even spacing between the teacher version and the student version of a document. I have a newcommand that puts text from the teacher version into a phantom in the student version. However, phantom doesn't seem to like the double dollar sign mathmode. Is there a workaround? MWE: ``` \documentclass{article} \usepackage{amsmath} \begin{document} I want this phantom to work: \phantom{$$\mathit{\dfrac{14}{20} = 0.7 = 70\%}$$ } It works when there's no phantom $$\mathit{\dfrac{14}{20} = 0.7 = 70\%}$$ It works with a single \$ around the math: \phantom{$\mathit{\dfrac{14}{20} = 0.7 = 70\%}$ } bla bla bla \end{document} ```
https://tex.stackexchange.com/users/26305
\phantom and $$ conflicting
false
There are two ways to interpret your posting. Removing the redundant `\mathit` wrappers and [using `\[ ... \]` instead of `$$ ... $$`](https://tex.stackexchange.com/q/503/5001) -- see also Why is [ ... ] preferable to $$ ... $$? --, you could be looking for either ``` \[ \phantom{\frac{14}{20} = 0.7 = 70\%} \] ``` or ``` $ \phantom{\dfrac{14}{20} = 0.7 = 70\%}$ ``` The first option places the phantom inside an unnumbered displayed equation environment. The second places the phantom in running text.
0
https://tex.stackexchange.com/users/5001
691063
320,580
https://tex.stackexchange.com/questions/691055
2
Let $S$ be a surface in $\mathbb{R}^3$. I have a large set of points $(x, y, z)$ belonging to this surface, and I want to draw it using Asymptote in LaTeX. Here is the version of my code that is not working since it complies with no error but no result is produced. Thank you in advance. ``` import three; size(200); currentprojection = perspective(6,3,2); file in = input("xyz.dat").line(); real[][] a=in; a=transpose(a); real[] x = a[0]; real[] y = a[1]; real[] z = a[2]; triple[][] points; for (int i = 0; i < x.length; ++i) { triple[] currentPoint = {(x[i], y[i], z[i])}; points.push(currentPoint); } surface s = surface(points); draw(s); ```
https://tex.stackexchange.com/users/194620
draw a surface from a matrix of points in asymptote latex
false
There are several issues, I think. First, the `surface(triple[][])` is part of `graph3`, and not `three`. So you need to `import graph3;` instead. Secondly, if I read your code correctly, your code stuff all of `xyz.dat` into essentially a one-dimensional array of `triples` (it has width just 1). This will **not** work for `surface`; the function `surface(triple[][])` builds a wire frame parametrized by the two array dimensions. The way you are stuffing the info into the array, there is no surface to plot, as the whole thing is interpreted as a one dimensional curve.
2
https://tex.stackexchange.com/users/119
691064
320,581
https://tex.stackexchange.com/questions/690994
0
I need to insert a 2 columns long table in my document with a large amount of text on each cell of the second column. However, the final result has been a table covering 6 pages of the document. I have been trying to reduce the fontsize of the text inside the table, but so far, the only solution I found resulted in reducing the size of the table's caption as well, which looked weird. One of the solutions I tried is [this](https://tex.stackexchange.com/questions/682357/how-to-resize-the-font-size-in-a-longtblr-tabularray), but for some reason, I couldn't understand, it didn't work as expected. For now, the solution I'm using is to insert the `longtblr` environment inside `\begingroup`, and then set the fontsize of the text there. Is there a way to resize the text only in the cells, or some specific rows, keeping the original fontsize of the caption? MWE: ``` \documentclass[12pt, a4paper, twoside, english]{article} \usepackage[margin=2.5cm]{geometry} \usepackage{array,booktabs} \usepackage{tabularray} \UseTblrLibrary{booktabs} \usepackage{xcolor} \begin{document} The quick brown fox jumps over the lazy dog. The quick brown fox jumps over the lazy dog. \begingroup \fontsize{8pt}{8pt}\selectfont \begin{longtblr}[ caption = {Caption of the table.}, label = {tab:label}, ]{ Q[c,m]|X[l,m] } \hline row & some relatively long description so that the other entries can showboat their floatiness row & some relatively long description so that the other entries can showboat their floatiness row & some relatively long description so that the other entries can showboat their floatiness row & some relatively long description so that the other entries can showboat their floatiness row & some relatively long description so that the other entries can showboat their floatiness row & some relatively long description so that the other entries can showboat their floatiness row & some relatively long description so that the other entries can showboat their floatiness row & some relatively long description so that the other entries can showboat their floatiness row & some relatively long description so that the other entries can showboat their floatiness row & some relatively long description so that the other entries can showboat their floatiness row & some relatively long description so that the other entries can showboat their floatiness row & some relatively long description so that the other entries can showboat their floatiness row & some relatively long description so that the other entries can showboat their floatiness row & some relatively long description so that the other entries can showboat their floatiness row & some relatively long description so that the other entries can showboat their floatiness \end{longtblr} \endgroup The quick brown fox jumps over the lazy dog. The quick brown fox jumps over the lazy dog. \end{document} ```
https://tex.stackexchange.com/users/188408
Tabularray - resize text in rows of longtblr without resizing caption text
true
* Answers on question in the given link do exactly what you require in your question title. * If you have problems, how used solutions for table works, please read `tabularray` package or ask here, which part of code (presumably settings in table preamble) you have problems. * A background and purpose of your table is unknown, but any kind of tables usually contain column headers, which are in cases of long table repeated on each pages spanned by it. * From typographical point of view is recommended that whole table body has the same font size (for which is recommended, that table is srill readable, not to be smaller than `\footnoteseize`). * If the table which use the proposed solutions in given link not sufficiently reduce table size, you still have two options to squize it a wee bit: + reduce `rowsep`, for example by setting `rowsep = 1pt` or `rowsep = 0.5pt` + reduce `\baselineskip` in cell texts, for example with `cells = {font=\footnotesize\linespread{0.84}\selectfont}` * See, if the following solution (which to my opinion has more "professional" look) is acceptable to you: ``` \documentclass[12pt, a4paper, twoside, english]{article} \usepackage[margin=2.5cm]{geometry} \usepackage{microtype} % added for better spacing of text \usepackage{xcolor} \usepackage{tabularray} \UseTblrLibrary{booktabs} \SetTblrStyle{firstfoot,middlefoot}{\footnotesize\itshape} \usepackage{lipsum} \begin{document} The quick brown fox jumps over the lazy dog. The quick brown fox jumps over the lazy dog. \begin{longtblr}[ caption = {Caption of the table.}, label = {tab:label}, ]{colspec = {Q[c] X[j]}, cells = {font=\footnotesize\linespread{0.84}\selectfont}, rowsep = 1pt, rowhead = 1 } \toprule item & Description \\ \midrule row & \lipsum[66] \\ row & some relatively long description so that the other entries can showboat their floatiness\\ row & \lipsum[1] \\ row & \lipsum[2] \\ row & \lipsum[3] \\ row & \lipsum[4] \\ row & \lipsum[5] \\ row & \lipsum[7] \\ row & \lipsum[66] \\ row & \lipsum[66] \\ row & \lipsum[66] \\ \bottomrule \end{longtblr} The quick brown fox jumps over the lazy dog. The quick brown fox jumps over the lazy dog. \end{document} ``` However, if you prefer to have more ugly solution, which has smaller font size only in the particular cells, than follow proposition in other answer, i.e. set font size for this cell locally by inserting in those cells ``` \SetCell{font=\tiny} % or any other font size ``` Off-topic: in any kind of table rows should be terminated accordingly. In your case at end of each row you should add `\\`.
1
https://tex.stackexchange.com/users/18189
691065
320,582
https://tex.stackexchange.com/questions/691057
3
I formerly used `\usepackage[footnote]{nicematrix}`, but this doesn't work any more, after changing my computer and updating MiKTeX. The error is ``` ! Undefined control sequence. <argument> \IfClassLoadeTF {beamer}{\bool_set_false:N\c_nicematrix_footnot...I.8442} ``` I want to have the note at the foot of the page. When I write `\usepackage{nicematrix}`, without `[footnote]`, no footnote appears. What can I do to fix this? My code is ``` \documentclass{article} \usepackage[footnote]{nicematrix} \usepackage{tikz} \begin{document} \ttfamily \begin{NiceTabular}{lc@{\hphantom{-}}c@{\hphantom{-}}cc} Tact\footnote{voilà} & 8 & 9 & 10 & 11 \\ Sup- & & & & quelle \\ Cont- & quel & \Block[l]{}{\llap{-}le} \\ Ten- & & & quelle \\ Bas- & & quel & \Block[l]{}{\llap{-}le} \\ \CodeAfter \begin{tikzpicture} \draw (3-2.south east) -- (3-2.south west) -- (5-3.south west) -- (5-3.south east) -- (4-4.south east) -- (4-4.south west) ; \draw (4-4.south east) -- (2-5.south east) -- (2-5.south west) ; \end{tikzpicture} \end{NiceTabular} \end{document} ``` Thank you for any help
https://tex.stackexchange.com/users/300668
Problem with nicematrix and footnotes
true
That's a bug. It will be corrected in the next version of `nicematrix`. As a workaround, you can use `footnotehyper` instead of `footnote`: ``` \usepackage[footnotehyper]{nicematrix} ```
3
https://tex.stackexchange.com/users/163000
691074
320,588
https://tex.stackexchange.com/questions/691056
2
I'm using phantom to maintain even spacing between the teacher version and the student version of a document. I have a newcommand that puts text from the teacher version into a phantom in the student version. However, phantom doesn't seem to like the double dollar sign mathmode. Is there a workaround? MWE: ``` \documentclass{article} \usepackage{amsmath} \begin{document} I want this phantom to work: \phantom{$$\mathit{\dfrac{14}{20} = 0.7 = 70\%}$$ } It works when there's no phantom $$\mathit{\dfrac{14}{20} = 0.7 = 70\%}$$ It works with a single \$ around the math: \phantom{$\mathit{\dfrac{14}{20} = 0.7 = 70\%}$ } bla bla bla \end{document} ```
https://tex.stackexchange.com/users/26305
\phantom and $$ conflicting
false
The first thing to say is: never use `$$` in a LaTeX `document` environment. What happens in your case can be explained: `\phantom` creates a horizontal box with the same dimensions as the material inside it. In such a horizontal box, it's not possible to make paragraphs, so display math mode is disallowed and `$` just starts math mode. A following `$` simply ends math mode. So you get an empty formula followed by `\mathit` in text mode, which triggers the error. If you want to make a double version, it's better to define structures. This is a basic framework just to give you an idea. ``` \documentclass[twocolumn]{article} \usepackage{amsmath} \newif\ifstudent \newcommand{\equ}[1]{% \[ \ifstudent\else\expandafter\phantom\fi{#1} \]% } \begin{document} \section{With phantom} I want this phantom to work: \equ{\dfrac{14}{20} = 0.7 = 70\%} It works when there's no phantom \[ \dfrac{14}{20} = 0.7 = 70\% \] Some text follows. \newpage \section{Clear text} \studenttrue I want this phantom to work: \equ{\dfrac{14}{20} = 0.7 = 70\%} It works when there's no phantom \[ \dfrac{14}{20} = 0.7 = 70\% \] Some text follows. \end{document} ```
1
https://tex.stackexchange.com/users/4427
691075
320,589
https://tex.stackexchange.com/questions/397174
30
I'm building a script for a CI to get a docker image with minimal distribution of Texlive possible, I specifically want to avoid pulling 5 Gb of `texlive-full` everytime I need this docker image. Right now I see this script as 1. install `texlive-something` 2. `tlmgr install latexmk` 3. `tlmgr install texliveonfly` 4. `texliveonfly -c latexmk -a "-pdf -f -synctex=0" myFile.tex` (install missing tex packages and compile with `latexmk`) 5. deploy results and cache the tex-related part of the image. Which package should I chose for `texlive-something` so that these steps work? Thanks in advance. **edit** It seems that the word *minimal* can lead to some confusion. In this case it means (for a package) 1. Has a set of binaries (`pdflatex`, `tlmgr`, `bibtex`/`biber`, `perl`, I might be missing something) that would allow me to compile an empty document. Should I need some other binaries, I'm ok with adding this dependencies by hand 2. Contains a minimal set of LaTeX packages so that an empty document would compile. If I understand correctly, most other packages will be handled by `texliveonfly` (barring some esoteric cases, of course, but that can be handled manually, too). In other words, minimal in terms of total disk space under the hypothesis that an empty document compiles using the instruments I mentioned.
https://tex.stackexchange.com/users/28746
Minimal TeXLive installation
false
For a CI environment, I would base on one of the Island of TeX texlive images. It is availble at <https://gitlab.com/islandoftex/images/texlive> To choose between `minimal`, `basic`, `small`, `medium`, and `full` etc., please consult [What makes up each TeX Live install-tl scheme?](https://tex.stackexchange.com/questions/500339/what-makes-up-each-tex-live-install-tl-scheme). For really minimal, start with `registry.gitlab.com/islandoftex/images/texlive:TL2023-latest-minimal`.
5
https://tex.stackexchange.com/users/9075
691079
320,591
https://tex.stackexchange.com/questions/691073
1
A colleague is writing a proposal collaboratively, in which the same proposal will be jointly submitted to two different funding agencies in different countries. There is a 70% overlap in content, but precise formatting in even the common portions is different (fonts, columns, etc) and there is a conditional inclusion of certain sections. So, this cannot be done simply by using conditional `\input` and `\include` commands, as the markup inside the files needs to be treated differently. Also, just writing two independent documents is not the right solution, since the overlap is significant and you will always run into consistency issues. `beamer` has a package called `beameraudience` that allows you to fine tune the output based on change of a single switch. Can this package (or something more appropriate for article class documents) be used for the above application? They are not looking to create two different PDF documents in a single compilation (though that would be ideal, though inadvisable, as `\write18` is potentially dangerous) but can things be conditionally included/formatted based on the value of a switch?
https://tex.stackexchange.com/users/44753
Produce two PDF documents from one LaTeX document based on a macro
true
My philosophy is the KISS principle "keep it simple, s\*\*\*", and under this view, the best is two documents for two layouts with a common comment with the list of all possible inputs: ``` % \input{foo} % \input{bar} % \input{whatever} ``` That can be selectively activated or deactivated just removing or adding one `%`. Said that, there is no problem messing all in a single file with conditionals. In this MWE you only have to choose between line 8 or 9 to obtain two very different documents in format and content: ``` \documentclass{article} \usepackage{lipsum} \newif\ifpropA \newif\ifpropB % choose: % \propAtrue\propBfalse % for proposal A \propAfalse\propBtrue % for proposal B \ifpropA \parskip0pt \parindent2em \twocolumn \usepackage[scaled]{helvet} \renewcommand\familydefault{\sfdefault} \fi \ifpropB \parskip1em \parindent0pt \onecolumn \usepackage{dejavu} \usepackage{xcolor}\color{blue} \fi \begin{document} \section*{A common title} This is a common part. \ifpropA This is the proposal \fbox{A}. \lipsum[1-10] \fi \ifpropB This is the proposal \fbox{B}. \lipsum[11-20] \fi \end{document} ```
3
https://tex.stackexchange.com/users/11604
691080
320,592
https://tex.stackexchange.com/questions/691082
0
I have a simple assignment in LuaTex: `\dimen1 = 210mm` Now I print the value `\the\dimen1` The result is: `597.50787pt` Calculating back with `1pt = 0.351mm` is: `209.725...mm`. This is an error of more than a quarter mm. Seems not much, but saying `\pagewidth = 210mm` means, my page is a quarter mm too small. When I do `\dimen2 = 598.2905983pt` (the correct value for 210mm), `\the\dimen2` shows the nearly correct `598.2906pt`. Why is the error so unexpected large when assigning millimeters? Am I using the wrong factor between pt and mm? Or is 0.351 rounded itself? Thanks for all answers Peter
https://tex.stackexchange.com/users/254672
rounding error in simple assignment
false
Oh, I found the answer myself. 0,351 is a rounded value. Donald Knuth set his TeX-pt to exact 1⁄72.27inch which is near to 0.35145980mm. It's so easy :-) Found the answer here: <https://en.wikipedia.org/wiki/Point_(typography)> Thanks for reading Peter
2
https://tex.stackexchange.com/users/254672
691084
320,593
https://tex.stackexchange.com/questions/690288
0
I have a document, formatted with luatex, beginning ``` \documentclass[b4paper]{article} \usepackage{expl3} \usepackage{hyperref} \usepackage{listings} %Requires luatex engine to handle UTF-8 %Consider using minted, but ... ... \begin{document} \lstset{language=Rexx, extendedchars=true, frame=trbl} \maketitle ``` that uses the listings package to display code samples of Rexx, a language that uses the ASCII apostrophe as a delimiter. The code samples include a letter e with an accent aigu ("é"), which I enter as "\’{e}", and an ASCII apostrophe ("'"), which I enter as "{\textquotesingle}". This works fine in text ``` For example, the Unicode string {\textquotesingle\}Caf\'{e}{\textquotesingle\} has 4 code points, 4 grapheme clusters and 5 octets in UTF-8 encoding while {\textquotesingle\}Cafe\textbf{'}{\textquotesingle\} has 5 code points, 4 grapheme clusters and 6 octets in UTF-8 encoding, yet many text processing applications need to treat them as equivalent. ``` renders properly as > > For example, the Unicode string 'Café' has 4 code points, 4 grapheme > clusters and 5 octets in UTF-8 encoding while 'Cafe’' has 5 code > points, 4 grapheme clusters and 6 octets in UTF-8 encoding, yet many > text processing applications need to treat them as equivalent. > > > The apostrophe should be rendered as straight. The second piece is that ``` \begin{lstlisting} foo = 'Ren\'{e}' parse upper var foo bar \end{lstlisting} ``` renders as > > > ``` > foo = ’Ren\’{e}’ > > ``` > > \_\_\_\_parse upper var foo bar > > > where \_ is actually the visible space cup. The ' is not interpolated and the leading spaces on the second line are not rendered properly. I was able to use \'{ } to display a bare accent aigu, and with a recent LaTeX I was able to use \textquotesingle for a straight apostrophe. MWE for listing: ``` \documentclass[b4paper]{article} \usepackage{enumitem} \usepackage{expl3} \usepackage{hyperref} \usepackage{listings} %Requires luatex engine to handle UTF-8 %Consider using minted, but ... \begin{document} \lstset{language=Rexx, extendedchars=true, frame=trbl} \begin{lstlisting} foo = {\textquotesingle\}Ren\'{e}{\textquotesingle} parse upper var foo bar \end{lstlisting} \end{document} ``` The documentation for listings claims that it is possible to escape to LaTeX, but I have not been able to make that work. The markup I used above, in plain text, renders properly as "’Café’". So my question is, without entering characters above U+7F, what luatex compatible package and markup should I use for the sample code without affecting the rendering of apostrophe elsewhere in the document? I can give up syntax highlighting as long as the code is indented, not wrapped, and is boxed or otherwise distinguished.
https://tex.stackexchange.com/users/110591
How to mix markup for straight apostrophes and accented letters in a lstlisting environment?
false
Both of these work ``` \documentclass[b4paper]{article} \usepackage{alltt} \usepackage{framed} \usepackage{upquote} \begin{document} Using alltt with framed and upquote. \begin{framed} \begin{verbatim} foo='Ren\'{e}' bar=`Ren\'{e}` \end{verbatim} \end{framed} \end{document} ``` and ``` \documentclass{article} \usepackage{fontspec} \usepackage{hyperref} \usepackage{listings} \usepackage{upquote} \begin{document} \lstset{language=Rexx, extendedchars=true, frame=trbl, escapechar={!},linewidth=20em} \section{Statement of problem} \subsection{Secondary Problem} Using upquote listings with language=Rexx, extendedchars=true, frame=trbl, escapechar={!}, width=20em \begin{lstlisting} foo = 'Ren!\'{e}!' baz = `Ren!\'{e}!` parse upper var foo bar \end{lstlisting} ``` \end{document}
0
https://tex.stackexchange.com/users/110591
691098
320,599
https://tex.stackexchange.com/questions/691097
2
Page 8 of the unofficial latex2e manual says > > One way to do that is to put \pdfpagewidth=\paperwidth and \pdfpageheight=\paperheight in your document’s preamble. > > > However, I get ``` ! Undefined control sequence. l.8 \pdfpagewidth =\paperwidth ? ! LaTeX Error: Missing \begin{document} ! Undefined control sequence. l.9 \pdfpageheight =\paperheight ? ``` when I run ``` \documentclass{article} \usepackage{fontspec} \usepackage{hyperref} \usepackage{listings} \usepackage{upquote} %per latex2e p. 8 One way to do that is to put \pdfpagewidth=\paperwidth and \pdfpageheight=\paperheight in your document’s preamble. \pdfpagewidth=\paperwidth \pdfpageheight=\paperheight \begin{document} \lstset{language=Rexx, extendedchars=true, frame=trbl, escapechar={!}, linewidth=20em} \section{Statement of problem} \subsection{Secondary Problem} Using upquote listings with language=Rexx, extendedchars=true, frame=trbl, escapechar={!}, width=20em \begin{lstlisting} foo = 'Ren!\'{e}!' baz = `Ren!\'{e}!` parse upper var foo bar \end{lstlisting} \end{document} ``` To clarify, when I use B4 paper I get massive left and right margins, with the text formatted in what looks to be an 8.5"x11" box. Is there an engine independent way to set the PDF geometry from the paper size? Also, how do I report this in order to get engine dependency added to page 8?
https://tex.stackexchange.com/users/110591
Undefined control sequence setting PDF geometry
false
See this [answer](https://tex.stackexchange.com/a/425646/241621) by David Carlisle. From there we can see that `\pdfpageheight` is supported by `pdftex` and `xetex` but not `luatex`. So you can't use `luatex` as the compiling engine in this case.
4
https://tex.stackexchange.com/users/241621
691099
320,600
https://tex.stackexchange.com/questions/691097
2
Page 8 of the unofficial latex2e manual says > > One way to do that is to put \pdfpagewidth=\paperwidth and \pdfpageheight=\paperheight in your document’s preamble. > > > However, I get ``` ! Undefined control sequence. l.8 \pdfpagewidth =\paperwidth ? ! LaTeX Error: Missing \begin{document} ! Undefined control sequence. l.9 \pdfpageheight =\paperheight ? ``` when I run ``` \documentclass{article} \usepackage{fontspec} \usepackage{hyperref} \usepackage{listings} \usepackage{upquote} %per latex2e p. 8 One way to do that is to put \pdfpagewidth=\paperwidth and \pdfpageheight=\paperheight in your document’s preamble. \pdfpagewidth=\paperwidth \pdfpageheight=\paperheight \begin{document} \lstset{language=Rexx, extendedchars=true, frame=trbl, escapechar={!}, linewidth=20em} \section{Statement of problem} \subsection{Secondary Problem} Using upquote listings with language=Rexx, extendedchars=true, frame=trbl, escapechar={!}, width=20em \begin{lstlisting} foo = 'Ren!\'{e}!' baz = `Ren!\'{e}!` parse upper var foo bar \end{lstlisting} \end{document} ``` To clarify, when I use B4 paper I get massive left and right margins, with the text formatted in what looks to be an 8.5"x11" box. Is there an engine independent way to set the PDF geometry from the paper size? Also, how do I report this in order to get engine dependency added to page 8?
https://tex.stackexchange.com/users/110591
Undefined control sequence setting PDF geometry
false
In luatex the names of the commands are `\pageheight` and `\pagewidth`. Typically the best is to load a package like geometry or graphics which will set the PDF mediabox automatically to the values of `\paperheight` and `\paperwidth`.
8
https://tex.stackexchange.com/users/2388
691101
320,601
https://tex.stackexchange.com/questions/691042
1
So the committee at my institution has some absurd formatting requirements on the thesis, and I am suppose to make corrections per their specifications to the default Table of Contents generated by LaTeX. They are: Instead of Contents, the heading must state: Table of Contents (currently, it reads Contents) Every entry in the TOC, even the chapter titles, must have leading dots to their page numbers (currently, the pages corresponding to the chapter titles are not by the dots) The page numbers, all of them, must be not in boldface (currently, the only pages corresponding to the chapter titles are boldfaced in mine) The chapter titles must be referenced in whole, meaning if it's Chapter 1: Introduction, as opposed to simply the entry saying "Introduction," it must read: Chater 1: Introduction. I am fairly clueless as to how to proceed, since I am very unfamiliar with those packages that customize the TOC. Please help!
https://tex.stackexchange.com/users/75687
Customizing various features in the table of contents
false
One of the great advantages of LaTeX is that if there's something that you need to do, chances are someone has written a package to do it. In this case, the `tocloft` package provides a full set of interfaces to the contents code so that modifying it to your needs is quite simple. This is really the preferred route compared to hacking large chunks of code. ``` \documentclass{book} \usepackage{tocloft} \usepackage{calc} \renewcommand{\contentsname}{Table of Contents} % if using babel (substitute english with the main language name) %\addto\extrasenglish{\renewcommand{\contentsname}{Table of Contents}} \renewcommand\cftchappresnum{Chapter\space} % name before title \setlength{\cftchapnumwidth}{\widthof{Chapter XX: }}% calculate width to leave enough room \renewcommand{\cftchapdotsep}{\cftdotsep}% add dots to chapter level \renewcommand\cftchapaftersnum{:}% add colon after chapter number \renewcommand\cftchappagefont{\normalfont}% make chapter page numbers not bold \renewcommand{\cftchapleader}{\cftdotfill{\cftchapdotsep}}% make chapter dots not bold \begin{document} \frontmatter \tableofcontents \mainmatter \chapter{One} \section{One-one} \subsection{One-one-one} \chapter{Two} \section{Two-one} \subsection{Two-one-one} \chapter{Three} \section{Three-one} \subsection{Three-one-one} \end{document} ```
0
https://tex.stackexchange.com/users/2693
691102
320,602
https://tex.stackexchange.com/questions/691081
4
Let us consider the following MWE: ``` \documentclass{article} \usepackage{tikz} \newcommand*\circled[1]{\tikz[baseline=(char.base)]{% \node[shape=circle,fill=blue!20,draw,inner sep=2pt] (char) {#1};}} \usepackage{enumitem} \begin{document} \begin{enumerate}[label=\protect\circled{\arabic*}] \item Step one \item Step two \item Step three \end{enumerate} \end{document} ``` How can we force the bullet to be automatically on two digits, ie "01", "02", "03", ...,"10". Thanks for your help
https://tex.stackexchange.com/users/111652
Force enumitem to be on two digits
false
Just use `\int_compare:nNnTF` and do not forget to add `~` between `inner` and `sep`. ``` \documentclass{article} \usepackage{tikz} \ExplSyntaxOn \newcommand*\circled[1]{\tikz[baseline=(char.base)]{% \node[shape=circle,fill=blue!20,draw,inner~sep=2pt] (char) { \int_compare:nNnTF {#1} < { 10 } { 0#1 } { #1 } };}} \ExplSyntaxOff \usepackage{enumitem} \begin{document} \begin{enumerate}[label=\protect\circled{\arabic*}] \item Step one \item Step two \item Step three \item Step four \item Step five \item Step six \item Step seven \item Step eight \item Step nine \item Step ten \item Step eleven \end{enumerate} \end{document} ```
6
https://tex.stackexchange.com/users/241621
691103
320,603
https://tex.stackexchange.com/questions/64894
31
For no particular reason that I could identify, I was faced with the impossibility to compile any latex document and invariably got this error message each time I tried : ``` LaTeX: problems after [0] pages kpathsea: Running mktexfmt pdflatex.fmt tcfmgr: config file `tcfmgr.map' (usually in $TEXMFMAIN/texconfig) not found. I can't find the format file `pdflatex.fmt'! ```
https://tex.stackexchange.com/users/12136
Error: I can't find the format file pdflatex.fmt
false
On Arch Linux, I fixed the issue by installing all of `texlive-*` packages: ``` pacman -Ssq texlive-* | sudo pacman -S - ```
0
https://tex.stackexchange.com/users/150714
691104
320,604
https://tex.stackexchange.com/questions/691096
0
I plot these two plots, but in latex it plot them under each other, I do not want they be ploted under each other, I want they be ploted near each other by some distances? how can I do that? ``` \documentclass{report} \usepackage{graphicx} % Required for inserting images \usepackage{mathtools} \usepackage{pgfplots} \pgfplotsset{compat=1.16} \begin{tikzpicture} \begin{axis}[ width=54mm, axis x line=bottom, axis y line=center, xmin = -3, xmax = 3, ymax = 2.2, xtick={-2, -1, 0, 1, 2}, ytick={1}, xlabel={$t$}, every axis x label/.style={at={(1,0)},anchor=south east}, ylabel={$h(t)$} ] \addplot+[thick,mark=none] coordinates {(0,0) (0,1) (2,1) (2,0)} ; \end{axis} \end{tikzpicture} \begin{tikzpicture} \begin{axis}[ width=54mm, axis x line=bottom, axis y line=center, xmin = -3, xmax = 3, ymax = 2.2, xtick={-2, -1, 0, 1, 2}, ytick={1}, xlabel={$t$}, every axis x label/.style={at={(1,0)},anchor=south east}, ylabel={$h(t)$} ] \addplot+[thick,mark=none] coordinates {(0,0) (0,1) (2,1) (2,0)} ; \end{axis} \end{tikzpicture} ```
https://tex.stackexchange.com/users/300699
plotting two plots near each other in latex
false
Add `\qquad` between the two plots: ``` \end{axis} \end{tikzpicture}\qquad \begin{tikzpicture} \begin{axis}[ ```
1
https://tex.stackexchange.com/users/24644
691105
320,605
https://tex.stackexchange.com/questions/691042
1
So the committee at my institution has some absurd formatting requirements on the thesis, and I am suppose to make corrections per their specifications to the default Table of Contents generated by LaTeX. They are: Instead of Contents, the heading must state: Table of Contents (currently, it reads Contents) Every entry in the TOC, even the chapter titles, must have leading dots to their page numbers (currently, the pages corresponding to the chapter titles are not by the dots) The page numbers, all of them, must be not in boldface (currently, the only pages corresponding to the chapter titles are boldfaced in mine) The chapter titles must be referenced in whole, meaning if it's Chapter 1: Introduction, as opposed to simply the entry saying "Introduction," it must read: Chater 1: Introduction. I am fairly clueless as to how to proceed, since I am very unfamiliar with those packages that customize the TOC. Please help!
https://tex.stackexchange.com/users/75687
Customizing various features in the table of contents
false
Another package that gives you full control of the format of the table of contents is the `titletoc` package, part of the `titlesec` and `titleps` suite of packages. The `titlesec` package is very popular for changing the format of section headings, and the `titletoc` package interfaces very nicely with that, so I'm adding this as a separate answer, even though `titlesec` is not being used in the example code. ``` \documentclass{book} \usepackage{titletoc} \usepackage{calc} \renewcommand{\contentsname}{Table of Contents} % if using babel (substitute english with the main language name) %\addto\extrasenglish{\renewcommand{\contentsname}{Table of Contents}} \dottedcontents{section}[3.8em]{}{2.3em}{.7pc} \dottedcontents{subsection}[6.1em]{}{3.2em}{.7pc} \contentsmargin{2.5em} \titlecontents{chapter} [0em] {} {\bfseries Chapter \thecontentslabel: } {} {\titlerule*[.7pc]{.}\contentspage} \begin{document} \frontmatter \tableofcontents \mainmatter \chapter{One} \section{One-one} \subsection{One-one-one} \chapter{Two} \section{Two-one} \subsection{Two-one-one} \chapter{Three} \section{Three-one} \subsection{Three-one-one} \end{document} ```
0
https://tex.stackexchange.com/users/2693
691107
320,607
https://tex.stackexchange.com/questions/691096
0
I plot these two plots, but in latex it plot them under each other, I do not want they be ploted under each other, I want they be ploted near each other by some distances? how can I do that? ``` \documentclass{report} \usepackage{graphicx} % Required for inserting images \usepackage{mathtools} \usepackage{pgfplots} \pgfplotsset{compat=1.16} \begin{tikzpicture} \begin{axis}[ width=54mm, axis x line=bottom, axis y line=center, xmin = -3, xmax = 3, ymax = 2.2, xtick={-2, -1, 0, 1, 2}, ytick={1}, xlabel={$t$}, every axis x label/.style={at={(1,0)},anchor=south east}, ylabel={$h(t)$} ] \addplot+[thick,mark=none] coordinates {(0,0) (0,1) (2,1) (2,0)} ; \end{axis} \end{tikzpicture} \begin{tikzpicture} \begin{axis}[ width=54mm, axis x line=bottom, axis y line=center, xmin = -3, xmax = 3, ymax = 2.2, xtick={-2, -1, 0, 1, 2}, ytick={1}, xlabel={$t$}, every axis x label/.style={at={(1,0)},anchor=south east}, ylabel={$h(t)$} ] \addplot+[thick,mark=none] coordinates {(0,0) (0,1) (2,1) (2,0)} ; \end{axis} \end{tikzpicture} ```
https://tex.stackexchange.com/users/300699
plotting two plots near each other in latex
false
Depending on what you want you can also follow [this strategie](https://tex.stackexchange.com/a/690972/245790): * create individual files for each `Tikz` drawing and compile them * use `\includegraphics` to include their `.pdf` s * which you can embed in a `figure environment` * which can use `subfigures` to place them next to each other, with sub-captions Next is a sreenshot from said link, which also tells you about the advantages for your workflow. And it schows you two Tikz drawing side by side ... ---
1
https://tex.stackexchange.com/users/245790
691108
320,608
https://tex.stackexchange.com/questions/690954
1
I would like to use the externalize library. So far it worked perfectly and created pdf documents. But now I want to get a "png" file instead. I tried, according to the externalize documentation, the following: ``` \documentclass{article} \usepackage{tikz} \usetikzlibrary{external} \tikzexternalize[prefix=,figure list=true] \tikzset{ png export/.style={ % First we call ImageMagick; change settings to requirements external/system call/.add={}{& magick.exe -density 300 "\image.pdf" "\image.png"}, % Now we force the PNG figure to be used instead of the PDF /pgf/images/external info, /pgf/images/include external/.code={ \includegraphics[width=\pgfexternalwidth,height=\pgfexternalheight]{##1.png} }, } } \begin{document} \tikzset{png export} \tikzsetnextfilename{Figure-A}% \begin{tikzpicture} \draw (0,0) circle (2) ; \end{tikzpicture} \end{document} ``` This though does lead to an error in Windows 11 + MiKTeX Console 4.9 + TeXstudio 4.5.2 (git 4.5.2) + ImageMagick 7.1.1-5 Q16-HDRI x64 + lualatex (LuaHBTeX, Version 1.16.0 (MiKTeX 23.1)): Process: lualatex.exe -synctex=1 -interaction=nonstopmode -shell-escape "main".tex Meldung: "Der Befehl "magick.exe" ist entweder falsch geschrieben oder konnte nicht gefunden werden." (English it means: "The command "magick.exe" is either misspelled or could not be found.") Log: "Package luatex.def Error: File `Figure-A.png' not found: using draft setting. \end{tikzpicture}" The Figure-A.log file doesn't show any error so far as I can see, but the main.log file shows an error at this line: ``` \openout4 = main.figlist Writing 'Figure-A' to 'main.figlist'. \openout3 = Figure-A.md5 \openout3 = main.auxlock ===== 'mode=convert with system call': Invoking 'lualatex -shell-escape -halt-o n-error -interaction=batchmode -jobname "Figure-A" "\def\tikzexternalrealjob{ma in}\input{main}"& magick.exe -density 300 "Figure-A.pdf" "Figure-A.png"' ====== == \openout3 = main.auxlock LaTeX Warning: File `Figure-A.png' not found on input line 24. ! Package luatex.def Error: File `Figure-A.png' not found: using draft setting. See the luatex.def package documentation for explanation. Type H <return> for immediate help. ... l.24 \end{tikzpicture} Try typing <return> to proceed. If that doesn't work, type X <return> to quit. ``` Summary: -) The Figure-A.pdf file has been created, but it seems there is a problem with the conversion from the "pdf" to "png" file. -) If I run the process on the commandline instead of TeXStudio the same problem occurs. -) When I try this on the command line 'magick.exe -density 300 "Figure-A.pdf" "Figure-A.png"' after one latex run (to generate Figure-A.pdf) it generates the image "Figure-A.png" perfectly. -) I found out it works with pdflatex, so it seems to be a problem with lualatex. Although I don't know where the problem is and I would need it lualatex... Would appreciate if someone could look into this and help me out.
https://tex.stackexchange.com/users/243302
Problem with tikzexternalize and conversion to png (lualatex)
true
As @cfr pointed out, using the full path to the executable solved the problem, meaning the following path in my case: ``` external/system call/.add={}{& "C:\\Program Files\\ImageMagick-7.1.1-Q16-HDRI\\magick.exe" -density 300 "\image.pdf" "\image.png"} ``` This generates first the pdf file, then the png file and includes the png in my document afterwards.
0
https://tex.stackexchange.com/users/243302
691111
320,609
https://tex.stackexchange.com/questions/688762
1
I define a few theorems with `amsthm`'s `\newtheorem`, and I want to prepend and append an `hrule` for each one of them. Currently I do it with ``` \AddToHook{env/〈env name〉/before}{hrule code} ``` and ``` \AddToHook{env/〈env name〉/after}{hrule code} ``` for each and every `\newtheorem`. Any idea how to make my code more compact so I state the `AddToHook`s only once and not every time I define a new `note` style environment? ``` \documentclass{book} \usepackage{amsthm} \newtheoremstyle{note}% 〈name〉 {3pt}% 〈Space above〉 {3pt}% 〈Space below 〉 {}% 〈Body font〉 {}% 〈Indent amount〉 {\itshape}% 〈Theorem head font〉 {:}% 〈Punctuation after theorem head 〉 {.5em}% 〈Space after theorem head 〉3 {}% 〈Theorem head spec (can be left empty, meaning ‘normal’ ) \theoremstyle{note} \newtheorem{theorem}{Theorem} \AddToHook{env/theorem/before}{\par\vspace{\baselineskip}\hrule} \AddToHook{env/theorem/after}{\hrule\vspace{\baselineskip}} \newtheorem{definition}{Definition}[chapter] \AddToHook{env/definition/before}{\vspace{\baselineskip}\par\hrule} % same Hook as above \AddToHook{env/definition/after}{\hrule\vspace{\baselineskip}} \newtheorem{remark}{Remark}[chapter] \AddToHook{env/remark/before}{\vspace{\baselineskip}\par\hrule} % Those two hooks again \AddToHook{env/remark/after}{\hrule\vspace{\baselineskip}} \begin{document} Some theorems, definitions and remarks appear here. \end{document} ``` *I am aware of `thmtools` and its `preheadhook` and `postfoothook` keys. But I want to use only `amsthm`.*
https://tex.stackexchange.com/users/180429
Add a latex code before and after every \newtheorem
true
You can easily achieve that effect using a suitable macro. ``` \newcommand*\newtushtheorem[1]{% \AddToHook{env/#1/before}{\par\vspace{\baselineskip}\hrule}% \AddToHook{env/#1/after}{\hrule\vspace{\baselineskip}}% \newtheorem{#1}% } \newtushtheorem{theorem}{Theorem} \newtushtheorem{definition}{Definition}[chapter] \newtushtheorem{remark}{Remark}[chapter] ``` --- However, as mentioned in [the comments](https://tex.stackexchange.com/questions/688762/add-a-latex-code-before-and-after-every-newtheorem#comment1708862_688762), note that this way of adding rules may not always behave in the preferred way.
5
https://tex.stackexchange.com/users/48973
691114
320,611
https://tex.stackexchange.com/questions/691123
0
I'm using TL2023 with LyX-2.3.6.1 on Slackware64-14.2. I'm trying to change the KOMA-Script book chapter headings so the heading is right-aligned, between two horizontal rules, and the chapter title is above the top rule as in the memoir class demo chapter head. I had found code on the KOMA-Script wiki to place chapter headings between two lines and right-align it, but lost the code for the latter. A minimal working example preamble is below. The chapter headings are between two rules, but still left-aligned. The last two lines of the preamble show what I tried from StackExchange threads; neither works for me and I've not found code that puts the header number in lower-case words centered above the top rule. ``` \textclass scrbook \begin_preamble \date{} \usepackage{mathpazo,amssymb} \usepackage{graphicx,relsize} \usepackage{scrlayer-scrpage} \pagestyle{scrheadings} \usepackage{lipsum} %% Add clines above and below chaper headings \usepackage{xpatch} \xapptocmd{\chapterheadstartvskip}{% {% \setlength{\parskip}{0pt}% \setlength{\parfillskip}{0pt plus 1fil}% \noindent\rule[.3\baselineskip]{\linewidth}{1pt}\par }\nobreak }{% \typeout{Horizontal line before chapter heading added.}% }{% \errmessage{Failed to patch \string\chapterheadstartvskip}% }% \xpretocmd{\chapterheadendvskip}{% {% \setlength{\parskip}{0pt}% \setlength{\parfillskip}{0pt plus 1fil}% \noindent\rule[-.3\baselineskip]{\linewidth}{1pt}\par }\nobreak }{% \typeout{Horizontal line after chapter heading added.}% }{% \errmessage{Failed to patch \string\chapterheadendvskip}% }% %% Align chapter heading on right %\let\raggedchapter\raggedrightrenewcommand*{\raggedsec %%\renewcommand*{\raggedchapter}{\raggedright} \end_preamble ``` Pointers to solutions needed.
https://tex.stackexchange.com/users/117172
KOMA-Script: chapter headings right aligned, between horizontal lines, chapter number in words centered at top
false
Herbert Voss provided the solution on the LyX mail list: Write into the documents preamble: ``` \usepackage{fmtcount} \setkomafont{chapter}{\huge} \renewcommand\chapterlinesformat[3]{%     \ifx\relax#2\relax\else\makebox[\linewidth]{% \numberstringnum{\thechapter}}\\\smallskip\fi\rule{\linewidth}{1pt}\par     \ifx\relax#2\relax\smallskip\else\bigskip\fi     \parbox{\linewidth}{\raggedchapter\raggedleft#3}%     \par\medskip\rule{\linewidth}{1pt}% }% ```
0
https://tex.stackexchange.com/users/117172
691130
320,617
https://tex.stackexchange.com/questions/691112
0
I need in a `tufte-book` citations with `author-year` and used the [recommendations](https://tex.stackexchange.com/questions/68175/biblatex-autocite-in-case-of-would-be-nested-footnotes) for the `author-year` style. Unlike the case there, I want * the simple citation in regular text as sidenote (as is automatically produced with `autocite=footnote` and the tufte style) and * a plain citation in footnotes. I have tried to change the code given there to have autocite a footnote in regular text and a plain citation in a footnote, but have not succeeded. What must be changed? ``` % \documentclass[a4paper,openany,nobib]{tufte-book} \documentclass{article} \usepackage[style=authoryear, autocite=footnote]{biblatex} \DeclareAutoCiteCommand{inlineplainfootnote}{\mysmartcite}{\mysmartcites} \DeclareCiteCommand{\mysmartcite}[\iffootnote\textnormal\mkbibparens] {\usebibmacro{prenote}} {\usebibmacro{citeindex}% \usebibmacro{cite}} {\multicitedelim} {\usebibmacro{postnote}} \DeclareMultiCiteCommand{\mysmartcites} [\iffootnote\textnormal\mkbibparens]{\mysmartcite}{\multicitedelim} \ExecuteBibliographyOptions{autocite=inlineplainfootnote} % \usepackage{filecontents} \begin{filecontents}{\jobname.bib} @misc{A01, author = {Author, A.}, year = {2001}, title = {Alpha}, } @misc{B02, author = {Poet, B.}, year = {2002}, title = {Beta}, } \end{filecontents} \addbibresource{\jobname.bib} \begin{document} \null\vfill% just for the example Some text with a reference \autocite{A01} which should become a sidenote i.e. 1 and the sidenote should say: (Author 2001) . Some more text with a citation which should become a footnote or sidenote saying: Author 2001, Poet 2002 \autocite{A01, B02}. Some text with a footnote \footnote{A footnote with \autocite{B02}.} which should say: 1 A footnote with (Poet 2002). And some text with a footnote with two citations \footnote{Two citations\autocite{B02, A01}} which should say: 2 Two citations(Poet 2002; Author 2001). \printbibliography \end{document} ``` Aside: I have added a second bib entry, but it cannot be found. what is wrong there?
https://tex.stackexchange.com/users/161067
Biblatex \autocite need adaption for nested footnotes for year-author in b=tufte-book
true
I think you don't need to define any new citation commands: You could be pretty happy with the standard `\smartcite` approach were it not for the fact that `biblatex` can't detect footnotes in `tufte-book`. So all we need to do is make it detect footnotes. This is done by inserting `\toggletrue{blx@footnote}` in the right place in the footnote implementation. ``` \documentclass[a4paper,openany,nobib]{tufte-book} \usepackage[style=authoryear, autocite=footnote]{biblatex} \makeatletter \renewcommand\@footnotetext[2][0pt]{% \marginpar{% \hbox{}\vspace*{#1}% \def\baselinestretch {\setspace@singlespace}% \reset@font\footnotesize% \@tufte@margin@par% use parindent and parskip settings for marginal text \vspace*{-1\baselineskip}\noindent% \protected@edef\@currentlabel{% \csname p@footnote\endcsname\@thefnmark% }% \color@begingroup% \@makefntext{% \toggletrue{blx@footnote}% \ignorespaces #2% }% \color@endgroup% }% }% \makeatother \addbibresource{biblatex-examples.bib} \begin{document} Some text with a reference \autocite{sigfridsson} Some more text with a citation\autocite{sigfridsson, nussbaum}. Some text with a footnote \footnote{A footnote with \autocite{nussbaum}.} And some text with a footnote with two citations \footnote{Two citations\autocite{nussbaum, sigfridsson}} \printbibliography \end{document} ``` Note that this does not include parentheses in footnotes that contain only citations.
2
https://tex.stackexchange.com/users/35864
691132
320,618
https://tex.stackexchange.com/questions/691136
0
I get this warning when I try to compile my latex file. This is very confusing, I thought `\;` was a proper way of adding spacing in math mode. Even more confusing is that most lines generating this warning do not even contain a `\;`. An online search suggested that some unicode character might be to blame. But which? The lines do not seem to contain any.
https://tex.stackexchange.com/users/255463
Command \; invalid in math mode
false
Turns out the answer was that the `tipa` package was doing weird thigs.
1
https://tex.stackexchange.com/users/255463
691138
320,621
https://tex.stackexchange.com/questions/691141
0
Is it possible to use `tblr` with `booktabs`? I seem to be getting error messages when I am trying to use it: ``` \documentclass{article} \usepackage{xcolor} \usepackage{tabularray} \usepackage{booktabs} \begin{document} \begin{table}[h] \centering \begin{tblr}{ colspec = {ccc}, row{2} = {purple7}, column{3} = {teal7}, cell{2}{3} = {yellow7}, } \toprule First & Second & Third \\ \toprule 1 & 0 & 1 \\ \midrule 1 & 0 & 1 \\ \bottomrule \end{tblr} \end{table} \end{document} ``` The error message is: `! Misplaced \noalign.`
https://tex.stackexchange.com/users/281557
Using tblr with booktabs?
true
Just replace `\usepackage{booktabs}` with `\UseTblrLibrary{booktabs}`:
2
https://tex.stackexchange.com/users/11604
691142
320,623
https://tex.stackexchange.com/questions/691147
3
Is there a TeXShop directive (something like `% !TEX TS-program = lualatex`) that I can place at the top of my document and can tell TeXShop to compile using LuaLaTeX with `latexmk`? That is, a TeXShop directive that does the equivalent of `latexmk -lualatex file.tex`.
https://tex.stackexchange.com/users/112411
TeXShop directive for LuaLaTeX and latexmk
true
Yes, your TeXShop Engines folder contains `pdflatexmk`, `lualatexmk` and `xelatexmk` engines. (They may be in the Inactive folder, in which case simply move them to the main Engines folder and restart TeXShop.) Then you can simply use: ``` % !TEX TS-program = lualatexmk ```
3
https://tex.stackexchange.com/users/2693
691148
320,626
https://tex.stackexchange.com/questions/691154
3
Tabularray emulates commands in some other packages and therefore requests that you enable them with `\UseTblrLibrary` instead. One such package is siunitx. When loading siunitx normally, one could pass options to it; unfortunately, when one loads siunitx as a tabularray library, one cannot pass options to it, or at least I cannot figure out how to. Proof below. ``` \documentclass{article} \usepackage{tabularray} \UseTblrLibrary{siunitx} \PassOptionsToPackage{retain-explicit-plus}{siunitx} \begin{document} \num{+5} \begin{tblr}{ colspec = {lS} } Hey & +1 \\ Ho & +2 \\ Hee & +40 \\ \end{tblr} \end{document} ``` When compiled, the document produced has no leading plus signs. How can I remedy this behavior? (My personal problem is to do with leading pluses, but I think the form of the problem is more general, so I'd appreciate answers which are similarly general.)
https://tex.stackexchange.com/users/101980
Pass options to package loaded as tabularray library
true
You have to change the order of things, if you use `\PassOptionsToPackage` after the package ran its code things are already too late to get picked up, you have to use that macro before a package is loaded to make it work. So if you use the following you get leading signs: ``` \documentclass{article} \usepackage{tabularray} \PassOptionsToPackage{retain-explicit-plus}{siunitx} \UseTblrLibrary{siunitx} \begin{document} \num{+5} \begin{tblr}{ colspec = {lS} } Hey & +1 \\ Ho & +2 \\ Hee & +40 \\ \end{tblr} \end{document} ```
5
https://tex.stackexchange.com/users/117050
691155
320,630
https://tex.stackexchange.com/questions/14071
85
I'm trying to create a `pmatrix` whose components are rather complicated fractions (Christoffel symbols), and the line spacing is too small making the whole thing a bit cramped and hard to read. Is there any easy way to increase the spacing (about 1.5 the default would be perfect)?
https://tex.stackexchange.com/users/4382
How can I increase the line spacing in a matrix?
false
Individual veritcal spaces can be done with `\\[3pt]` option, horizontal by `\,` or `\!` ``` \[ \begin{pmatrix} 1 & 0 \\ 0 & 1 \end{pmatrix}, \begin{pmatrix} 1 & 0 \\[3pt] 0 & 1 \end{pmatrix}, \begin{pmatrix} 1 & \!\!\!\! 0 \\ 0 & \!\!\!\! 1 \end{pmatrix} \] ```
1
https://tex.stackexchange.com/users/300748
691164
320,633
https://tex.stackexchange.com/questions/691125
0
I am transcribing a document into the `memoir` class that has a front matter "chapter" with a collection of epigraphs. Each epigraph has no page note mark in the text, but in the back matter Notes section there is an unnumbered list of references for the Epigraphs chapter, one reference for each quotation. Other main matter chapters have normal page notes with numerical marks in the text and numbered lists in the Notes chapter. I have achieved a `\pagenote` that temporarily does not put marks in the text, but how can I achieve an unnumbered list of references in `\printpagenotes` for one chapter only? MWE and my attempts below. ``` \documentclass{memoir} \usepackage{lipsum} \makepagenote \begin{document} \frontmatter \chapter{Epigraphs} \let\orignotenumintext\notenumintext \renewcommand*{\notenumintext}[1]{\relax} % don't print a page note mark \lipsum[1]\pagenote{Cicero}\par \lipsum[2]\pagenote{Augustus} \let\notenumintext\orignotenumintext % restore original page note mark behavior \mainmatter \chapter{Body} \lipsum[3-4]\pagenote{Caesar} \backmatter \printpagenotes % results in: % Notes % Chapter 0 Epigraphs % 1. Cicero % 2. Augustus % Chapter 1 Body % 1. Caesar \end{document} ``` In the above, I want to get rid of the `1.` and `2.` before `Cicero` and `Augustus`. I tried to override and then restore `\notenuminnotes` as I did with `\notenumintext`, but this did not produce the desired behavior. I guess `\notenuminnotes` is maybe not expanded until it's time to actually typeset the Notes chapter. I also noticed in the `memoir` manual there is `\addtonotes`, but this command is more low-level and just splats some text into the `ent` file. So if you write `\addtonotes{Cicero}\addtonotes{Augustus}` you will not even get a line break. I'd like to use the usual `\pagenote` architecture if possible so I can play with the other commands like `\prenoteinnotes` etc. Is this possible?
https://tex.stackexchange.com/users/47128
Page notes with no mark in text and no number in notes for one chapter in memoir
true
Try ``` \documentclass{memoir} \usepackage{lipsum} \makepagenote \renewcommand{\idtextinnotes}[1]{} \begin{document} \frontmatter \chapter{Epigraphs} \lipsum[1]\pagenote[\relax]{Cicero}\par \lipsum[2]\pagenote[\relax]{Augustus} \mainmatter \chapter{Body} \lipsum[3-4]\pagenote{Caesar} \backmatter \printpagenotes \end{document} ``` For further customisation, perhaps the answer here can help: [Reformatting endnotes in memoir](https://tex.stackexchange.com/questions/500408/reformatting-endnotes-in-memoir) Cf. also section "12.6.1 Changing the appearance" in `memoir` documentation.
0
https://tex.stackexchange.com/users/233251
691165
320,634
https://tex.stackexchange.com/questions/691158
1
My Latex code : ``` \documentclass{article} \usepackage{amsmath} \renewcommand{\theequation}{\thesection.\arabic{equation}} \makeatletter \numberwithin{equation}{section} \numberwithin{equation}{subsection} \makeatother \begin{document} \section{First Section} \subsection{Subsection A} \begin{equation} E = mc^2 \end{equation} \subsection{Subsection B} \begin{equation} F = ma \end{equation} \section{Second Section} \begin{equation} a^2 + b^2 = c^2 \end{equation} \end{document} ``` **Current output** ``` 1 First Section 1.1 Subsection A E = mc2 (1.1.1) 1.2 Subsection B F = ma (1.2.1) 2 Second Section a2 + b2 = c2 (2.0.1) ``` **But the required output is** ``` 1 First Section 1.1 Subsection A E = mc2 (1.1.1) 1.2 Subsection B F = ma (1.2.1) 2 Second Section a2 + b2 = c2 (2.1) ```
https://tex.stackexchange.com/users/300744
How to modify the appearance of equation numbers
true
The following solution does what the OP wants, *viz.*, to show the value of the `subsection` counter in the composite equation number *unless* this value is equal to zero -- which will be the case if a `\section` directive but no `\subsection` directive has been issued of late. ``` \documentclass{article} \usepackage{amsmath} % for \numberwithin macro \numberwithin{equation}{subsection} \let\origtheequation\theequation % store the default format \renewcommand{\theequation}{% \ifnum\value{subsection}>0 \origtheequation % use default format \else \thesection.\arabic{equation} % use a simplified format \fi} \setlength\textwidth{3.5in} % just for this example \begin{document} \section{First Section} \subsection{Subsection A} Some words\dots \begin{equation} E = mc^2 \end{equation} \subsection{Subsection B} Some words\dots \begin{equation} F = ma \end{equation} \section{Second Section} Some words\dots \begin{equation} a^2 + b^2 = c^2 \end{equation} \end{document} ```
1
https://tex.stackexchange.com/users/5001
691168
320,636