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/686430
1
The following simple MWE, generates an error: ``` \documentclass{book} \usepackage{complexity} \usepackage{polyglossia} \setdefaultlanguage[variant=american]{english} \begin{document} Test! \end{document} ``` literally: ``` ! LaTeX Error: Command \lang already defined. Or name \end... illegal, see p.192 of the manual. ``` Is this something that can be dealt with at user level?
https://tex.stackexchange.com/users/224933
Incompatibility of complexity and polyglossia
false
The `complexity` package defined the `\lang` macro. The `polyglossia` package defined the `lang` environment (i.e. `\lang` and `\endlang` macros). You can rename the `lang` environment into `polyglossialang` before loading the `complexity` package. ``` \documentclass{book} \usepackage{polyglossia} % rename 'lang' environment to 'polyglossialang' \let\polyglossialang\lang \let\endpolyglossialang\endlang \let\lang\relax % \usepackage{complexity} \setmainlanguage{english} \setotherlanguage{french} \begin{document} Test! \begin{polyglossialang}{french} Test! \end{polyglossialang} \end{document} ```
1
https://tex.stackexchange.com/users/14500
686454
318,455
https://tex.stackexchange.com/questions/686443
26
ConTeXt has a number of advantages over LaTeX. But for some reason people prefer second one. 1. ConTeXt can generate epub, pdf, XHTML and xml while LaTeX can only generate pdf and dvi. [1] 2. ConTeXt provides third-party font support while pdflatex doesn't. 3. ConTeXt provides more control over document formatting and style. 4. ConTeXt supports MathMl natively. 5. ConTeXt is monolithic and mostly you don't need packages and modules in ConTeXt. [1] 6. ConTeXt error messages are easier to understand (at least in my opinion). 7. ConTeXt has better MetaPost integration. 8. ConTeXt has native SVG support. 9. ConTeXt can be used to work with spreadsheets. 10. ConTeXt is unified. It has only one implementation and you don't need to think about comparability with other implementations.
https://tex.stackexchange.com/users/297321
Why don't people use ConTeXt?
false
Most people learn LaTeX for one of two reasons: 1. They need to type math. 2. Their supervisor/journal editor/professor/etc. told them they had to use it. The disconnect here is that most TeX enthusiasts use it for a different two reasons: 3. Easily extendable and automatable (macros, packages, etc.). 4. High output quality. Everything in your list is an obvious benefit for an enthusiast, but let's look at it from the perspective of a TeX novice: > > 1. ConTeXt can generate epub, pdf, XHTML and xml while LaTeX can only generate pdf and dvi. > > > What is XHMTL and EPUB? I'm able to print and email a PDF and that's what the journal/my professor asks for. > > 2. ConTeXt provides third-party font support while pdflatex doesn't. > > > * What's a font? * I just do `\usepackage{tgtermes}` * `fontspec` > > 3. ConTeXt provides more control over document formatting and style. > > > This is all too confusing, why can't I use the document class from my publisher/university? > > 4. ConTeXt supports MathMl natively. > > > What is MathML? > > 5. ConTeXt is monolithic and mostly you don't need packages and modules in ConTeXt. > > > What's a package? I just this template I copied from the internet/the document class from my publisher/university. > > 6. ConTeXt error messages are easier to understand (at least in my opinion). > > > I really can't agree with you here. In my experience, ConTeXt has way worse error messages. The error experience is much better though since the compiler points to the exact line that was broken and stops on the first error. > > 7. ConTeXt has better MetaPost integration. > > > What is MetaPost? > > 8. ConTeXt has native SVG support. > > > If I need to include an SVG, I just take a picture with my phone, email it to myself, and include that in the document. > > 9. ConTeXt can be used to work with spreadsheets. > > > Cool feature, but too complicated for me to figure out. > > 10. ConTeXt is unified. It has only one implementation and you don't need to think about comparability with other implementations. > > > So is LaTeX: Overleaf is the only thing that exists. --- Another key point is inertia. LaTeX has been around since 1983, but ConTeXt has only been public until 1996, but didn't really get any users until 2000. LaTeX had a 20 year head-start here, so anyone learning a TeX format in that time would have probably learned LaTeX. Then anyone learning TeX after that would end up learning it from someone who only knew LaTeX, and the cycle repeats. Documentation is also important. You can Google or look on TeX.se for any LaTeX questions/problems, but you don't really get many results for ConTeXt. Plus, there have always been tons of good LaTeX introductory manuals, but there hasn't been any introductory ConTeXt manual until quite recently ([Not so short intro…](https://raw.githubusercontent.com/contextgarden/not-so-short-introduction-to-context/main/en/introCTX_eng_s.pdf)). And even then, LaTeX has tons of material for the intermediate user, but there's almost nothing for ConTeXt. ConTeXt has the best manuals of all the formats for an advanced user ([CLD](https://www.pragma-ade.nl/general/manuals/cld-mkiv.pdf), [Metafun](https://www.pragma-ade.nl/general/manuals/metafun-p.pdf), [LuaMetaTeX](https://www.pragma-ade.nl/general/manuals/luametatex.pdf), [Low Level TeX](https://www.pragma-ade.nl/general/manuals/lowlevel.pdf), etc.). And the ConTeXt source is also really easy to read, unlike most of the LaTeX kernel and packages. But neither of these are helpful with attracting new users. --- For context (ha!), I really like ConTeXt. I use it for nearly all of my documents, I have 100+ posts on the ConTeXt mailing list, I've [published a package for it](https://ctan.org/pkg/lua-widow-control) ([with a manual written with ConTeXt](https://texdoc.org/serve/lua-widow-control/0)), I've helped with the integration of LMTX into TeX Live, etc. I'm also an undergraduate student, so I see a lot of new users to TeX. Often I'm the first one to teach someone TeX. Whenever I'm working with someone else, I always use LaTeX. I feel a little weird simultaneously complaining that ConTeXt has no users and teaching new users LaTeX, but it would feel irresponsible for me to teach them ConTeXt due to the lack of documentation and users.
48
https://tex.stackexchange.com/users/270600
686455
318,456
https://tex.stackexchange.com/questions/686462
4
I've got a matrix like: ``` \documentclass{article} \usepackage{amsmath} \setcounter{MaxMatrixCols}{15} \begin{document} $\begin{bmatrix} I & L & i & k & e & t & h & e & H & P & P & R & I & M & E \\ 8 & 11 & 8 & 10 & 4 & 19 & 7 & 4 & 7 & 15 & 15 & 17 & 8 & 12 & 4 \end{bmatrix}$ \end{document} ``` I want to un italicise the entire first row without making it messy using the `\text{}` command for every single cell. How would I go about doing this?? Thank you!
https://tex.stackexchange.com/users/297584
Un-italicising entire row of matrix
false
You could always write: ``` $\mathrm{ \begin{bmatrix} … \end{bmatrix} }$ ``` assuming that you don’t have any non-italic inside your matrix. --- **note**: this doesn’t actually work because the math of the individual cells of a matrix are actually math inside of a box inside the math so the math font will be reset. I knew that, but forgot momentarily.
1
https://tex.stackexchange.com/users/202780
686465
318,461
https://tex.stackexchange.com/questions/686462
4
I've got a matrix like: ``` \documentclass{article} \usepackage{amsmath} \setcounter{MaxMatrixCols}{15} \begin{document} $\begin{bmatrix} I & L & i & k & e & t & h & e & H & P & P & R & I & M & E \\ 8 & 11 & 8 & 10 & 4 & 19 & 7 & 4 & 7 & 15 & 15 & 17 & 8 & 12 & 4 \end{bmatrix}$ \end{document} ``` I want to un italicise the entire first row without making it messy using the `\text{}` command for every single cell. How would I go about doing this?? Thank you!
https://tex.stackexchange.com/users/297584
Un-italicising entire row of matrix
false
(simplified the answer a bit) You may achieve your formatting objective by (a) using a fixed-width column type instead of the `c` column type that underlies the `bmatrix` environment and (b) encasing the first row in a `tabular` environment and the second row in an `array` environment, using the same fixed-width column type for both. Note that because all cells have the same fixed width (given, most easily, as the width of a two-digit number), the overall `bmatrix` is a bit wider than before. Note that I've also equated `\tabcolsep` with `\arraycolsep`, so that the amount of intercolumn whitespace is the same for both environments. ``` \documentclass{article} \usepackage{amsmath} % for 'bmatrix' env. and 'MaxMatrixCols' counter \setcounter{MaxMatrixCols}{15} % just for this example \usepackage{array} % for '\newcolumntype' macro \usepackage{calc} % for '\widthof' macro \newcolumntype{U}{wc{\widthof{19}}} % fixed-width column type \setlength\tabcolsep\arraycolsep % 5pt instead of '6pt' \newcommand\RowA{I & L & i & k & e & t & h & e & H & P & P & R & I & M & E} \newcommand\RowB{8 & 11 & 8 & 10 & 4 & 19 & 7 & 4 & 7 & 15 & 15 & 17 & 8 & 12 & 4} \begin{document} %% "before" $\begin{bmatrix} \RowA \\ \RowB \end{bmatrix}$ \smallskip %% "after" $\begin{bmatrix} \begin{tabular}{@{} *{15}{U} @{}} \RowA \end{tabular} \\ \begin{array}{@{} *{15}{U} @{}} \RowB \end{array} \end{bmatrix}$ \end{document} ```
3
https://tex.stackexchange.com/users/5001
686466
318,462
https://tex.stackexchange.com/questions/686447
0
I am using the `classicthesis` template. I am trying to type the capital Greek letter Psi Ψ. However, it compiles as the symbol ̄ . This stops when I disable `breqn`. This occurs in the regular equation mode with just ``` \[\Psi\] ``` but I have encountered this with `dmath` and `equation` as well.
https://tex.stackexchange.com/users/297574
How can I fix breqn replacing \Psi with an overbar?
false
breqn documentation mentions the issue: --- Normally you load the math font before `breqn`: Unfortunately `fourier` is not one of the supported math fonts, you need to figure out what's going on then create your own support file. Similar question: [fourier - breqn corrupts fouriernc in TL 2016 - TeX - LaTeX Stack Exchange](https://tex.stackexchange.com/questions/330012/breqn-corrupts-fouriernc-in-tl-2016) The following is probably the proper way: ``` \documentclass{article} \usepackage{amsmath} \usepackage{fourier} %\usepackage[fourier]{flexisym} % it would suffice to do this if there were a `fourier.sym` support file \usepackage{breqn} \ExplSyntaxOn \makeatletter \cs_gset:cpx {mg@Greek} {\hexnumber@\symotherletters} \makeatother \ExplSyntaxOff \begin{document} \[ \Psi \] \end{document} ``` Basically, you can * read the existing support file (e.g. `mathpazo.sym`) to see what `breqn`/`flexisym` does with other math packages, * read the source code of `fourier` package to figure out the ⟨sym-font⟩ name (`otherletters`), * read around various source codes to figure out the little tricks that + LaTeX's `mathgroup` is TeX's `fam`, + `\mg@⟨flexisym internal symbol font name⟩` stores the `\mathgroup` number of that symbol font name, + `\sym⟨sym-font⟩` stores the mathgroup of that symbol font where `⟨sym-font⟩` is as in `fntguide`. --- What if you load `breqn` before `fourier` instead? You get some error messages on "commands already defined". Internally, what's going on is that `fourier` runs `\DeclareMathSymbol` to redefine `\Psi` and many other commands, but the problem is * `\DeclareMathSymbol` only allow safely redefining a control sequence if the meaning includes the string `mathchar`, * `breqn`'s definition of `\Psi` does not have it, * thus `\DeclareMathSymbol` raises an error and does not redefine the control sequence. Is this LaTeX's fault or breqn's fault? I'm not sure, I can only trace the LaTeX code back to 2008 through GitHub log (<https://github.com/latex3/latex2e/blob/develop/base/ltfssdcl.dtx#L1591>), but breqn package is older than that. (Either way, TeX's lack of interface to check whether something is a math character forces LaTeX to use a string-in-meaning test which is fragile as you've seen) Anyway, one way is to patch `\DeclareMathSymbol`: (you also need to similarly patch `\DeclareMathDelimiter` to avoid other error messages which is not done here): ``` \makeatletter \def\originalDeclareMathSymbol#1#2#3#4{% \expandafter\in@\csname sym#3\expandafter\endcsname \expandafter{\group@list}% \ifin@ \begingroup \count\z@=#4\relax \count\tw@\count\z@ \divide\count\z@\sixt@@n \count@\count\z@ \multiply\count@\sixt@@n \advance\count\tw@-\count@ \if\relax\noexpand#1% is command? % \end{macrocode} % Store the command name with a space attached inside % \cs{reserved@@b} in case we look at a robust definition. % \begin{macrocode} \edef\reserved@b{\expandafter\noexpand \csname\expandafter\@gobble\string#1\space\endcsname}% % \end{macrocode} % Test both \verb=#1= and \verb*=#1 = for containing \texttt{mathchar}. % \begin{macrocode} \edef\reserved@a {\noexpand\in@{\expandafter\@gobble\string\mathchar}% {\meaning#1\expandafter\meaning\reserved@b}}% \reserved@a % \end{macrocode} % Drop \verb*=#1 = in case it was defined before. % \begin{macrocode} \global\expandafter\let\reserved@b\@undefined \ifin@ \expandafter\set@mathsymbol \csname sym#3\endcsname#1#2% {\hexnumber@{\count\z@}\hexnumber@{\count\tw@}}% \@font@info{Redeclaring math symbol \string#1}% \else \expandafter\ifx \csname\expandafter\@gobble\string#1\endcsname \relax \expandafter\set@mathsymbol \csname sym#3\endcsname#1#2% {\hexnumber@{\count\z@}\hexnumber@{\count\tw@}}% \else \@latex@error{Command `\string#1' already defined}\@eha \fi \fi \else \expandafter\set@mathchar \csname sym#3\endcsname#1#2 {\hexnumber@{\count\z@}\hexnumber@{\count\tw@}}% \fi \endgroup \else \@latex@error{Symbol font `#3' is not defined}\@eha \fi } \ifx\originalDeclareMathSymbol\DeclareMathSymbol \else \errmessage{Unexpected definition of DeclareMathSymbol!!}\fi \def\DeclareMathSymbol#1#2#3#4{% \expandafter\in@\csname sym#3\expandafter\endcsname \expandafter{\group@list}% \ifin@ \begingroup \count\z@=#4\relax \count\tw@\count\z@ \divide\count\z@\sixt@@n \count@\count\z@ \multiply\count@\sixt@@n \advance\count\tw@-\count@ \if\relax\noexpand#1% is command? % \end{macrocode} % Store the command name with a space attached inside % \cs{reserved@@b} in case we look at a robust definition. % \begin{macrocode} \edef\reserved@b{\expandafter\noexpand \csname\expandafter\@gobble\string#1\space\endcsname}% % \end{macrocode} % Drop \verb*=#1 = in case it was defined before. % \begin{macrocode} \global\expandafter\let\reserved@b\@undefined \expandafter\set@mathsymbol \csname sym#3\endcsname#1#2% {\hexnumber@{\count\z@}\hexnumber@{\count\tw@}}% \@font@info{Redeclaring math symbol \string#1}% \else \expandafter\set@mathchar \csname sym#3\endcsname#1#2 {\hexnumber@{\count\z@}\hexnumber@{\count\tw@}}% \fi \endgroup \else \@latex@error{Symbol font `#3' is not defined}\@eha \fi } \makeatother \documentclass{article} %\usepackage[paperheight=5cm, paperwidth=5cm]{geometry} %\errorcontextlines=10 \usepackage{amsmath} \usepackage{breqn} \usepackage{fourier} \begin{document} \[ \Psi \] \end{document} ```
2
https://tex.stackexchange.com/users/250119
686468
318,463
https://tex.stackexchange.com/questions/686462
4
I've got a matrix like: ``` \documentclass{article} \usepackage{amsmath} \setcounter{MaxMatrixCols}{15} \begin{document} $\begin{bmatrix} I & L & i & k & e & t & h & e & H & P & P & R & I & M & E \\ 8 & 11 & 8 & 10 & 4 & 19 & 7 & 4 & 7 & 15 & 15 & 17 & 8 & 12 & 4 \end{bmatrix}$ \end{document} ``` I want to un italicise the entire first row without making it messy using the `\text{}` command for every single cell. How would I go about doing this?? Thank you!
https://tex.stackexchange.com/users/297584
Un-italicising entire row of matrix
true
It is quite simple with `tabularray`: ``` \documentclass{article} \usepackage{tabularray} \UseTblrLibrary{amsmath} \begin{document} It is quite simple with \texttt{+bmatrix} adding \texttt{mode=text} option for the first row: \[\begin{+bmatrix}[row{1}={mode=text}] I & L & i & k & e & t & h & e & H & P & P & R & I & M & E \\ 8 & 11 & 8 & 10 & 4 & 19 & 7 & 4 & 7 & 15 & 15 & 17 & 8 & 12 & 4 \end{+bmatrix}\] The following example is just to show that the other rows are in math mode: \[\begin{+bmatrix}[row{1}={mode=text}] I & L & i & k & e & t & h & e & H & P & P & R & I & M & E \\ \alpha & \beta & \gamma & 10 & 4 & 19 & 7 & 4 & 7 & 15 & 15 & 17 & 8 & 12 & 4\\ a^2 & \sqrt{b} & \frac{c}{d} & 10 & 4 & 19 & 7 & 4 & 7 & 15 & 15 & 17 & 8 & 12 & 4 \end{+bmatrix}\] Note that in the examples above the space between rows is a little larger than in an ordinary \texttt{bmatrix}. If you don't like it, you can set \texttt{rowsep=0pt} to have the same row separator as an ordinary \texttt{bmatrix}: \[\begin{+bmatrix}[row{1}={mode=text}, rowsep=0pt] I & L & i & k & e & t & h & e & H & P & P & R & I & M & E \\ 8 & 11 & 8 & 10 & 4 & 19 & 7 & 4 & 7 & 15 & 15 & 17 & 8 & 12 & 4 \end{+bmatrix}\] The following example is just to show that the other rows are in math mode: \[\begin{+bmatrix}[row{1}={mode=text}, rowsep=0pt] I & L & i & k & e & t & h & e & H & P & P & R & I & M & E \\ \alpha & \beta & \gamma & 10 & 4 & 19 & 7 & 4 & 7 & 15 & 15 & 17 & 8 & 12 & 4\\ a^2 & \sqrt{b} & \frac{c}{d} & 10 & 4 & 19 & 7 & 4 & 7 & 15 & 15 & 17 & 8 & 12 & 4 \end{+bmatrix}\] The following examples are with an ordinary \texttt{bmatrix}, just to compare with the previous ones:\setcounter{MaxMatrixCols}{15} \[\begin{bmatrix} I & L & i & k & e & t & h & e & H & P & P & R & I & M & E \\ 8 & 11 & 8 & 10 & 4 & 19 & 7 & 4 & 7 & 15 & 15 & 17 & 8 & 12 & 4 \end{bmatrix}\] The following example is just to show that all the rows are in math mode with an ordinary \texttt{bmatrix}: \[\begin{bmatrix} I & L & i & k & e & t & h & e & H & P & P & R & I & M & E \\ \alpha & \beta & \gamma & 10 & 4 & 19 & 7 & 4 & 7 & 15 & 15 & 17 & 8 & 12 & 4\\ a^2 & \sqrt{b} & \frac{c}{d} & 10 & 4 & 19 & 7 & 4 & 7 & 15 & 15 & 17 & 8 & 12 & 4 \end{bmatrix}\] \end{document} ```
6
https://tex.stackexchange.com/users/101651
686472
318,466
https://tex.stackexchange.com/questions/686419
2
I am trying to put some equations inside an `align` environment in a cell inside a table. However, when I activate the `\usepackage[table]{xcolor}` option, my code inmediately crashes. EDIT: I modified the question. Now, the code below works. ``` \documentclass{article} % librería para definir funciones matemáticas \usepackage{amsmath, amssymb} % definiendo los colores \usepackage[table]{xcolor} % con la opción para colorear las tablas % Para las tablas \usepackage{array} \begin{document} \begin{table} \centering \begin{tabular}{% | >{\centering\arraybackslash}m{2cm}|% Todo esto es para que centre horizontal >{\centering\arraybackslash}m{5cm}|% y verticalmente en la celda >{\centering\arraybackslash}m{6cm}% |} \hline\hline \textbf{Caso} & \textbf{Apoyo} & \textbf{Ecuaciones} \\ \hline\hline Rodillo intermedio & & {\makeatletter\CT@everycr{\the\everycr} %https://tex.stackexchange.com/questions/213342/problem-with-align-inside-tabular-environment-when-using-xcolor/213347#213347 \begin{align*} v_i(a) &= \Delta_a \\ v_{i+1}(a) &= \Delta_a \\ \theta_i(a) &= \theta_{i+1}(a) \\ M_i(a) &= M_{i+1}(a) + m \end{align*} \begin{center} \hrulefill \end{center} $R_y = V_{i+1}(a) - V_{i}(a) - f$ } \\ \hline \hline \end{tabular} \end{table} \end{document} ```
https://tex.stackexchange.com/users/61162
Conflict between [table]{xcolor} and {align} inside table
false
Your problem can also be avoided with use `aligned` math environment instead of `align*. By using` tabullaray` package for writing your table the MWE can be: ``` \documentclass{article} % definiendo los colores %\usepackage[table]{xcolor} % con la opción para colorear las tablas % Para las tablas \usepackage{tabularray} % librería para definir funciones matemáticas \UseTblrLibrary{amsmath} \usepackage{amssymb} \begin{document} \begin{table} \centering \begin{tblr}{hlines, vlines, colspec = {Q[c, wd=2cm] X[0.8, c] X[c, mode=dmath]}, row{1} = {font=\bfseries, mode=text}, rowsep=5pt } Caso & Apoyo & Ecuaciones \\ \SetCell[r=2]{h} Rodillo intermedio & \SetCell[r=2]{c} & \begin{aligned} v_i(a) & = \Delta_a \\ v_{i+1}(a) & = \Delta_a \\ \theta_i(a) & = \theta_{i+1}(a) \\ M_i(a) & = M_{i+1}(a) + m \end{aligned} \\ & & R_y = V_{i+1}(a) - V_{i}(a) - f \\ \end{tblr} \end{table} \end{document} ``` As you can see, I a wee bit change your table design.
1
https://tex.stackexchange.com/users/18189
686475
318,468
https://tex.stackexchange.com/questions/385242
6
What exactly is the symbol produced in LaTeX by `\i`. I haven't located it in several lists of symbols. The output looks like a smaller version of the numeral 1, but with the top "hook" horizontal rather than angled downward. (The question was inspired by [How to typeset 2pii in LaTeX](https://tex.stackexchange.com/questions/385232/how-to-typeset-2pii-in-latex). I'm well aware of the need to use dotless-i `\imath` in math mode to put, say, an arrow over it, as in vector notation; writing in English, I just had never encountered the need to put a diacritical mark over the letter "i" in text.)
https://tex.stackexchange.com/users/13492
What is the character \i?
false
It is dotless i, in Unicode: Latin Small Letter Dotless i U+0131. This character was designed in old 7bit TeX fonts by Knuth because these fonts do not have accented letters. Each accented letter had to be composed by a basic letter and an isolated accent using `\accent` TeX primitive. For example `\'e` is `\accent19 e`, i.e. the printed é was composed from a character `e` and an accent located at slot 19. Analogically `\'\i` is `\accent19 \i`, it means that the accent 19 was inserted above dotless i, not above i. Note that `\i` is defined in plain TeX by `\chardef\i="10` because Knuth inserted the dotless i to the slot 10 in his 7bit fonts. LaTeX adopted this concept when old 7bit fonts are used with it. On the other hand, if we are using fonts with accented letters included then they are used directly from the font, no composed characters are created. When a non-Unicode engine is running then LaTeX converts input characters like á, é, í to internal character representation (LICR) and then it is printed. This representation uses the sequence `\i` if accented `i` is printed. Finally, if we use Unicode TeX engine and Unicode fonts then each letters like á, é, í are printed directly without any re-encoding.
4
https://tex.stackexchange.com/users/51799
686476
318,469
https://tex.stackexchange.com/questions/686474
1
During the review process of a manuscript, I was asked to highlight changes according to the comments of the reviewers. I used the soul package in combination with the color package. These two really do the job, but now I am desperately looking for a way of removing the hl command without removing the inner part. For instance, from: ``` \hl{This is a default text.} ``` to ``` This is a default text. ``` I found this [answer](https://stackoverflow.com/questions/13462522/vim-latex-remove-command-around-word-phrase-easily), using vim for a very similar problem. Since I am not familiar with vim, I am seeking a solution for an editor I am familiar with, like texstudio or notepad++. Any ideas?
https://tex.stackexchange.com/users/192551
Remove hl command using notepad++ or Texstudio
true
If you've used `\hl` only for this purpose, you can remove the highlighting at LaTeX with adding: ``` \renewcommand\hl[1]{#1} ``` to your document preamble. If you really need to replace the `\hl{…}` by the content of the argument in the source code, this could be possible using search&replace with a regular expression. If you don't need to handle balanced braces (e.g. `\hl{Test \textit{and} test}`) the search expression could be `\hl{\([^}]*\)}` and the replacement `$1` resp. `\1` as shown here: ``` echo '\But{and \hl{Test} and}' | sed 's/\\hl{\([^}]*\)}/\1/' ``` or (with extended regular expressions enabled): ``` echo '\But{and \hl{Test} and}' | sed -E 's/\\hl\{([^}]*)\}/\1/' ``` results in ``` \But{and Test and} ``` For multiline `\hl` commands with commands inside, this would be more complicate. Because `perl` should be available with both TeX Live and MiKTeX, you can use (note: quoting in this example has been done for a unix shell like `bash`): ``` perl -0ne 's/\\hl{//g;$i=0;while(/./gs){$i-- if $& eq "{";$i++ if $& eq "}"; if ($i<1){print $&}else{$i=0}}' <infile.tex >outfile.tex ``` This also works with text above multiple lines and commands inside the `\hl` argument. For example, if your `infile.tex` is: ``` This is a \hl{test \textit{and does} also work} as wanted. ``` the `outfile.tex` would be: ``` This is a test \textit{and does} also work as wanted. ``` Unfortunately, currently it fails, if `\hl{…}` is used inside another argument,like here: ``` \But{This is a \hl{test \textit{and does} not work} as wanted.} ``` (would result in ``` \But{This is a test \textit{and does} not work} as wanted. ``` so maybe I should think about it a little longer, if you really need a solution for such constructs).
3
https://tex.stackexchange.com/users/277964
686478
318,470
https://tex.stackexchange.com/questions/332203
6
How it is possible to check the math font loaded in a document? Like `\fontname\font` is used to check the font loaded, how is the command for printing the current math font?
https://tex.stackexchange.com/users/114300
Check math font
false
This answer covers the case the user uses LaTeX. Saying "there's no current math font" is half-accurate in that * in the low level of TeX the `\textfont` etc. are not set in advance, but * users of (La)TeX usually doesn't care too much about the low-level. In reality, what happens is that LaTeX maintains an internal table of, * the current mathversion in `\math@version` (`normal` or `bold`) [taken here](https://tex.stackexchange.com/questions/618718/import-symbol-from-other-font-without-wasting-math-alphabet?rq=1), * for each math version (e.g. `bold`, `normal`, or if you use unicode-math and load appropriate fonts you may get mathversions like `times` or `xitsmath` etc.), + a mapping from math alphabet (e.g. `\mathbf`) to a text font name exclude the size -- that is, ⟨encoding, family, series, shape⟩ e.g. `\mathbf → (OT1, cmr, bx, n⟩` + a mapping from each ⟨sym-font⟩ to a text font name as above. e.g. `symbols → ⟨OMS, cmsy, m, n⟩` * in addition, a *size* information is kept (set by `\DeclareMathSizes`) In order to access these information, you can access some internal macros of LaTeX -- whose names can be found by reading the documentation: * the mapping "(math version, math alphabet) → font" is modified by `\DeclareMathAlphabet` (set font of math alphabet for all math version), `\SetMathAlphabet` (set font of math alphabet for a specific math version), `\DeclareSymbolFont`, `\SetSymbolFont`. * the command to define which ⟨sym-font⟩ a symbol belong to is `\DeclareMathSymbol` (there's also `\DeclareMathDelimiter` etc.) Of course, accessing these *programmatically* is quite fragile, but then the LaTeX kernel has been fixed for a very long time anyway. So for example ``` $ latexdef math@version \math@version: macro:->normal $ latexdef alpha # check which symbol font "\alpha" belong to \alpha: \mathchar"10B # ⟹ actually it's not unambiguously defined, we only know it belong to some symbol font # which correspond to mathgroup 1 $ latexdef symletters # this shows ⟨sym-font⟩ = "letters" → mathgroup 1 \symletters: \char"1 $ latexdef mathbf # check the math alphabet "mathbf" (→ OT1/cmr/bx/n) \mathbf: macro:->\protect \mathbf \mathbf : macro:->\select@group \mathbf \M@OT1 \OT1/cmr/bx/n $ latexdef "mv@bold" # check the math version "bold" (self explanatory) \mv@bold: macro:->\getanddefine@fonts \symoperators \OT1/cmr/bx/n \getanddefine@fonts \symletters \OML/cmm/b/i t \getanddefine@fonts \symsymbols \OMS/cmsy/b/n \getanddefine@fonts \symlargesymbols \OMX/cmex/m/n \ install@mathalphabet \mathbf {\select@group \mathbf \M@OT1 \OT1/cmr/bx/n }\install@mathalphabet \m athsf {\select@group \mathsf \M@OT1 \OT1/cmss/bx/n }\install@mathalphabet \mathit {\select@group \mathit \M@OT1 \OT1/cmr/bx/it }\install@mathalphabet \mathtt {\select@group \mathtt \M@OT1 \OT1/c mtt/m/n } $ latexdef group@list # list of all math groups defined so far (available in preamble only) \group@list: macro:->\@latex@error {Can be used only in preamble}\@eha (in preamble) \group@list: macro:->\group@elt \symoperators \OT1/cmr/m/n \group@elt \symletters \OML/cmm/m/it \group@elt \symsy mbols \OMS/cmsy/m/n \group@elt \symlargesymbols \OMX/cmex/m/n # so "letters" → OML/cmm/m/it etc. ``` Another thing one may want to check is whether you're inside `\mathbf` or outside, etc. While each symbol font is fixed to a mathgroup number as shown above, the allocation of mathalphabet → mathgroup number is on-demand: (which you can test yourself: if you do `$\mathbf{\the\fam} \mathit{\the\fam}$` at the very start of the document you get mathbf → 4 and mathit → 5, but if you do `$\mathit{\the\fam} \mathbf{\the\fam}$` first then mathit → 4 and mathbf → 5 instead. This may be dependent on which LaTeX version is used however. -- LaTeX can *afford* to do this because you can set e.g. `\textfont4` halfway through the formula and the whole math formula is rendered using the setting in effect at the end of the formula) Because the mapping to `\mathgroup` is not fixed, we need to know where the internal lookup table is defined as well. For this, reading the source code of `\select@group` is useful. The documentation may be a bit misleading though (e.g. it says the command takes 4 arguments while in fact it takes just 3) So the mapping is in the command definition itself after the command is used the first time. ``` %! TEX program = pdflatex \documentclass{article} \usepackage[T1]{fontenc} \begin{document} \expandafter\meaning\csname mathbf \endcsname \makeatletter\the\c@mv@normal\makeatother $\mathbf{a}$ \makeatletter\the\c@mv@normal\makeatother \expandafter\meaning\csname mathbf \endcsname \end{document} ``` You see: which means: * initially, `\mathbf` is not assigned to any mathgroup. When it's first called `\select@group` will be used to choose a mathgroup. * initially, 4 math groups are used. * after typesetting the bold `a` in math mode, 5 math groups are used. * now `\mathbf` is assigned to mathgroup 4. Unfortunately this answer does not (yet) cover the case where `unicode-math` package is used -- it has the concept of `\setmathfont` also available as `\mathversion`. --- For some useful readings, refer to `texdoc fntguide` as well as the documents/books linked from there:
0
https://tex.stackexchange.com/users/250119
686482
318,472
https://tex.stackexchange.com/questions/686448
0
I am trying to run bibunits on TexShop based on the template that can be found in <https://github.com/gsalzer/subfiles/tree/master/tests/bibunitsand> It is reproduced below with some minor modifications. The main file, all the chapters and bib files for each chapter are in the same folder. The problem is that when running Cmd+Shft+L followed by Cmd+Shft+B I get the following error: ``` I found no \citation commands---while reading file main.aux I found no \bibdata command---while reading file main.aux I found no \bibstyle command---while reading file main.aux ``` The only reason I am following this solution is because the github mentioned before seems very authoritative and it describes my situation: each chapter is a separate tex file and each chapter has a bibliography file. The error happens irrespectively of me adding `% !TEX TS-program = pdflatexmk` in the first line of the main file or not. And btw, pdflatexmk.engire is in the Engine folder already. In addition, when I try to run bibtex (Cmd+Shft+B) on the aux files first, I get the exact same three errors. It seems that the problem is that there are no citations inside of the main file, but why they should be? All the citations are inside of the chapters! This is the type of problem that is usually solved with a simple instruction that nobody thought it was important and it was not mentioned in the 100+ tutorials and examples available online. **main.tex** ``` \documentclass{report} \usepackage{bibunits} \defaultbibliographystyle{apalike} \usepackage{subfiles} \begin{document} \title{Main document} \author{The Author} \maketitle This is a test for using \verb|bibtex| to generate bibliographies chapter-wise with the \verb|bibunits| package. \subfile{chapter1} \end{document} ``` **chapter1.tex** ``` \documentclass[main]{subfiles} \begin{document} \begin{bibunit} \chapter{First chapter} My references: \cite{A} \putbib \end{bibunit} \end{document} ``` **bib1.bib** ``` @book{A, title={The meaning of A}, author={A. Alpha}, year=2019, publisher={Apublisher} } ```
https://tex.stackexchange.com/users/46866
Using bibunits with TeXshop
false
Using `subfiles` and `bibunits` together seems brave but seems to work. You have not specified a bibliography, so `bibunits` seems to assume it is named after the main file. after `pdflatex` the file `bu1.aux` is ``` \bibstyle{apalike} \citation{A} \bibdata{main} ``` so your `.bib` file should be `main.bib` `bibtex bu1` runs without error producing `bu1.bbl` so running `pdflatex main` twice produces
1
https://tex.stackexchange.com/users/1090
686483
318,473
https://tex.stackexchange.com/questions/332203
6
How it is possible to check the math font loaded in a document? Like `\fontname\font` is used to check the font loaded, how is the command for printing the current math font?
https://tex.stackexchange.com/users/114300
Check math font
false
When Unicode Math font is used then it is possible (and it is typical) to have single math font for all characters used in math formulae. This differs from the old concept (with 7bit fonts) where the set of all math characters were divided to more fonts registered by math-family numbers. This old concept was explained in another answers here. For example, OpTeX reserves the math-family number 1 for main Unicode math font. So, you can get its name by ``` \fontfam[lm] \fontname\textfont1 \bye ``` Other math-family numbers can be used for additional fonts. It is usable if the main Unicode math font doesn't include all desired characters needed in math formulae.
2
https://tex.stackexchange.com/users/51799
686488
318,475
https://tex.stackexchange.com/questions/686487
1
`tex4ebook` adds an additional numbering in front of each part/chapter/section etc in the table of contents: ``` 1. I First Part 1. 1 First Chapter of Part 1 1. 1.1 Header of Section 1 2. 1.2 Header of Section 2 2. 2 Second Chapter of Part 1 ``` Is there a way to prevent the first number to be shown in the ToC so that it looks the same way as if compiling a pdf, i.e.: ``` I First Part 1 First Chapter of Part 1 1.1 Header of Section 1 1.2 Header of Section 2 2 Second Chapter of Part 1 ``` Here is a MWE: ``` \documentclass[12pt]{book} \begin{document} \tableofcontents \part{First Part} \chapter{First Chapter of part 1} \section{Header of Section 1} Text within section 1. \section{Header of Section 2} Text within section 2. \chapter{Second Chapter of part 1} \part{Second Part} \section{First Chapter of part 2} Text within part 2. \end{document} ``` and the config file: ``` \Preamble{xhtml} \begin{document} \EndPreamble ```
https://tex.stackexchange.com/users/179378
tex4ebook: Numbering in Table of Contents
true
The numbering can be removed using this config file: ``` \Preamble{xhtml} \Css{nav ol li{ list-style-type: none; }} \begin{document} \EndPreamble ``` The CSS rule removes numbering from ordered lists that are contained in the `<nav>` element, which is used for TOC. This is the result:
1
https://tex.stackexchange.com/users/2891
686493
318,476
https://tex.stackexchange.com/questions/686490
0
Cosndier the MWE: ``` \documentclass[12pt,a4paper,oneside]{book} \usepackage[a4paper,width=150mm,top=30mm,bottom=30mm,bindingoffset=6mm]{geometry} \usepackage[nottoc]{tocbibind} \usepackage[utf8]{inputenc} \usepackage[T1]{fontenc} \usepackage{bm} \usepackage{nccmath} \usepackage{amsfonts, graphicx, verbatim, mathtools,amssymb, amsthm, mathrsfs,amsmath} \usepackage{color} \usepackage{array} \usepackage{setspace} \usepackage{fancyhdr} \usepackage{rsfso} \usepackage{enumitem} \usepackage{tikz} \usetikzlibrary{babel, arrows.meta, positioning, quotes} \usepackage{parskip} \usepackage{lipsum} \usepackage{upgreek} \usepackage{floatrow} \usepackage{epstopdf} \usepackage[capitalise]{cleveref} \usepackage{siunitx} \usepackage{tocloft} \usepackage{listings} \usepackage{booktabs} \usepackage{nicematrix} \usepackage{subcaption} \usepackage{multicol} \usepackage{geometry} \usepackage{tabularray} \UseTblrLibrary{booktabs, siunitx} \usepackage[thinc]{esdiff} \usepackage{ae} \usepackage [english]{babel} \usepackage [autostyle, english = american]{csquotes} \usepackage[style=numeric,maxbibnames=200,sortcites=true,backend=bibtex]{biblatex} \allowdisplaybreaks \usepackage{mwe} \usepackage{undertilde} \usepackage{dsfont} \usepackage{lmodern} \usepackage{ae} \usepackage{amsmath} \usepackage{xcolor} \usepackage{tocloft} \begin{document} \frontmatter \newpage \pagestyle{fancy} \fancyhf{} \fancyhead[EL]{\nouppercase\leftmark} \fancyhead[OR]{\nouppercase\rightmark} \fancyhead[ER,OL]{\thepage} \mainmatter \chapter{one} \section{a} \lipsum[1-20] \section{b} \lipsum[1-20] \chapter{two} \section{c} \lipsum[1-20] \end{document} ``` As we see at the top of the page, the headings of each section are on the right while page numbers are on the left. How can we flip this so that section headings are on the left while page numbers are on the right?
https://tex.stackexchange.com/users/181561
How do I make the the page numbers appear on the right using \pagestyle{fancy} and section headings of the left?
false
This does it: ``` \documentclass[12pt,a4paper,oneside]{book} \usepackage[a4paper,width=150mm,top=30mm,bottom=30mm,bindingoffset=6mm]{geometry} \usepackage[nottoc]{tocbibind} \usepackage[utf8]{inputenc} \usepackage[T1]{fontenc} \usepackage{bm} \usepackage{nccmath} \usepackage{amsfonts, graphicx, verbatim, mathtools,amssymb, amsthm, mathrsfs,amsmath} \usepackage{color} \usepackage{array} \usepackage{setspace} \usepackage{fancyhdr} \usepackage{rsfso} \usepackage{enumitem} \usepackage{tikz} \usetikzlibrary{babel, arrows.meta, positioning, quotes} \usepackage{parskip} \usepackage{lipsum} \usepackage{upgreek} \usepackage{floatrow} \usepackage{epstopdf} \usepackage[capitalise]{cleveref} \usepackage{siunitx} \usepackage{tocloft} \usepackage{listings} \usepackage{booktabs} \usepackage{nicematrix} \usepackage{subcaption} \usepackage{multicol} \usepackage{geometry} \usepackage{tabularray} \UseTblrLibrary{booktabs, siunitx} \usepackage[thinc]{esdiff} \usepackage{ae} \usepackage [english]{babel} \usepackage [autostyle, english = american]{csquotes} \usepackage[style=numeric,maxbibnames=200,sortcites=true,backend=bibtex]{biblatex} \allowdisplaybreaks \usepackage{mwe} \usepackage{undertilde} \usepackage{dsfont} \usepackage{lmodern} \usepackage{ae} \usepackage{amsmath} \usepackage{xcolor} \usepackage{tocloft} \begin{document} \frontmatter \newpage \pagestyle{fancy} \fancyhf{} \fancyhead[ER]{\nouppercase\leftmark} \fancyhead[OL]{\nouppercase\rightmark} \fancyhead[EL,OR]{\thepage} \mainmatter \chapter{one} \section{a} \lipsum[1-20] \section{b} \lipsum[1-20] \chapter{two} \section{c} \lipsum[1-20] \end{document} ```
0
https://tex.stackexchange.com/users/181561
686495
318,477
https://tex.stackexchange.com/questions/686484
0
``` \documentclass{book} \usepackage{fontspec} \usepackage{appendix} \usepackage{kantlipsum} \newfontfamily\chapterfont{Verdana} \makeatletter % https://tex.stackexchange.com/questions/18604/chapter-formatting \def\@makechapterhead#1{% {\parindent \z@ \raggedright \chapterfont\fontsize{14pt}{0pt}\bfseries \ifnum \c@secnumdepth >\m@ne \if@mainmatter % Check if we are in the main matter \thechapter.\ % <-- Chapter # (without "Chapter") %\if@appendix \appendixname~\thechapter:% <-- "Appendix A:" \fi \fi \interlinepenalty\@M #1\par\nobreak% <------------------ Chapter title \vskip 12pt% <------------------ Space between chapter title and first paragraph }} \makeatother \begin{document} \frontmatter \chapter{Preface} \kant[10] \tableofcontents \mainmatter \chapter{This is a chapter} \kant[1] \chapter{Second chapter} \kant \appendix \chapter{Appendix title} \kant[6] \end{document} ``` I have adapted the appearance of my main matter chapter titles to be on the same line and without the label "Chapter". However, I would like for my appendices to have the label Appendix. The MWE doesn't achieve this, I've just managed to get LaTeX to print the title twice. Any thougths? --- Edit: code should compile now. Generally, I use XeLaTeX because of fontspec.
https://tex.stackexchange.com/users/269662
How do I get my book appendices to be titled according to "Appendix A: Appendix Title" in adapted book class?
false
Using the answer by @Werner to [Is there an "\if" command that determines if a command has been issued?](https://tex.stackexchange.com/a/233251) allows an `\if` test which outputs as you desire: ``` \documentclass{book} \usepackage{fontspec} \usepackage{appendix} \usepackage{kantlipsum} \newfontfamily\chapterfont{Verdana} \makeatletter % https://tex.stackexchange.com/a/233251 \newcommand{\inappendix}{TT\fi\expandafter\ifx\@chapapp\appendixname} % https://tex.stackexchange.com/questions/18604 \def\@makechapterhead#1{% {\parindent \z@ \raggedright \chapterfont\fontsize{14pt}{0pt}\bfseries \ifnum \c@secnumdepth >\m@ne \if\inappendix \appendixname~\thechapter:\ % <-- "Appendix A:" \else \thechapter.\ % <-- Chapter # (without "Chapter") \fi \fi \interlinepenalty\@M #1\par\nobreak% <------------------ Chapter title \vskip 12pt% <------------------ Space between chapter title and first paragraph }} \makeatother \begin{document} \mainmatter \chapter{This is a chapter} \kant[1] \chapter{Second chapter} \kant \appendix \chapter{Appendix title} \kant[6] \end{document} ``` --- To remove the `\frontmatter` numbering then use the following code: ``` \documentclass[oneside]{book} \usepackage{fontspec} \usepackage{appendix} \usepackage{kantlipsum} \newfontfamily\chapterfont{Verdana} \makeatletter % https://tex.stackexchange.com/a/233251 \newcommand{\inappendix}{TT\fi\expandafter\ifx\@chapapp\appendixname} % https://tex.stackexchange.com/questions/18604 \def\@makechapterhead#1{% {\parindent \z@ \raggedright \chapterfont\fontsize{14pt}{0pt}\bfseries \ifnum \c@secnumdepth >\m@ne \if\inappendix \appendixname~\thechapter:\ % <-- "Appendix A:" \else \if@mainmatter \thechapter.\ % <-- Chapter # (without "Chapter") \fi \fi \fi \interlinepenalty\@M #1\par\nobreak% <------------------ Chapter title \vskip 12pt% <------------------ Space between chapter title and first paragraph }} \makeatother \begin{document} \frontmatter \chapter{Preface} \kant[10] \tableofcontents \mainmatter \chapter{This is a chapter} \kant[1] \chapter{Second chapter} \kant \appendix \chapter{Appendix title} \kant[6] \end{document} ``` I am not sure how to add the `\appendixname` to the TOC (e.g. `Appendix A. Appendix Title`), using the package options `\usepackage[titletoc,title]{appendix}` doesn't add it to the TOC and is likely worth a new question (linked back to this one).
0
https://tex.stackexchange.com/users/273733
686498
318,480
https://tex.stackexchange.com/questions/685914
2
I have to adjust text size and to do this I use the following code having read [this](https://texblog.org/2012/08/29/changing-the-font-size-in-latex/) article but unfortunately it seems there is something does not work so that I thought to put here an answer where I ask how adjust text size: could someone help me, please? ``` \documentclass[10pt]{article} \usepackage{titlesec} \usepackage{mathrsfs} \usepackage{amsfonts} \usepackage{amssymb} \usepackage{amsthm} \usepackage{amsmath} \usepackage{txfonts} \usepackage{enumitem} \usepackage[T1]{fontenc} \usepackage{layout} \usepackage[paperheight=29.7cm,paperwidth=21cm,textwidth=17cm,textheight=25 cm]{geometry} \linespread{1.5} \begin{document} A \end{document} ```
https://tex.stackexchange.com/users/296807
Why the command \documentclass[n pt]{article} is not useful to adjust text size?
false
A good way to change the font size using the package [fontsize](https://ctan.org/pkg/fontsize?lang=en) is the following ``` \documentclass[10pt]{article} \usepackage{fontsize} \begin{document} \begin{flushleft} \changefontsize{5 pt} This text is written with font size in 5 pt. \end{flushleft} \begin{flushleft} \changefontsize{7 pt} This text is written with font size in 7 pt. \end{flushleft} \begin{flushleft} \changefontsize{9 pt} This text is written with font size in 9 pt. \end{flushleft} \noindent This text is written with a default font size and it is not written using the \texttt{flushleft} command. \begin{flushleft} \changefontsize{13 pt} This text is written with font size in 13 pt. \end{flushleft} \begin{flushleft} \changefontsize{15 pt} This text is written with font size in 15 pt. \end{flushleft} \begin{flushleft} \changefontsize{18 pt} This text is written with font size in 18 pt. \end{flushleft} \begin{flushleft} \changefontsize{20 pt} This text is written with font size in 20 pt. \end{flushleft} \end{document} ```
0
https://tex.stackexchange.com/users/296807
686500
318,481
https://tex.stackexchange.com/questions/686094
6
I want to typeset the titles of the sections of my document in capitals, so I need to increase the spacing between the letters. I am currently using the following (ugly) trick ``` \begingroup \catcode`/=13 \def/{\kern0.167em} \catcode` =\active \def {\kern0.5em} c/h/a/p/t/e/r t/i/t/l/e \endgroup ``` Is there a better way? (I would prefer a plain TeX solution but one using pdfTeX/XeTeX extensions is also fine to me.)
https://tex.stackexchange.com/users/nan
Increase letter spacing in plain TeX
false
pdftex version: ``` \letterspacefont\f=\tenrm 70 ABCDEF \f ABCDEF \bye ``` Note, that the parameter of the `\letterspacefont` pdfTeX primitive is given in 1/1000 em, whilst the font-feature `letterspace` used in LuaTeX and XeTeX has its parameter in 1/100 em.
7
https://tex.stackexchange.com/users/51799
686506
318,484
https://tex.stackexchange.com/questions/686508
0
I have a code like below, and I want to insert the string "22222222222222222222222222" at the place above `\date{today}` as is in the code, **but** it appears on the first page and `today` is on the second page. How can I make them to be on the same page (and above `today`) ? **EDIT** Also when I put 2 times this `\date{today}` it appears only once, why ? ``` \documentclass[ a4paper, % Page size fontsize=10pt, % Base font size twoside=true, % Use different layouts for even and odd pages (in ipt documentation for an in-depth explanation) ]{kaobook} \let\providelength\relax \usepackage{dialogue} % Choose the language \ifxetexorluatex \let\providelength\relax \usepackage{polyglossia} \setmainlanguage{english} \else \let\providelength\relax \usepackage[english]{babel} % Load characters and hyphenation \fi \usepackage[english=british]{csquotes} % English quotes %\documentclass{book} \usepackage{amsmath,amssymb} \usepackage{mathrsfs} \usepackage{imakeidx} \usepackage{hyperref} \makeindex \usepackage{enumitem} \usepackage{etoolbox} \usepackage{indentfirst} \usepackage[Lenny]{fncychap} \usepackage[natbib=true]{biblatex} % include the chapter number \setlist[enumerate]{label=\thechapter.\arabic{*},resume} % restart the enumerate list every chapter \preto\chapter{% \restartlist{enumerate}% } % Load packages for testing \usepackage{blindtext} \usepackage{kaobiblio} \addbibresource{main.bib} % Bibliography file % Load mathematical packages for theorems and related environments \usepackage[framed=true]{kaotheorems} % Load the package for hyperreferences \usepackage{kaorefs} \graphicspath{{examples/documentation/images/}{images/}} % Paths in which to look for images \makeindex[columns=3, title=Alphabetical Index, intoc] % Make LaTeX produce the files required to compile the index \makeglossaries % Make LaTeX produce the files required to compile the glossary \input{glossary.tex} % Include the glossary definitions \makenomenclature % Make LaTeX produce the files required to compile the nomenclature \usepackage{indentfirst} \begin{document} \titlehead{The \texttt{proper} class} \subject{} \title[Example and documentation of the {\normalfont\texttt{kaobook}} class]{On the {\normalfont\texttt{Second }} and } \subtitle{Provability } \author[Y]{J K\thanks{A \LaTeX\ lover}} \date{\today} 22222222222222222222222222 \date{\today} 999999999999999 \publishers{ submitted in } %---------------------------------------------------------------------------------------- \frontmatter % Denotes the start of the pre-document content, uses roman numerals %---------------------------------------------------------------------------------------- % OPENING PAGE %---------------------------------------------------------------------------------------- \makeatletter \uppertitleback{\@titlehead} % Header \maketitle \index{preface} %---------------------------------------------------------------------------------------- % TABLE OF CONTENTS & LIST OF FIGURES/TABLES %---------------------------------------------------------------------------------------- \begingroup % Local scope for the following commands % Define the style for the TOC, LOF, and LOT %\setstretch{1} % Uncomment to modify line spacing in the ToC %\hypersetup{linkcolor=blue} % Uncomment to set the colour of links in the ToC \setlength{\textheight}{230\hscale} % Manually adjust the height of the ToC pages % Turn on compatibility mode for the etoc package \etocstandarddisplaystyle % "toc display" as if etoc was not loaded \etocstandardlines % "toc lines" as if etoc was not loaded \tableofcontents % Output the table of contents \listoffigures % Output the list of figures % Comment both of the following lines to have the LOF and the LOT on different pages \let\cleardoublepage\bigskip \let\clearpage\bigskip \listoftables % Output the list of tables \endgroup %---------------------------------------------------------------------------------------- % MAIN BODY %---------------------------------------------------------------------------------------- \end{document} ```
https://tex.stackexchange.com/users/171927
the string position in code doesn't correspond with the position in the output pdf
false
Quick and dirty hack: ``` \documentclass[ a4paper, % Page size fontsize=10pt, % Base font size twoside=true, % Use different layouts for even and odd pages (in ipt documentation for an in-depth explanation) ]{kaobook} \let\providelength\relax \usepackage{dialogue} % Choose the language \ifxetexorluatex \let\providelength\relax \usepackage{polyglossia} \setmainlanguage{english} \else \let\providelength\relax \usepackage[english]{babel} % Load characters and hyphenation \fi \usepackage[english=british]{csquotes} % English quotes %\documentclass{book} \usepackage{amsmath,amssymb} \usepackage{mathrsfs} \usepackage{imakeidx} \usepackage{hyperref} \makeindex \usepackage{enumitem} \usepackage{etoolbox} \usepackage{indentfirst} \usepackage[Lenny]{fncychap} \usepackage[natbib=true]{biblatex} % include the chapter number \setlist[enumerate]{label=\thechapter.\arabic{*},resume} % restart the enumerate list every chapter \preto\chapter{% \restartlist{enumerate}% } % Load packages for testing \usepackage{blindtext} \usepackage{kaobiblio} \addbibresource{main.bib} % Bibliography file % Load mathematical packages for theorems and related environments \usepackage[framed=true]{kaotheorems} % Load the package for hyperreferences \usepackage{kaorefs} \graphicspath{{examples/documentation/images/}{images/}} % Paths in which to look for images \makeindex[columns=3, title=Alphabetical Index, intoc] % Make LaTeX produce the files required to compile the index \makeglossaries % Make LaTeX produce the files required to compile the glossary \input{glossary.tex} % Include the glossary definitions \makenomenclature % Make LaTeX produce the files required to compile the nomenclature \usepackage{indentfirst} \addtokomafont{date}{\includegraphics[width=3cm]{example-image-duck}\endgraf} \begin{document} \titlehead{The \texttt{proper} class} \subject{} \title[Example and documentation of the {\normalfont\texttt{kaobook}} class]{On the {\normalfont\texttt{Second }} and } \subtitle{Provability } \author[Y]{J K\thanks{A \LaTeX\ lover}} \date{\today} \publishers{ submitted in } %---------------------------------------------------------------------------------------- \frontmatter % Denotes the start of the pre-document content, uses roman numerals %---------------------------------------------------------------------------------------- % OPENING PAGE %---------------------------------------------------------------------------------------- \makeatletter \uppertitleback{\@titlehead} % Header \maketitle \index{preface} %---------------------------------------------------------------------------------------- % TABLE OF CONTENTS & LIST OF FIGURES/TABLES %---------------------------------------------------------------------------------------- \begingroup % Local scope for the following commands % Define the style for the TOC, LOF, and LOT %\setstretch{1} % Uncomment to modify line spacing in the ToC %\hypersetup{linkcolor=blue} % Uncomment to set the colour of links in the ToC \setlength{\textheight}{230\hscale} % Manually adjust the height of the ToC pages % Turn on compatibility mode for the etoc package \etocstandarddisplaystyle % "toc display" as if etoc was not loaded \etocstandardlines % "toc lines" as if etoc was not loaded \tableofcontents % Output the table of contents \listoffigures % Output the list of figures % Comment both of the following lines to have the LOF and the LOT on different pages \let\cleardoublepage\bigskip \let\clearpage\bigskip \listoftables % Output the list of tables \endgroup %---------------------------------------------------------------------------------------- % MAIN BODY %---------------------------------------------------------------------------------------- \end{document} ```
0
https://tex.stackexchange.com/users/36296
686511
318,485
https://tex.stackexchange.com/questions/686492
0
Having trouble running the following MWE with LuaLaTeX, despite ***multiple*** confirmations that font-libertinus was successfully installed using Homebrew! I'm running MacOS Ventura 13.3.1 on M2 Max; TeXShop typesetting with LuaLaTeX. The following MWE is enough to generate the error: > > The font "LibertinusMaths" cannot be found. > > > ``` \documentclass[12pt]{book} \usepackage{unicode-math} % this calls fontspec \setmathfont[]{Libertinus Maths} \begin{document} \end{document} ``` which results in the following error log: > > This is LuaHBTeX, Version 1.17.0 (TeX Live 2023) restricted system > commands enabled. (./font\_testing.tex LaTeX2e <2022-11-01> patch level > 1 L3 programming layer <2023-05-15> > (/usr/local/texlive/2023/texmf-dist/tex/latex/base/book.cls Document > Class: book 2022/07/02 v1.4n Standard LaTeX document class > (/usr/local/texlive/2023/texmf-dist/tex/latex/base/bk12.clo)) > (/usr/local/texlive/2023/texmf-dist/tex/latex/unicode-math/unicode-math.sty > (/usr/local/texlive/2023/texmf-dist/tex/latex/l3kernel/expl3.sty > (/usr/local/texlive/2023/texmf-dist/tex/latex/l3backend/l3backend-luatex.def)) > (/usr/local/texlive/2023/texmf-dist/tex/latex/unicode-math/unicode-math-luatex. > sty > (/usr/local/texlive/2023/texmf-dist/tex/latex/l3packages/xparse/xparse.sty) > (/usr/local/texlive/2023/texmf-dist/tex/latex/l3packages/l3keys2e/l3keys2e.sty > ) (/usr/local/texlive/2023/texmf-dist/tex/latex/fontspec/fontspec.sty > (/usr/local/texlive/2023/texmf-dist/tex/latex/fontspec/fontspec-luatex.sty > (/usr/local/texlive/2023/texmf-dist/tex/latex/base/fontenc.sty) > (/usr/local/texlive/2023/texmf-dist/tex/latex/fontspec/fontspec.cfg))) > (/usr/local/texlive/2023/texmf-dist/tex/latex/base/fix-cm.sty > (/usr/local/texlive/2023/texmf-dist/tex/latex/base/ts1enc.def)) > (/usr/local/texlive/2023/texmf-dist/tex/latex/amsmath/amsmath.sty For > additional information on amsmath, use the `?' option. > (/usr/local/texlive/2023/texmf-dist/tex/latex/amsmath/amstext.sty > (/usr/local/texlive/2023/texmf-dist/tex/latex/amsmath/amsgen.sty)) > (/usr/local/texlive/2023/texmf-dist/tex/latex/amsmath/amsbsy.sty) > (/usr/local/texlive/2023/texmf-dist/tex/latex/amsmath/amsopn.sty)) > (/usr/local/texlive/2023/texmf-dist/tex/lualatex/lualatex-math/lualatex-math.st > y > (/usr/local/texlive/2023/texmf-dist/tex/latex/etoolbox/etoolbox.sty)) > (/usr/local/texlive/2023/texmf-dist/tex/latex/unicode-math/unicode-math-table.t > ex))) luaotfload | db : Reload initiated (formats: otf,ttf,ttc); > reason: Font "LibertinusMaths" not found. luaotfload | resolve : > sequence of 3 lookups yielded nothing appropriate. > > > ./font\_testing.tex:4: Package fontspec Error: The font > "LibertinusMaths" cannot be found. > > > For immediate help type H . ... > > > l.4 \begin > {document} ? > > > I've recently switched from using LaTeX to LuaLaTeX to typeset the code. Oddly enough, the same code runs w/o error on an older Mac running Catalina 10.15.7 MacOS. Apologies for the lengthly error log, but I have NO idea what might be needed to diagnose the error. Thanks in advance!
https://tex.stackexchange.com/users/213365
The font "LibertinusMaths" cannot be found
true
If I change ``` \setmathfont[]{Libertinus Maths} ``` to ``` \setmathfont[]{Libertinus Math} ``` the MWE compiles just fine on my (upstream) TeXLive 2023.
3
https://tex.stackexchange.com/users/3929
686512
318,486
https://tex.stackexchange.com/questions/686413
0
I know there are some posts about this but none of them could solve my problem, which I think comes from the cls fils I am using. A very basic example to reproduce the error is: ``` \documentclass{iau} \begin{document} \section{Introduction} blah blah blah ... \end{document} ``` The error is: ``` ! Extra \endgroup. \document ->\endgroup \ifx \@unusedoptionlist \@empty \else \@latex@warning@... l.2 \begin{document} ? ``` ``` ! Undefined control sequence. \set@color ...\@pdfcolorstack push{\current@color }\aftergroup \reset@color l.5 \end{document} ? ``` The `iau.cls` file can be download in the file [IAU\_Author-Latex-template-Macro-Cambridge-2022.zip](https://www.iau.org/static/scientific_meetings/authors/). Maybe someone would find the problem.
https://tex.stackexchange.com/users/268703
`iau.cls` will not compile with a basic document
false
The class redefines `\document` in a way incompatible with recent latex releases. I can't see any essential features in the redefinition so this simply restores the standard latex command, and runs without error. ``` \let\Xdocument\document \documentclass{iau} \let\document\Xdocument \begin{document} \section{Introduction} blah blah blah ... \end{document} ```
3
https://tex.stackexchange.com/users/1090
686522
318,487
https://tex.stackexchange.com/questions/686537
0
It compiles but I see an error: ``` I do not know the key \tikz\general shadow ``` This is the code: ``` \documentclass[10pt]{article} \usepackage{amstext} \usepackage{amsmath} \usepackage{amsfonts} \usepackage{amssymb} \usepackage{amsthm} \usepackage{array} \usepackage{tikz} \usetikzlibrary{shapes.geometric} \usepackage[margin=1.5in]{geometry} \usepackage{graphicx} \usetikzlibrary{shapes,positioning} \usepackage[utf8]{inputenc} \begin{document} \begin{tikzpicture}[scale = 0.3] \tikzset{ cli/.style={circle,ball color=black,inner sep=0pt,minimum size=5pt],draw, general shadow={fill=gray!60,shadow xshift=1pt,shadow yshift=-1pt}}, c1/.style={very thick,black}, c2/.style={very thick,red!65!black}, c3/.style={very thick,green!70!black}} \node[cli] (w0) at (-2,0) {}; \node[cli] (w1) at (-2,-4) {}; \node[cli] (w2) at (2,-4) {}; \node[cli] (w3) at (2,0) {}; \draw[c1] (w0) -- (w1); \draw[c1] (w0) -- (w3); \draw[c2] (w1) to node [black,below] {$aaa$} (w2); \draw[c1] (w2) -- (w3); \draw[c2] (w2) -- (w0); \draw[c2] (w1) -- (w3); \end{tikzpicture} \end{document} ```
https://tex.stackexchange.com/users/239907
Error: I do not know the key \tikz\general shadow
false
You need to load the `shadows` TikZ library (`\usetikzlibrary{shapes,positioning,shadows}`): ``` \documentclass[10pt]{article} \usepackage{amstext} \usepackage{amsmath} \usepackage{amsfonts} \usepackage{amssymb} \usepackage{amsthm} \usepackage{array} \usepackage{tikz} \usetikzlibrary{shapes.geometric} \usepackage[margin=1.5in]{geometry} \usepackage{graphicx} \usetikzlibrary{shapes,positioning,shadows} \usepackage[utf8]{inputenc} \begin{document} \begin{tikzpicture}[scale = 0.3] \tikzset{ cli/.style={circle,ball color=black,inner sep=0pt,minimum size=5pt],draw, general shadow={fill=gray!60,shadow xshift=1pt,shadow yshift=-1pt}}, c1/.style={very thick,black}, c2/.style={very thick,red!65!black}, c3/.style={very thick,green!70!black}} \node[cli] (w0) at (-2,0) {}; \node[cli] (w1) at (-2,-4) {}; \node[cli] (w2) at (2,-4) {}; \node[cli] (w3) at (2,0) {}; \draw[c1] (w0) -- (w1); \draw[c1] (w0) -- (w3); \draw[c2] (w1) to node [black,below] {$aaa$} (w2); \draw[c1] (w2) -- (w3); \draw[c2] (w2) -- (w0); \draw[c2] (w1) -- (w3); \end{tikzpicture} \end{document} ```
1
https://tex.stackexchange.com/users/273733
686538
318,495
https://tex.stackexchange.com/questions/215876
2
I am trying to complile an elsarticle tex document. Although I dont get errors, the bibliographt doesn's seem to work. All I get is "elsarticle-harv" written. Here is my MWE: ``` \documentclass[preprint,12pt,authoryear]{elsarticle} \usepackage{amssymb} \usepackage{amsthm} \usepackage[brazilian]{babel} \usepackage[utf8]{inputenc} \usepackage{natbib} \begin{document} \cite{BHL} \begin{thebibliography} %\bibliographystyle{plainnat} \bibliographystyle{elsarticle-harv} \bibliography{bib} \end{thebibliography} \end{document} ``` Any help is appreciated. EDIT: Here is the bib file: ``` @Article{BHL, author={Bjørnland, Hilde C. and Leitemo, Kai}, title={Identifying the interdependence between US monetary policy and the stock market}, journal={Journal of Monetary Economics}, year=2009, volume={56}, number={2}, pages={275-282}, month={March}, keywords={ VAR Monetary policy Asset prices Identification}, abstract={We estimate the interdependence between US monetary policy and the S\&P 500 using structural vector autoregressive (VAR) methodology. A solution is proposed to the simultaneity problem of identifying monetary and stock price shocks by using a combination of short-run and long-run restrictions that maintains the qualitative properties of a monetary policy shock found in the established literature [Christiano, L.J., Eichenbaum, M., Evans, C.L., 1999. Monetary policy shocks: what have we learned and to what end? In: Taylor, J.B., Woodford, M. (Eds.), Handbook of Macroeconomics, vol. 1A. Elsevier, New York, pp. 65-148]. We find great interdependence between the interest rate setting and real stock prices. Real stock prices immediately fall by seven to nine percent due to a monetary policy shock that raises the federal funds rate by 100 basis points. A stock price shock increasing real stock prices by one percent leads to an increase in the interest rate of close to 4 basis points.}, url={http://ideas.repec.org/a/eee/moneco/v56y2009i2p275-282.html} } ``` Thanks.
https://tex.stackexchange.com/users/39052
Bibliography and elsarticle
false
I was facing the same problem. Just a simple trick solved it for me. `Elsarticle` uses `natbib`, so, I deleted the `cite` package in my file. Then, everything runs fine. I hope this helps someone.
1
https://tex.stackexchange.com/users/297641
686544
318,496
https://tex.stackexchange.com/questions/686551
3
I want to start my enumitem counter at 2 instead of 1, but I do not know how. Could you please tell me how to do this? Here is a minimum example: ``` \documentclass[a4paper, 11pt]{article} \usepackage[a4paper,left=3cm,right=3cm,top=3cm,bottom=3cm]{geometry} \usepackage{enumitem} \newcounter{mycount} \renewcommand{\themycount}{\arabic{mycount}} \AtBeginEnvironment{enumerate}{\stepcounter{mycount}} \setlist[enumerate]{label=\themycount.\arabic*,ref=\themycount.\arabic*)} \begin{document} \begin{enumerate} \item Should be 2.1. \end{enumerate} \begin{enumerate} \item Should be 3.1. \end{enumerate} \end{document} ```
https://tex.stackexchange.com/users/189930
How to start enumerate counting at 2 instead of 1?
true
Maybe I've misunderstood what you want, but you just need to set your `mycount` counter to 1 in your preamble. And you don't need to use `\AtBeginEnvironment` since `enumitem` has a `before` key for injecting this sort of code. `enumitem` also has a `start` key which can be used to start any list at any number without manually incrementing the counter, but in your case that doesn't seem to be what you need. ``` \documentclass[a4paper, 11pt]{article} \usepackage[a4paper,left=3cm,right=3cm,top=3cm,bottom=3cm]{geometry} \usepackage{enumitem} \newcounter{mycount} \renewcommand{\themycount}{\arabic{mycount}} \setlist[enumerate]{label=\themycount.\arabic*, ref=\themycount.\arabic*), before=\refstepcounter{mycount}} \setcounter{mycount}{1} \begin{document} \begin{enumerate} \item Should be 2.1. \end{enumerate} \begin{enumerate} \item Should be 3.1. \end{enumerate} \end{document} ```
5
https://tex.stackexchange.com/users/2693
686553
318,499
https://tex.stackexchange.com/questions/686094
6
I want to typeset the titles of the sections of my document in capitals, so I need to increase the spacing between the letters. I am currently using the following (ugly) trick ``` \begingroup \catcode`/=13 \def/{\kern0.167em} \catcode` =\active \def {\kern0.5em} c/h/a/p/t/e/r t/i/t/l/e \endgroup ``` Is there a better way? (I would prefer a plain TeX solution but one using pdfTeX/XeTeX extensions is also fine to me.)
https://tex.stackexchange.com/users/nan
Increase letter spacing in plain TeX
true
You can use `eplain` and `letterspace`, with `pdftex` or `luatex`. For XeTeX you need to set letterspacing in the definition of the chapter font. ``` \input eplain \beginpackages \usepackage{iftex} \ifxetex\else \usepackage[letterspace=200]{letterspace} \fi \endpackages \ifxetex \font\chapterfont="[lmromancaps10-regular.otf]:letterspace=40" at 16pt \def\lsstyle{} \else \font\chapterfont=cmcsc10 at 16pt \fi \def\chapter#1{% \par\supereject \vglue 48pt \begingroup \baselineskip=24pt \chapterfont\lsstyle #1 \par \endgroup \vskip 24pt } \chapter{This is spaced} This is standard text for the chapter. \bye ```
1
https://tex.stackexchange.com/users/4427
686554
318,500
https://tex.stackexchange.com/questions/686558
0
I'm trying to list examples of weak compositions of 4, and my code looks like the following: ``` Weak compositions of $4$ into three parts are: \[(4,0,0), (0,4,0),(0,0,4),(3,1,0),(3,0,1),(0,1,3)\linebreak(0,3,1),(1,0,3),(1,3,0),(2,2,0),(2,0,2),(0,2,2),\linebreak(2,1,1),(1,2,1),(1,1,2)\] ``` However, the line break is not working and the list is overflowing from the page. Is there any fix/convention when this happens?
https://tex.stackexchange.com/users/297652
Overfull hbox too wide (how to break lines)?
false
I broke the lines where you indicated but I think breaking after a comma would be more natural ``` \documentclass{article} \usepackage{amsmath} \begin{document} Weak compositions of $4$ into three parts are: \begin{multline*} (4,0,0), (0,4,0),(0,0,4),(3,1,0),(3,0,1),(0,1,3)\\ (0,3,1),(1,0,3),(1,3,0),(2,2,0),(2,0,2),(0,2,2),\\ (2,1,1),(1,2,1),(1,1,2) \end{multline*} \end{document} ```
0
https://tex.stackexchange.com/users/1090
686559
318,503
https://tex.stackexchange.com/questions/686558
0
I'm trying to list examples of weak compositions of 4, and my code looks like the following: ``` Weak compositions of $4$ into three parts are: \[(4,0,0), (0,4,0),(0,0,4),(3,1,0),(3,0,1),(0,1,3)\linebreak(0,3,1),(1,0,3),(1,3,0),(2,2,0),(2,0,2),(0,2,2),\linebreak(2,1,1),(1,2,1),(1,1,2)\] ``` However, the line break is not working and the list is overflowing from the page. Is there any fix/convention when this happens?
https://tex.stackexchange.com/users/297652
Overfull hbox too wide (how to break lines)?
false
You have 15 triples, so you can order them five per line (in your order) or lexicographically ``` \documentclass{article} \usepackage{amsmath} \begin{document} Weak compositions of $4$ into three parts are: \begin{align*} &(4,0,0),(0,4,0),(0,0,4),(3,1,0),(3,0,1),\\ &(0,1,3),(0,3,1),(1,0,3),(1,3,0),(2,2,0),\\ &(2,0,2),(0,2,2),(2,1,1),(1,2,1),(1,1,2) \end{align*} Weak compositions of $4$ into three parts are: \begin{align*} &(0,0,4),(0,1,3),(0,2,2),(0,3,1),(0,4,0),\\ &(1,0,3),(1,1,2),(1,2,1),(1,3,0),\\ &(2,0,2),(2,1,1),(2,2,0),\\ &(3,0,1),(3,1,0),\\ &(4,0,0) \end{align*} \end{document} ```
0
https://tex.stackexchange.com/users/4427
686561
318,504
https://tex.stackexchange.com/questions/686563
1
I'm trying to personalise my page setup using `fancyhdr`, but it only works for the document class `book`. I read the `fancyhdr` documentation and I didn’t find any specific difference between the two document classes, although, as I said, it only works for `book`. For more details, the line "COSTRUZIONE DI MACCHINE" and the page number appear on the same side every page, while I'm trying to alternate them. Thanks in advance to everyone. ``` %impostazioni impaginazione \pagestyle{fancy} \fancyhf{} \fancyfoot[LE,RO]{\thepage} \fancyfoot[LO,RE]{COSTRUZIONE DI MACCHINE} \renewcommand{\chaptermark}[1]{% \markboth{\thechapter. \ #1}{}} \renewcommand{\sectionmark}[1]{\markright{\thesection.\ #1}} \setlength{\headheight}{15pt} \fancyhead[LE]{\slshape \leftmark} \fancyhead[RO]{\slshape \rightmark} %ridefinizione plain \fancypagestyle{plain}{% \fancyhf{} \fancyfoot[LE,RO]{\thepage} \renewcommand{\headrulewidth}{0pt} \renewcommand{\footrulewidth}{0pt}} ```
https://tex.stackexchange.com/users/297660
Page setup not working with document class report
false
The main difference between `report` and `book` is that the former uses by default the `oneside` option, while the latter uses `twoside`. With `oneside` all pages are considered to be right-hand ones (odd numbered, even if the actual page number is even), so specifying `LE` and `RE` is moot. And `fancyhdr` actually tells you so: ``` Package fancyhdr Warning: \fancyfoot's `E' option without twoside option is useless. (fancyhdr) Please consider using the `twoside' option on input line 6. Package fancyhdr Warning: \fancyfoot's `E' option without twoside option is useless. (fancyhdr) Please consider using the `twoside' option on input line 7. Package fancyhdr Warning: \fancyhead's `E' option without twoside option is useless. (fancyhdr) Please consider using the `twoside' option on input line 12. ``` (line numbers may differ, of course). Use `book`, it's better because it provides you `\frontmatter` and `\mainmatter`, but is the same as `report` under all respects, except for the default option mentioned at the beginning.
2
https://tex.stackexchange.com/users/4427
686564
318,506
https://tex.stackexchange.com/questions/686567
2
The `\binom` command is an example of a LaTeX command which accepts two inputs. We have the following example: ``` \binom{n+1}{2k} ``` What is an example of a LaTeX command with three or more parameters?
https://tex.stackexchange.com/users/178952
What are some examples of LaTeX commands which accept three or more arguments?
true
As of version 2022-11-01, patch level 1, the LaTeX "kernel" contains * 10 instances of `#9` * 30 instances of `#8` * 40 instances of `#7` * 86 instances of `#6` * 172 instances of `#5` * 407 instances of `#4` * 892 instances of `#3` This translates into (very!) roughly 5, 10, 5, 23, 43, 117, and 242 kernel commands taking *exactly* 9, 8, 7, 6, 5, 4, and 3 arguments, respectively. Of course, many (most?) kernel commands that take 5 or more inputs are not user-level commands. Instead, they are part of an erector set of tools meant to create further tools, including user-level commands. To give an example of a *user-level* command provided by one of the myriad of available LaTeX packages, consider `\DeclarePairedDelimiter`, which is provided by the [mathtools](https://www.ctan.org/pkg/mathtools) package. E.g., ``` \DeclarePairedDelimiter{\abs}{\lvert}{\rvert} ``` And an example from the [cleveref](https://ctan.org/pkg/cleveref) package: ``` \crefname{prop}{proposition}{propositions} ``` Of course, I make no claim whatsoever that these two commands are somehow representative of the vast number of LaTeX commands out there that take exactly three arguments.
12
https://tex.stackexchange.com/users/5001
686575
318,509
https://tex.stackexchange.com/questions/686443
26
ConTeXt has a number of advantages over LaTeX. But for some reason people prefer second one. 1. ConTeXt can generate epub, pdf, XHTML and xml while LaTeX can only generate pdf and dvi. [1] 2. ConTeXt provides third-party font support while pdflatex doesn't. 3. ConTeXt provides more control over document formatting and style. 4. ConTeXt supports MathMl natively. 5. ConTeXt is monolithic and mostly you don't need packages and modules in ConTeXt. [1] 6. ConTeXt error messages are easier to understand (at least in my opinion). 7. ConTeXt has better MetaPost integration. 8. ConTeXt has native SVG support. 9. ConTeXt can be used to work with spreadsheets. 10. ConTeXt is unified. It has only one implementation and you don't need to think about comparability with other implementations.
https://tex.stackexchange.com/users/297321
Why don't people use ConTeXt?
false
Why don't people use LaTeX? =========================== LaTeX has a number of advantages over Word. But for some reason people prefer second one... *Why don't people use Linux? Linux has many advantages over Windows...* You see what I'm getting at? It's very hard for the *objectively* superior tool to win against the *good enough* tool that everybody uses already, especially so, if said *good enough* tool has been around forever and is the de-facto standard. That said, LaTeX has quite a few issues and it shows that is very old, so I'd love it if there was some better alternative (and ConTeXt, which I never heard about before seems very interesting!) but we're running into a hen and egg issue here. Let's say I switch over to CenTeXt, but then what? If I want to publish my stuff, I have to translate it to Latex anyways, and if I leave academia, it's just another thing that I have to forget since I have to use Word again (*shudder...*). Also, I guess <https://xkcd.com/927/> applies.
6
https://tex.stackexchange.com/users/109399
686580
318,512
https://tex.stackexchange.com/questions/686552
0
I have a problem with the command `\begin{landscape}`, it generates a blank sheet. ``` \documentclass[12pt,a4paper]{article} \usepackage[utf8]{inputenc} \usepackage[spanish,es-tabla]{babel} \usepackage[usenames]{color} \usepackage{amsmath} \usepackage{lipsum} \usepackage{subcaption} \usepackage{pdflscape} \pagestyle{empty} \usepackage[export]{adjustbox} \usepackage{afterpage} \usepackage{longtable} % for 'longtable' environment \usepackage{pdflscape} % for 'landscape' environment \usepackage{longtable} \usepackage{rotating} \usepackage{float} \usepackage{array} \usepackage{fancybox} \usepackage{multirow} \usepackage{booktabs} \usepackage{setspace} \usepackage{amsfonts} \usepackage{amssymb} \usepackage{diagbox} \usepackage{slashbox} \usepackage{graphicx} \usepackage[T1]{fontenc} \usepackage[left=2.2cm,right=2.2cm,top=2.5cm,bottom=2.5cm]{geometry} \usepackage{fancyhdr} \usepackage[table,xcdraw]{xcolor} % para el color de la primera fila de la tabla \usepackage{sectsty} \chapterfont{\color{red}} % sets colour of chapters \sectionfont{\color{red}} % sets colour of sections \pagestyle{fancy} \fancyhead{} % Eliminamos definiciones previas \fancyhead[L]{Aseguramiento de la calidad} \fancyhead[R]{\includegraphics[scale=0.09]{../../LOGO SOLO LA HOJA.PNG}} \renewcommand{\headrulewidth}{1pt} \renewcommand{\footrulewidth}{1pt} \fancyfoot{} \fancyfoot[R]{\thepage} \fancyfoot[C]{Aprendiz de soporte técnico} \fancyfoot[L]{Recubrimientos especiales} \setlength{\headheight}{13.6pt} %---->%%%%%%%%%%%%%%%%%%%%%%%%%%%%% \begin{document} \begin{titlepage} \begin{landscape} \begin{center} \begin{longtable}[H]{|p{5cm}|c|c|c|c|c|} \multicolumn{5}{|c|}{\cellcolor[HTML]{FE0000}{\color[HTML]{FFFFFF} \textbf{CRITERIOS DE ACEPTACIÓN}}} \\ \hline \multicolumn{1}{|c|}{\cellcolor[HTML]{FE0000}{\color[HTML]{FFFFFF} }} & \multicolumn{2}{c|}{\textbf{\textcolor{red}{CLIENTE TIPO A}}}& \multicolumn{2}{c|}{\textbf{\textcolor{red} {CLIENTE TIPO B}}} \\ \cline{3-3} \multicolumn{1}{|c|}{\multirow{-2}{*}{\cellcolor[HTML]{FE0000}{\color[HTML]{FFFFFF} \textbf{Defectos}}}} & \multicolumn{1}{c|}{\cellcolor[HTML]{FE0000}{\color[HTML]{FFFFFF} \textbf{\begin{tabular}[c]{@{}c@{}}Baker\\Hughes\\(LVOF)\end{tabular}}}} & \multicolumn{1}{c|}{\cellcolor[HTML]{FE0000}{\color[HTML]{FFFFFF} \textbf{\begin{tabular}[c]{@{}c@{}}Schlumberger\\(HVOF)\end{tabular}}}} & \multicolumn{1}{c|}{\cellcolor[HTML]{FE0000}{\color[HTML]{FFFFFF} \textbf{\begin{tabular}[c]{@{}c@{}}NOV\\(HVOF)\end{tabular}}}} & \multicolumn{1}{c|}{\cellcolor[HTML]{FE0000}{\color[HTML]{FFFFFF} \textbf{\begin{tabular}[c]{@{}c@{}}Watherford\\(HVOF)\end{tabular}}}} \\ \hline \multicolumn{1}{|c|}{\cellcolor[HTML]{FE0000}{\color[HTML]{FFFFFF} \backslashbox[34mm]{\textbf{Fatiga}}{\textbf{Grieta}}}}&\multicolumn{4}{c|}{\begin{tabular}[c]{@{}l@{}}\textbf{No} son admisibles grietas y revestimiento fatigado a través de VT y MT \end{tabular}} \\ \hline \multicolumn{1}{|c|}{\cellcolor[HTML]{FE0000}{\color[HTML]{FFFFFF} \textbf{Porosidades}}}& \multicolumn{1}{c|}{\begin{tabular}[c]{@{}l@{}}\textbf{Son} admisibles 5 poros\\abiertos y 10 cerrados\\con $\varnothing\leq 1mm$ posterior\\ al primer tercio desde la\\ caja del rotor o stub a\\través de VT y MT \end{tabular}}& \multicolumn{2}{c|}{\begin{tabular}[c]{@{}l@{}}\textbf{No} son admisibles poros\\ abiertos y cerrados a tr-\\avé de VT \end{tabular}}&\multicolumn{1}{c|}{\begin{tabular}[c]{@{}l@{}}\textbf{No} son admisibles poros\\ abiertos y cerrados a tra-\\vés de VT y MT \end{tabular}} \\ \hline \multicolumn{1}{|c|}{\cellcolor[HTML]{FE0000}{\color[HTML]{FFFFFF} \textbf{\begin{tabular}[c]{@{}c@{}}Pegas entre \\ revestimientos\end{tabular}}}}& \multicolumn{4}{c|}{\begin{tabular}[c]{@{}l@{}}\textbf{No} Aplica \end{tabular}} \\ \hline \multicolumn{1}{|c|}{\cellcolor[HTML]{FE0000}{\color[HTML]{FFFFFF} \textbf{Sellante}}}&\multicolumn{3}{c|}{\begin{tabular}[c]{@{}l@{}}\textbf{No} es admisible marcas de sellante a través de VT\\y \textbf{Son} admisibles con MT \end{tabular}} & \multicolumn{1}{c|}{\begin{tabular}[c]{@{}l@{}}\textbf{No} es admisible marcas de\\sellante a través de VT y\\ \textbf{Son} admisibles a través\\de MT con una $A^{2}<1in^{2}$\end{tabular}}\\ \hline \multicolumn{1}{|c|}{\cellcolor[HTML]{FE0000}{\color[HTML]{FFFFFF} \textbf{\begin{tabular}[c]{@{}c@{}}Marcas de\\ Pulido\end{tabular}}}} & \multicolumn{1}{c|}{\begin{tabular}[c]{@{}l@{}}\textbf{No} es admisible marcas\\de pulido en el revestimi-\\ento por medio de VT y\\MT\end{tabular}} & \multicolumn{2}{c|}{\begin{tabular}[c]{@{}l@{}}\textbf{No} es admisibles marcas\\de pulido en el revestimi-\\ento por medio de VT y\\MT\end{tabular}} & \multicolumn{1}{c|}{\begin{tabular}[c]{@{}l@{}}\textbf{No} es admisible marcas\\de pulido en el revestimi-\\ento por medio de VT y\\MT\end{tabular}}\\ \hline \multicolumn{1}{|c|}{\cellcolor[HTML]{FE0000}{\color[HTML]{FFFFFF} \textbf{\begin{tabular}[c]{@{}c@{}}Zonas sin\\ revestimiento\end{tabular}}}} & \multicolumn{4}{c|}{\begin{tabular}[c]{@{}c@{}}\textbf{No} es admisible zonas carentes de revestimiento \end{tabular}} \\ \hline \multicolumn{1}{|c|}{\cellcolor[HTML]{FE0000}{\color[HTML]{FFFFFF} \textbf{\begin{tabular}[c]{@{}c@{}}Pulido \\ final\end{tabular}}}} &\multicolumn{4}{c|}{\begin{tabular}[c]{@{}c@{}}\textbf{No} es admisible un componente con un mal acabado final y con los defectos\\mencionados anteriormente, este debe estar libre de cualquier discontinuidad \end{tabular}}\\ \hline \multicolumn{5}{|c|}{\begin{tabular}[c]{@{}c@{}}\textbf{No} es admisible un componente con defectos o discontinuidades en el revestimiento duro como:\\Arañazos, falta de adhesión, revestimiento no completamente fundido. Cualquier discontinuidad\\en el revestimiento sera rechazado \end{tabular}} \\ \hline \caption{Criterios de aceptación para el revestimiento duro - HVOF} \label{tab:grupos} \end{longtable} \end{center} \end{landscape} \end{titlepage} \end{document} ```
https://tex.stackexchange.com/users/297648
I have a problem with the command \begin{landscape}, it generates a blank sheet
false
IMHO it makes not sense to put a table with caption into a `titlepage` environment. And putting a landscape table with caption into a `titlepage` environment even more doesn't make sense. And putting a landscape table, that is allowed to span several pages, into a `titlepage` environment also does not make sense. So I would recommend to remove the `titlepage` and the center environment: ``` \documentclass[12pt,a4paper]{article} \usepackage[spanish,es-tabla]{babel} \usepackage{graphicx} \usepackage[table,xcdraw]{xcolor} % para el color de la primera fila de la tabla \usepackage{lipsum} \usepackage{subcaption} \pagestyle{empty} \usepackage{longtable} % for 'longtable' environment \usepackage{pdflscape} % for 'landscape' environment \usepackage{multirow} \usepackage{amssymb} \usepackage{diagbox} \usepackage[T1]{fontenc} \usepackage[left=2.2cm,right=2.2cm,top=2.5cm,bottom=2.5cm]{geometry} \usepackage{fancyhdr} \pagestyle{fancy} \fancyhead{} % Eliminamos definiciones previas \fancyhead[L]{Aseguramiento de la calidad} \fancyhead[R]{\includegraphics[scale=0.09]{example-image}}% NOTE: image replaced to make a real MWE \renewcommand{\headrulewidth}{1pt} \renewcommand{\footrulewidth}{1pt} \fancyfoot{} \fancyfoot[R]{\thepage} \fancyfoot[C]{Aprendiz de soporte técnico} \fancyfoot[L]{Recubrimientos especiales} \setlength{\headheight}{13.6pt} %---->%%%%%%%%%%%%%%%%%%%%%%%%%%%%% \begin{document} \begin{landscape} \begin{longtable}[H]{|p{5cm}|c|c|c|c|c|} \multicolumn{5}{|c|}{\cellcolor[HTML]{FE0000}{\color[HTML]{FFFFFF} \textbf{CRITERIOS DE ACEPTACIÓN}}} \\ \hline \multicolumn{1}{|c|}{\cellcolor[HTML]{FE0000}{\color[HTML]{FFFFFF} }} & \multicolumn{2}{c|}{\textbf{\textcolor{red}{CLIENTE TIPO A}}}& \multicolumn{2}{c|}{\textbf{\textcolor{red} {CLIENTE TIPO B}}} \\ \cline{3-3} \multicolumn{1}{|c|}{\multirow{-2}{*}{\cellcolor[HTML]{FE0000}{\color[HTML]{FFFFFF} \textbf{Defectos}}}} & \multicolumn{1}{c|}{\cellcolor[HTML]{FE0000}{\color[HTML]{FFFFFF} \textbf{\begin{tabular}[c]{@{}c@{}}Baker\\Hughes\\(LVOF)\end{tabular}}}} & \multicolumn{1}{c|}{\cellcolor[HTML]{FE0000}{\color[HTML]{FFFFFF} \textbf{\begin{tabular}[c]{@{}c@{}}Schlumberger\\(HVOF)\end{tabular}}}} & \multicolumn{1}{c|}{\cellcolor[HTML]{FE0000}{\color[HTML]{FFFFFF} \textbf{\begin{tabular}[c]{@{}c@{}}NOV\\(HVOF)\end{tabular}}}} & \multicolumn{1}{c|}{\cellcolor[HTML]{FE0000}{\color[HTML]{FFFFFF} \textbf{\begin{tabular}[c]{@{}c@{}}Watherford\\(HVOF)\end{tabular}}}} \\ \hline \multicolumn{1}{|c|}{\cellcolor[HTML]{FE0000}{\color[HTML]{FFFFFF} \backslashbox[34mm]{\textbf{Fatiga}}{\textbf{Grieta}}}}&\multicolumn{4}{c|}{\begin{tabular}[c]{@{}l@{}}\textbf{No} son admisibles grietas y revestimiento fatigado a través de VT y MT \end{tabular}} \\ \hline \multicolumn{1}{|c|}{\cellcolor[HTML]{FE0000}{\color[HTML]{FFFFFF} \textbf{Porosidades}}}& \multicolumn{1}{c|}{\begin{tabular}[c]{@{}l@{}}\textbf{Son} admisibles 5 poros\\abiertos y 10 cerrados\\con $\varnothing\leq 1mm$ posterior\\ al primer tercio desde la\\ caja del rotor o stub a\\través de VT y MT \end{tabular}}& \multicolumn{2}{c|}{\begin{tabular}[c]{@{}l@{}}\textbf{No} son admisibles poros\\ abiertos y cerrados a tr-\\avé de VT \end{tabular}}&\multicolumn{1}{c|}{\begin{tabular}[c]{@{}l@{}}\textbf{No} son admisibles poros\\ abiertos y cerrados a tra-\\vés de VT y MT \end{tabular}} \\ \hline \multicolumn{1}{|c|}{\cellcolor[HTML]{FE0000}{\color[HTML]{FFFFFF} \textbf{\begin{tabular}[c]{@{}c@{}}Pegas entre \\ revestimientos\end{tabular}}}}& \multicolumn{4}{c|}{\begin{tabular}[c]{@{}l@{}}\textbf{No} Aplica \end{tabular}} \\ \hline \multicolumn{1}{|c|}{\cellcolor[HTML]{FE0000}{\color[HTML]{FFFFFF} \textbf{Sellante}}}&\multicolumn{3}{c|}{\begin{tabular}[c]{@{}l@{}}\textbf{No} es admisible marcas de sellante a través de VT\\y \textbf{Son} admisibles con MT \end{tabular}} & \multicolumn{1}{c|}{\begin{tabular}[c]{@{}l@{}}\textbf{No} es admisible marcas de\\sellante a través de VT y\\ \textbf{Son} admisibles a través\\de MT con una $A^{2}<1in^{2}$\end{tabular}}\\ \hline \multicolumn{1}{|c|}{\cellcolor[HTML]{FE0000}{\color[HTML]{FFFFFF} \textbf{\begin{tabular}[c]{@{}c@{}}Marcas de\\ Pulido\end{tabular}}}} & \multicolumn{1}{c|}{\begin{tabular}[c]{@{}l@{}}\textbf{No} es admisible marcas\\de pulido en el revestimi-\\ento por medio de VT y\\MT\end{tabular}} & \multicolumn{2}{c|}{\begin{tabular}[c]{@{}l@{}}\textbf{No} es admisibles marcas\\de pulido en el revestimi-\\ento por medio de VT y\\MT\end{tabular}} & \multicolumn{1}{c|}{\begin{tabular}[c]{@{}l@{}}\textbf{No} es admisible marcas\\de pulido en el revestimi-\\ento por medio de VT y\\MT\end{tabular}}\\ \hline \multicolumn{1}{|c|}{\cellcolor[HTML]{FE0000}{\color[HTML]{FFFFFF} \textbf{\begin{tabular}[c]{@{}c@{}}Zonas sin\\ revestimiento\end{tabular}}}} & \multicolumn{4}{c|}{\begin{tabular}[c]{@{}c@{}}\textbf{No} es admisible zonas carentes de revestimiento \end{tabular}} \\ \hline \multicolumn{1}{|c|}{\cellcolor[HTML]{FE0000}{\color[HTML]{FFFFFF} \textbf{\begin{tabular}[c]{@{}c@{}}Pulido \\ final\end{tabular}}}} &\multicolumn{4}{c|}{\begin{tabular}[c]{@{}c@{}}\textbf{No} es admisible un componente con un mal acabado final y con los defectos\\mencionados anteriormente, este debe estar libre de cualquier discontinuidad \end{tabular}}\\ \hline \multicolumn{5}{|c|}{\begin{tabular}[c]{@{}c@{}}\textbf{No} es admisible un componente con defectos o discontinuidades en el revestimiento duro como:\\Arañazos, falta de adhesión, revestimiento no completamente fundido. Cualquier discontinuidad\\en el revestimiento sera rechazado \end{tabular}} \\ \hline \caption{Criterios de aceptación para el revestimiento duro - HVOF} \label{tab:grupos} \end{longtable} \end{landscape} \end{document} ``` If you don't want page header and footer at the landscape page, don't use the `titlepage` environment (that, e.g., also resets the `page` counter), but use `\pagestyle` (or for one page `\thispagestyle`) inside the `landscape` environment: ``` \documentclass[12pt,a4paper]{article} \usepackage[spanish,es-tabla]{babel} \usepackage{graphicx} \usepackage[table,xcdraw]{xcolor} % para el color de la primera fila de la tabla \usepackage{lipsum} \usepackage{subcaption} \pagestyle{empty} \usepackage{longtable} % for 'longtable' environment \usepackage{pdflscape} % for 'landscape' environment \usepackage{multirow} \usepackage{amssymb} \usepackage{diagbox} \usepackage[T1]{fontenc} \usepackage[left=2.2cm,right=2.2cm,top=2.5cm,bottom=2.5cm]{geometry} \usepackage{fancyhdr} \pagestyle{fancy} \fancyhead{} % Eliminamos definiciones previas \fancyhead[L]{Aseguramiento de la calidad} \fancyhead[R]{\includegraphics[scale=0.09]{example-image}}% NOTE: image replaced to make a real MWE \renewcommand{\headrulewidth}{1pt} \renewcommand{\footrulewidth}{1pt} \fancyfoot{} \fancyfoot[R]{\thepage} \fancyfoot[C]{Aprendiz de soporte técnico} \fancyfoot[L]{Recubrimientos especiales} \setlength{\headheight}{13.6pt} %---->%%%%%%%%%%%%%%%%%%%%%%%%%%%%% \begin{document} \begin{landscape} \pagestyle{empty}% or \thispagestyle{empty}, if only one page \begin{longtable}[H]{|p{5cm}|c|c|c|c|c|} \multicolumn{5}{|c|}{\cellcolor[HTML]{FE0000}{\color[HTML]{FFFFFF} \textbf{CRITERIOS DE ACEPTACIÓN}}} \\ \hline \multicolumn{1}{|c|}{\cellcolor[HTML]{FE0000}{\color[HTML]{FFFFFF} }} & \multicolumn{2}{c|}{\textbf{\textcolor{red}{CLIENTE TIPO A}}}& \multicolumn{2}{c|}{\textbf{\textcolor{red} {CLIENTE TIPO B}}} \\ \cline{3-3} \multicolumn{1}{|c|}{\multirow{-2}{*}{\cellcolor[HTML]{FE0000}{\color[HTML]{FFFFFF} \textbf{Defectos}}}} & \multicolumn{1}{c|}{\cellcolor[HTML]{FE0000}{\color[HTML]{FFFFFF} \textbf{\begin{tabular}[c]{@{}c@{}}Baker\\Hughes\\(LVOF)\end{tabular}}}} & \multicolumn{1}{c|}{\cellcolor[HTML]{FE0000}{\color[HTML]{FFFFFF} \textbf{\begin{tabular}[c]{@{}c@{}}Schlumberger\\(HVOF)\end{tabular}}}} & \multicolumn{1}{c|}{\cellcolor[HTML]{FE0000}{\color[HTML]{FFFFFF} \textbf{\begin{tabular}[c]{@{}c@{}}NOV\\(HVOF)\end{tabular}}}} & \multicolumn{1}{c|}{\cellcolor[HTML]{FE0000}{\color[HTML]{FFFFFF} \textbf{\begin{tabular}[c]{@{}c@{}}Watherford\\(HVOF)\end{tabular}}}} \\ \hline \multicolumn{1}{|c|}{\cellcolor[HTML]{FE0000}{\color[HTML]{FFFFFF} \backslashbox[34mm]{\textbf{Fatiga}}{\textbf{Grieta}}}}&\multicolumn{4}{c|}{\begin{tabular}[c]{@{}l@{}}\textbf{No} son admisibles grietas y revestimiento fatigado a través de VT y MT \end{tabular}} \\ \hline \multicolumn{1}{|c|}{\cellcolor[HTML]{FE0000}{\color[HTML]{FFFFFF} \textbf{Porosidades}}}& \multicolumn{1}{c|}{\begin{tabular}[c]{@{}l@{}}\textbf{Son} admisibles 5 poros\\abiertos y 10 cerrados\\con $\varnothing\leq 1mm$ posterior\\ al primer tercio desde la\\ caja del rotor o stub a\\través de VT y MT \end{tabular}}& \multicolumn{2}{c|}{\begin{tabular}[c]{@{}l@{}}\textbf{No} son admisibles poros\\ abiertos y cerrados a tr-\\avé de VT \end{tabular}}&\multicolumn{1}{c|}{\begin{tabular}[c]{@{}l@{}}\textbf{No} son admisibles poros\\ abiertos y cerrados a tra-\\vés de VT y MT \end{tabular}} \\ \hline \multicolumn{1}{|c|}{\cellcolor[HTML]{FE0000}{\color[HTML]{FFFFFF} \textbf{\begin{tabular}[c]{@{}c@{}}Pegas entre \\ revestimientos\end{tabular}}}}& \multicolumn{4}{c|}{\begin{tabular}[c]{@{}l@{}}\textbf{No} Aplica \end{tabular}} \\ \hline \multicolumn{1}{|c|}{\cellcolor[HTML]{FE0000}{\color[HTML]{FFFFFF} \textbf{Sellante}}}&\multicolumn{3}{c|}{\begin{tabular}[c]{@{}l@{}}\textbf{No} es admisible marcas de sellante a través de VT\\y \textbf{Son} admisibles con MT \end{tabular}} & \multicolumn{1}{c|}{\begin{tabular}[c]{@{}l@{}}\textbf{No} es admisible marcas de\\sellante a través de VT y\\ \textbf{Son} admisibles a través\\de MT con una $A^{2}<1in^{2}$\end{tabular}}\\ \hline \multicolumn{1}{|c|}{\cellcolor[HTML]{FE0000}{\color[HTML]{FFFFFF} \textbf{\begin{tabular}[c]{@{}c@{}}Marcas de\\ Pulido\end{tabular}}}} & \multicolumn{1}{c|}{\begin{tabular}[c]{@{}l@{}}\textbf{No} es admisible marcas\\de pulido en el revestimi-\\ento por medio de VT y\\MT\end{tabular}} & \multicolumn{2}{c|}{\begin{tabular}[c]{@{}l@{}}\textbf{No} es admisibles marcas\\de pulido en el revestimi-\\ento por medio de VT y\\MT\end{tabular}} & \multicolumn{1}{c|}{\begin{tabular}[c]{@{}l@{}}\textbf{No} es admisible marcas\\de pulido en el revestimi-\\ento por medio de VT y\\MT\end{tabular}}\\ \hline \multicolumn{1}{|c|}{\cellcolor[HTML]{FE0000}{\color[HTML]{FFFFFF} \textbf{\begin{tabular}[c]{@{}c@{}}Zonas sin\\ revestimiento\end{tabular}}}} & \multicolumn{4}{c|}{\begin{tabular}[c]{@{}c@{}}\textbf{No} es admisible zonas carentes de revestimiento \end{tabular}} \\ \hline \multicolumn{1}{|c|}{\cellcolor[HTML]{FE0000}{\color[HTML]{FFFFFF} \textbf{\begin{tabular}[c]{@{}c@{}}Pulido \\ final\end{tabular}}}} &\multicolumn{4}{c|}{\begin{tabular}[c]{@{}c@{}}\textbf{No} es admisible un componente con un mal acabado final y con los defectos\\mencionados anteriormente, este debe estar libre de cualquier discontinuidad \end{tabular}}\\ \hline \multicolumn{5}{|c|}{\begin{tabular}[c]{@{}c@{}}\textbf{No} es admisible un componente con defectos o discontinuidades en el revestimiento duro como:\\Arañazos, falta de adhesión, revestimiento no completamente fundido. Cualquier discontinuidad\\en el revestimiento sera rechazado \end{tabular}} \\ \hline \caption{Criterios de aceptación para el revestimiento duro - HVOF} \label{tab:grupos} \end{longtable} \end{landscape} \end{document} ``` Note: I've also removed all packages, which are not used in the example, and the second loading of packages.
1
https://tex.stackexchange.com/users/277964
686583
318,513
https://tex.stackexchange.com/questions/685545
0
XeLaTeX and LuaLaTeX support Unicode, and are perhaps also in some other ways better than pdfLaTeX. However, are mathematical and logical journals prepared for submissions prepared with XeLaTeX or LuaLaTeX? Perhaps it is more prudent to prepare one's work with standard pdfLaTeX? I am a bit wary about these things, as I one time when finishing an essay for a book was suddenly told that they just accepted word-submissions. What is a prudent strategy if one wants to have an essay published in a good logic journal?
https://tex.stackexchange.com/users/24406
Are XeLaTex and LuaLaTeX acceptable when submitting an article for publication?
true
As I said in the comments, this is an answer I prepared to the original question. Maybe you could consider having two separate main files, to be used with XeLaTeX or LuaLaTeX (e.g. your own copy that you could host and distribute), and pdflatex respectively: ``` xelatex main_xelatex.tex pdflatex main_pdflatex.tex ``` The changes required to switch from one to the other are certainly not comparable to the hassle of having to switch between LaTeX and Word; it is rather quite small all in all. I have been doing that, personally. You can then e.g. write your document's contents in a manuscript.tex file and use `\input manuscript.tex` in `between begin{document}` and `end{document}` to include the actual contents in both your setups. You can moreover easily reuse this setup for your later publications. I have just written a MWE demo for you. There are more elaborate ways to do it, but this is simple and works. ###### main\_xelatex.tex ``` \documentclass[11pt, a4paper]{article} \usepackage{fontspec} \usepackage{microtype} \usepackage{xltxtra} \usepackage{amsfonts} \usepackage{amsmath} \usepackage{amssymb} \usepackage{mathrsfs} \usepackage{latexsym} \usepackage{euscript} \usepackage{lipsum} \title{Lorem Ipsum} \author{René Descartes} \begin{document} \setmainfont{TheSansOsF} % or any other font you want XeLaTeX to use. \input manuscript.tex \end{document} ``` Note that in this example `main_xelatex.tex` is compatible with both XeLaTeX and LuaLaTeX. ###### main\_pdflatex.tex ``` \documentclass[11pt, a4paper]{article} \usepackage[utf8]{inputenc} \usepackage{amsfonts} \usepackage{amsmath} \usepackage{amssymb} \usepackage{mathrsfs} \usepackage{latexsym} \usepackage{euscript} \usepackage{lipsum} \title{Lorem Ipsum} \author{René Descartes} \begin{document} \input manuscript.tex \end{document} ``` ###### manuscript.tex ``` \maketitle \begin{abstract} \lipsum[1] \end{abstract} \section{Introduction} \lipsum[2-4] % ETC ... ``` ###### XeLaTeX output ###### pdflatex output I am essentially always using XeLaTeX nowadays when writing documents, knowing it's easy to switch if needed (since I only input text, pictures, and maths). Of course, if you know for sure that what you are currently writing is for a paper in a specific journal, then contacting them beforehand is the safest approach I would say.
3
https://tex.stackexchange.com/users/1216
686585
318,514
https://tex.stackexchange.com/questions/686567
2
The `\binom` command is an example of a LaTeX command which accepts two inputs. We have the following example: ``` \binom{n+1}{2k} ``` What is an example of a LaTeX command with three or more parameters?
https://tex.stackexchange.com/users/178952
What are some examples of LaTeX commands which accept three or more arguments?
false
The question is rather under specified, but for example `\newenvironment` has 0 parameters considered as a tex macro (the same is true of `\binom`) `\show\newenvironment` shows ``` > \newenvironment=macro: ->\@star@or@long \new@environment . l.4 \show\newenvironment ``` But considered as a latex command it has 3 or 5 depending if you count optional parameters, or 4 or 6 if you count `*` ``` \newenvironment{foo1}{start}{end} \newenvironment{foo2}[2][default]{start}{end} \newenvironment*{foo3}[2][default]{start}{end} ```
9
https://tex.stackexchange.com/users/1090
686590
318,516
https://tex.stackexchange.com/questions/686501
0
I have this table, that I need to color it's first row similar to the second example, however, it is not working because of the `\multirow` command, cannot be done despite the row command. If I used the `\cellcolor` the mission word will be clipped. ``` \begin{table}[b!] \begin{center} \renewcommand{\arraystretch}{1.4} \scriptsize \begin{tabular}{|m{0.17\textwidth}| % <-- use 'm', not 'p', col. type m{0.1\textwidth}| m{0.11\textwidth}| m{0.12\textwidth}| m{0.12\textwidth}| } \hline \hline \multirow{ 2}{*}{A} & \multicolumn{2}{c|}{X} & \multicolumn{2}{c|}{Y} \\ \cline{2-5} & Z & L &M & N \end{tabular} \end{center} \end{table} \begin{table}[t!] \begin{center} \renewcommand{\arraystretch}{1.4} \scriptsize \begin{tabular}{|m{0.17\textwidth}| % <-- use 'm', not 'p', col. type m{0.06\textwidth}| m{0.11\textwidth}| m{0.12\textwidth}| m{0.12\textwidth}| m{0.18\textwidth}| } \hline \hline \rowcolor{myblue!30} A & B & C & D & E & F\\ \hline \hline \end{tabular} \end{center} \label{Table01} \end{table} ```
https://tex.stackexchange.com/users/98778
\rowcolor is not working with \multirow
false
The trick is to merge cells from the bottom to top and apply `\multirow` in the last of the merging cells with a negative argument ``` \documentclass{article} \usepackage{array} \usepackage{multirow} \usepackage[svgnames]{xcolor} \usepackage{colortbl} \colorlet{myblue}{Blue!30} \begin{document} \begin{table} \centering \renewcommand{\arraystretch}{1.4} \scriptsize \begin{tabular}{| m{0.17\textwidth}| m{0.1\textwidth}| m{0.11\textwidth}| m{0.12\textwidth}| m{0.12\textwidth}| } \hline\hline \cellcolor{myblue} & \multicolumn{2}{c|}{X} & \multicolumn{2}{c|}{Y} \\ \cline{2-5} \cellcolor{myblue}\multirow{-2}{*}{A} & Z & L & M & N \\ \hline\hline \end{tabular} \end{table} \end{document} ```
2
https://tex.stackexchange.com/users/31283
686592
318,517
https://tex.stackexchange.com/questions/686586
2
I am trying to replace the `\begin{markdown}...\end{markdown}` idiom with `\markdown{...}` to save some keystrokes, but I get a "runaway argument" error and No PDF. Here is a MWE: ``` \documentclass{article} \usepackage{markdown} \newcommand\md[1]{\begin{markdown}#1\end{markdown}} \title{markdown test} \author{Goo Bar} \date{May 2023} \begin{document} \maketitle \section{Introduction} \begin{markdown} Hello world \end{markdown} \md{Goodbye world} \end{document} ``` Replacing `markdown` with `abstract` works fine, so the idea should work in practice. What am I missing with the `markdown` package?
https://tex.stackexchange.com/users/145550
How to replace \begin{markdown}...\end{markdown} with \md{...}?
true
You can't: `\begin{markdown}` sets up things so that * some category code are changed; * lines are processed one by one; * processing is stopped when the ***string*** `\end{markdown}` is scanned. As you surely know, leading and trailing spaces are significant in Markdown, but they aren't for TeX: under the standard settings, leading spaces on a line of input are ignored and trailing spaces are discarded and replaced by the `\endlinechar`. Thus in the `markdown` environment the standard settings about spaces have to be changed. If you do ``` \newcommand{\md}[1]{\begin{markdown}#1\end{markdown}} ``` none of the three points above can be salvaged, because when TeX absorbs an argument it fixes the category codes and no longer has a notion of the endlines that could be present in the argument. Well, there are tricks that could help to get a somewhat functional command version of the environment, but now consider this: can you see a clear advantage of ``` \md{You can't: `\begin{markdown}` sets up things so that * some category code are changed; * lines are processed one by one; * processing is stopped when the ***string*** `\end{markdown}` is scanned. } ``` over ``` \begin{markdown} You can't: `\begin{markdown}` sets up things so that * some category code are changed; * lines are processed one by one; * processing is stopped when the ***string*** `\end{markdown}` is scanned. \end{markdown} ``` in case of longer input?
5
https://tex.stackexchange.com/users/4427
686594
318,519
https://tex.stackexchange.com/questions/625652
0
I wanted to add the citation (APA7) on the Springer template but I did not know how to do it on Latex (Overleaf). Do you have experience? Can you please explain?
https://tex.stackexchange.com/users/258418
APA (7th ed.) citation/bibliography style with Springer template
false
Though the official Springer-Nature template cannot directly provide APA 7 referencing style, it is quite easy to modify it to support APA 7 by using `biblatex`. The steps are as follows: 1. Choose any document class you like for reference style in the begining of the main tex file `sn-article.tex`. I prefer `\documentclass[sn-apa]{sn-jnl}` since it's a provided APA style. 2. Open the file `sn-jnl.cls` and comment all the lines after `\if@APA@refstyle%` (related to the document class you choose in the first step) like this: ``` \if@APA@refstyle% %\if@Numbered@refstyle% %% \usepackage[natbibapa]{apacite}% % \gdef\NumBib{YES}% %\else% %% \usepackage[natbibapa]{apacite}% % \gdef\NumBib{NO}% %\fi% % \bibliographystyle{apacite}% % \def\refdoi#1{\urlstyle{rm}\url{#1}}% % \renewcommand{\doiprefix}{}% % \AtBeginDocument{% % \renewcommand{\BPBI}{.}% Period between initials - command from apacite.sty % }% % \setlength{\bibsep}{1em}% % \def\bibfont{\reset@font\fontfamily{\rmdefault}\normalsize\selectfont}% %\fi% ``` 3. Add the following usepackages in the head of the main tex file `sn-article.tex`: ``` \usepackage[utf8]{inputenc} \usepackage[style=apa, backend=biber]{biblatex} \addbibresource{sn-bibliography.bib} ``` 4. Add `\printbibliography` at the end of the main body before `\end{document}` for printing bibliography and delete (or comment) `\bibliography{sn-bibliography}`. 5. Use `\parencite{label}` for `(name,year)` citation style and `\textcite{label}` for `name (year)` citationstyle. The above steps work well in **overleaf** with the latest Tex Live version. If you edit your manuscript offline on your own PC/Mac, make sure your own Tex Live is the latest version as well.
0
https://tex.stackexchange.com/users/297678
686595
318,520
https://tex.stackexchange.com/questions/686567
2
The `\binom` command is an example of a LaTeX command which accepts two inputs. We have the following example: ``` \binom{n+1}{2k} ``` What is an example of a LaTeX command with three or more parameters?
https://tex.stackexchange.com/users/178952
What are some examples of LaTeX commands which accept three or more arguments?
false
Think at the package `tcolorbox` that ha a lot ov parameter in his implementation. You ca specify in Your program a few of this in extenso like in this example: ``` \documentclass[a4paper]{article} \usepackage[skins,breakable]{tcolorbox} \usepackage{lipsum} \begin{document} %\flushbottom \lipsum[6] \begin{tcolorbox}[title={\huge Prova di titolo},% <-- commenta se npn vuoi il titolo colbacktitle=cyan, boxsep=5pt, left=35pt, right=35pt, top=15pt, bottom=15pt, before upper={\parindent 0pt}, breakable=true, colback=cyan!20, %empty % <-- decommenta se non vuoi fondo e cornice ] \lipsum[1][1-4] \end{tcolorbox} \par \begin{tcolorbox}[title={\huge Prova di titolo},% <-- commenta se npn vuoi il titolo colbacktitle=gray, boxsep=2pt, left=5pt, right=5pt, top=5pt, bottom=5pt, before upper={\parindent 0pt}, breakable=true, colback=gray!10, %empty % <-- decommenta se non vuoi fondo e cornice ] \lipsum[2][3-7] \end{tcolorbox} \par \begin{tcolorbox}[title={\huge Prova di titolo},% <-- commenta se npn vuoi il titolo colbacktitle=blue, left skip=30pt, right skip=30pt, coltitle=yellow, boxsep=2pt, left=0pt, right=0pt, top=5pt, bottom=5pt, before upper={\parindent 0pt}, breakable=true, colback=cyan!10, %empty % <-- decommenta se non vuoi fondo e cornice ] \lipsum[2][1-4] \end{tcolorbox} \par \begin{tcolorbox}[%title={\huge Prova di titolo},% <-- commenta se npn vuoi il titolo colbacktitle=blue, left skip=30pt, right skip=30pt, coltitle=yellow, boxsep=2pt, left=0pt, right=0pt, top=5pt, bottom=5pt, before upper={\parindent 0pt}, breakable=true, colback=cyan!10, %empty % <-- decommenta se non vuoi fondo e cornice ] \lipsum[2][1-4] \end{tcolorbox} \lipsum[9]\par %\pagebreak \lipsum[8] \end{document} ``` Output: or define in the preamble a new command with 5 or 6 paramenters and then You call in the body of the program the box You need with the appropriates parameters. The result is the same but I think the first method is better and more easy. Other thing if You want to draw a regular poligon with his circle around: three parameters, radius, n of vertex, starting angle. If You want add a forth parameter: edges color.
1
https://tex.stackexchange.com/users/24644
686596
318,521
https://tex.stackexchange.com/questions/686571
3
The MWE below shows the problem whether I uses the cases or array environment. ``` \documentclass{article} \usepackage{amsmath} \usepackage{amssymb} \begin{document} \[ \begin{cases} \Phi^0_x\leqq 0, &{\Phi^{0}_x}'x_0=0,\\ \Phi_{z^*}^{0}\geqq 0, &{\Phi^{0}_{z^*}}'z_{0}^{*}=0. \end{cases} \] \[ \left\{ \begin{array}{ll} \Phi^0_x\leqq 0, &{\Phi^{0}_x}'x_0=0,\\ \Phi_{z^*}^{0}\geqq 0, &{\Phi^{0}_{z^*}}'z_{0}^{*}=0. \end{array} \right. \] \end{document} ``` In either case, I would like the inequalities on the left, and equalities on the right to line up. In addition, I would like the prime on the second line to match the prime on the first.
https://tex.stackexchange.com/users/30985
Term alignment in cases or array
false
Like this? In the amsldoc section 3.7 Alignment building blocks p.9 ``` \documentclass{article} \usepackage{amsmath} \usepackage{amssymb} \begin{document} \begin{equation*} \left\{ \begin{aligned} \Phi^0_x&\leqq 0, &{\Phi^{0}_x}'x_0&=0,\\ \Phi_{z^*}^{0}&\geqq 0, &{\Phi^{0}_{z^*}}'z_{0}^{*}&=0. \end{aligned} \right. \end{equation*} \end{document} ```
3
https://tex.stackexchange.com/users/263375
686597
318,522
https://tex.stackexchange.com/questions/686571
3
The MWE below shows the problem whether I uses the cases or array environment. ``` \documentclass{article} \usepackage{amsmath} \usepackage{amssymb} \begin{document} \[ \begin{cases} \Phi^0_x\leqq 0, &{\Phi^{0}_x}'x_0=0,\\ \Phi_{z^*}^{0}\geqq 0, &{\Phi^{0}_{z^*}}'z_{0}^{*}=0. \end{cases} \] \[ \left\{ \begin{array}{ll} \Phi^0_x\leqq 0, &{\Phi^{0}_x}'x_0=0,\\ \Phi_{z^*}^{0}\geqq 0, &{\Phi^{0}_{z^*}}'z_{0}^{*}=0. \end{array} \right. \] \end{document} ``` In either case, I would like the inequalities on the left, and equalities on the right to line up. In addition, I would like the prime on the second line to match the prime on the first.
https://tex.stackexchange.com/users/30985
Term alignment in cases or array
false
You can get away with `alignedat`. ``` \documentclass{article} \usepackage{amsmath} \usepackage{amssymb} \begin{document} \[ \left\{ \begin{alignedat}{3} \Phi^0_x &\leqq 0, &\qquad {\Phi^{0}_x}' && x_0 &=0,\\ \Phi_{z^*}^{0} &\geqq 0, &\qquad {\Phi^{0}_{z^*}}'&& z_{0}^{*} &=0. \end{alignedat} \right. \] \[ \left\{ \begin{alignedat}{3} \Phi^0_x &\leqq 0, &\qquad (\Phi^{0}_x)' && x_0 &=0,\\ \Phi_{z^*}^{0} &\geqq 0, &\qquad (\Phi^{0}_{z^*})'&& z_{0}^{*} &=0. \end{alignedat} \right. \] \end{document} ``` I added a second version with parentheses around the primed expressions: in the top instance, the prime appears to be hanging from nowhere.
4
https://tex.stackexchange.com/users/4427
686598
318,523
https://tex.stackexchange.com/questions/686582
2
Good evening, I am relatively new to LaTeX and Tikz and need your help. I have created a graphic and have come relatively far, but there are still three open points that I cannot solve. These would be: 1. How do I get the headings to start at the same position as shown here (<https://ibb.co/8cqxWnr>), i.e. starting from the same x-coordinate? 2. I have added a legend at the top that contains 5 entries, with one of the entries representing the middle. However, I now want to add a 6th entry. How could I make this happen? The new entry should have the following pattern: \fill[pattern=grid,pattern color=black] 3. I would like to add a box like the one shown here (<https://ibb.co/sKbKTL7>) to the right of my graph. What code do I need to add for this? This is my code: Thank you! ``` \documentclass{standalone} \usepackage{tikz} \usetikzlibrary{patterns} \begin{document} \newcommand{\myScheduleStuff}{ \fill[pattern=north east lines,pattern color=teal, draw=black] (.3,0) rectangle (1.3,1); \fill[pattern=vertical lines,pattern color=orange, draw=black] (1.4,0) rectangle (2.4,1); \fill[pattern=north west lines,pattern color=violet, draw=black] (2.5,0) rectangle (3.5,1); \draw (.2,-.5)--(.2,.5); \draw (3.6,-.5)--(3.6,.5); \node at (1.9,-.3) () {\bfseries Day 1}; \fill[pattern=north east lines,pattern color=teal, draw=black] (3.7,0) rectangle (4.7,1); \fill[pattern=vertical lines,pattern color=orange, draw=black] (4.8,0) rectangle (5.8,1); \fill[pattern=north west lines,pattern color=violet, draw=black] (5.9,0) rectangle (6.9,1); \draw (.2,-.5)--(.2,.5); \draw (3.6,-.5)--(3.6,.5); \node at (5.3,-.3) () {\bfseries Day 2}; \fill[pattern=north east lines,pattern color=teal, draw=black] (7.1,0) rectangle (8.1,1); \fill[pattern=vertical lines,pattern color=orange, draw=black] (9.3,0) rectangle (10.3,1); \fill[pattern=north west lines,pattern color=violet, draw=black] (9.3,1) rectangle (10.3,2); \draw (10.4,-.5)--(10.4,.5); \draw (7,-.5)--(7,.5); \node at (8.7,-.3) () {\bfseries Day 3}; \fill[pattern=north east lines,pattern color=teal, draw=black] (10.5,0) rectangle (11.5,1); \fill[pattern=vertical lines,pattern color=orange, draw=black] (12.7,0) rectangle (13.7,1); \fill[pattern=north west lines,pattern color=violet, draw=black] (12.7,1) rectangle (13.7,2); \draw (10.4,-.5)--(10.4,.5); \draw (13.8,-.5)--(13.8,.5); \node at (12.1,-.3) () {\bfseries Day 4}; \fill[pattern=north east lines,pattern color=teal, draw=black] (15,0) rectangle (16,1); \fill[pattern=vertical lines,pattern color=orange, draw=black] (13.9,0) rectangle (14.9,1); \fill[pattern=north west lines,pattern color=violet, draw=black] (13.9,1) rectangle (14.9,2); \draw (17.2,-.5)--(17.2,.5); \draw (13.8,-.5)--(13.8,.5); \node at (15.5,-.3) () {\bfseries Day 5}; \fill[pattern=north east lines,pattern color=teal, draw=black] (17.3,0) rectangle (18.3,1); \fill[pattern=vertical lines,pattern color=orange, draw=black] (18.4,0) rectangle (19.4,1); \fill[pattern=north west lines,pattern color=violet, draw=black] (19.5,0) rectangle (20.5,1); \draw (17.2,-.5)--(17.2,.5); \draw (20.6,-.5)--(20.6,.5); \node at (18.9,-.3) () {\bfseries Day 6}; \fill[pattern=north east lines,pattern color=teal, draw=black] (20.7,0) rectangle (21.7,1); \fill[pattern=vertical lines,pattern color=orange, draw=black] (20.7,1) rectangle (21.7,2); \fill[pattern=north west lines,pattern color=violet, draw=black] (22.9,0) rectangle (23.9,1); \draw (24,-.5)--(24,.5); \draw (20.6,-.5)--(20.6,.5); \node at (22.3,-.3) () {\bfseries Day 7}; % Achse \draw[-latex,line width=2pt] (0,0)--(25,0); } \begin{tikzpicture} \myScheduleStuff % Legende \node (leg) at (12,4) {\textbf{Legend}}; % Random position of the center of the legend \node[anchor=north] (w2leg) at (leg.south) {\tikz{\fill[pattern=north west lines,pattern color=violet] (0,0) rectangle (0.4,0.4);} Worker 3}; \node[anchor=east,left of= w2leg,node distance=2.5cm] (w1leg) {\tikz{\fill[pattern=vertical lines,pattern color=orange] (0,0) rectangle (0.4,0.4);} Worker 2}; \node[anchor=west,right of= w2leg,node distance=2.5cm] (w3leg) {\tikz{\fill[pattern=crosshatch dots,pattern color=grey] (0,0) rectangle (0.4,0.4);} Overstaffing}; \node[anchor=west,left of= w1leg,node distance=2.5cm] (w4leg) {\tikz{\fill[pattern=north east lines,pattern color=teal] (0,0) rectangle (0.4,0.4);} Worker 1}; \node[anchor=west,right of= w3leg,node distance=2.5cm] (w5leg) {\tikz{\fill[pattern=crosshatch dots,pattern color=red] (0,0) rectangle (0.4,0.4);} Understaffing}; \node[anchor=west,right of= w3leg,node distance=2.5cm] (w5leg) {\tikz{\fill[pattern=grid,pattern color=black] (0,0) rectangle (0.4,0.4);} Performance decrease}; \draw (w4leg.south west) rectangle (leg.north -| w5leg.east); % Using corners here \draw (0,-1) -- ++(25,0); % Separation line \begin{scope}[yshift=-4cm] \myScheduleStuff \end{scope} \draw (0,-5) -- ++(25,0); % Separation line \node at (1.5,3.8) () {\bfseries Demand pattern}; \node at (1.5,-1.5) () {\bfseries Classic approach}; \node at (1.5,-5.5) () {\bfseries Behaviour-aware approach}; \begin{scope}[yshift=-8cm] \end{scope} \end{tikzpicture} \end{document} ```
https://tex.stackexchange.com/users/270806
Several problems with tikz
false
Here you have a possible solution. 1.- define `tikzstyles` to save typping 2.- use `positioning` library to easily placing elements 3.- avoid nesting `tikzpictures` (in legend) 4.- added arrow and box to the right of diagram ``` \documentclass{standalone} \usepackage{tikz} \usetikzlibrary{patterns, positioning, fit, shapes.arrows} \tikzset{ pteal/.style={pattern=north east lines, pattern color=teal}, porange/.style={pattern=vertical lines, pattern color=orange}, pviolet/.style={pattern=north west lines, pattern color=violet}, pred/.style={pattern=crosshatch dots, pattern color=red}, pgray/.style={pattern=crosshatch dots, pattern color=gray}, pblack/.style={pattern=grid, pattern color=black} } \begin{document} \newcommand{\myScheduleStuff}{ \fill[draw,pteal] (.3,0) rectangle (1.3,1); \fill[draw,porange] (1.4,0) rectangle (2.4,1); \fill[draw,pviolet] (2.5,0) rectangle (3.5,1); \draw (.2,-.5)--(.2,.5); \draw (3.6,-.5)--(3.6,.5); \node at (1.9,-.3) () {\bfseries Day 1}; \fill[draw,pteal] (3.7,0) rectangle (4.7,1); \fill[draw,porange] (4.8,0) rectangle (5.8,1); \fill[draw,pviolet] (5.9,0) rectangle (6.9,1); \draw (.2,-.5)--(.2,.5); \draw (3.6,-.5)--(3.6,.5); \node at (5.3,-.3) () {\bfseries Day 2}; \fill[draw,pteal] (7.1,0) rectangle (8.1,1); \fill[draw,porange] (9.3,0) rectangle (10.3,1); \fill[draw,pviolet] (9.3,1) rectangle (10.3,2); \draw (10.4,-.5)--(10.4,.5); \draw (7,-.5)--(7,.5); \node at (8.7,-.3) () {\bfseries Day 3}; \fill[draw,pteal] (10.5,0) rectangle (11.5,1); \fill[draw,porange] (12.7,0) rectangle (13.7,1); \fill[draw,pviolet] (12.7,1) rectangle (13.7,2); \draw (10.4,-.5)--(10.4,.5); \draw (13.8,-.5)--(13.8,.5); \node at (12.1,-.3) () {\bfseries Day 4}; \fill[draw,pteal] (15,0) rectangle (16,1); \fill[draw,porange] (13.9,0) rectangle (14.9,1); \fill[draw,pviolet] (13.9,1) rectangle (14.9,2); \draw (17.2,-.5)--(17.2,.5); \draw (13.8,-.5)--(13.8,.5); \node at (15.5,-.3) () {\bfseries Day 5}; \fill[draw,pteal] (17.3,0) rectangle (18.3,1); \fill[draw,porange] (18.4,0) rectangle (19.4,1); \fill[draw,pviolet] (19.5,0) rectangle (20.5,1); \draw (17.2,-.5)--(17.2,.5); \draw (20.6,-.5)--(20.6,.5); \node at (18.9,-.3) () {\bfseries Day 6}; \fill[draw,pteal] (20.7,0) rectangle (21.7,1); \fill[draw,porange] (20.7,1) rectangle (21.7,2); \fill[draw,pviolet] (22.9,0) rectangle (23.9,1); \draw (24,-.5)--(24,.5); \draw (20.6,-.5)--(20.6,.5); \node at (22.3,-.3) () {\bfseries Day 7}; % Achse \draw[-latex,line width=2pt] (0,0)--(25,0) coordinate (EndofAxis); \node[single arrow,draw, right=2mm of EndofAxis] (arrow) {}; \matrix[right=5mm of arrow, draw, dashed, ampersand replacement=\&,column sep=1mm, label={Shift changes}]{% \node[fill=red!30,text=red,]{3};\&\node[fill=blue!30]{2};\&\node[fill=green!30]{2};\\}; } \begin{tikzpicture} \myScheduleStuff % Legende \node (leg) at (12,4) {\textbf{Legend}}; % Random position of the center of the legend \node[minimum size=4mm, pviolet, label=right:Worker 3, below left=3mm and 10mm of leg] (w3leg) {}; \node[minimum size=4mm, porange, label=right:Worker 2, left=2cm of w3leg] (w2leg) {}; \node[minimum size=4mm, pteal, label=right:Worker 1, left=2cm of w2leg] (w1leg) {}; \node[minimum size=4mm, pgray, label=right:Overstaffing, right=2cm of w3leg] (w4leg) {}; \node[minimum size=4mm, pred, label=right:Understaffing, right=2.5cm of w4leg] (w5leg) {}; \node[minimum size=4mm, pblack, label={[name=pd]right:Performance decrease}, right=2.5cm of w5leg] (w6leg) {}; \node[draw, fit= (pd) (leg) (w1leg)]{}; % Using corners here \draw (0,-1) -- ++(25,0); % Separation line \begin{scope}[yshift=-4cm] \myScheduleStuff \end{scope} \draw (0,-5) -- ++(25,0); % Separation line \node[right, font=\bfseries] at (0,3.8) () {Demand pattern}; \node[right, font=\bfseries] at (0,-1.5) () {Classic approach}; \node[right, font=\bfseries] at (0,-5.5) () {Behaviour-aware approach}; \begin{scope}[yshift=-8cm] \end{scope} \end{tikzpicture} \end{document} ```
3
https://tex.stackexchange.com/users/1952
686606
318,525
https://tex.stackexchange.com/questions/686582
2
Good evening, I am relatively new to LaTeX and Tikz and need your help. I have created a graphic and have come relatively far, but there are still three open points that I cannot solve. These would be: 1. How do I get the headings to start at the same position as shown here (<https://ibb.co/8cqxWnr>), i.e. starting from the same x-coordinate? 2. I have added a legend at the top that contains 5 entries, with one of the entries representing the middle. However, I now want to add a 6th entry. How could I make this happen? The new entry should have the following pattern: \fill[pattern=grid,pattern color=black] 3. I would like to add a box like the one shown here (<https://ibb.co/sKbKTL7>) to the right of my graph. What code do I need to add for this? This is my code: Thank you! ``` \documentclass{standalone} \usepackage{tikz} \usetikzlibrary{patterns} \begin{document} \newcommand{\myScheduleStuff}{ \fill[pattern=north east lines,pattern color=teal, draw=black] (.3,0) rectangle (1.3,1); \fill[pattern=vertical lines,pattern color=orange, draw=black] (1.4,0) rectangle (2.4,1); \fill[pattern=north west lines,pattern color=violet, draw=black] (2.5,0) rectangle (3.5,1); \draw (.2,-.5)--(.2,.5); \draw (3.6,-.5)--(3.6,.5); \node at (1.9,-.3) () {\bfseries Day 1}; \fill[pattern=north east lines,pattern color=teal, draw=black] (3.7,0) rectangle (4.7,1); \fill[pattern=vertical lines,pattern color=orange, draw=black] (4.8,0) rectangle (5.8,1); \fill[pattern=north west lines,pattern color=violet, draw=black] (5.9,0) rectangle (6.9,1); \draw (.2,-.5)--(.2,.5); \draw (3.6,-.5)--(3.6,.5); \node at (5.3,-.3) () {\bfseries Day 2}; \fill[pattern=north east lines,pattern color=teal, draw=black] (7.1,0) rectangle (8.1,1); \fill[pattern=vertical lines,pattern color=orange, draw=black] (9.3,0) rectangle (10.3,1); \fill[pattern=north west lines,pattern color=violet, draw=black] (9.3,1) rectangle (10.3,2); \draw (10.4,-.5)--(10.4,.5); \draw (7,-.5)--(7,.5); \node at (8.7,-.3) () {\bfseries Day 3}; \fill[pattern=north east lines,pattern color=teal, draw=black] (10.5,0) rectangle (11.5,1); \fill[pattern=vertical lines,pattern color=orange, draw=black] (12.7,0) rectangle (13.7,1); \fill[pattern=north west lines,pattern color=violet, draw=black] (12.7,1) rectangle (13.7,2); \draw (10.4,-.5)--(10.4,.5); \draw (13.8,-.5)--(13.8,.5); \node at (12.1,-.3) () {\bfseries Day 4}; \fill[pattern=north east lines,pattern color=teal, draw=black] (15,0) rectangle (16,1); \fill[pattern=vertical lines,pattern color=orange, draw=black] (13.9,0) rectangle (14.9,1); \fill[pattern=north west lines,pattern color=violet, draw=black] (13.9,1) rectangle (14.9,2); \draw (17.2,-.5)--(17.2,.5); \draw (13.8,-.5)--(13.8,.5); \node at (15.5,-.3) () {\bfseries Day 5}; \fill[pattern=north east lines,pattern color=teal, draw=black] (17.3,0) rectangle (18.3,1); \fill[pattern=vertical lines,pattern color=orange, draw=black] (18.4,0) rectangle (19.4,1); \fill[pattern=north west lines,pattern color=violet, draw=black] (19.5,0) rectangle (20.5,1); \draw (17.2,-.5)--(17.2,.5); \draw (20.6,-.5)--(20.6,.5); \node at (18.9,-.3) () {\bfseries Day 6}; \fill[pattern=north east lines,pattern color=teal, draw=black] (20.7,0) rectangle (21.7,1); \fill[pattern=vertical lines,pattern color=orange, draw=black] (20.7,1) rectangle (21.7,2); \fill[pattern=north west lines,pattern color=violet, draw=black] (22.9,0) rectangle (23.9,1); \draw (24,-.5)--(24,.5); \draw (20.6,-.5)--(20.6,.5); \node at (22.3,-.3) () {\bfseries Day 7}; % Achse \draw[-latex,line width=2pt] (0,0)--(25,0); } \begin{tikzpicture} \myScheduleStuff % Legende \node (leg) at (12,4) {\textbf{Legend}}; % Random position of the center of the legend \node[anchor=north] (w2leg) at (leg.south) {\tikz{\fill[pattern=north west lines,pattern color=violet] (0,0) rectangle (0.4,0.4);} Worker 3}; \node[anchor=east,left of= w2leg,node distance=2.5cm] (w1leg) {\tikz{\fill[pattern=vertical lines,pattern color=orange] (0,0) rectangle (0.4,0.4);} Worker 2}; \node[anchor=west,right of= w2leg,node distance=2.5cm] (w3leg) {\tikz{\fill[pattern=crosshatch dots,pattern color=grey] (0,0) rectangle (0.4,0.4);} Overstaffing}; \node[anchor=west,left of= w1leg,node distance=2.5cm] (w4leg) {\tikz{\fill[pattern=north east lines,pattern color=teal] (0,0) rectangle (0.4,0.4);} Worker 1}; \node[anchor=west,right of= w3leg,node distance=2.5cm] (w5leg) {\tikz{\fill[pattern=crosshatch dots,pattern color=red] (0,0) rectangle (0.4,0.4);} Understaffing}; \node[anchor=west,right of= w3leg,node distance=2.5cm] (w5leg) {\tikz{\fill[pattern=grid,pattern color=black] (0,0) rectangle (0.4,0.4);} Performance decrease}; \draw (w4leg.south west) rectangle (leg.north -| w5leg.east); % Using corners here \draw (0,-1) -- ++(25,0); % Separation line \begin{scope}[yshift=-4cm] \myScheduleStuff \end{scope} \draw (0,-5) -- ++(25,0); % Separation line \node at (1.5,3.8) () {\bfseries Demand pattern}; \node at (1.5,-1.5) () {\bfseries Classic approach}; \node at (1.5,-5.5) () {\bfseries Behaviour-aware approach}; \begin{scope}[yshift=-8cm] \end{scope} \end{tikzpicture} \end{document} ```
https://tex.stackexchange.com/users/270806
Several problems with tikz
false
Some suggestions: * allow some `border` in standalone * use `gray` * phiolosphy in this place: 1 question <=> 1 problem (not many; that's why you see demand for closing this question `needs more focus`) ``` \documentclass[10pt,border=3mm]{standalone}% <<<<< ... \node[anchor=west,right of= w2leg,node distance=2.5cm] (w3leg) {\tikz{\fill[pattern=crosshatch dots,pattern color=gray] (0,0) rectangle (0.4,0.4);} Overstaffing};% <<< not grey ``` Some solution: * use the anchor for aligning text-nodes, as you did before (or at least was present in code) * see ch. 17.5.1 in the pgfmanual (Version 3.1.9a) ``` %\node at (1.5,3.8) () {\bfseries Demand pattern}; %\node at (1.5,-1.5) () {\bfseries Classic approach}; %\node at (0,-5.5) () {\bfseries Behaviour-aware approach}; \draw (0,3.8) node [anchor=west] {\bfseries Demand pattern}; \draw (0,-1.5) node [anchor=west] {\bfseries Classic approach}; \draw (0,-5.5) node [anchor=west] {\bfseries Behaviour-aware approach}; ```
2
https://tex.stackexchange.com/users/245790
686608
318,526
https://tex.stackexchange.com/questions/106093
19
I would like to know how to include table of contents into a table of contents.... I have an example of how to spoof it into the toc - using \phantomsection - but it seems like when i have a long document the link goes a bit wrong - ie. it links to a couple of pages before..... ``` \phantomsection \addcontentsline{toc}{chapter}{Contents} \tableofcontents ``` --- **Example:** ``` \documentclass[12pt, a4paper, twoside]{book} \usepackage[english]{babel} \usepackage{amsfonts,dsfont} \usepackage[final]{pdfpages} \usepackage{hyperref} %---------------------------------------------------------------------------------- \begin{document} \pagenumbering{roman} %---------------------------------------------------------------------------------- %---------------------------------------------------------------------------------- \thispagestyle{empty} \begin{titlepage} {\Large \begin{center} {\bf XXXXXXXXXXXXXXX} \end{center} } \end{titlepage} %---------------------------------------------------------------------------------- \phantomsection \addcontentsline{toc}{chapter}{Contents} \tableofcontents \phantomsection \addcontentsline{toc}{chapter}{List of Figures} \listoffigures \phantomsection \addcontentsline{toc}{chapter}{List of Tables} \listoftables %---------------------------------------------------------------------------------- \newpage \setcounter{page}{1} \pagenumbering{arabic} \chapter{XXXXX} \label{chXXXXX} \section{Introduction}\label{chXXXXX_Intro} BLAH BLAH BLAH. %---------------------------------------------------------------------------------- %-------------------- \setboolean{@twoside}{false} \end{document} ```
https://tex.stackexchange.com/users/27334
How to include table of contents into a table of contents
false
If you are using the KOMA-script class, then the following is recommended over the `tocbibind` package: ``` \setuptoc{toc}{totoc} ```
0
https://tex.stackexchange.com/users/180688
686613
318,528
https://tex.stackexchange.com/questions/686541
2
I want to write the i and j as one "ij", as can be seen in the Dutch language, in my LaTeX document, but can't figure out how to do it, even with ChatGPT! If someone knows more, please hit me up! It could be the case that this is just not possible as it is not that frequently used, especially not when actually typing it. If so, please let me know too. Thank you.
https://tex.stackexchange.com/users/297639
LaTeX - Is it possible to write i and j as 'ij', where the letters are concatenated?
false
You should always type the `ij` and `IJ` as two characters, just as you would write `fi` and not `fi`. The ligatures for these characters in the unicode standard are deprecated and should not be used. If a certain font contains an ij ligature, it will replace the two characters with a ligature according to its own logic. Most fonts will do this when you activate the `lang=NLD` font feature, though this depends on the font (you might have to use a stylistic variant instead). When a reader selects or copies the resulting text, however, the ligature will be translated back into two characters.
2
https://tex.stackexchange.com/users/258593
686623
318,531
https://tex.stackexchange.com/questions/686556
2
Extending the question [here](https://tex.stackexchange.com/questions/686353/tex4ebook-how-to-get-colored-text-in-enumerations), is there also a way to get a colored text in a `tabularx` environment? Here is an MWE: ``` \documentclass[12pt]{book} \usepackage{tabularx} \usepackage{xcolor} \newenvironment{colorenv}[1]{\color{#1}}{} \begin{document} \begin{colorenv}{blue} This text is blue. \begin{tabularx}{\linewidth}{| X | X |} \hline This text is black & although I would like to have it blue.\\ \hline \end{tabularx} \end{colorenv} \end{document} ``` And here the config-file: ``` \Preamble{xhtml} \ExplSyntaxOn \renewenvironment{colorenv}[1]{ \get:xcolorcss{#1}\:colorenv \ifvmode\IgnorePar\fi\EndP\HCode{<div~style="color:\:colorenv">}\par\ShowPar }{\ifvmode\IgnorePar\fi\EndP\HCode{</div>}} \ExplSyntaxOff \begin{document} \EndPreamble ```
https://tex.stackexchange.com/users/179378
tex4ebook: How to get colored text in tables
false
There are two issues. One is that Calibre doesn't show text in the right color, the other is related to table rules colors, which is set to black by TeX4ht. The first issue can be fixed with this CSS declaration: ``` \Css{table{color: inherit;}} ``` It just tells Calibre to use the parent element's color for table. It seems that it sets it to black by default. The fix for rules is more complicated. I had to copy some configurations that sets rule colors and change the explicit color to use the `\:colorenv` color. This is the full config file: ``` \Preamble{xhtml} \catcode`\:=11 \def\:colorenv{black} \renewenvironment{colorenv}[1]{ \get:xcolorcss{#1}\:colorenv \ifvmode\IgnorePar\fi\EndP\HCode{<div style="color:\:colorenv" class="colorenv">}\par\ShowPar }{\ifvmode\IgnorePar\fi\EndP\HCode{</div>}} \Configure{VBorder} {\let\VBorder\empty \let\AllColMargins\empty \global\let\GROUPS\empty \HAssign\NewGroup = 0 \gHAdvance\Next:TableNo by 1 \global\let\TableNo=\Next:TableNo } {\xdef\VBorder{\VBorder\ifnum \NewGroup> 0 </colgroup>\fi} \HAssign\NewGroup = 0 % \gdef\GROUPS{rules="groups"}} % put vertical border for a column \ifnum\ar:cnt > 0% % in all other cases, we should put right border \Css{\#TBL-\TableNo-\ar:cnt {border-right:1px solid \:colorenv;}}% \else% % columns are numbered from 1. if \ar:cnt == 0 then it is the left border \Css{\#TBL-\TableNo-1{border-left: 1px solid \:colorenv;}}% \fi% } {\Advance:\NewGroup by 1 \ifnum \NewGroup=1 \xdef\VBorder{\VBorder<colgroup id="TBL-\TableNo-\ar:cnt g">}\fi \xdef\VBorder{\VBorder<col\Hnewline id="TBL-\TableNo -\ar:cnt"\xml:empty>}\xdef\AllColMargins{\AllColMargins1}} {\xdef\AllColMargins{\AllColMargins 0}} \AddToHook{env/tabularx/after}{ \Css{.colorenv \#TBL-\TableNo\space .hline{border-top: 1px solid \:colorenv;}} } \catcode`\:=12 \Css{table{color: inherit;}} \begin{document} \EndPreamble ``` And this is the result:
1
https://tex.stackexchange.com/users/2891
686635
318,537
https://tex.stackexchange.com/questions/686633
1
The code ``` picture tex_pct; tex_pct:=btex Too baffled etex scaled 3; for tkn within tex_pct: if textual tkn: show "textual"; fi endfor end. ``` compiled with `mptopdf` shows 4 "textual"s but the following `lualatex` example ``` \documentclass{article} \usepackage{luamplib} \begin{document} \begin{mplibcode} % text material and glyphs contours picture tex_pct; tex_pct:=btex Too baffled etex scaled 3; for tkn within tex_pct: if textual tkn: show "textual"; fi endfor \end{mplibcode} \end{document} ``` does not. Is there a reason or is this a bug?
https://tex.stackexchange.com/users/217400
MetaPost textual does not operate with luamplib
true
This is not really a bug, but a difference in implementation. Luamplib implements `btex ... etex;` by keeping the typeset contents at the TeX side and returning only the dimensions to MetaPost. This has great advantages: done this way, the contents of `btex ... etex;` can interact with the rest of your TeX document. If you need access to glyph positions or glyph contours, have a look at the [minim-mp](https://ctan.org/pkg/minim-mp) metapost processor, which gives you access to those data through the `infont` and `glyph of` operators. Only the next version of minim-mp will have full LaTeX support, however (it was written for plain TeX), so you will probably have to get the current development version off gitlab to try it.
1
https://tex.stackexchange.com/users/258593
686641
318,540
https://tex.stackexchange.com/questions/686625
0
I want to make a schematic of two masses connected by a string. One is positioned on a solid body, the other is hanging down the body's edge. Typically, a solid body is shown by putting diagonal lines within it. I could obviously just draw a couple ones with `\draw`, but maybe there is a faster way to do this. If some of you know how this could be achieved, I'd be glad to learn how it's done.
https://tex.stackexchange.com/users/296358
How do draw diagonal lines indicating a solid body
false
I am unsure what you want to achieve exactly, but you could maybe make use of `patterns`: ``` \documentclass[border=10pt]{standalone} \usepackage{tikz} \usetikzlibrary{patterns} \begin{document} \begin{tikzpicture} \begin{scope}[shift={(-1.5,0)}] \fill[pattern=north east lines] (-1,0) rectangle (1,-0.25); \draw[thick] (-1,0) -- (1,0); \fill (0,0.35) circle[radius=0.35]; \end{scope} \begin{scope}[shift={(1.5,0)}] \fill[pattern=north east lines] (-1,0) rectangle (1,0.25); \draw[thick] (-1,0) -- (1,0); \draw (0,0) -- (0,-1); \fill (0,-1) circle[radius=0.35]; \end{scope} \end{tikzpicture} \end{document} ```
1
https://tex.stackexchange.com/users/47927
686652
318,544
https://tex.stackexchange.com/questions/686645
2
I am wanting to produce a simple package called `aminosymb` for CTAN as I have macros for typesetting amino acids and residue numbers (with optional symbols above the residue name like `*`, improved from an old question: [Custom asterisk for amino acid names](https://tex.stackexchange.com/q/675299)). I want to write the package in `expl3` but my efforts are inadequate so far. I have the following non-working MWE: ``` \documentclass{article} \ExplSyntaxOn \NewDocumentCommand{\AminoAcidPrinter}{mm} { \aminoacid_printer:n { #1 #2 } } \str_new:N \s__aminoacid_printer_str \cs_new_protected:Nn \aminoacid_printer:n { \str_clear:N \s__aminoacid_printer_str \tl_map_function:nN { #1 } \__aminoacid_printer_str_add:n \str_use:Nn \s__aminoacid_printer_str } \cs_new_protected:Nn \__aminoacid_printer_str_add:n { \str_put_right:Nx \s__aminoacid_printer_str { \str_case:nn { #1 } { {HIS}{His} {His}{His} {H}{His} {h}{His} } } } \ExplSyntaxOff \begin{document} \noindent\AminoAcidPrinter{h}{442}\newline \AminoAcidPrinter{HIS}{442}\newline \AminoAcidPrinter{His}{442}\newline \AminoAcidPrinter{H}{442}\newline \end{document} ``` All four options should print out the same output i.e. `His 442`. The code itself doesn't work with the first error being ``` Undefined control sequence. \aminoacid_printer:n ...ter_str_add:n \str_use:Nn \s__aminoacid_printer_str ``` which whilst being informative, I am not sure how to proceed nor how to manage a second argument within the `\NewDocumentCommand`. I am not even sure if I should be using `\s__` for string or if this is a token/other datatype. How can I make this document compile and print out `His 442` for all four varying inputs please? I am new to `expl3` and have been reading through the [LaTeX3 Interfaces](https://mirror.apps.cam.ac.uk/pub/tex-archive/macros/latex/contrib/l3kernel/interface3.pdf) but it is a steep learning curve and I wouldn't mind a working basic document I can build on to adapt my macros for `expl3` plus helpful hints with respect to this MWE please.
https://tex.stackexchange.com/users/273733
LaTeX3 - Use of \__seq_use_setup:w doesn't match its definition
true
It is not at all clear what you want this code to do, but this runs without error ``` \documentclass{article} \ExplSyntaxOn \NewDocumentCommand{\AminoAcidPrinter}{mm} { \aminoacid_printer:nn { #1 }{ #2 } } \str_new:N \l__aminoacid_printer_str \cs_new_protected:Nn \aminoacid_printer:nn { \str_clear:N \l__aminoacid_printer_str \tl_map_function:nN { #1 } \__aminoacid_printer_str_add:n \str_use:N \l__aminoacid_printer_str ??? \str_clear:N \l__aminoacid_printer_str \tl_map_function:nN { #2 } \__aminoacid_printer_str_add:n \str_use:N \l__aminoacid_printer_str } \cs_new_protected:Nn \__aminoacid_printer_str_add:n { \str_put_right:Nx \l__aminoacid_printer_str { \str_case:nn { #1 } { {HIS}{His} {His}{His} {H}{His} {h}{His} } } } \ExplSyntaxOff \begin{document} \noindent\AminoAcidPrinter{h}{442}\newline \AminoAcidPrinter{HIS}{442}\newline \AminoAcidPrinter{His}{442}\newline \AminoAcidPrinter{H}{442} \end{document} ```
2
https://tex.stackexchange.com/users/1090
686653
318,545
https://tex.stackexchange.com/questions/686658
0
I understand how to clip with a rectangle, for instance. But how to do it with a different path. I wrote many lines with Bezier curves ( .. controls (,) and (,) ..). So now I have a path with all these Bezier curves. So, how do I clip inside this path? Here is a MWE: ``` \begin{tikzpicture}[line width=0.8pt] \draw (0.1,4.95) .. controls (0.6,4.5) and (1.8,4.15) .. (1.8,3.65); \draw (1.8,3.65) .. controls (1.8,2.75) and (1.9,3.15) .. (1.9,2.55); \draw (1.9,2.55) .. controls (1.9,2.35) and (2.25,2.15) .. (2.25,1.65); \draw (2.25,1.65) .. controls (2.25,1.4) and (1.65,0.8) .. (1.65,0.75); \draw (1.65,0.75) .. controls (1.65,0.6) and (1.8,0.54) .. (1.9,0.5); \draw (1.9,0.5) .. controls (2,0.44) and (2.5,0.6) .. (2.7,1.05); \draw (2.7,1.05) .. controls (3,1.45) and (3,1.5) .. (3,1.8); \draw (3,1.8) .. controls (3.05,2.1) and (3.1,2.1) .. (3.4,2); \draw (3.4,2) .. controls (3.6,2) and (3.6,1.95) .. (3.8,1.95); \draw (3.8,1.95) .. controls (3.85,1.95) and (4.1,1.85) .. (4.2,1.85); \draw (4.2,1.85) .. controls (4.4,1.85) and (4.5,1.95) .. (5,2); \draw (5,2) .. controls (5.4,1.95) and (5.5,1.95) .. (5.8,1.96); \draw (5.8,1.96) .. controls (6.55,1.92) and (6.7,1.94) .. (6.7,2.2); \draw (6.7,2.2) .. controls (6.7,2.45) and (6.1,2.5) .. (5.9,2.43); \draw (5.9,2.43) .. controls (5.8,2.47) and (5.2,2.55) .. (5.1,2.5); \draw (5.1,2.5) .. controls (5.0,2.55) and (5,2.57) .. (4.9,2.6); \draw (4.9,2.6) .. controls (4.95,3.0) and (4.95,3.0) .. (4.9,3.6); \draw (4.9,3.6) .. controls (4.93,4.0) and (4.9,4.0) .. (4.85,4.5); \draw (4.85,4.5) .. controls (4.83,4.8) and (4.8,4.6) .. (4.78,5); \draw (4.78,5) .. controls (4.76,5.2) and (4.8,5.0) .. (4.75,5.35); \draw (4.75,5.35) .. controls (4.35,5.57) and (4.23,5.0) .. (4.33,4.5); \draw (4.33,4.5) .. controls (4.3,4.38) and (4.31,4.4) .. (4.3,4.18); \draw (4.3,4.18) -- (4.25,4.16); \draw (4.25,4.16) .. controls (4,4.5) and (3.4,4.7) .. (3,4.75); \draw (3,4.75) .. controls (2.8,4.8) and (2.65,5.03) .. (2.6,5.05); \draw (2.6,5.05) .. controls (2.4,5.15) and (1.75,5.8) .. (1.3,6.25); \end{tikzpicture} ``` I can't close the path because I don't want a line between the first and the last point (or an invisible line)
https://tex.stackexchange.com/users/249670
Clipping a path with TikZ
false
I think you need to close the path: ``` \documentclass[tikz, border=2mm]{standalone} \begin{document} \begin{tikzpicture} \draw[clip] (0,0)..controls (1,1).. (4,0)..controls (3,-1)..cycle; \fill[red] (-1,-1) rectangle (2,1); \fill[green] (2,1) rectangle (4,-1); \end{tikzpicture} \end{document} ``` **Update:** The proposed by OP shows several bezier lines that finishes where the new line starts. This way it's easier to build them as one path. This path can be closed to delimit the `clip` area and be drawn a second time without the closing line. ``` \documentclass[tikz,border=2mm]{standalone} \newcommand{\myline}{% (0.1,4.95) .. controls (0.6,4.5) and (1.8,4.15) .. (1.8,3.65)%; % \draw (1.8,3.65) .. controls (1.8,2.75) and (1.9,3.15) .. (1.9,2.55)%; % \draw (1.9,2.55) .. controls (1.9,2.35) and (2.25,2.15) .. (2.25,1.65)%; % \draw (2.25,1.65) .. controls (2.25,1.4) and (1.65,0.8) .. (1.65,0.75)%; % \draw (1.65,0.75) .. controls (1.65,0.6) and (1.8,0.54) .. (1.9,0.5)%; % \draw (1.9,0.5) .. controls (2,0.44) and (2.5,0.6) .. (2.7,1.05)%; % \draw (2.7,1.05) .. controls (3,1.45) and (3,1.5) .. (3,1.8)%; % \draw (3,1.8) .. controls (3.05,2.1) and (3.1,2.1) .. (3.4,2)%; % \draw (3.4,2) .. controls (3.6,2) and (3.6,1.95) .. (3.8,1.95)%; % \draw (3.8,1.95) .. controls (3.85,1.95) and (4.1,1.85) .. (4.2,1.85)%; % \draw (4.2,1.85) .. controls (4.4,1.85) and (4.5,1.95) .. (5,2)%; % \draw (5,2) .. controls (5.4,1.95) and (5.5,1.95) .. (5.8,1.96)%; % \draw (5.8,1.96) .. controls (6.55,1.92) and (6.7,1.94) .. (6.7,2.2)%; % \draw (6.7,2.2) .. controls (6.7,2.45) and (6.1,2.5) .. (5.9,2.43)%; % \draw (5.9,2.43) .. controls (5.8,2.47) and (5.2,2.55) .. (5.1,2.5)%; % \draw (5.1,2.5) .. controls (5.0,2.55) and (5,2.57) .. (4.9,2.6)%; % \draw (4.9,2.6) .. controls (4.95,3.0) and (4.95,3.0) .. (4.9,3.6)%; % \draw (4.9,3.6) .. controls (4.93,4.0) and (4.9,4.0) .. (4.85,4.5)%; % \draw (4.85,4.5) .. controls (4.83,4.8) and (4.8,4.6) .. (4.78,5)%; % \draw (4.78,5) .. controls (4.76,5.2) and (4.8,5.0) .. (4.75,5.35)%; % \draw (4.75,5.35) .. controls (4.35,5.57) and (4.23,5.0) .. (4.33,4.5)%; % \draw (4.33,4.5) .. controls (4.3,4.38) and (4.31,4.4) .. (4.3,4.18)%; % \draw (4.3,4.18) -- (4.25,4.16)%; % \draw (4.25,4.16) .. controls (4,4.5) and (3.4,4.7) .. (3,4.75)%; % \draw (3,4.75) .. controls (2.8,4.8) and (2.65,5.03) .. (2.6,5.05)%; % \draw (2.6,5.05) .. controls (2.4,5.15) and (1.75,5.8) .. (1.3,6.25)} \begin{document} \begin{tikzpicture}[line width=0.8pt] \path[clip] \myline--cycle; \fill[green!90!black] (0,0) rectangle (7,7); \draw \myline; \end{tikzpicture} \end{document} ```
1
https://tex.stackexchange.com/users/1952
686659
318,547
https://tex.stackexchange.com/questions/686660
2
How can I use `stix2` to type math equations while all number whether it's in mathmode or textmode still print out as Times font as in textmode. (In the code below I have to use Times New Roman font for text since `stix2` doesn't support Vietnamese characters) ``` \documentclass[12pt, a4paper, twoside]{book} \usepackage[top = 3.5cm, right = 2.5cm, left = 2.5cm, bottom = 3.5cm]{geometry} \usepackage{stix2} % Use this instead of mtpro2 since it's free \renewcommand{\rmdefault}{ptm} % set Times as the default text font \usepackage[vietnamese]{babel} \usepackage{amsmath} \usepackage{amssymb} \usepackage{bm} % Bold math characters \usepackage{fontawesome} % Awesome symbol \begin{document} \begin{align*} \text{Textmode number:}&\quad 0123456789 \\ \text{Mathmode number:}&\quad 0123456789 \end{align*} \begin{align*} \text{Textmode number:}&\quad u(x,\text{0}) = u_{\text{0}}(x) \\ \text{Mathmode number:}&\quad u(x,0) = u_{0}(x) \end{align*} \end{document} ```
https://tex.stackexchange.com/users/209997
Using STIX2 with Times number font
true
It's simpler to use the text font digits in math rather than conversely. ``` \documentclass[12pt, a4paper, twoside]{book} \usepackage[top = 3.5cm, right = 2.5cm, left = 2.5cm, bottom = 3.5cm]{geometry} \usepackage[vietnamese]{babel} \usepackage{stix2} % Use this instead of mtpro2 since it's free \usepackage{tgtermes} \DeclareSymbolFont{numbers}{OT1}{\rmdefault}{m}{n} \SetSymbolFont{numbers}{bold}{OT1}{\rmdefault}{b}{n} \DeclareMathSymbol{0}{\mathalpha}{numbers}{`0} \DeclareMathSymbol{1}{\mathalpha}{numbers}{`1} \DeclareMathSymbol{2}{\mathalpha}{numbers}{`2} \DeclareMathSymbol{3}{\mathalpha}{numbers}{`3} \DeclareMathSymbol{4}{\mathalpha}{numbers}{`4} \DeclareMathSymbol{5}{\mathalpha}{numbers}{`5} \DeclareMathSymbol{6}{\mathalpha}{numbers}{`6} \DeclareMathSymbol{7}{\mathalpha}{numbers}{`7} \DeclareMathSymbol{8}{\mathalpha}{numbers}{`8} \DeclareMathSymbol{9}{\mathalpha}{numbers}{`9} \usepackage{amsmath} \usepackage{amssymb} \usepackage{bm} % Bold math characters \usepackage{fontawesome} % Awesome symbol \begin{document} Trong toán học, các số tự nhiên được sử dụng để đếm (như trong ``có sáu đồng xu trên bàn'') và thứ tự (như trong ``đây là thành phố lớn thứ ba trong cả nước''). Đôi khi, các số tự nhiên có thể xuất hiện dưới dạng một bộ mã thuận tiện (nhãn hoặc ``tên''), nghĩa là, như những gì các nhà ngôn ngữ học gọi là số danh nghĩa, loại bỏ nhiều hoặc tất cả các thuộc tính của một số theo nghĩa toán học. Tập hợp các số tự nhiên thường được kí hiệu bằng kí hiệu $\mathbb{N}$. \begin{align*} \text{Textmode number:}&\quad \text{0123456789} \\ \text{Mathmode number:}&\quad 0123456789 \end{align*} Trong tiêu chuẩn của ISO 80000-2 và tài liệu giáo khoa chuẩn của Việt Nam, số tự nhiên được định nghĩa là các số nguyên không âm $0, 1, 2, 3,\dotsc$ (đôi khi được ký hiệu chung là biểu tượng $\mathbb{N}_{0}$, để nhấn mạnh rằng số $0$ cũng được bao gồm), trong khi những số khác bắt đầu bằng $1$, tương ứng với các số nguyên dương $1, 2, 3,\dotsc$ (đôi khi được ký hiệu chung bằng ký hiệu $\mathbb{N}_{1}$, $\mathbb{N}^{+}$, hoặc $\mathbb{N}^{*}$ với nhấn mạnh rằng số $0$ bị loại trừ). \begin{align*} \text{Textmode number:}&\quad u(x,\text{0}) = u_{\text{0}}(x) \\ \text{Mathmode number:}&\quad u(x,0) = u_{0}(x) \end{align*} (Text from \texttt{https://vi.wikipedia.org/wiki/Số\_tự\_nhiên}) \end{document} ``` I replaced `ptm` with TeX Gyre Termes. The same with `\renewcommand{\rmdefault}{ptm}` would give
2
https://tex.stackexchange.com/users/4427
686665
318,550
https://tex.stackexchange.com/questions/686567
2
The `\binom` command is an example of a LaTeX command which accepts two inputs. We have the following example: ``` \binom{n+1}{2k} ``` What is an example of a LaTeX command with three or more parameters?
https://tex.stackexchange.com/users/178952
What are some examples of LaTeX commands which accept three or more arguments?
false
Funnily, `newcommand` itself takes 4 arguments: ``` \newcommand{name}[num][default]{definition} ``` If you consider the `*` in `\newcommand*` an argument, it's 5.
1
https://tex.stackexchange.com/users/150785
686667
318,551
https://tex.stackexchange.com/questions/686658
0
I understand how to clip with a rectangle, for instance. But how to do it with a different path. I wrote many lines with Bezier curves ( .. controls (,) and (,) ..). So now I have a path with all these Bezier curves. So, how do I clip inside this path? Here is a MWE: ``` \begin{tikzpicture}[line width=0.8pt] \draw (0.1,4.95) .. controls (0.6,4.5) and (1.8,4.15) .. (1.8,3.65); \draw (1.8,3.65) .. controls (1.8,2.75) and (1.9,3.15) .. (1.9,2.55); \draw (1.9,2.55) .. controls (1.9,2.35) and (2.25,2.15) .. (2.25,1.65); \draw (2.25,1.65) .. controls (2.25,1.4) and (1.65,0.8) .. (1.65,0.75); \draw (1.65,0.75) .. controls (1.65,0.6) and (1.8,0.54) .. (1.9,0.5); \draw (1.9,0.5) .. controls (2,0.44) and (2.5,0.6) .. (2.7,1.05); \draw (2.7,1.05) .. controls (3,1.45) and (3,1.5) .. (3,1.8); \draw (3,1.8) .. controls (3.05,2.1) and (3.1,2.1) .. (3.4,2); \draw (3.4,2) .. controls (3.6,2) and (3.6,1.95) .. (3.8,1.95); \draw (3.8,1.95) .. controls (3.85,1.95) and (4.1,1.85) .. (4.2,1.85); \draw (4.2,1.85) .. controls (4.4,1.85) and (4.5,1.95) .. (5,2); \draw (5,2) .. controls (5.4,1.95) and (5.5,1.95) .. (5.8,1.96); \draw (5.8,1.96) .. controls (6.55,1.92) and (6.7,1.94) .. (6.7,2.2); \draw (6.7,2.2) .. controls (6.7,2.45) and (6.1,2.5) .. (5.9,2.43); \draw (5.9,2.43) .. controls (5.8,2.47) and (5.2,2.55) .. (5.1,2.5); \draw (5.1,2.5) .. controls (5.0,2.55) and (5,2.57) .. (4.9,2.6); \draw (4.9,2.6) .. controls (4.95,3.0) and (4.95,3.0) .. (4.9,3.6); \draw (4.9,3.6) .. controls (4.93,4.0) and (4.9,4.0) .. (4.85,4.5); \draw (4.85,4.5) .. controls (4.83,4.8) and (4.8,4.6) .. (4.78,5); \draw (4.78,5) .. controls (4.76,5.2) and (4.8,5.0) .. (4.75,5.35); \draw (4.75,5.35) .. controls (4.35,5.57) and (4.23,5.0) .. (4.33,4.5); \draw (4.33,4.5) .. controls (4.3,4.38) and (4.31,4.4) .. (4.3,4.18); \draw (4.3,4.18) -- (4.25,4.16); \draw (4.25,4.16) .. controls (4,4.5) and (3.4,4.7) .. (3,4.75); \draw (3,4.75) .. controls (2.8,4.8) and (2.65,5.03) .. (2.6,5.05); \draw (2.6,5.05) .. controls (2.4,5.15) and (1.75,5.8) .. (1.3,6.25); \end{tikzpicture} ``` I can't close the path because I don't want a line between the first and the last point (or an invisible line)
https://tex.stackexchange.com/users/249670
Clipping a path with TikZ
false
You can clip a slightly different path (notice the `-| cycle` at the end), draw something against that clip and then, outside of the clip, draw the unclosed path. (As an alternative, a similar thing can be done with a path picture which is basically a one-path clip where the clipping path can be drawn, though. This doesn't help you much since you clipping path and drawn path differ slightly.) Code ---- ``` \documentclass[tikz]{standalone} \begin{document} \begin{tikzpicture}[ line width=0.8pt, hand/.style={insert path={ (0.1,4.95) .. controls (0.6,4.5) and (1.8,4.15) .. (1.8,3.65) .. controls (1.8,2.75) and (1.9,3.15) .. (1.9,2.55) .. controls (1.9,2.35) and (2.25,2.15) .. (2.25,1.65) .. controls (2.25,1.4) and (1.65,0.8) .. (1.65,0.75) .. controls (1.65,0.6) and (1.8,0.54) .. (1.9,0.5) .. controls (2,0.44) and (2.5,0.6) .. (2.7,1.05) .. controls (3,1.45) and (3,1.5) .. (3,1.8) .. controls (3.05,2.1) and (3.1,2.1) .. (3.4,2) .. controls (3.6,2) and (3.6,1.95) .. (3.8,1.95) .. controls (3.85,1.95) and (4.1,1.85) .. (4.2,1.85) .. controls (4.4,1.85) and (4.5,1.95) .. (5,2) .. controls (5.4,1.95) and (5.5,1.95) .. (5.8,1.96) .. controls (6.55,1.92) and (6.7,1.94) .. (6.7,2.2) .. controls (6.7,2.45) and (6.1,2.5) .. (5.9,2.43) .. controls (5.8,2.47) and (5.2,2.55) .. (5.1,2.5) .. controls (5.0,2.55) and (5,2.57) .. (4.9,2.6) .. controls (4.95,3.0) and (4.95,3.0) .. (4.9,3.6) .. controls (4.93,4.0) and (4.9,4.0) .. (4.85,4.5) .. controls (4.83,4.8) and (4.8,4.6) .. (4.78,5) .. controls (4.76,5.2) and (4.8,5.0) .. (4.75,5.35) .. controls (4.35,5.57) and (4.23,5.0) .. (4.33,4.5) .. controls (4.3,4.38) and (4.31,4.4) .. (4.3,4.18) -- (4.25,4.16) .. controls (4,4.5) and (3.4,4.7) .. (3,4.75) .. controls (2.8,4.8) and (2.65,5.03) .. (2.6,5.05) .. controls (2.4,5.15) and (1.75,5.8) .. (1.3,6.25)}}] \begin{scope} \clip[hand] -| cycle; \shade[left color=red, right color=green] (current bounding box.south west) rectangle (current bounding box.north east); \end{scope} \draw[hand]; \tikzset{xshift=7cm} \path[hand] -| cycle [path picture={ \shade[left color=red, right color=green] (path picture bounding box.south west) rectangle (path picture bounding box.north east); }]; \draw[hand]; \end{tikzpicture} \end{document} ``` Output ------
0
https://tex.stackexchange.com/users/16595
686668
318,552
https://tex.stackexchange.com/questions/686393
1
I have multiple pieces of redundant LaTeX3 code that creates new conditionals: ``` \bool_if:nT { \cs_if_free_p:N \mypkg_if_package_loaded_p:n && \cs_if_free_p:N \mypkg_if_package_loaded_T:n && \cs_if_free_p:N \mypkg_if_package_loaded_F:n && \cs_if_free_p:N \mypkg_if_package_loaded_TF:n } { \prg_new_conditional:Nnn \mypkg_if_package_loaded:n { p, T, F, TF } { \use:c { @ifpackageloaded } { #1 } { \prg_return_true: } { \prg_return_false: } } } ``` I want to replace the first code with something more concise, like the following: ``` \cs_new_protected:Npn \mypkg_def_if:Nn #1#2 { \clist_new:N \l_mypkg_cond_clist \clist_map_inline:nn { p, T, F, TF } { \bool_if:nT { \cs_if_free_p:N #1:##1 } { \clist_put_right:Nn \l_mypkg_cond_clist { #1 } } } \prg_new_conditional:Nnn #2:n { \l_mypkg_cond_clist } { \use:c { #2 } { ##1 } { \prg_return_true: } { \prg_return_false: } } } \mypkg_def_if:Nn \mypkg_if_package_loaded { @ifpackageloaded } \mypkg_def_if:Nn \mypkg_if_package_with { @ifpackagewith } \mypkg_def_if:Nn \mypkg_if_class_loaded { @ifclassloaded } \mypkg_def_if:Nn \mypkg_if_class_with { @ifclasswith } ``` To solve it I'm trying to follow this structure: 1. Create a new clistA 2. Iterate over {p, T, F, TF} 3. For each element, check if function + element is available with `\cs_if_free` 4. If available, add it to clistB 5. Create a conditional with arg1 and clistB 6. Use arg2 as a control sequence 7. Attempt to disambiguate the arguments Any feedback appreciated!
https://tex.stackexchange.com/users/297525
LaTeX3 dynamic generation of \prg_new_conditional
false
I still think that your package is your namespace, hence your responsibility. As long as this isn't used via a user-interface to set up some internal auxiliaries I'd not advise using it and instead simply do a `\cs_new_eq:Nc \nevada_if_package_loaded:nTF { @ifpackageloaded }` to get the conditional if you absolutely need a package name for a 2e-macro. The following might be more complicated than it has to be, but does what you want: ``` \documentclass{article} \ExplSyntaxOn \clist_new:N \l__nevada_variants_clist \tl_new:N \l__nevada_cs_parts_tl \tl_new:N \l__nevada_arg_forwarded_tl \str_new:N \l__nevada_cs_base_str \str_new:N \l__nevada_cs_args_str \int_new:N \l__nevada_arg_count_int \msg_new:nnn { nevada } { missing-colon } { Function~ name~ #1~ misses~ a~ colon. } \cs_new_protected:Npn \__nevada_split_cs:N #1 { \tl_set:Nx \l__nevada_cs_parts_tl { \cs_split_function:N #1 } \bool_if:nF { \exp_last_unbraced:No \use_iii:nnn \l__nevada_cs_parts_tl } { \msg_error:nnn { nevada } { missing-colon } {#1} \prg_break: } \str_set:Nx \l__nevada_cs_base_str { \exp_last_unbraced:No \use_i:nnn \l__nevada_cs_parts_tl } \str_set:Nx \l__nevada_cs_args_str { \exp_last_unbraced:No \use_ii:nnn \l__nevada_cs_parts_tl } } \cs_new:Npn \__nevada_cs_base: { \exp_last_unbraced:No \use_i:nnn \l__nevada_cs_parts_tl } \cs_new_protected:Npn \__nevada_provide_conditional:NNnn #1#2#3#4 { \__nevada_split_cs:N #2 \clist_clear:N \l__nevada_variants_clist \clist_map_inline:nn {#3} { \cs_if_exist:cF { \l__nevada_cs_base_str \str_if_eq:nnT {##1} { p } { _p } : \l__nevada_cs_args_str \str_if_eq:nnF {##1} { p } { \tl_to_str:n {##1} } } { \clist_put_right:Nn \l__nevada_variants_clist {##1} } } \clist_if_empty:NF \l__nevada_variants_clist { \exp_args:NNe #1 #2 { \clist_use:Nn \l__nevada_variants_clist { , } } {#4} } \prg_break_point: } \cs_new_protected:Npn \nevada_provide_conditional:Nnn { \__nevada_provide_conditional:NNnn \prg_new_conditional:Nnn } \cs_new_protected:Npn \nevada_provide_protected_conditional:Nnn { \__nevada_provide_conditional:NNnn \prg_new_protected_conditional:Nnn } \cs_new_protected:Npn \nevada_provide_all_conditionals:Nn #1 { \nevada_provide_conditional:Nnn #1 { TF, T, F, p } } \cs_new_protected:Npn \nevada_provide_all_protected_conditionals:Nn #1 { \nevada_provide_protected_conditional:Nnn #1 { TF, T, F } } \cs_new_protected:Npn \__nevada_provide_conditional_alias:NNN #1#2#3 { \__nevada_split_cs:N #2 \int_set:Nn \l__nevada_arg_count_int { \str_count:N \l__nevada_cs_args_str } \tl_clear:N \l__nevada_arg_forwarded_tl \int_step_inline:nn { \l__nevada_arg_count_int } { \tl_put_right:Nn \l__nevada_arg_forwarded_tl { {######1} } } \exp_args:NNe #1 #2 { \exp_not:N #3 \l__nevada_arg_forwarded_tl \exp_not:N \prg_return_true: \exp_not:N \prg_return_false: } \prg_break_point: } \cs_new_protected:Npn \nevada_provide_conditional_alias:NN { \__nevada_provide_conditional_alias:NNN \nevada_provide_all_conditionals:Nn } \cs_new_protected:Npn \nevada_provide_protected_conditional_alias:NN { \__nevada_provide_conditional_alias:NNN \nevada_provide_all_protected_conditionals:Nn } \cs_generate_variant:Nn \nevada_provide_protected_conditional_alias:NN { Nc } \nevada_provide_protected_conditional_alias:Nc \nevada_if_package_loaded:n { @ifpackageloaded } \ExplSyntaxOff \usepackage{graphicx} \begin{document} \texttt{graphicx} is \ExplSyntaxOn \nevada_if_package_loaded:nF {graphicx} { not~ } \ExplSyntaxOff loaded. You \ExplSyntaxOn \nevada_if_package_loaded:nTF {xcolor} { did } { should } ~ \ExplSyntaxOff load \texttt{xcolor}. \end{document} ```
3
https://tex.stackexchange.com/users/117050
686677
318,557
https://tex.stackexchange.com/questions/686393
1
I have multiple pieces of redundant LaTeX3 code that creates new conditionals: ``` \bool_if:nT { \cs_if_free_p:N \mypkg_if_package_loaded_p:n && \cs_if_free_p:N \mypkg_if_package_loaded_T:n && \cs_if_free_p:N \mypkg_if_package_loaded_F:n && \cs_if_free_p:N \mypkg_if_package_loaded_TF:n } { \prg_new_conditional:Nnn \mypkg_if_package_loaded:n { p, T, F, TF } { \use:c { @ifpackageloaded } { #1 } { \prg_return_true: } { \prg_return_false: } } } ``` I want to replace the first code with something more concise, like the following: ``` \cs_new_protected:Npn \mypkg_def_if:Nn #1#2 { \clist_new:N \l_mypkg_cond_clist \clist_map_inline:nn { p, T, F, TF } { \bool_if:nT { \cs_if_free_p:N #1:##1 } { \clist_put_right:Nn \l_mypkg_cond_clist { #1 } } } \prg_new_conditional:Nnn #2:n { \l_mypkg_cond_clist } { \use:c { #2 } { ##1 } { \prg_return_true: } { \prg_return_false: } } } \mypkg_def_if:Nn \mypkg_if_package_loaded { @ifpackageloaded } \mypkg_def_if:Nn \mypkg_if_package_with { @ifpackagewith } \mypkg_def_if:Nn \mypkg_if_class_loaded { @ifclassloaded } \mypkg_def_if:Nn \mypkg_if_class_with { @ifclasswith } ``` To solve it I'm trying to follow this structure: 1. Create a new clistA 2. Iterate over {p, T, F, TF} 3. For each element, check if function + element is available with `\cs_if_free` 4. If available, add it to clistB 5. Create a conditional with arg1 and clistB 6. Use arg2 as a control sequence 7. Attempt to disambiguate the arguments Any feedback appreciated!
https://tex.stackexchange.com/users/297525
LaTeX3 dynamic generation of \prg_new_conditional
true
I can't see the need for `\cs_if_free:NTF`. You're developing a package and if, by mistake, you try redefining an already defined conditional *in your own namespace*, you'll be welcome with an error message that says so. In this case just remove the faulty piece of code and go on. This is the reason why a prefix specific to a package is recommended: you're, the package author, are completely responsible for the functions and variables using that prefix. Actually, with your `\bool_if:nT` you're sweeping the problem under the carpet. Suppose you have already defined `\mypkg_if_foo:nTF` in your big package and at some later time you forget having done so and deem `foo` good for some other conditional. If you use your `\bool_if:nT` strategy, your new conditional will *not* be defined and the older function will still be used at each call of `\mypkg_if_foo:nTF`. Are you sure you wouldn't prefer an error message, so you can realize the mistake and choose a new name? I would. Using `\bool_if:nTF` and a warning in the “false” branch would help, but I see no advantage. Last, but not least, definitions of similar functions should not be scattered among the package, but kept near to each other, for easier maintenance. Thus you'll have a section ``` % define conditionals emulating the LaTeX kernel pseudoconditionals \prg_new_conditional:Nnn \mypkg_if_package_loaded:n { p, T, F, TF } { \use:c { @ifpackageloaded } { #1 } { \prg_return_true: } { \prg_return_false: } } ``` Now we can write syntactic sugar for defining such conditional “at once”. ``` % define conditionals emulating the LaTeX kernel pseudoconditionals \cs_new_protected:Nn \__mypkg_define_kernel_conditional:Nn { \prg_new_conditional:Nnn #1 { p,T,F,TF } { \use:c { #2 } { \prg_return_true: } { \prg_return_false: } } } \__mypkg_define_kernel_conditional:Nn \mypkg_if_package_loaded:n { @ifpackageloaded } \__mypkg_define_kernel_conditional:Nn \mypkg_if_package_with:n { @ifpackagewith } \__mypkg_define_kernel_conditional:Nn \mypkg_if_class_loaded:n { @ifclassloaded } \__mypkg_define_kernel_conditional:Nn \mypkg_if_class_with:n { @ifclasswith } ``` If you really want to use your `\bool_if:nT` strategy, then ``` \cs_new_protected:Nn \__mypkg_define_kernel_conditional:nn { \bool_if:nT { \cs_if_free_p:c {mypkg_if_#1_p:n} && \cs_if_free_p:c {mypkg_if_#1:nT && \cs_if_free_p:c {mypkg_if_#1:nF && \cs_if_free_p:c {mypkg_if_#1:nTF } { \prg_new_conditional:cnn {mypkg_if_#1:n} { p,T,F,TF } { \use:c { #2 } { \prg_return_true: } { \prg_return_false: } } } } \__mypkg_define_kernel_conditional:nn {package_loaded} { @ifpackageloaded } \__mypkg_define_kernel_conditional:nn {package_with} { @ifpackagewith } \__mypkg_define_kernel_conditional:nn {class_loaded} { @ifclassloaded } \__mypkg_define_kernel_conditional:nn {class_with} { @ifclasswith } ```
4
https://tex.stackexchange.com/users/4427
686681
318,559
https://tex.stackexchange.com/questions/686669
2
If I write `\count10=\iftrue'\fi10 \the\count10` then the answer is 8, because the "if" clause adds a `'` which causes `10` to be interpreted as octal. If I write this, the answer is also 8: ``` \count10='\iftrue\fi10 \the\count10 ``` However, if I switch out the "if" clause for a different expandable-- say, `\relax`: ``` \count10='\relax10 \the\count10 ``` then it fails: ``` ! Missing number, treated as zero. <to be read again> \relax l.16 \count10='\relax 10 ``` What makes the difference?
https://tex.stackexchange.com/users/259978
Why can \if come between a base and the digits in a literal integer, but \relax can't?
true
There are contexts where `\relax` is ignored during the scan for the argument to a primitive command, but this is not one of them. The TeXbook defines a ⟨filler⟩ as any sequence of space and `\relax` tokens; when it is scanning for `{`, a ⟨filler⟩ is ignored. Note, however that the TeXbook uses `{` to denote an explicit or implicit character token of category code 1. So a ⟨filler⟩ is ignored when looking for the argument in a token register assignment or in a `\lowercase` operation (see [Get the lion to run in loops. Tersely](https://tex.stackexchange.com/a/44459/4427) for a peculiar aspect). Another case when `\relax` is ignored is when it is used for ending an expression to be passed to `\numexpr`, `\dimexpr`, `\glueexpr` or `\muexpr`. When TeX wants to determine the argument for an assignment to a `\count` register, it looks for an optional `=` and then expands tokens (if expandable, of course) as long as it finds something that can be interpreted as an integer (which may include a prefix for the radix). At the first token that cannot be interpreted as valid input for a number in the chosen radix, the search stops and the number is evaluated for storing. Important exception: when TeX has determined that an integer is in alphabetic format, that is, when the prefix is ``` (backquote), it stops expanding tokens and takes the next character token or length one control sequence to be the alphabetic constant, translating it into ASCII code (or Unicode, for Unicode engines). An error would be raised if the input is incorrect. Let's examine your attempts ``` \count10=\iftrue'\fi10 \the\count10 \count10='\iftrue\fi10 \the\count10 \count10='\relax10 ``` In the first case TeX finds something expandable after `=` and expands it. Well, the expansion of `\iftrue` is empty and then `'` is scanned because it's part or the “true text”; now TeX knows that it wants to look for an octal constant. Next it finds `\fi`, whose expansion is empty and next `1`, then `0` and finally a space that ends the scanning process. The number is computed and the value stored in the register; the space is ignored and processing continues, in this case printing the value stored in the register. The second case is completely similar. But the third one has a problem: after `'` there's `\relax` that's ***not*** ignored. It is an unexpandable token that cannot be interpreted as an octal digit and TeX stops with an error, because just the radix prefix is not a valid number. Out of curiosity, here's another case that fails: ``` \chardef\foo=10 \count10='\foo ``` A `\chardef` token *can* be used in the context of a number, but not with a radix prefix: it is an “abstract” number, just like in ``` \count10=\count255 ``` The prefixes `'` and `"` can only be used in front of an explicit number, that is, a sequence of digits in the appropriate range.
3
https://tex.stackexchange.com/users/4427
686684
318,561
https://tex.stackexchange.com/questions/686686
0
I am using `enumitem` for horizontal lists. However, I would like to spread the items over the entire row. I've tried with `wide` parameter, but it puts the space between the label and text. I can adjust the absolute value with `itemjoin`, but this should be redone for all lists considering the number of items and their text length. Is there a way to automate this? ``` \documentclass{article} \usepackage[inline]{enumitem} \begin{document} Lorem ipsum dolor sit amet, consectetur adipiscing elit. Etiam eget ligula eu lectus lobortis condimentum. Aliquam nonummy auctor massa. Pellentesque habitant morbi tristique senectus et netus et malesuada fames ac turpis egestas. Nulla at risus. Quisque purus magna, auctor et, sagittis ac, posuere eu, lectus. Nam mattis, felis ut adipiscing. List: \begin{enumerate*}[before=\noindent, wide=\parindent] \item Item X \item Item Y \item Item Z \end{enumerate*} Desired list: \begin{enumerate*}[before=\noindent, itemjoin = \hspace{0.32\linewidth}] \item Item X \item Item Y \item Item Z \end{enumerate*} \end{document} ```
https://tex.stackexchange.com/users/175118
Enumitem inline span to \textwidth
true
You could try using `itemjoin=\hspace{10pt plus 1fill}` to get a minimum width of 10pt between the items (I added `~` to avoid a line break at this position): ``` \documentclass{article} \usepackage[inline]{enumitem} \begin{document} \noindent\hrule \bigskip \begin{enumerate*}[before=\noindent, itemjoin=\hspace{10pt plus 1fill}] \item Item~X \item Item~Y \item Item~Z \end{enumerate*} \bigskip \begin{enumerate*}[before=\noindent, itemjoin=\hspace{10pt plus 1fill}] \item Item~S \item Item~T \item Item~U \item Item~V \item Item~W \item Item~X \item Item~Y \item Item~Z \end{enumerate*} \bigskip \begin{enumerate*}[before=\noindent, itemjoin=\hspace{10pt plus 1fill}] \item This is a long item \item This is an even longer item that requires a lot of space \item This is also a long item \end{enumerate*} \end{document} ```
1
https://tex.stackexchange.com/users/47927
686687
318,562
https://tex.stackexchange.com/questions/686646
0
How can I top align these two tables, and possibly prevent them from overlapping each other? ``` \documentclass[12pt]{article} \usepackage{booktabs} \usepackage{siunitx} \usepackage{subcaption} \begin{document} \begin{table}[h] \centering \renewcommand{\arraystretch}{1.25}% \begin{subtable}[t]{0.4\textwidth} \begin{tabular}{cc} \toprule Numero d'onda ($\unit{cm^{-1}}$) & Classificazione \\ \midrule 3204 & weak \\ 3183 & weak \\ 3167 & weak \\ \midrule 3139 & weak \\ \midrule 3087 & weak \\ 3072 & weak \\ \midrule 1856 & strong \\ \midrule 1511 & weak \\ 1493 & weak \\ \midrule 1415 & strong \\ \midrule 1257 & strong \\ \midrule 1128 & weak \\ \midrule 938 & weak \\ \midrule 525 & medium \\ \midrule 378 & weak \\ \bottomrule \end{tabular} \end{subtable} \quad \begin{tabular}{cc} \toprule Numero d'onda ($\unit{cm^{-1}}$) & Classificazione \\ \midrule 3204 & medium \\ 3183 & medium \\ 3167 & medium \\ 3139 & medium \\ \midrule 3097 & strong \\ 3072 & strong \\ \midrule 1856 & weak \\ \midrule 1511 & medium \\ 1510 & medium \\ 1493 & weak \\ \midrule 1411 & weak \\ 1089 & weak \\ \midrule 938 & weak \\ \midrule 891 & weak \\ \midrule 799 & medium \\ \bottomrule \end{tabular} \end{table} \end{document} ```
https://tex.stackexchange.com/users/258662
Top align two tabular placed side by side
true
The contents of table cells does not break by default and in your case results in the tabulars being too wide. You can't restrict the width of a tabular using a `subtable` in this way. A simple solution that reduces the width of both `tabular`s by inserting a line break in the header of the left column (without even using `subtable`s) could be: ``` \documentclass[12pt]{article} \usepackage{booktabs} \usepackage{siunitx} \begin{document} \begin{table}[h] \centering \renewcommand{\arraystretch}{1.25}% \begin{tabular}[t]{cc} \toprule \shortstack{Numero d'onda \\ ($\unit{cm^{-1}}$)} & Classificazione \\ \midrule 3204 & weak \\ 3183 & weak \\ 3167 & weak \\ \midrule 3139 & weak \\ \midrule 3087 & weak \\ 3072 & weak \\ \midrule 1856 & strong \\ \midrule 1511 & weak \\ 1493 & weak \\ \midrule 1415 & strong \\ \midrule 1257 & strong \\ \midrule 1128 & weak \\ \midrule 938 & weak \\ \midrule 525 & medium \\ \midrule 378 & weak \\ \bottomrule \end{tabular} \quad \begin{tabular}[t]{cc} \toprule \shortstack{Numero d'onda \\ ($\unit{cm^{-1}}$)} & Classificazione \\ \midrule 3204 & medium \\ 3183 & medium \\ 3167 & medium \\ 3139 & medium \\ \midrule 3097 & strong \\ 3072 & strong \\ \midrule 1856 & weak \\ \midrule 1511 & medium \\ 1510 & medium \\ 1493 & weak \\ \midrule 1411 & weak \\ 1089 & weak \\ \midrule 938 & weak \\ \midrule 891 & weak \\ \midrule 799 & medium \\ \bottomrule \end{tabular} \end{table} \end{document} ``` Another solution could be to use `tabularx`: ``` \documentclass[12pt]{article} \usepackage{tabularx} \usepackage{booktabs} \usepackage{siunitx} \begin{document} \begin{table}[h] \centering \renewcommand{\arraystretch}{1.25}% \begin{tabularx}{0.475\textwidth}[t]{ *{2}{>{\centering\arraybackslash}X} } \toprule Numero d'onda ($\unit{cm^{-1}}$) & Classificazione \\ \midrule 3204 & weak \\ 3183 & weak \\ 3167 & weak \\ \midrule 3139 & weak \\ \midrule 3087 & weak \\ 3072 & weak \\ \midrule 1856 & strong \\ \midrule 1511 & weak \\ 1493 & weak \\ \midrule 1415 & strong \\ \midrule 1257 & strong \\ \midrule 1128 & weak \\ \midrule 938 & weak \\ \midrule 525 & medium \\ \midrule 378 & weak \\ \bottomrule \end{tabularx} \quad \begin{tabularx}{0.475\textwidth}[t]{ *{2}{>{\centering\arraybackslash}X} } \toprule Numero d'onda ($\unit{cm^{-1}}$) & Classificazione \\ \midrule 3204 & medium \\ 3183 & medium \\ 3167 & medium \\ 3139 & medium \\ \midrule 3097 & strong \\ 3072 & strong \\ \midrule 1856 & weak \\ \midrule 1511 & medium \\ 1510 & medium \\ 1493 & weak \\ \midrule 1411 & weak \\ 1089 & weak \\ \midrule 938 & weak \\ \midrule 891 & weak \\ \midrule 799 & medium \\ \bottomrule \end{tabularx} \end{table} \end{document} ```
2
https://tex.stackexchange.com/users/47927
686694
318,566
https://tex.stackexchange.com/questions/686697
0
I am trying to use tikzexternal to produce pdf of my images. I was using `tikzpicture` in `\begin{figure}` environment. However, I could not get any pdf output. Then I removed the `\begin{figure}`, tried again and no pdf output. I have checked the logfile from "logs and other files". It seems that I am using shell-escape option. I do not know what is the problem. I am pasting my code here. Maybe there are other libraries causing the conflict. I do not know. Btw, I am using overleaf ``` \documentclass{article} \usepackage{graphicx} % Required for inserting images \usepackage[font=footnotesize,labelfont=bf]{caption} \usepackage{dashbox} \usepackage{subfig} \usepackage{floatrow} \usepackage{amsmath} \usepackage{float} \usepackage{braket} \usepackage{graphicx} \usepackage{qcircuit} \usepackage{svg} \usepackage{color} \xyoption{color} \def\imagetop#1{\vtop{\null\hbox{#1}}} \newcommand\dboxed[1]{\dbox{\ensuremath{#1}}} \usepackage{tikz} \usepackage{mathtools}% \usetikzlibrary{decorations.text} \usepackage{pst-node, pst-arrow} \usepackage{environ} \usepackage{adjustbox} \makeatletter \newcommand\mathcircled[1]{% \mathpalette\@mathcircled{#1}% } \newcommand\@mathcircled[2]{% \tikz[baseline=(math.base)] \node[draw,circle,inner sep=1pt] (math) {$\m@th#1#2$};% } \usetikzlibrary{ arrows, calc, chains, decorations, decorations.text, decorations.pathmorphing, matrix, positioning, shapes, tikzmark, fit } \usetikzlibrary{shapes.symbols} \usepackage{circledsteps} \usepackage{floatrow} \tikzset{ mycirc/.style={circle, draw=black, thick, outer sep=0, anchor=#1, inner sep=0, minimum size=1.5ex}, mytext/.style={text=black, anchor=#1, inner sep=0, outer sep=1pt} } \tikzstyle{arrow} = [thick,->,>=stealth] \tikzstyle{arrow} = [thick,->,>=stealth] \floatsetup[figure]{style=plain,subcapbesideposition=top} \usepackage{geometry} \title{Figure} \usetikzlibrary{external} \tikzexternalize \begin{document} \maketitle %\begin{figure}[H] %\centering % \includegraphics[width=0.5\linewidth]{Images/hirarchy.png} \begin{tikzpicture} \filldraw[inner color=pink,draw=black] (2,2) circle (3cm); \path[decorate,decoration={text along path, text={something},text align=center}] (4,2) arc [start angle= 0,end angle=-360,radius=2]; \draw[inner color = blue ,draw = black] (3,2) circle (2cm); \path[decorate,decoration={text along path, text={something},text align=center}] (5,2) arc [start angle= 0,end angle=-360,radius=1.4]; \draw[inner color = pink,outer color=pink,draw = black] (4,2) circle (1cm) node {something}; \end{tikzpicture} \caption{there was a long caption here} %\label{fig:hirarchy} %\end{figure} \end{document} ```
https://tex.stackexchange.com/users/287702
tikzexternal no pdf output
true
You imported a lot of unnecessary or duplicated packages which can result in conflicts. Next time you also should report the error messages. I removed some of the packages and this is what worked for me: ``` \documentclass{article} \usepackage{graphicx} % Required for inserting images \usepackage[font=footnotesize,labelfont=bf]{caption} \usepackage{dashbox} \usepackage{subfig} %\usepackage{floatrow} \usepackage{amsmath} %\usepackage{float} \usepackage{braket} \usepackage{qcircuit} \usepackage{svg} \usepackage{color} \xyoption{color} \def\imagetop#1{\vtop{\null\hbox{#1}}} \newcommand\dboxed[1]{\dbox{\ensuremath{#1}}} \usepackage{tikz} \usepackage{mathtools}% \usetikzlibrary{decorations.text} %\usepackage{pst-node, pst-arrow} %\usepackage{environ} %\usepackage{adjustbox} \makeatletter \newcommand\mathcircled[1]{% \mathpalette\@mathcircled{#1}% } \newcommand\@mathcircled[2]{% \tikz[baseline=(math.base)] \node[draw,circle,inner sep=1pt] (math) {$\m@th#1#2$};% } \usetikzlibrary{ arrows, calc, chains, decorations, decorations.text, decorations.pathmorphing, matrix, positioning, shapes, tikzmark, fit } \usetikzlibrary{shapes.symbols} \usepackage{circledsteps} \usepackage{floatrow} \tikzset{ mycirc/.style={circle, draw=black, thick, outer sep=0, anchor=#1, inner sep=0, minimum size=1.5ex}, mytext/.style={text=black, anchor=#1, inner sep=0, outer sep=1pt} } \tikzstyle{arrow} = [thick,->,>=stealth] \tikzstyle{arrow} = [thick,->,>=stealth] \floatsetup[figure]{style=plain,subcapbesideposition=top} \usepackage{geometry} \title{Figure} \usetikzlibrary{external} \tikzexternalize \begin{document} \maketitle \begin{figure}[h] \centering % \includegraphics[width=0.5\linewidth]{Images/hirarchy.png} \begin{tikzpicture} \filldraw[inner color=pink,draw=black] (2,2) circle (3cm); \path[decorate,decoration={text along path, text={something},text align=center}] (4,2) arc [start angle= 0,end angle=-360,radius=2]; \draw[inner color = blue ,draw = black] (3,2) circle (2cm); \path[decorate,decoration={text along path, text={something},text align=center}] (5,2) arc [start angle= 0,end angle=-360,radius=1.4]; \draw[inner color = pink,outer color=pink,draw = black] (4,2) circle (1cm) node {something}; \end{tikzpicture} \caption{there was a long caption here} \label{fig:hirarchy} \end{figure} \end{document} ```
1
https://tex.stackexchange.com/users/65210
686706
318,571
https://tex.stackexchange.com/questions/100932
48
My `texmf.cnf` file contains these lines: ``` % Allow TeX \openin, \openout, or \input on filenames starting with `.' % (e.g., .rhosts) or outside the current tree (e.g., /etc/passwd)? % a (any) : any file can be opened. % r (restricted) : disallow opening "dotfiles". % p (paranoid) : as `r' and disallow going to parent directories, and % restrict absolute paths to be under $TEXMFOUTPUT. openout_any = p openin_any = a ``` But if I compile the following code via `lualatex`, the file `/home/login/unsafe.txt` is created! ``` \documentclass{article} \usepackage{luatextra} \begin{luacode*} function securityproblem(a) local file = assert(io.open(os.getenv("HOME") .. "/unsafe.txt", "w")) file:write("foobar\n") file:write(a) file:close() end \end{luacode*} \begin{document} \directlua{securityproblem("\today")} \end{document} ``` *Is luatex as secure as pdftex?* **Edit:** With the `--safer` option, `luatex` can't write files (via `io.open`) but `fontspec` (for example) is unusable. *Is there a safe way to use LuaTEX with `fontspec` (and other useful features of LuaTeX) ?* **Edit (May 2023)** The security of Lua(La)TeX seems to be taken into account in certain aspects: [LuaTeX Security Vulnerabilities](https://tug.org/%7Emseven/luatex.html) *Ten years after, does my question have an acceptable answer?*
https://tex.stackexchange.com/users/14500
Is luatex as secure as pdftex?
false
Setup ===== * Operating System: Arch Linux (Manjaro) * TeXLive: texlive-bin 2022.62885-3 * Terminal: Xfce/bash Technically, texlive-bin 2022.62885-3 is not the newest release at the time of writing (May 2023); but newer than the one that was available when the question was originally asked 10 years ago and according to [Tug Post](https://tug.org/%7Emseven/luatex.html) provided by the author of the question the version BEFORE the vulnerability fix was included. Observations ============ Update 1 (2023-05-25): ---------------------- Included output of `kpsewhere texmf.cnf`, thanks @Paul Gaborit for pointing out that command. 1. Compilation with `lualatex FILENAME.tex`, no modifications to `texmf.cnf` ---------------------------------------------------------------------------- creates the file at `/home/$USER/unsafe.txt` Output of `kpsewhere texmf.cnf`: `/usr/share/texmf-dist/web2c/texmf.cnf` 2. Compilation with `lualatex --safer FILENAME.tex` , no modifications to `texmf.cnf` ------------------------------------------------------------------------------------- does not work, since the `--safer` flag gets detected and throws an error message: `luaotfload can't run with option --safer. Aborting` `/usr/share/texmf-dist/tex/luatex/luaotfload/luaotfload.lua:105: safer_option used` Output of `kpsewhere texmf.cnf`: `/usr/share/texmf-dist/web2c/texmf.cnf` 3. Compilation with `lualatex FILENAME.tex`, additional local `texmf.cnf`, `TEXMFCNF` Option 1 ---------------------------------------------------------------------------------------------- I created a **LOCAL** `texmf.cnf` only containing: ``` openout_any = p openin_any = a ``` Before compilation, I added the line `export TEXMFCNF='PATH/TO/LOCAL/TEXMF/DIR/'` into my `~/.bashrc`. Like expected, the compilation fails due to `I can't find the format file 'lualatex.fmt'!` (and consequently does not produce `/home/$USER/unsafe.txt`), since the local `texmf.cnf` is technically incomplete and the missing information prevents lualatex to run in the first place. Output of `kpsewhere texmf.cnf`: (None) 4. Compilation with `lualatex FILENAME.tex`, additional local `texmf.cnf`, `TEXMFCNF` Option 2 ---------------------------------------------------------------------------------------------- I created a **LOCAL** `texmf.cnf` only containing: ``` openout_any = p openin_any = a ``` Before compilation, I added the line `export TEXMFCNF='PATH/TO/LOCAL/TEXMF/DIR/:'` into my `~/.bashrc` and compiled the MWE with `lualatex FILENAME.tex`. Now the compilation runs with no error, but also produces `/home/$USER/unsafe.txt` Output of `kpsewhere texmf.cnf`: `PATH/TO/LOCAL/TEXMF/DIR/texmf.cnf` ### Explanation: 1. The `:` at the end of the `TEXMFCNF` string allows Kpathsea to load all `texmf.cnf` it can find (including the default one). Omitting the `:` forces `kpathsea` to only use the path that is specified in `TEXMFCNF`. 2. Although the output of `kpsewhere` points towards `PATH/TO/LOCAL/TEXMF/DIR/texmf.cnf`, another `texmf.cnf` has to be loaded (since the local file is incomplete and should not allow a compilation). 5. Compilation with `lualatex FILENAME.tex`, only local `texmf.cnf`, `TEXMFCNF` Option 1 ---------------------------------------------------------------------------------------- I copied `/usr/share/texmf-dist/web2c/texmf.cnf` to a **LOCAL** `texmf.cnf` and added at the end: ``` openout_any = p openin_any = a ``` Before compilation, I added the line `export TEXMFCNF='PATH/TO/LOCAL/TEXMF/DIR/'` into my `~/.bashrc` and compiled the MWE with `lualatex FILENAME.tex`. The compilation creates the file at `/home/$USER/unsafe.txt` Output of `kpsewhere texmf.cnf`: `PATH/TO/LOCAL/TEXMF/DIR/texmf.cnf` **Explanation:** In the file `/usr/share/texmf-dist/web2c/texmf.cnf` the values for `openout_any` and `openin_any` are already set to the desired values. Summary of Observations ======================= Either the document does not compile at all or the undesired file `/home/$USER/unsafe.txt` will be created. Possible Reason =============== Update 1 (2023-05-25): ---------------------- According to the comment of @Paul Gaborit, > > the `TeX` part of `luatex` respects the settings related to `kpathsea`, but the `Lua` part of `luatex` ignores these settings. > > > This means that there is no way to control the behavior of `Lua` with a local `texmf.cnf`. In addition, `Lua` seems to also ignore the ``` openout_any = p openin_any = a ``` which are already set in the default `texmf.cnf`. Is there a safe way to use LuaTEX with fontspec (and other useful features of LuaTeX)? ====================================================================================== Consider the following MWE: ``` \documentclass{scrreprt} \usepackage{fontspec} \begin{document} Test Document to see, whether {\ttfamily fontspec} works with the {\ttfamily --safe} or other options \end{document} ``` Compilation with `lualatex FILENAME.tex` produces a valid pdf. Compilation with `lualatex --safe FILENAME.tex` aborts and gives the following error message: ``` (/usr/share/texmf-dist/tex/latex/base/fontenc.sty ! Font \TU/lmr/m/n/10.95=[lmroman10-regular]:+tlig; at 10.95pt not loadable: me tric data not found or bad. <to be read again> relax l.112 ...lt\familydefault\seriesdefault\shapedefault ``` So still, as of May 2023, the `--safe` option cannot be used in conjunction with `fontspec`. Using `\usepackage{fontspec-luatex}` does change nothing. The [LuaTeX Reference Manual](https://www.pragma-ade.com/general/manuals/luatex.pdf) provides additional, less restrictive command line options. They should in theory not block the file i/o, but e.g. networking capabilities. The command line options are: * `--nosocket` (prevents networking capabilities) * `--no-shell-escape` (prevents `shell-escape` completely) * `--shell-restricted` (restricts `shell-escape` to behavior defined in `texmf.cmf`) The MWE compiles with `lualatex --nosocket --no-shell-escape FILENAME.tex` as well as `lualatex --nosocket --shell-restricted FILENAME.tex` This of course does not offer as much protection as `--safer`, but should be better than none. So unfortunately, as by May 2023, there is no easy way to make `LuaLaTeX` safe and use all its functionality. Conclusion: Is `luatex` as secure as `pdftex`? ============================================== Well, that depends. In my opinion, there are two aspects to consider: 1. As soon as `shell-escape` is allowed, both `luatex` and `pdftex` are technically unsafe. In this case, malicious actors could inject code however they please, completely independent of what the internal capabilities of `luatex` and `pdftex` actually are. 2. But what if `shell-escape` is explicitly prohibited? This is a tricky one to answer definitively. One might argue that even without the `shell-escape` options, since the `Lua` programming language is very powerful and comparatively wider spread than `LaTeX`, a potential malicious actor would have a big knowledge base to profit from and more attack options at their disposal. However, `LaTeX3` is also insanely powerful and - in theory - could provide similar file i/o vulnerability as `Lua`. What reduces this risk is that the `LaTeX3` syntax is quite cumbersome and not widely used outside the hardcore LaTeX community. Consequently, as the knowledge base is smaller and less as well as less worthwhile targets are available, the attack risk could be assumed to be a lot smaller. In my humble opinion, there is no clear another possible as long as somebody tries to find `LaTeX3` exploits and to replicate the `LuaLaTeX` exploits outlined in the [Tug Post](https://tug.org/%7Emseven/luatex.html). Additionally, in my experience, the `Lua` subset one can use in `LuaLaTeX` out-of-the-box is/behaves quite different/ly as the regular `Lua`. So porting of (higher-level/complicated) malware is not always straightforward. My advice would be to at first use `pdftex` (if it provides you with all functionality you need) and only switch to `LuaLaTeX` if required. That also makes it easier to share your LaTeX files with other, less technically inclined LaTeX users, as in my experience sometimes the `LuaLaTeX` compilation is more tricky and the available functionality differs between different releases (versions as well as `MikTeX` versus `TeXLive`).
3
https://tex.stackexchange.com/users/260651
686707
318,572
https://tex.stackexchange.com/questions/523711
0
I would like to use XITS/XITS Math within my LaTeX project (which uses XeTeX). Following the answers to [this question](https://tex.stackexchange.com/questions/257231/using-the-tex-live-fonts-in-xelatex), I created a file `/etc/fonts/conf.avail/76-texlive-fonts.conf` with the following content: ``` <?xml version="1.0"?> <!DOCTYPE fontconfig SYSTEM "fonts.dtd"> <fontconfig> <dir>/usr/share/texlive/texmf-dist/fonts/opentype</dir> <dir>/usr/share/texlive/texmf-dist/fonts/truetype</dir> </fontconfig> ``` I had checked the above paths before to make sure that they are correct: ``` $ ls -l /usr/share/texlive/texmf-dist/fonts/opentype/public/xits -rw-r--r-- 1 root root 111280 Nov 25 2016 xits-bolditalic.otf -rw-r--r-- 1 root root 151692 Nov 25 2016 xits-bold.otf -rw-r--r-- 1 root root 115536 Nov 25 2016 xits-italic.otf -rw-r--r-- 1 root root 248956 Nov 25 2016 xits-mathbold.otf -rw-r--r-- 1 root root 530128 Nov 25 2016 xits-math.otf -rw-r--r-- 1 root root 249372 Nov 25 2016 xits-regular.otf ``` Afterwards, I added a symlink to `/etc/fonts/conf.d/`: ``` $ ls -l /etc/fonts/conf.d/76-texlive-fonts.conf lrwxrwxrwx 1 root root 35 Jan 10 13:15 /etc/fonts/conf.d/76-texlive-fonts.conf -> ../conf.avail/76-texlive-fonts.conf ``` …and ran `$ fc-cache -fv`. Its output, among others was: ``` /usr/share/texlive/texmf-dist/fonts/opentype/public/xits: caching, new cache contents: 6 fonts, 0 dirs ``` Still, when I run `fc-list | grep -i xits` now, there is no output and compiling the below MWE gives the following error, as expected: ``` … main.tex:11: !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! [\setmainfont{XITS}] main.tex:11: Font TU/XITS(0)/m/n/12=XITS at 12.0pt not loadable: Metric (TFM) file or installed font not found. [\setmainfont{XITS}] … main.tex:12: !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! [\setmathfont{XITS Math}] main.tex:12: Font TU/XITSMath(0)/m/n/12="XITS Math/OT" at 12.0pt not loadable: Metric (TFM) file or installed font not found. … ``` Here is the MWE: ``` \documentclass[12pt,a4paper]{article} \usepackage{fontspec} \usepackage{unicode-math} \setmainfont{XITS} \setmathfont{XITS Math} \begin{document} Hello! Some math: $y = f(x)$ \end{document} ``` I would very much appreciate any pointers to how I could fix or at least debug this problem! --- **[UPDATE]:** Turns out *none* of the fonts in `/usr/share/texlive/texmf-dist/fonts/` show up in `fc-list`: The output of `$ fc-list | grep /usr/share/texlive/texmf-dist/fonts` is completely empty. Nevertheless, dozens of fonts get recognized when running `sudo fc-cache -fv | grep /usr/share/texlive/texmf-dist/fonts`. What is going on here?
https://tex.stackexchange.com/users/26566
fontconfig doesn't list/find XITS font even after updating config
false
for `xetex` use the file names instead of the symbolic names: ``` \setmainfont{xits-regular.otf} \setmathfont{xits-math.otf} \setmathfont[version=bold]{xits-mathbold.otf} ```
0
https://tex.stackexchange.com/users/187802
686710
318,574
https://tex.stackexchange.com/questions/387966
4
If I typeset the following, (obviously) the *top* of the marginpar aligns with the last line of the paragraph, which looks ugly. ``` \documentclass{article} \begin{document} Some text some text some text some text some text some text some text some text some text some text some text some text some text some text some text some text some text some text some text.\marginpar{Lorem ipsum dolor sit amet, consectetur adipiscing elit.} \end{document} ``` Is there a way to align the *bottom* of a marginpar with the last line of the paragraph?
https://tex.stackexchange.com/users/141957
Align "bottom" of marginpar with "last" line of paragraph
false
Building up on the previous answer of John Kormylo, I try to address the issue of the box being raised too high if the previous paragraph extends only little into the next page. ``` \documentclass{article} \usepackage{kantlipsum} \usepackage{etoolbox} \newcommand{\marginparbottom}[1]{ \marginpar{% \raisebox{ \ifdimcomp{\height}{>}{\pagetotal}{% \dimexpr\pagetotal-5.95pt\relax }{% \dimexpr\height\relax% }% }{% \parbox{\marginparwidth}{\sloppy #1}% } } } \begin{document} \section{One} \kant[1-3] \section{Two} \kant[1] \marginparbottom{ Lorem ipsum dolor sit amet, consectetur adipiscing elit. Lorem ipsum dolor sit amet, consectetur adipiscing elit. Lorem ipsum dolor sit amet, consectetur adipiscing elit.} \end{document} ``` This somewhat works, but for some reason the manual calculation to account for baseline offset in the if-true-clause does not have any effect. It would be nice, if the first horizontal box in the margin paragraph did not rose above the first horizontal box in the main body.
1
https://tex.stackexchange.com/users/283313
686711
318,575
https://tex.stackexchange.com/questions/686258
0
The below code is the tex file content, which has listings package. ``` \documentclass[12pt,a4paper]{report} \usepackage{hyperref} \usepackage[english]{babel} \usepackage{xcolor} \usepackage{listings} % display coding \usepackage[none]{hyphenat} \definecolor{codegreen}{rgb}{0,0.6,0} \definecolor{codegray}{rgb}{0.5,0.5,0.5} \definecolor{codepurple}{rgb}{0.58,0,0.82} \definecolor{backcolour}{rgb}{0.95,0.95,0.92} \lstdefinestyle{mystyle}{ language=C++, breaklines=true, commentstyle=\color{codegreen}, keywordstyle=\color{magenta}, numberstyle=\tiny\color{codegray}, stringstyle=\color{codepurple}, basicstyle={\nhttfamily\footnotesize}, breakatwhitespace=false, frame=shadowbox, numbers=left, numbersep=10pt, linewidth=\textwidth, columns=flexible, } \lstset{style=mystyle} % document starts here... \begin{document} \lstinputlisting{xxx.cpp} \end{document} ``` the cpp file content for xxx.cpp shown below. ``` 1 //(title name) This Programme gives the ouput for the theory of the Programme gives the ouput for the theory of the Programme gives the ouput for the theory. 2 #include <iostream> 3 using namespace std; 4 int main() { 5 Code goes here... 6 return 0; 7 } ``` When the `yyy.tex` file runs, the first line of `xxx.cpp` appears outside the right margin. but when i change the option "`none`" to "`htt`" in `hyphenat` package, it gives correct output. but the remaining content of the tex document other than listings, it enables hyphenation. All i need is, with the `\usepackage[none]{hyphenat}`, i need the first line of cpp occurs within the frame. or any solution which would satisfy my both necessaries that, all the content in my document should be non-hyphenated and first line of .cpp stays within the frame. Thanks in Advance,
https://tex.stackexchange.com/users/136404
breakline is not working for lstlisting package while none option in hyphenat package used
false
You can change a penalty before the listing (it works with \lstinputlisting too): ``` \documentclass[12pt,a4paper]{report} \usepackage[none]{hyphenat} \usepackage{listings} \lstdefinestyle{mystyle}{ breaklines=true, breakatwhitespace=false, } \lstset{style=mystyle} \makeatletter\lst@AddToHook{PreSet}{\exhyphenpenalty=50 }\makeatother \begin{document} \begin{lstlisting} 1 //(title name) This Programme gives the ouput for the theory of the Programme gives the ouput for the theory of the \end{lstlisting} \end{document} ```
2
https://tex.stackexchange.com/users/2388
686713
318,576
https://tex.stackexchange.com/questions/686714
0
I am trying to link to local files in the pdf using absolute file path which contains spaces (this cannot be avoided since the files are being stored in iCloud whose local file path already contains a space). For `\url` there is an option `obeyspaces` which allows me to insert the file path directly without having to change space into `%20`. However this option does not work for `\href`. Is there some way to make `\href` absorb the input as `\url` does? Below is a MWE. ``` \documentclass{article} \PassOptionsToPackage{obeyspaces}{url} \usepackage{hyperref} \def\absolutepath{/Users/username/Library/Mobile Documents/com\string~apple\string~CloudDocs} \def\bookpath{The Path/For The/PDF File.pdf} \begin{document} \href{file://\absolutepath/\bookpath#page=40}{p.\,40} \url{file://\absolutepath/\bookpath#page=40} \end{document} ```
https://tex.stackexchange.com/users/194994
obeyspaces for \href
true
If you uncompress the pdf by adding at the begin ``` \ExplSyntaxOn\sys_ensure_backend:\pdf_uncompress:\ExplSyntaxOff ``` you can inspect the link annotations. For the url a (actually two) link annotation of action type URI is created: ``` /Subtype/Link /A<< /Type/Action /S/URI /URI(file:///Users/username/Library/Mobile\040Documents/com~apple~CloudDocs/The\040Path/For\040The/PDF\040File.pdf#page=40) >> ``` The value is actually faulty (but will probably work in most viewers anyway): is used `\040` for the spaces, but url's should be percent encoded. For the first hyperref creates a file link (GotoR): ``` /Subtype/Link /A<</S/GoToR /F(/Users/username/Library/Mobile\040Documents/com~apple~CloudDocs/The\040Path/For\040The/PDF\040File.pdf) /D(page=40)>> ``` It should normally work, if the local path is correct and no security settings prevent the opening of the file. If you load the pdfmanagement with \DocumentMetadata, you have a few more options both to force the action type and to automatically percent encode urls: ``` \DocumentMetadata{} %load pdfmanagement \documentclass{article} \PassOptionsToPackage{obeyspaces}{url} \usepackage{hyperref} \def\absolutepath{/Users/username/Library/Mobile Documents/com\string~apple\string~CloudDocs} \def\bookpath{The Path/For The/PDF File.pdf} \begin{document} \hrefpdf{file://\absolutepath/\bookpath#page=40}{p.\,40} %GoToR link \hrefurl[urlencode]{file://\absolutepath/\bookpath#page=40}{p.\,40} %URI link \url[urlencode]{file://\absolutepath/\bookpath#page=40} \end{document} ```
3
https://tex.stackexchange.com/users/2388
686721
318,580
https://tex.stackexchange.com/questions/686731
0
Consider: ``` \documentclass[12pt,a4paper,oneside]{book} \usepackage[a4paper,width=150mm,top=30mm,bottom=30mm,bindingoffset=6mm]{geometry} \usepackage[nottoc]{tocbibind} \usepackage[utf8]{inputenc} \usepackage[T1]{fontenc} \usepackage{bm} \usepackage{nccmath} \usepackage{amsfonts, graphicx, verbatim, mathtools,amssymb, amsthm, mathrsfs,amsmath} \usepackage{color} \usepackage{array} \usepackage{setspace} \usepackage{fancyhdr} \usepackage{rsfso} \usepackage{enumitem} \usepackage{tikz} \usetikzlibrary{babel, arrows.meta, positioning, quotes} \usepackage{parskip} \usepackage{lipsum} \usepackage{upgreek} \usepackage{floatrow} \usepackage{epstopdf} \usepackage[colorlinks,linkcolor=blue,anchorcolor=black,citecolor=black,filecolor=black,urlcolor=blue]{hyperref} \usepackage[all]{hypcap} \usepackage[capitalise]{cleveref} \usepackage{siunitx} \usepackage{tocloft} \usepackage{listings} \usepackage{booktabs} \usepackage{nicematrix} \usepackage{subcaption} \usepackage{multicol} \usepackage{geometry} \usepackage{tabularray} \UseTblrLibrary{booktabs, siunitx} \usepackage[thinc]{esdiff} \usepackage{ae} \usepackage [english]{babel} \usepackage [autostyle, english = american]{csquotes} \usepackage[style=numeric,maxbibnames=200,sortcites=true,backend=bibtex]{biblatex} \allowdisplaybreaks \begin{document} \frontmatter \newpage \pagestyle{fancy} \fancyhf{} \fancyhead[ER]{\nouppercase\leftmark} \fancyhead[OL]{\nouppercase\rightmark} \fancyhead[EL,OR]{\thepage} \begin{titlepage} \begin{center} %\begin{figure} %\centering %\includegraphics[width=9cm]{UoLLogo.png} %\end{figure} \rule[0.5cm]{15cm}{0.1cm} \Huge {blabla bla} \rule{15cm}{0.1cm} \\\vspace{3cm} {\normalsize \it{Thesis submitted for the degree of}} \\ {\normalsize \it{Doctor of blabla}} \\ {\normalsize \it{at the}} \\ {\normalsize \it{blablabla}}\\ \vfill \vspace{5cm} {\normalsize by} \\ {\normalsize bla}\\ {\normalsize bla}\\ {\normalsize University of bla}\\ {\normalsize bla}\\ \rule{15cm}{0.1cm} \end{center} \end{titlepage} \clearpage \begin{center} \thispagestyle{empty} \vspace*{\fill} \textit{bla} \vspace*{\fill} \end{center} \clearpage \setcounter{page}{1} \chapter{Abstract} \clearpage \tableofcontents \clearpage \phantomsection%<--- \listoffigures \clearpage \phantomsection%<--- \listoftables \clearpage \mainmatter \section{intro} \begin{equation}\label{a1} 2+2=4 \end{equation} observe \eqref{a1} is beautfiul. \section{bla} \end{document} ``` how can we make the equation one stay in blue but keep the TOC black?
https://tex.stackexchange.com/users/181561
Using hyperref, how do I change the links in the document to blue but leaving the TOC black?
true
I would suggest this way. 1. Use the `xcolor` package. 2. Use `\usepackage{hyperref}` with the `colorlinks` option. 3. Use `\hypersetup` command and the `linkcolor` parameter with the desired values. To see how it works, try the following. ``` \documentclass{article} \usepackage{xcolor} \usepackage[colorlinks]{hyperref} \begin{document} \hypersetup{linkcolor=black} \tableofcontents \bigskip \hypersetup{linkcolor=blue} Look at section no.~\ref{mylab}. \section{foo} \label{mylab} \end{document} ```
5
https://tex.stackexchange.com/users/174620
686732
318,583
https://tex.stackexchange.com/questions/632376
4
Observation ----------- When I press `Ctrl+S` in a `sample.tex` I get the following error: `LaTeX fatal error: spawn latexmk ENOENT, . PID: undefined.`. It [seems](https://github.com/James-Yu/LaTeX-Workshop/issues/2625) [to be](https://github.com/James-Yu/LaTeX-Workshop/issues/1337) a path related error. I **assume** this occurs because the `Latex Workshop` extension tries to compile something. Debugging --------- I like the syntax highlighting, and I expect there may be some other functionalities in the `LaTex Workshop` extension that I can appreciate in the near future. However, I don't want it to do anything other than save the file I edited when I press `Ctrl+s`. I **assume** it does not need some advanced path to do that, as it knows where the file is located, since it was opened from some location. When I press `Ctrl+F` inside the extension settings and type: `compile`, I get 8 results of which I found the `Latex-workshop>Latex>Recipes` and `Latex-workshop>latex:Tools` to be containing the word `compile`. However I did not yet find an option to disable compilation when saving. To verify the error is caused by the `LaTex Workshop` extension, I disabled it, tried saving the edited `sample.tex` file using `Ctrl+s`. That worked perfectly fine without raising errors. Note, the mentioned error can be resolved with: `sudo apt install latexmk` as explained in [this answer](https://tex.stackexchange.com/questions/596884/setting-up-latex-in-vs-code). However, I would prefer VScode not to start compiling when I save a file. Question -------- How can I ensure VScode saves an edited `.tex` file when I press `Ctrl+s`, without throwing errors, whilst using the `LaTex Workshop extension`?
https://tex.stackexchange.com/users/161901
How to prevent the LaTex Workshop extension from compiling when I save a file?
false
You can also navigate to `File` -> `Preferences` -> `Settings` -> `Open Settings (JSON)` (*top right*) and add the following to your `settings.json` file: ``` "latex-workshop.latex.autoBuild.run": "never", ``` This achieves the same as the accepted answer but is an alternative way. More information can be found in the [GitHub documentation about options for autoBuild](https://github.com/James-Yu/LaTeX-Workshop/wiki/Compile#latex-workshoplatexautobuildrun).
0
https://tex.stackexchange.com/users/273733
686734
318,584
https://tex.stackexchange.com/questions/686192
0
I`m trying to visualize a stretch of a protein with texshade. I would like to only show residues 400 to 600, shade some parts and put annotated braces above and below, but I get the entire sequence, some random characters before it, and depending on the order of the commands, no pdf. ``` \documentclass{article} \usepackage{texshade} \begin{document} \begin{filecontents*}{protein.fasta} >sp|P42566|EPS15_HUMAN Epidermal growth factor receptor substrate 15 OS=Homo sapiens OX=9606 GN=EPS15 PE=1 SV=2 MAAAAQLSLTQLSSGNPVYEKYYRQVDTGNTGRVLASDAAAFLKKSGLPDLILGKIWDLA DTDGKGILNKQEFFVALRLVACAQNGLEVSLSSLNLAVPPPRFHDTSSPLLISGTSAAEL PWAVKPEDKAKYDAIFDSLSPVNGFLSGDKVKPVLLNSKLPVDILGRVWELSDIDHDGML DRDEFAVAMFLVYCALEKEPVPMSLPPALVPPSKRKTWVVSPAEKAKYDEIFLKTDKDMD GFVSGLEVREIFLKTGLPSTLLAHIWSLCDTKDCGKLSKDQFALAFHLISQKLIKGIDPP HVLTPEMIPPSDRASLQKNIIGSSPVADFSAIKELDTLNNEIVDLQREKNNVEQDLKEKE DTIKQRTSEVQDLQDEVQRENTNLQKLQAQKQQVQELLDELDEQKAQLEEQLKEVRKKCA EEAQLISSLKAELTSQESQISTYEEELAKAREELSRLQQETAELEESVESGKAQLEPLQQ HLQDSQQEISSMQMKLMEMKDLENHNSQLNWCSSPHSILVNGATDYCSLSTSSSETANLN EHVEGQSNLESEPIHQESPARSSPELLPSGVTDENEVTTAVTEKVCSELDNNRHSKEEDP FNVDSSSLTGPVADTNLDFFQSDPFVGSDPFKDDPFGKIDPFGGDPFKGSDPFASDCFFR QSTDPFATSSTDPFSAANNSSITSVETLKHNDPFAPGGTVVAASDSATDPFASVFGNESF GGGFADFSTLSKVNNEDPFRSATSSSVSNVVITKNVFEETSVKSEDEPPALPPKIGTPTR PCPLPPGKRSINKLDSPDPFKLNDPFQPFPGNDSPKEKDPEIFCDPFTSATTTTNKEADP SNFANFSAYPSEEDMIEWAKRESEREEEQRLARLNQQEQEDLELAIALSKSEISEA \end{filecontents*} \begin{texshade}{protein.fasta} \hideconsensus \hidenames \showruler \residuesperline{50} \setdomain{1}{400..600} \feature{top}{1}{458..463}{brace}{cdk} \tintblock{1}{458..463} \end{texshade} \end{document} ``` [This](https://www.overleaf.com/6534718236bxrrwwydgqnr) is the overleaf.
https://tex.stackexchange.com/users/297368
texshade in overleaf produces errors that I don't understand
true
The nice people at overleaf helped: > > The current version of texshade installed on Overleaf would indeed have this error. If you upload the latest version of texshade.sty to your project (also attached), then the compilation should complete without errors. > When we upgrade to TeX Live 2023 later this year, texshade will also be upgraded on the server. > > > I've included the file in the [updated MWE](https://de.overleaf.com/read/ykznfjgybrmc). The other problem was caused by missing options ``` {1}{top} ``` in *\showruler*.
1
https://tex.stackexchange.com/users/297368
686735
318,585
https://tex.stackexchange.com/questions/686738
1
``` \documentclass{exam} \usepackage{graphicx} % Required for inserting images \title{2023 Non-Calc} \author{ccd1pga } \date{May 2023} \begin{document} \begin{center} \fbox{\fbox{\parbox{5.5in}{\centering Answer the questions in the spaces provided on the question sheets. If you run out of room for an answer, continue on the back of the page.}}} \end{center} \vspace{0.1in} \makebox[\textwidth]{Name and section:\enspace\hrulefill} \vspace{0.2in} \makebox[\textwidth]{Instructor’s name:\enspace\hrulefill} \begin{questions} %Start of all questions \pointsinmargin \noaddpoints \question[10] \begin{parts} \nopointsinmargin \addpoints \part[5] How do I do this? \end{parts} \end{questions} \end{document} ``` but I want "how do I get this? ............................(5)" for example, Thanks.
https://tex.stackexchange.com/users/267103
Changing the answer points using exams
true
By checking the doc of the `exam` [package](https://ctan.gutenberg-asso.fr/macros/latex/contrib/exam/examdoc.pdf), I found in sec 4.3.1 "Where the points will be printed": `the command \pointsinrightmargin will cause the point values to be set in the right margin,` I modified your MWE: ``` \begin{parts} \pointsinrightmargin \addpoints \part[5] How do I do this? \end{parts} ```
2
https://tex.stackexchange.com/users/216067
686739
318,587
https://tex.stackexchange.com/questions/686742
0
I would like to use the capdot (⩀) symbol but unfortunately it seems impossibile to use it so that I thought to put a question where I ask clarification about: I point out the symbol is present into the [TheComprehensiveLATEXSymbolList](https://www.math.toronto.edu/mathit/symbols-letter.pdf). To follow the code I am trying to use. ``` \documentclass[10pt]{article} \usepackage{titlesec} \usepackage{mathrsfs} \usepackage{amsfonts} \usepackage{amssymb} \usepackage{amsthm} \usepackage{amsmath} \usepackage{newtxtext} \usepackage{newtxmath} \usepackage{enumitem} \usepackage{yfonts} \usepackage{fontsize} \usepackage{soul} \usepackage[hang,flushmargin]{footmisc} \usepackage[T1]{fontenc} \usepackage{layout} \usepackage[paperheight=29.7cm,paperwidth=21cm,textwidth=17cm,textheight=25 cm]{geometry} \linespread{1.5} \setcounter{equation}{-1} \newtheorem{lemma}[equation]{Lemma} \newtheorem{proposition}[equation]{Proposizione} \newtheorem{corollary}[equation]{Corollario} \newtheorem{theorem}[equation]{Teorema} \begin{document} \fontfamily{lmr}\selectfont \end{document} ```
https://tex.stackexchange.com/users/296807
Which package do I have to use to print capdot (⩀) symbol?
true
In the interest of "teaching a person to fish": When using the Comprehensive Symbols List, the tables tell you which packages you need to load to use them. `\capdot` shows up in Table 50, which describes the binary operators in the MnSymbol package. One way to find out how to load these symbols is to search CTAN for "MnSymbol", which will helpfully give you [this result](https://ctan.org/pkg/mnsymbol?lang=en); the documentation there tells you that you should `\usepackage{MnSymbol}`. Importantly, though, the documentation also tells you that > > The MnSymbol package is incompatible with the > amssymb and amsfonts packages. It automatically loads the amsmath and textcomp packages. If you want to pass options to these packages you can either put the corresponding > \usepackage command before the \usepackage{MnSymbol} or you can include the options in the \documentclass command. > > > Seeing that you are loading both `amssymb` and `amsfonts` in your document, you may wish to pay attention to this.
2
https://tex.stackexchange.com/users/119
686747
318,590
https://tex.stackexchange.com/questions/686716
0
I have a very narrow table (2 columns) imported from a csv using csvreader that currently stretches over 3 pages. This looks a bit weird, so I would like to have all three pages of the table on the same page. Is there some option for this? I can't seem to find one. One possible solution that I thought about was to just use `\begin{multicols}{3}`, but I'm not sure if that will work and it's also not very elegant. Update: Tried `\begin{multicols}{3}`, but longtable doesn't like it. MWE: ``` \documentclass{article} \usepackage[utf8]{inputenc} \usepackage{csvsimple} \usepackage{longtable} \begin{document} \csvreader[ longtable = c|c, table head = Distanz (Pixel) & Graustufen \\\hline\endhead ]{im_171.csv}{}% {\csvlinetotablerow}% \end{document} ```
https://tex.stackexchange.com/users/297754
LaTeX csvreader/longtable: Put long narrow table multiple times on page
false
You could try splitting the table and working with minipages: ``` \documentclass{article} \usepackage[utf8]{inputenc} \usepackage{longtable} \begin{document} \begin{minipage}{.3\linewidth} \begin{longtable}{cc} A & B\\ 1 & 2\\ 1 & 2\\ 1 & 2\\ 1 & 2\\ 1 & 2\\ 1 & 2\\ 1 & 2\\ 1 & 2\\ 1 & 2\\ 1 & 2\\ 1 & 2\\ 1 & 2\\ 1 & 2\\ 1 & 2\\ 1 & 2\\ 1 & 2\\ 1 & 2\\ 1 & 2\\ 1 & 2\\ 1 & 2\\ 1 & 2\\ 1 & 2\\ 1 & 2 \end{longtable} \end{minipage} \begin{minipage}{.3\linewidth} \begin{longtable}{cc} A & B\\ 1 & 2\\ 1 & 2\\ 1 & 2\\ 1 & 2\\ 1 & 2\\ 1 & 2\\ 1 & 2\\ 1 & 2\\ 1 & 2\\ 1 & 2\\ 1 & 2\\ 1 & 2\\ 1 & 2\\ 1 & 2\\ 1 & 2\\ 1 & 2\\ 1 & 2\\ 1 & 2\\ 1 & 2\\ 1 & 2\\ 1 & 2\\ 1 & 2\\ 1 & 2 \end{longtable} \end{minipage} \begin{minipage}{.3\linewidth} \begin{longtable}{cc} A & B\\ 1 & 2\\ 1 & 2\\ 1 & 2\\ 1 & 2\\ 1 & 2\\ 1 & 2\\ 1 & 2\\ 1 & 2\\ 1 & 2\\ 1 & 2\\ 1 & 2\\ 1 & 2\\ 1 & 2\\ 1 & 2\\ 1 & 2\\ 1 & 2\\ 1 & 2\\ 1 & 2\\ 1 & 2\\ 1 & 2\\ 1 & 2\\ 1 & 2\\ 1 & 2 \end{longtable} \end{minipage} \end{document} ```
0
https://tex.stackexchange.com/users/17360
686750
318,591
https://tex.stackexchange.com/questions/686756
1
Consider the code: ``` \documentclass[12pt]{book} \begin{document} \thispagestyle{empty} \begin{enumerate} \itemsep3.0em \item Item 1 \item Item 2 \item Item 3 See also item [referenced \#, in this case \textbf{13}] \item Item 4 \item Item 5 \item Item 6 \item Item 7 \item Item 8 \item Item 9 \item Item 10 \item Item 11 \item Item 12 \item Item 13 (to be referenced). \item Item 14 \item Item 15 \end{enumerate} \end{document} ``` I would like to be able to reference a specific item number---in the MWE case--**13** I know that if I wanted to reference a page number, I could do something along the lines of `\pageref{Ref}` and `\label{Ref}`. QUESTION: Is there, perhaps, an analogous way to make reference to a specific item, so that in the case of the MWE, Latex automatically prints out "See also item **13**"? Thank you.
https://tex.stackexchange.com/users/192836
Cross Referencing an Item within an Enumerate Display
true
The basic `\label`-`\ref` mechanism works like a charm for items in an `enumerate`-type list. In the list part of the the document, just write ``` ... \item Item 12 \item \label{item:zzz} Item 13 \item Item 14 ... ``` Elsewhere in the document, you'd write ``` ... as shown in item \ref{item:zzz} above, ... ``` If you employ the `cleveref` package, you could write ``` ... as shown in \cref{item:zzz} above, ... ```
1
https://tex.stackexchange.com/users/5001
686759
318,596
https://tex.stackexchange.com/questions/686744
1
Example bibliography displays this way right now: > > [1] John Doe et al. Book Title. Publisher, 2023. > > > I want it to display that way: > > [1] Doe J., Smith A., Parker P., Edwards J. Book Title. Publisher, 2023. > > > I have absolutely no idea how to do it, no matter what I try it either doesn't compile or just does nothing. I'm considering abandoning automatic bibliography packages and simply do it manually. It will take a lot of time, but at least it will work, unlike `biblatex`. Here is the code: ``` \documentclass[a4paper,10pt]{article} \usepackage[english]{babel} \usepackage[nottoc]{tocbibind} \usepackage{biblatex} \usepackage{csquotes} \addbibresource{bibliography.bib} \title{Bibliography management} \author{Overleaf} \begin{document} \maketitle \tableofcontents \medskip \section{First Section} Cite \cite{author00}. \medskip \printbibliography \end{document} ``` Bibliography file: ``` @book{author00, title = {Book Title}, author = {John Doe and Adam Smith and Peter Parker and John Edwards}, year = {2023}, publisher = {Publisher}, } ```
https://tex.stackexchange.com/users/289855
Styling the bibliography with biblatex
true
From what I can see you only want to change the presentation of the author names. Almost all of the changes you need can be found in the introduction to `biblatex` customisation in [Guidelines for customizing biblatex styles](https://tex.stackexchange.com/q/12806/35864). Increase `maxbibnames` to a high value to show all names, set `giveninits` to `true` to show only the given name initials. Then you just need to change the name format from the `default` `given-family` to `family-given`. If you don't like to see an "and" before the last author and prefer the comma instead, redefine `finalnamedelim`. (See e.g. [Deleting the "and" inside the bibliography](https://tex.stackexchange.com/q/446997/35864.)) ``` \documentclass[a4paper,10pt]{article} \usepackage[english]{babel} \usepackage[nottoc]{tocbibind} \usepackage{csquotes} \usepackage[ backend=biber, style=numeric, maxbibnames=999, giveninits=true, ]{biblatex} \DeclareNameAlias{sortname}{family-given} \DeclareNameAlias{author}{sortname} \DeclareNameAlias{editor}{sortname} \DeclareNameAlias{translator}{sortname} \DeclareDelimAlias{finalnamedelim}{multinamedelim} \begin{filecontents}{\jobname.bib} @book{author00, title = {Book Title}, author = {John Doe and Adam Smith and Peter Parker and John Edwards}, year = {2023}, publisher = {Publisher}, } \end{filecontents} \addbibresource{\jobname.bib} \begin{document} \section{First Section} Cite \autocite{author00}. \printbibliography \end{document} ```
2
https://tex.stackexchange.com/users/35864
686760
318,597
https://tex.stackexchange.com/questions/301482
3
I'm writing a technical paper and there's a small annoyance on the pdf of my paper. At the bottom of the first page in the footnote the text ``` ACM ISBN 978-1-4503-2138-9. DOI: 10.1145/1235 ``` appears. This text throws the formatting of my paper off significantly and it leaves a huge gap of white space towards the bottom of the first page. How can I get rid of this? Is it a problem with the document class "sig-alternate-05-2015"?
https://tex.stackexchange.com/users/101892
ACM SIG Template: unwanted ACM ISBN and DOI
false
I observe the same behaviour with the new [ACM Primary Article Template](https://www.acm.org/publications/proceedings-template) (used as the SIG conference template), which includes the commands `\acmDOI` and `\acmISBN`. Calling these with an empty value will cause DOI / ISBN to be omitted from the ACM copyright section. ``` \acmDOI{} \acmISBN{} ``` To remove the copyright statement as well, call `\setcopyright{none}`. (In this case, you may also want to set `\acmYear{}` to prevent printing of the conference year on a line by itself.) To completely omit the ACM copyright and ACM reference sections, add the `nonacm` option to the `acmart` package, i.e. ``` \documentclass[sigconf,nonacm]{acmart} ```
0
https://tex.stackexchange.com/users/36583
686764
318,599
https://tex.stackexchange.com/questions/686765
2
I want to change the color of node q1 in slide 2 but without redrawing the same node. Is there a way to change it using Tikzset? I am not sure how to 'call' the node by its name (in this case q1) and change its color. Eventually, I want to use the pdf output to make a GIF. ``` \documentclass[hyperref={pdfpagelabels=false}]{beamer} %\usepackage{amssymb} \usepackage{graphicx} % Required for inserting images \usepackage{tikz} \usetikzlibrary{automata, positioning, arrows.meta,calc,cd,animations,shapes} \usetikzlibrary{patterns} \usetikzlibrary{datavisualization} \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 } %\usepackage{animate} \begin{document} \pgfdeclarelayer{background} \pgfsetlayers{background,main} \begin{frame} \begin{figure} \begin{tikzpicture}[node distance = 2cm, on grid,>={Stealth[inset=0pt,length=6pt,angle'=28,round]}][overlay] \node[state, initial] at (0,0) (q1) {$q^1$}; \node[state] at (1,-2.5) (q2) {$q^2$}; \node[state, right of=q2] (q3) {$q^3$}; \node[state, right of=q3] (q4) {$q^4$}; \node[state, right of=q4] (q5) {$q^5$}; \node[state,accepting] at (8,0) (q6) {$q^6$}; \node[state] at (2,0) (q7) {$q^7$}; \node[state, right of=q7] (q8) {$q^8$}; \node[state] at (6,0) (q9) {$q^9$}; \node[state] at (1,2.5) (q10) {$q^{10}$}; \node[state, right of=q10] (q11) {$q^{11}$}; \node[state, right of=q11] (q12) {$q^{12}$}; \node[state, right of=q12] (q13) {$q^{13}$}; \node[state,fill=red!20, densely dashed] at (2,-1.25) (q14) {$q^{14}$}; \node[state,fill=red!20, densely dashed] at (4,-1.25) (q15) {$q^{15}$}; \node[state,fill=red!20, densely dashed] at (2,1.25) (q16) {$q^{16}$}; \node[state,fill=red!20, densely dashed] at (6,1.25) (q17) {$q^{17}$}; \draw (q1) edge[bend right] node [below left]{$e^1$} (q2) (q2) edge node [below] {$e^2$} (q3) (q3) edge node [below]{$e^3$} (q4) (q4) edge node [below]{$e^4$} (q5) (q5) edge[bend right] node [below right] {$e^5$} (q6) (q1) edge node [above]{$e^6$} (q7) (q7) edge node [above]{$e^7$} (q8) (q8) edge node [above]{$e^8$} (q9) (q9) edge node [above]{$e^9$} (q6) (q1) edge[bend left] node [below left]{$e^{10}$} (q10) (q10) edge node [above]{$e^{11}$} (q11) (q11) edge node [above]{$e^{12}$} (q12) (q12) edge node [above]{$e^{13}$} (q13) (q13) edge[bend left] node [above right]{$e^{14}$} (q6) (q2) edge[bend right, densely dashed] node [above left]{$e^{15}$} (q14) (q14) edge[bend right, densely dashed] node [ right]{$e^{16}$} (q7) (q4) edge[bend right, densely dashed] node [ right]{$e^{17}$} (q15) (q15) edge[bend right, densely dashed] node [ right]{$e^{18}$} (q9) (q12) edge[bend left=10, densely dashed] node [ above]{$e^{19}$} (q16) (q16) edge[bend left=10, densely dashed] node [ above right]{$e^{20}$} (q9) (q12) edge[bend left=10, densely dashed] node [ above right]{$e^{21}$} (q17) (q17) edge[bend left, densely dashed] node [ above right]{$e^{22}$} (q9); \begin{pgfonlayer}{main} \draw<1->; \only<2->{ \node [state,fill=yellow] at (0,0) (q1) {$q^1$}; }; \draw<3-> (q7) to (q10); \end{pgfonlayer} \end{tikzpicture} \end{figure} \end{frame} \end{document} ```
https://tex.stackexchange.com/users/290854
Changing the already drawn node color in Tikz pgfonlayer
true
You can use the `overlay-beamer-styles` library to change the style of your node: ``` \documentclass[hyperref={pdfpagelabels=false}]{beamer} %\usepackage{amssymb} %\usepackage{graphicx} % Required for inserting images \usepackage{tikz} \usetikzlibrary{automata, positioning, arrows.meta,calc,cd,animations,shapes} \usetikzlibrary{patterns} \usetikzlibrary{datavisualization} \usetikzlibrary{overlay-beamer-styles} \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 } %\usepackage{animate} \begin{document} \begin{frame} \begin{figure} \begin{tikzpicture}[node distance = 2cm, on grid,>={Stealth[inset=0pt,length=6pt,angle'=28,round]}][overlay] \node[state, initial,alt=<2->{fill=yellow}{}] at (0,0) (q1) {$q^1$}; \node[state] at (1,-2.5) (q2) {$q^2$}; \node[state, right of=q2] (q3) {$q^3$}; \node[state, right of=q3] (q4) {$q^4$}; \node[state, right of=q4] (q5) {$q^5$}; \node[state,accepting] at (8,0) (q6) {$q^6$}; \node[state] at (2,0) (q7) {$q^7$}; \node[state, right of=q7] (q8) {$q^8$}; \node[state] at (6,0) (q9) {$q^9$}; \node[state] at (1,2.5) (q10) {$q^{10}$}; \node[state, right of=q10] (q11) {$q^{11}$}; \node[state, right of=q11] (q12) {$q^{12}$}; \node[state, right of=q12] (q13) {$q^{13}$}; \node[state,fill=red!20, densely dashed] at (2,-1.25) (q14) {$q^{14}$}; \node[state,fill=red!20, densely dashed] at (4,-1.25) (q15) {$q^{15}$}; \node[state,fill=red!20, densely dashed] at (2,1.25) (q16) {$q^{16}$}; \node[state,fill=red!20, densely dashed] at (6,1.25) (q17) {$q^{17}$}; \draw (q1) edge[bend right] node [below left]{$e^1$} (q2) (q2) edge node [below] {$e^2$} (q3) (q3) edge node [below]{$e^3$} (q4) (q4) edge node [below]{$e^4$} (q5) (q5) edge[bend right] node [below right] {$e^5$} (q6) (q1) edge node [above]{$e^6$} (q7) (q7) edge node [above]{$e^7$} (q8) (q8) edge node [above]{$e^8$} (q9) (q9) edge node [above]{$e^9$} (q6) (q1) edge[bend left] node [below left]{$e^{10}$} (q10) (q10) edge node [above]{$e^{11}$} (q11) (q11) edge node [above]{$e^{12}$} (q12) (q12) edge node [above]{$e^{13}$} (q13) (q13) edge[bend left] node [above right]{$e^{14}$} (q6) (q2) edge[bend right, densely dashed] node [above left]{$e^{15}$} (q14) (q14) edge[bend right, densely dashed] node [ right]{$e^{16}$} (q7) (q4) edge[bend right, densely dashed] node [ right]{$e^{17}$} (q15) (q15) edge[bend right, densely dashed] node [ right]{$e^{18}$} (q9) (q12) edge[bend left=10, densely dashed] node [ above]{$e^{19}$} (q16) (q16) edge[bend left=10, densely dashed] node [ above right]{$e^{20}$} (q9) (q12) edge[bend left=10, densely dashed] node [ above right]{$e^{21}$} (q17) (q17) edge[bend left, densely dashed] node [ above right]{$e^{22}$} (q9); \end{tikzpicture} \end{figure} \end{frame} \end{document} ``` (the .gif was created with ImageMagick `convert -delay 30 -loop 0 -density 100 -alpha remove "document".pdf "document".gif`)
1
https://tex.stackexchange.com/users/36296
686769
318,600
https://tex.stackexchange.com/questions/666483
3
I'd like to create an environment, which will have its own parsing rules inside, for example: ``` \begin{foo} a := 42; c := a; \end{foo} ``` Would be understood as: ``` a \mapsto 42 \\[2pt] c \mapsto a \\[2pt] ``` Here, `:=` is understood by TeX as `\mapsto` and `;` as `\\[2pt]`. Is it at all possible?
https://tex.stackexchange.com/users/1449
How to make plain text be understood as a macro?
false
A token-cycle pseudo-environment `\foo...\endfoo` can accomplish this directly in (La)TeX. I show not only the typeset result, but the detokenized tokens that result in the converted token list. ``` \documentclass{article} \usepackage[T1]{fontenc} \usepackage{tokcycle} \tokcycleenvironment\foo {\ifx;##1\addcytoks{\\[2pt]}\else \ifx:##1 \tcpeek\z\ifx=\z\addcytoks{\mapsto}\tcpop\z\else \addcytoks{##1}\fi\else \addcytoks{##1}\fi\fi} {\processtoks{##1}} {\addcytoks{##1}} {\addcytoks{##1}} \begin{document} \noindent$\foo a := 42; c := a; \endfoo % \textrm{\detokenize\expandafter{\the\cytoks}}$ \end{document} ```
0
https://tex.stackexchange.com/users/25858
686775
318,604
https://tex.stackexchange.com/questions/686501
0
I have this table, that I need to color it's first row similar to the second example, however, it is not working because of the `\multirow` command, cannot be done despite the row command. If I used the `\cellcolor` the mission word will be clipped. ``` \begin{table}[b!] \begin{center} \renewcommand{\arraystretch}{1.4} \scriptsize \begin{tabular}{|m{0.17\textwidth}| % <-- use 'm', not 'p', col. type m{0.1\textwidth}| m{0.11\textwidth}| m{0.12\textwidth}| m{0.12\textwidth}| } \hline \hline \multirow{ 2}{*}{A} & \multicolumn{2}{c|}{X} & \multicolumn{2}{c|}{Y} \\ \cline{2-5} & Z & L &M & N \end{tabular} \end{center} \end{table} \begin{table}[t!] \begin{center} \renewcommand{\arraystretch}{1.4} \scriptsize \begin{tabular}{|m{0.17\textwidth}| % <-- use 'm', not 'p', col. type m{0.06\textwidth}| m{0.11\textwidth}| m{0.12\textwidth}| m{0.12\textwidth}| m{0.18\textwidth}| } \hline \hline \rowcolor{myblue!30} A & B & C & D & E & F\\ \hline \hline \end{tabular} \end{center} \label{Table01} \end{table} ```
https://tex.stackexchange.com/users/98778
\rowcolor is not working with \multirow
false
An alternative solution with `tabularray`: ``` \documentclass{article} \usepackage{tabularray} \usepackage[svgnames]{xcolor} \colorlet{myblue}{Blue!30} \begin{document} \begin{table} \centering\scriptsize \begin{tblr}{ colspec={X[1.7]XX[1.1]*2{X[1.2]}}, vlines, hlines, stretch=1.4, cell{1}{1}={r=2}{bg=myblue}, cell{1}{2,4}={c=2}{c}, } \hline A & X & & Y & \\ & Z & L & M & N \\ \hline \end{tblr} \end{table} \end{document} ```
0
https://tex.stackexchange.com/users/101651
686779
318,608
https://tex.stackexchange.com/questions/311053
1
I am trying to make a table (code below) that should contain three headings and five equally spaced sub columns but the one on the far right does not want to agree. If I make the really long heading on multiple lines then all is tidy but I'd rather have a nicely spaced wide table. ``` \documentclass[[a4paper,12pt]{article} \usepackage{pgfplotstable} \usepackage{booktabs} \begin{document} \begin{table} \centering \caption{Multicolumn Table} \pgfplotstabletypeset[ header=false, every head row/.style={after row={\toprule\toprule \multicolumn{1}{c}{C} & \multicolumn{1}{c}{B} & \multicolumn{3}{c}{A very Long Heading On One Line}\\}}, every first row/.style={after row=\midrule}, every last row/.style={after row=\bottomrule\bottomrule}, string type, columns/0/.style={column name=}, columns/1/.style={column name=}, columns/2/.style={column name=}, columns/3/.style={column name=}, columns/4/.style={column name=}, columns/5/.style={column name=}, columns/6/.style={column name=}, col sep=comma, row sep=\\, string type, ]{ ,,d,e,f\\ 1,4,2,8,1\\ 5,5,5,8,6\\ 2,6,4,6,2\\ 3,7,5,6,5\\ 9,8,3,3,3\\ 7,9,1,5,1\\ 7,7,4,9,2\\ 6,1,3,7,7\\ 2,7,1,3,8\\ 7,9,5,5,7\\ 9,4,6,5,7\\ Ans,,9,9,9\\ } \end{table} \end{document} ```
https://tex.stackexchange.com/users/106325
pgfplotstable, multicolumn sp
false
You can set a dimension for the columns, for example with ``` \newcolumntype{C}{>{\centering\arraybackslash}p{2cm}} ``` and then use `C` in the column style: ``` \documentclass[a4paper,12pt]{article} \usepackage{pgfplotstable} \pgfplotsset{compat=1.18} \usepackage{booktabs} \newcolumntype{C}{>{\centering\arraybackslash}p{2cm}}% a centered fixed-width-column \begin{document} \begin{table} \centering \caption{Multicolumn Table} \pgfplotstabletypeset[ header=false, every head row/.style={after row={\toprule\toprule \multicolumn{1}{c}{C} & \multicolumn{1}{c}{B} & \multicolumn{3}{c}{A very Long Heading On One Line}\\}}, every first row/.style={after row=\midrule}, every last row/.style={after row=\bottomrule\bottomrule}, string type, columns/0/.style={column type=C,column name=}, columns/1/.style={column type=C,column name=}, columns/2/.style={column type=C,column name=}, columns/3/.style={column type=C,column name=}, columns/4/.style={column type=C,column name=}, columns/5/.style={column type=C,column name=}, col sep=comma, row sep=\\, string type, ]{ ,,d,e,f\\ 1,4,2,8,1\\ 5,5,5,8,6\\ 2,6,4,6,2\\ 3,7,5,6,5\\ 9,8,3,3,3\\ 7,9,1,5,1\\ 7,7,4,9,2\\ 6,1,3,7,7\\ 2,7,1,3,8\\ 7,9,5,5,7\\ 9,4,6,5,7\\ Ans,,9,9,9\\ } \end{table} \end{document} ```
1
https://tex.stackexchange.com/users/101651
686784
318,610
https://tex.stackexchange.com/questions/686770
0
Suppose I use biblatex and that I cite two papers by two authors with the same last name, A. Smith (2019) and B. Smith (2020). If I use, say `\textcite{Smith2020}`, it may compile as > > Lorem ipsum dolor sit amet, consectetur **B.** > > > **Smith (2020)** adipiscing elit, sed do eiusmod > > > How can I get it to compile as the following? > > Lorem ipsum dolor sit amet, consectetur > > > ****B.** Smith (2020)** adipiscing elit, sed do eiusmod > > >
https://tex.stackexchange.com/users/51091
How to get \textcite{} to insert a non-breaking space between the first name initial and the last name in the main text?
true
The safest way is probably ``` \documentclass[british]{article} \usepackage[T1]{fontenc} \usepackage{babel} \usepackage{csquotes} \usepackage[backend=biber, style=authoryear]{biblatex} \newbibmacro*{name:giveni-family}[4]{% \usebibmacro{name:delim}{#2#3#1}% \usebibmacro{name:hook}{#2#3#1}% \mkbibcompletenamegivenfamily{% \ifdefvoid{#2} {} {\mkbibnamegiven{#2}\isdot\addnbspace}% \ifdefvoid{#3} {} {\mkbibnameprefix{#3}\isdot \ifprefchar {} {\ifuseprefix{\bibnamedelimc}{\bibnamedelimd}}}% \mkbibnamefamily{#1}\isdot \ifdefvoid{#4}{}{\bibnamedelimd\mkbibnamesuffix{#4}\isdot}}} \DeclareNameFormat{labelname}{% \ifcase\value{uniquename}% \usebibmacro{name:family} {\namepartfamily} {\namepartgiven} {\namepartprefix} {\namepartsuffix}% \or \ifuseprefix {\usebibmacro{name:giveni-family} {\namepartfamily} {\namepartgiveni} {\namepartprefix} {\namepartsuffixi}} {\usebibmacro{name:giveni-family} {\namepartfamily} {\namepartgiveni} {\namepartprefixi} {\namepartsuffixi}}% \or \usebibmacro{name:given-family} {\namepartfamily} {\namepartgiven} {\namepartprefix} {\namepartsuffix}% \fi \usebibmacro{name:andothers}} \begin{filecontents}{\jobname.bib} @book{aelk, author = {Anne Elk}, title = {A Theory on Brontosauruses}, year = {1972}, publisher = {Monthy \& Co.}, location = {London}, } @book{celk, author = {Catherine Elk}, title = {A Theory on Other Dionsaurs}, year = {2021}, publisher = {Monthy \& Co.}, location = {London}, } \end{filecontents} \addbibresource{\jobname.bib} \addbibresource{biblatex-examples.bib} \begin{document} Lorem ipsum dolor sit amet dolor sit amet igitur a \textcite{aelk} ipsum \autocite{celk} \printbibliography \end{document} ``` do note that using a nonbreakable space in this position does not necessarily guarantee that the whole name moves to the next line. You could also get an overful line.
1
https://tex.stackexchange.com/users/35864
686788
318,612
https://tex.stackexchange.com/questions/686787
3
I try to check if \institute is empty in a beamer document. This fails. I found the solution for \author already here: [Why does \insertauthor lead to an error inside \ifthenelse statement?](https://tex.stackexchange.com/questions/679478/why-does-insertauthor-lead-to-an-error-inside-ifthenelse-statement) You can access \beamer@shortauthor to check if author is empty. What is the solution for \institute? ``` \documentclass{beamer} \usepackage{ifthen} %\title{Title goes here} \institute{me} \begin{document} \ifthenelse{\equal{\insertinstitute}{}}{empty}{not empty} \end{document} ```
https://tex.stackexchange.com/users/281557
How can I access \institute content with \ifthenelse in beamer?
true
You can get some inspiration from the [inmargin inner theme](http://mirrors.ctan.org/macros/latex/contrib/beamer/base/themes/inner/beamerinnerthemeinmargin.sty), which also tests for an empty institute and uses a `\ifx...\else...\fi` construct for this: ``` \documentclass{beamer} \institute{me} \makeatletter \newcommand{\testinst}{% \ifx\insertinstitute\@empty empty \else not empty \fi } \makeatother \begin{document} \begin{frame} \testinst \end{frame} \end{document} ```
2
https://tex.stackexchange.com/users/36296
686789
318,613
https://tex.stackexchange.com/questions/686792
6
The [documentation of `xparse`](//texdoc.net/pkg/xparse) states (emphasis mine): > > *`r`* Given as `r⟨token1⟩⟨token2⟩`, this denotes a “required” delimited argument, where the delimiters are `⟨token1⟩` and `⟨token2⟩`. **If the opening delimiter `⟨token1⟩` is > missing, the default marker `-NoValue-` will be inserted after a suitable error.** > > *`R`* Given as `R⟨token1⟩⟨token2⟩{⟨default⟩}`, this is a “required” delimited argument as for `r`, **but it has a user-definable recovery `⟨default⟩` instead of `-NoValue-`**. > > > However in both cases, an error is produced if the parameter is not specified. And I can't see any difference in the error message between `r` and `R`. * How exactly does this *default marker *`-NoValue-`** intervene? * And what is the purpose of this additional `{⟨default⟩}`? Any use case? Is it to avoid additional errors where the corresponding parameter `#N` is used? Or (for `R`) somehow document the parameter with that default value? Any notable difference between `r` and `R` in the end? Note: I already know about the related optional types `d`/`D`.
https://tex.stackexchange.com/users/132778
\NewDocumentCommand: Mandatory types r / R and their “default values”
true
Let's do a test: ``` \documentclass{article} \NewDocumentCommand{\test}{r<>}{?#1?} \begin{document} \test<X> \test X \end{document} ``` Upon running LaTeX on it we get ``` ! LaTeX cmd Error: Required argument missing for command '\test'. For immediate help type H <return>. ... l.9 \test X ``` and the output is You see that, in order to recover from the error, LaTeX inserts `<-NoValue>` after `\test`, so processing can continue without a possible further error from a missing `>`. The output would be invalid anyway. Second test. ``` \documentclass{article} \NewDocumentCommand{\test}{R<>{what}}{?#1?} \begin{document} \test<X> \test X \end{document} ``` The error message is the same, but now the output is Instead of “what” you can use something different that will catch your attention in the PDF file. Better than `-NoValue-`. This might also be useful if you do something more complicated with the argument, so you can perhaps avoid further error messages.
5
https://tex.stackexchange.com/users/4427
686793
318,614
https://tex.stackexchange.com/questions/686783
1
I was wondering how to remove the double empty pages before Chapter 1 and the Bibliography in the following book example. I tried `\cleardoublepage` and `\usepackage{emptypage}` with no success. I believe it is due to setting the interline spacing with `\onehalfspacing` using `\usepackage{setspace}`, but I need this function. The argument `openany` for `\documentlass` is not desired. Any suggestions to make the document quality more elegant would be appreciated. Thanks. ``` \documentclass[12pt]{extbook} \pagestyle{myheadings} \usepackage{setspace} \onehalfspacing \usepackage{hyperref} \hypersetup{hidelinks} \usepackage{pgfornament} \usepackage{lipsum} \title{Book Title} \author{Author} \date{} \newcommand\institute{ Department \par \medskip University \par City, State} \begin{document} \frontmatter \begin{titlepage} \makeatletter \centering {\LARGE\bfseries\baselineskip1.25em\@title\par} \par \vfill {\large\bfseries\@author} \par \@date \makeatother \vfill \pgfornament[width=.35\linewidth]{84} \bigskip \par \institute \end{titlepage} % Empty page \phantom{} \pagebreak % Dedication \topskip0pt \vspace*{\fill} \begingroup \centering \lipsum[1-1] \endgroup \vspace*{\fill} \chapter{Preface} \lipsum[2-3] \tableofcontents \addcontentsline{toc}{chapter}{Contents} \chapter{Introduction} \lipsum[4-6] \mainmatter \chapter{Title of Chapter 1} \lipsum[5-25] \cite{Akhiezer62} \chapter{Title of Chapter 2} \lipsum[30-45] \backmatter \bibliographystyle{plainnat} \begin{thebibliography}{100} \bibitem[Akhiezer(1962)]{Akhiezer62} N.~I. Akhiezer. \newblock \emph{The Calculus of Variations}. \newblock Blaisdell Publishing Company, New York, London, 1962. \end{thebibliography} \addcontentsline{toc}{chapter}{Bibliography} \end{document} ```
https://tex.stackexchange.com/users/62605
Remove double empty pages before book chapters
true
Thanks to @DavidCarlisle comment above, I believe removing `\topskip0pt` solves the problem.
0
https://tex.stackexchange.com/users/62605
686794
318,615
https://tex.stackexchange.com/questions/686796
8
I read somewhere that you should use `\dimexpr ... \relax` when defining lengths. Is that really the case? There seems to be no difference between using it or not: ``` \documentclass{article} \newlength{\onelen} \newlength{\twolen} \newlength{\threelen} \setlength{\threelen}{5em} \setlength{\onelen}{2.5\threelen} \setlength{\twolen}{\dimexpr2.5\threelen\relax} \begin{document} a \hspace{\onelen} b c \hspace{\twolen} d \end{document} ``` Are there specific circumstances where you should use it or can you skip it and make the length more readable?
https://tex.stackexchange.com/users/281557
Why would I use \dimexpr .. \relax in \setlength?
false
Look at the definition of `\setlength` ``` % latex.ltx, line 7668: \def\setlength#1#2{#1 #2\relax} ``` Now let's try ``` \documentclass{article} \newlength{\test} \begin{document} \setlength{\test}{\dimexpr 3pt+1cm} plus something else \end{document} ``` This will issue the puzzling error message ``` ! Missing number, treated as zero. <to be read again> s l.7 \setlength{\test}{\dimexpr 3pt+1cm} plus s omething else ``` Always use `\relax` to end `\dimexpr`, unless you are 100% sure that you can omit it. It would be the same with your ``` \setlength{\twolen}{\dimexpr2.5\threelen} ``` if something like `plus` or `minus` follows. By the way, ``` \setlength{\onelen}{2.5\threelen} ``` is way more efficient and will not run into the problem described above.
11
https://tex.stackexchange.com/users/4427
686799
318,617
https://tex.stackexchange.com/questions/652835
0
Feeding ``` \documentclass{article} \usepackage{footmisc} \usepackage{marginfix} \usepackage{todonotes} \begin{document} \todo{test} \end{document} ``` to `pdflatex` leads to a compilation error: ``` ! Package marginfix Error: lost some margin notes. See the marginfix package documentation for explanation. Type H <return> for immediate help. ... l.7 \end{document} ? Q ``` Unfortunately, the explanation in § 13 of the documentation of marginfix says nothing to me. Having a bit more text, say, ``` \begin{document} test \todo{test} test \end{document} ``` doesn't help. Used versions: * pdfTeX, Version 3.141592653-2.6-1.40.24 (TeX Live 2022/Debian) * LaTeX2e <2021-11-15> patch level 1 * L3 programming layer <2022-06-02> * article 2021/10/04 v1.4n * footmisc 2022/03/08 v6.0d * marginfix 2020/05/06 v1.2 * todonotes 2021/06/04 v1.1.5 This is the current Debian testing TeX Live. In Debian stable TeX Live, the aforementioned code works (or at least worked several months ago). Who is the culprit and what to do?
https://tex.stackexchange.com/users/nan
footmisc + marginfix + todonotes = error
false
marginfix patches into `\@combinefloats` and footmisc uses a new output routine where this no longer works (or rather has no effect it it comes *after* footmisc. So instead of using the old version of footmisc one can simply load marginfix first. Given that the the output routine of LaTeX will change (along the lines that footmisc already uses, but with additional hooks for other packages) the low-level patching for something like `\@combinefloats` the way it is done by marginfix has no future and should be replaced at some point in the future when appropriate hooks are made availabe for "safe" patching. By the way, the problem is unrelated to todonotes and you can drop the package and use a `\marginpar` to generate the error.
0
https://tex.stackexchange.com/users/10109
686802
318,619
https://tex.stackexchange.com/questions/686800
1
My table: ``` \begin{table}[!htb] \caption{Question} \label{tab:q} \begin{tabular}{@{}lclclclcl@{}} \toprule & \multicolumn{4}{l}{\textbf{Event 1}} & \multicolumn{4}{l}{\textbf{Event 2}} \\ \cmidrule(l){2-9} \textbf{} & \multicolumn{2}{l}{Prob} & \multicolumn{2}{l}{Amount} & \multicolumn{2}{l}{Prob} & \multicolumn{2}{l}{Amount} \\ \midrule \textbf{Graduation} & 0.1482 & *** & 487.17 & & $-0.2209$ & *** & $-1,613.31$ & *** \\ \textbf{} & (0.0409) & & (520.14) & & (0.0491) & & (396.12) & \\ \textbf{First job} & 0.1174 & *** & 2,891.29 & ** & -0.1756 & *** & $-1,516.49$ & *** \\ \textbf{} & (0.0312) & & (1283.82) & & (0.0319) & & (517.66) & \\ \textbf{First marriage} & $-0.0246$ & & $-1,780.18$ & ** & 0.0413 & *** & 379.59 & *** \\ \textbf{} & (0.0168) & & (656.93) & & (0.0140) & & (131.73) & \\ \textbf{First child} & $-0.0514$ & ** & $-369.90$ & & 0.0808 & *** & 1,234.24 & ** \\ & (0.0243) & & (1328.18) & & (0.0206) & & (603.08) & \\ \midrule \multicolumn{9}{l}{Standard errors are in parentheses.} \end{tabular} \end{table} ``` I want the numbers to be aligned by decimal points. I know this question is frequently asked, but I cannot reproduce the code on my table since I do not understand what the code like `\newcolumntype{d}[1]{D{.}{.}{#1}}` or `\begin{tabular}{l *{4}{d{3.3}} }` means. Edit: Shoutout to Steven! I can reproduce the results now!
https://tex.stackexchange.com/users/251582
How to align numbers on decimal points? Please explain the meaning of the code
true
Here, I use an approach I set out in the **BONUS** section of this answer: [Specifying minimal (not fixed) width in tabular](https://tex.stackexchange.com/questions/402414/specifying-minimal-not-fixed-width-in-tabular/478054#478054). I created by own `D` column type that takes an argument that specifies the max number of digits following the decimal point (here, the right paren counts as a digit). The only change I needed to your input was to isolate the minus signs in their own math group, as in `$-$xx.xx` rather than include the complete cell entry in math, as in `$-xx.xx$`, since the parser needs to separate the pre-decimal content from the post-decimal content. ``` \documentclass{article} \usepackage{tabularx,stackengine,collcell,booktabs} \let\endecm\relax \newcolumntype{D}[1]{>{\collectcell\Decm l{#1}}r<% {..\endDecm\endcollectcell}} \def\decm#1#2#3.#4.#5\endDecm{#3.% \stackengine{0pt}{#4}{\rule{#2\wd0}{0pt}}{O}{#1}{F}{F}{L}} \newcommand\Decm[1]{\setbox0=\hbox{0}\decm#1} \begin{document} \begin{tabular}{@{}lD{5}lD{3}lD{5}lD{3}l@{}} \toprule & \multicolumn{4}{l}{\textbf{Event 1}} & \multicolumn{4}{l}{\textbf{Event 2}} \\ \cmidrule(l){2-9} \textbf{} & \multicolumn{2}{l}{Prob} & \multicolumn{2}{l}{Amount} & \multicolumn{2}{l}{Prob} & \multicolumn{2}{l}{Amount} \\ \midrule \textbf{Graduation} & 0.1482 & *** & 487.17 & & $-$0.2209 & *** & $-$1,613.31 & *** \\ \textbf{} & (0.0409) & & (520.14) & & (0.0491) & & (396.12) & \\ \textbf{First job} & 0.1174 & *** & 2,891.29 & ** & $-$0.1756 & *** & $-$1,516.49 & *** \\ \textbf{} & (0.0312) & & (1283.82) & & (0.0319) & & (517.66) & \\ \textbf{First marriage} & $-$0.0246 & & $-$1,780.18 & ** & 0.0413 & *** & 379.59 & *** \\ \textbf{} & (0.0168) & & (656.93) & & (0.0140) & & (131.73) & \\ \textbf{First child} & $-$0.0514 & ** & $-$369.90 & & 0.0808 & *** & 1,234.24 & ** \\ & (0.0243) & & (1328.18) & & (0.0206) & & (603.08) & \\ \midrule \multicolumn{9}{l}{Standard errors are in parentheses.} \end{tabular} \end{document} ```
2
https://tex.stackexchange.com/users/25858
686804
318,620
https://tex.stackexchange.com/questions/686803
1
Dear LaTeX enthusiasts, I have been trying to deal with a problem for days and I fear, it will still take me days if not months to find an answer myself -- if I ever find one at all. So I would very much appreciate your help. My problem: I have adapted the definitions of headlines of chapter, section and so on to my needs -- and they now look just like I want them for the text, I am working at. One of my adaptions is, that I changed the color of the headlines. But this change of color had an unwanted side effect: Now it can happen, that a lonely headline of section or subsection is seen at the very bottom of the page, the first line of text after that only appearing at the next page. I have tried to write a minimum example: ``` \documentclass[12pt,fleqn,twoside]{report}% \usepackage[utf8]{inputenc}% \usepackage[T1]{fontenc}% \usepackage[ngerman,english]{babel}% \usepackage{color}% \usepackage[varumlaut]{yfonts}% Oldstyle headlines \usepackage{blindtext}% %Adapted chapter headline \makeatletter \def\@makechapterhead#1{% \vspace*{-20\p@}% {\parindent \z@ \raggedright \large\textsc{\@chapapp\space \thechapter} \par\nobreak \interlinepenalty\@M \LARGE\color{blue} \textfrak{#1}\par\nobreak % \LARGE \textfrak{#1}\par\nobreak \vskip 20\p@ }} \def\@makeschapterhead#1{% \vspace*{50\p@}% {\parindent \z@ \raggedright \interlinepenalty\@M \LARGE\color{blue} \textfrak{#1}\par\nobreak % \LARGE \textfrak{#1}\par\nobreak \vskip 40\p@ }} \makeatother %Adapted headlines of section and subsection \makeatletter% \renewcommand\section{% \@startsection {section}{1}{\z@}% {-3.5ex \@plus -1ex \@minus -.2ex}% {2.3ex \@plus.2ex}% {\color{blue}\large\frakfamily}}% % {\large\frakfamily}}% % \renewcommand\subsection{% \@startsection{subsection}{2}{\z@}% {-3.25ex\@plus -1ex \@minus -.2ex}% {1.5ex \@plus .2ex}% {\color{blue}\frakfamily}}% % {\frakfamily}}% \makeatother% \begin{document} \chapter{The chapter} \blindtext[2]\\% text\\ text\\ text\\ text\\ text\\ text\\ text\\ text\\ text\\ text\\ \section{The section} \subsection{The subsection} \blindtext \end{document} ``` It is not perfect though: I can't provoke it to only show a section headline directly followed by text to be interrupted by a pagebreak. But I managed to provoke a pagebreak between section headline and subsection headline. Chapter headlines never are a problem up to now -- probably as their definition is quite different as well. For experimentation purposes I have given the lines without the color definition as well -- if you use them, the appearance of the text alters a bit and the problem can not be reproduced, even if you add some "text\\" lines. My questions: 1. Why is coloration of headlines altering the appearance of the text? 2. What can I do for not having a pagebreak directly after a (section/subsection/subsubsection/paragraph) headline? Can anybody help me?
https://tex.stackexchange.com/users/202047
Lonely section headline at bottom of page
false
Avoid adding color whatsit nodes in vmode ``` \renewcommand\subsection{% \@startsection{subsection}{2}{\z@}% {-3.25ex\@plus -1ex \@minus -.2ex}% {1.5ex \@plus .2ex}% {\everypar{\color{blue}\frakfamily}}% ```
1
https://tex.stackexchange.com/users/1090
686805
318,621
https://tex.stackexchange.com/questions/376420
4
when I try to incorporate some Chinese characters into an article complied by Xelatex, something goes wrong. The Chinese characters don't show up. My code is as below, ``` \documentclass[12pt]{article} \usepackage{CJKutf8} \usepackage{fontspec} \begin{document} \begin{CJK}{UTF8}{bkai} \begin{titlepage} \centering { 經濟系 \\ Department \centering \thispagestyle{empty} \end{titlepage} \end{CJK} \end{document} ``` Thanks for any help!
https://tex.stackexchange.com/users/134980
Include Chinese characters into article in Xelatex
false
You can also use the xeCJK package, though it requires the XeLaTeX engine. As in the answer from @ShreevatsaR, if the character is rarer, you may need to change the font. ``` \documentclass{article} \usepackage{xeCJK} \setCJKmainfont{Noto Sans CJK TC} \begin{document} This tests the traditional Chinese character 錄. It has Unicode ID 37636. \end{document} ``` On Overleaf, at time of writing, this example will only work with the font change line, as the default Chinese font is Fandol, which doesn't have 錄. Note the directive `\setCJKmainfont` instead of `\setmainfont`.
0
https://tex.stackexchange.com/users/194936
686808
318,623
https://tex.stackexchange.com/questions/686796
8
I read somewhere that you should use `\dimexpr ... \relax` when defining lengths. Is that really the case? There seems to be no difference between using it or not: ``` \documentclass{article} \newlength{\onelen} \newlength{\twolen} \newlength{\threelen} \setlength{\threelen}{5em} \setlength{\onelen}{2.5\threelen} \setlength{\twolen}{\dimexpr2.5\threelen\relax} \begin{document} a \hspace{\onelen} b c \hspace{\twolen} d \end{document} ``` Are there specific circumstances where you should use it or can you skip it and make the length more readable?
https://tex.stackexchange.com/users/281557
Why would I use \dimexpr .. \relax in \setlength?
true
The syntax `<factor><internal dimen>` or `<factor><internal glue>` for a dimen value is supported by classical TeX, see TeXbook pages 269-271. Because `<factor>` can be decimal constant and `<internal glue>` can be a token declared by `\skipdef` primitive, the following example is valid in classical TeX: ``` \newskip\twolen \newskip\threelen \threelen=5em\relax \twolen=2.5\threelen \relax ``` This is an extraction of your example, because the LaTeX macro `\newlength` does `\neswkip` and this macro does `\skipdef`, so the declared token is "skipdef token" from TeXbook's point of view. The `<factor>` is `2.5` here and `<internal glue>` is `\threelen`. Because `\threelen` was set to 5em, the resulting assignment to `\twolen` is 2.5\*5em = 12.5em. We can interpret the `\threelen` as "a declared unit" of measure and read the syntax `2.5\threelen` as `<factor>`\*`<unit>`. Classical TeX supports no more calculation with dimen values, only the mentioned `<factor>`\*`<unit>`. eTeX gives a new primitive `\dimexpr <dimen expression> <optional relax>` which allows to do more dimen calculations, like `2em-4ex+.5\hsize`. The accepted answer here doesn't explain why the "puzzling error message" occurs here. The example does, in fact: ``` \newskip\test \test=\dimexpr 3pt+1cm\relax plus something else ``` The `\dimexpr` primitive creates a `<dimen>` value and consumes the `\relax` expanded from LaTeX macro `\setlength`. So, we get ``` \test=<dimen value> plus something else ``` Because `\test` was declared as `\newskip` (i.e. using `\skipdef` primitive), the assignment has syntax ``` \test <optional equal> <dimen> <optional plus followed by stretch value> <optional minus followed by shrink value> ``` If there is no `plus` after the `<dimen>`, the assignment is finalized with zero stretch value. But we have `plus` here in egreg's example, then TeX excepts the `<stretch value>` which must begin by `<number>`. The number isn't present here, so TeX reports `missing number` error.
5
https://tex.stackexchange.com/users/51799
686816
318,626
https://tex.stackexchange.com/questions/686815
1
I am trying to store the text from the abstract environment to a file + display this text as well. I tried the following: ``` \documentclass{article} \makeatletter \renewenvironment{abstract}{% \textbf{\textsf{Abstract.}}% \filecontents[nosearch,noheader,overwrite]{\jobname.abstract}% }% {% \endfilecontents% \input{\jobname.abstract}% } \makeatother \begin{document} \begin{abstract} This is a test abstract. \end{abstract} \end{document} ``` However, this results in ``` ! Missing number, treated as zero. <to be read again> \protect ``` When I comment out the "\input{\jobname.abstract}" it compiles. What am I doing wrong?
https://tex.stackexchange.com/users/293508
Store + display text in the abstract environment
true
Timing issue. Use `\AddToHook`. ``` \documentclass{article} \NewCommandCopy{\originalabstract}{\abstract} \NewCommandCopy{\endoriginalabstract}{\endabstract} \renewenvironment{abstract}{% \filecontents[nosearch,noheader,overwrite]{\jobname.abstract}% }% {% \endfilecontents } \AddToHook{env/abstract/after}{% \begin{originalabstract}\input{\jobname.abstract}\end{originalabstract}% } \begin{document} \begin{abstract} This is a test abstract. \end{abstract} \end{document} ``` I copied the original `abstract` environment, but you're free to use a different formatting.
1
https://tex.stackexchange.com/users/4427
686817
318,627
https://tex.stackexchange.com/questions/686818
2
I want to have a command `\myInclude{}` doing the following thing: * `\myInclude{}` does nothing (if the argument if empty) * `\myInclude{file.tex}` includes the file named `file.tex` if it has not been previously included (via the command `\myInclude{file.tex}`; otherwise, it does nothing. Can you help me?
https://tex.stackexchange.com/users/8323
Testing the appartenance to a list
false
You can populate a sequence and check for the filename to be present. I also add the extension `.tex` if not present (and use `\input` rather than `\include`). ``` \documentclass{article} \ExplSyntaxOn \NewDocumentCommand{\myInclude}{m} { \IfBlankF{#1}{ \colas_myinclude:n { #1 } } } \cs_new_protected:Nn \colas_myinclude:n { \str_if_eq:eeTF { \str_range:nnn { #1 } { -4 } { -1 } } { .tex } { \__colas_myinclude:n { #1 } } { \__colas_myinclude:n { #1.tex } } } \seq_new:N \g_colas_myinclude_prop \cs_new_protected:Nn \__colas_myinclude:n { \seq_if_in:NnF \g_colas_myinclude_prop { #1 } { \seq_gput_right:Nn \g_colas_myinclude_prop { #1 } \input{#1} } } \ExplSyntaxOff \begin{filecontents*}{colas-a.tex} This is file A \end{filecontents*} \begin{filecontents*}{colas-b.tex} This is file B \end{filecontents*} \begin{document} Trying to include A \myInclude{colas-a} Trying to include nothing \myInclude{} Trying to include B \myInclude{colas-b.tex} Trying to include A \myInclude{colas-a.tex} Trying to include B \myInclude{colas-b} End \end{document} ```
4
https://tex.stackexchange.com/users/4427
686820
318,628
https://tex.stackexchange.com/questions/660238
1
When loading repository in the GUI an error immediately pops up saying `Error: key "texlive.infra" not known in dictionary`. The detailed error message is as follows: ``` key "texlive.infra" not known in dictionary key "texlive.infra" not known in dictionary while executing "dict get $::pkgs texlive.infra localrev" (procedure "get_packages_info_remote" line 17) invoked from within "get_packages_info_remote" invoked from within ".pkfilter.upd invoke " invoked from within ``` After closing that error message another message saying `collect_filtered should not have been invoked at this time` appears, leading to a crash. How can I resolve this issue?
https://tex.stackexchange.com/users/282114
Windows TeX Live Shell GUI Malfunctioning
false
It helped for me to run TeX Live Shell with admin rights, so the issue was gone and I could update packages
1
https://tex.stackexchange.com/users/13318
686823
318,630
https://tex.stackexchange.com/questions/686818
2
I want to have a command `\myInclude{}` doing the following thing: * `\myInclude{}` does nothing (if the argument if empty) * `\myInclude{file.tex}` includes the file named `file.tex` if it has not been previously included (via the command `\myInclude{file.tex}`; otherwise, it does nothing. Can you help me?
https://tex.stackexchange.com/users/8323
Testing the appartenance to a list
true
Here is a solution relying on TeX's `\ifcsname`: ``` \newcommand\myIncludeSeen[1]{% \expandafter\newcommand\csname myInclude:#1\endcsname{}% } \newcommand\myInclude[1]{% \ifcsname myInclude:#1\endcsname \else \myIncludeSeen{#1}% \input{#1}% \fi } \myIncludeSeen{} ``` Unlike @egreg's solution, it does not append `.tex` automatically, so `\myInclude{file}` and `\myInclude{file.tex}` will be treated as if loading different files. ``` \documentclass{article} \newcommand\myIncludeSeen[1]{% \expandafter\newcommand\csname myInclude:#1\endcsname{}% } \newcommand\myInclude[1]{% \ifcsname myInclude:#1\endcsname \else \myIncludeSeen{#1}% \input{#1}% \fi } \myIncludeSeen{} \begin{filecontents*}{colas-a.tex} This is file A \end{filecontents*} \begin{filecontents*}{colas-b.tex} This is file B \end{filecontents*} \begin{document} Trying to include A \myInclude{colas-a} Trying to include nothing \myInclude{} Trying to include B \myInclude{colas-b} Trying to include A \myInclude{colas-a} Trying to include B \myInclude{colas-b} End \end{document} ```
2
https://tex.stackexchange.com/users/110998
686826
318,631
https://tex.stackexchange.com/questions/681974
0
I have a little problem with my footnotes and using package glossaries-extra. I'm using a solution ([see here](https://tex.stackexchange.com/a/594567/229073)) to add a period at the end of every `\footnote{}` (yes, I have to use `\footnote{}` and not `\footcite{}` because I have to add some text in my footnotes, too) and most of the time it works fine. But when I'm using an abbreviation (`\gls{}`) which ends with a period at the end of a sentence in a footnote it doesn't work. I'll get two periods. I have no clue how to solve this problem. Hopefully, someone could help me. (I had a similiar question but with package acro [[see here]](https://tex.stackexchange.com/questions/642437/footnotes-with-automatic-final-period-not-working-with-package-acro).) MWE: ``` \documentclass[paper=a4,fontsize=12pt]{scrbook} \KOMAoptions{twoside=false} \usepackage[ngerman]{babel} \usepackage{fontspec} \usepackage[german=guillemets]{csquotes} \usepackage[hidelinks]{hyperref} \usepackage[style=german-legal-book]{biblatex} \setmainfont{ebgaramond}[] \usepackage[style=long,nogroupskip,nonumberlist]{glossaries-extra} \setabbreviationstyle{short-nolong} \glssetcategoryattribute{abbreviation}{noshortplural}{true} \glssetcategoryattribute{abbreviationdot}{discardperiod}{true} % \newabbreviation[% description={mit weiteren/m Nachweisen/Nachweis},%Darstellung der longform im Abkürzungsverzeichnis category=abbreviationdot,% longplural={mit weiteren Nachweisen},% shortplural=m.~w.~N., sort={mwN},% ]% {mwN}%key {m.~w.~N.}%shortform {mit weiterem Nachweis}%longform % %automatic final period in footnote \makeatletter% \long\def\@makefntext#1{% \parindent 1em\noindent \hb@xt@ 1.8em{\hss\@makefnmark}#1% \ifnum\the\spacefactor<3000 \ifnum\the\spacefactor=\blx@sf@period \else .% \fi \fi} \makeatother % \begin{document} There are no two dots at the end of sentence \gls{mwN}.\footnote{And here in the footnote is a dot at the end of the sentence} Here is a dot.\footnote{But here, I only want one dot not two: \gls{mwN}} \end{document} ```
https://tex.stackexchange.com/users/229073
Footnotes with automatic final period not working with glossaries-extra
true
I found a solution which seems to work. It's based on this [issue](https://github.com/plk/biblatex/issues/1071). MWE: ``` \documentclass[paper=a4,fontsize=12pt] {scrbook} \KOMAoptions{twoside=false} \usepackage[ngerman]{babel} \usepackage{fontspec} \usepackage[german=guillemets]{csquotes} \usepackage[hidelinks]{hyperref} \usepackage[style=german-legal-book]{biblatex} \setmainfont{ebgaramond}[] \usepackage[style=long,nogroupskip,nonumberlist]{glossaries-extra} \usepackage{xpatch} \setabbreviationstyle{short-nolong} \glssetcategoryattribute{abbreviation}{noshortplural}{true} \glssetcategoryattribute{abbreviationdot}{discardperiod}{true} \makeatletter \newcommand{\addperiod}{\blx@imc@addperiod} \makeatother \makeatletter \protected\def\blx@imc@addperiod{% \ifnum\blx@spacefactor=999 \@% \fi \blx@addpunct{period}% \ifnum\blx@spacefactor=\blx@sf@dot \spacefactor\blx@sf@period \fi} \makeatother %automatic final period in footnote \makeatletter% \long\def\@makefntext#1{% \parindent 2em% \hangindent = 1.7em% \hangafter = 1% \noindent % \hb@xt@ 1.6em{\hss\@makefnmark\hspace{0,1 cm}}#1%\parindent 1em\noindent \hb@xt@ 1.8em{\hss\@makefnmark}#1 \makebox[0.5em][l] \ifnum\the\spacefactor<3000 \ifnum\the\spacefactor=\blx@sf@period \else .% \fi \fi} \makeatother \newabbreviation[% description={mit weiteren/m Nachweisen/Nachweis},%Darstellung der longform im Abkürzungsverzeichnis category=abbreviationdot,% longplural={mit weiteren Nachweisen},% shortplural=m.~w.~N\addperiod, sort={mwN},% ]% {mwN}%key {m.~w.~N\addperiod}%shortform {mit weiterem Nachweis}%longform % \begin{document} There are no two dots at the end of sentence \gls{mwN}.\footnote{And here in the footnote is a dot at the end of the sentence} Here is a dot.\footnote{But here, I only want one dot not two: \gls{mwN}} \end{document} ```
1
https://tex.stackexchange.com/users/229073
686828
318,632
https://tex.stackexchange.com/questions/686832
0
I think I've stumbled upon a tcolorbox bug: whenever there are two consecutive breakable boxes, neither can fit unbroken in the current page, and the content of the first is unbreakable (e.g. an image) while the content of the second is breakable (e.g. text), then the first is moved to the next page as expected, but for some reason, the second one is not broken and end-up overflowing from the page. Making the first box unbreakable (which should change basically nothing since it can not be broken) fixes the problem, which makes me think that this is due to tcolorbox somehow wrongly applying the decision to not break the first box to the second box. The actual use case is a PhD thesis where every figure, theorem (and fact, proposition, remark, etc.) and proof is in a breakable tcolorbox. This problem happens at unexpected places because the figures float while the theorems do not, which makes manually making some boxes unbreakable unmanageable. I've looked at the [code for the beakable](https://github.com/T-F-S/tcolorbox/blob/67963e25ceb3a685c5521413eea52cb5128ddc1a/tex/latex/tcolorbox/tcbbreakable.code.tex), tried changing the values of booleans `\tcb@break@allowedtrue` and `\tcb@ignorenobreaktrue` and placing the box in a group (to prevent value changes from leaking to the other box), but this had no effect. ``` \documentclass{article} \usepackage[most]{tcolorbox} \usepackage{afterpage} \usepackage{lipsum} \tcbset{enhanced} \newcommand{\breakablecontent}{\lipsum[1-12]} \newcommand{\nonbreakablecontent}{\rule{\columnwidth}{\columnwidth}} \newcommand{\mytest}[1]{ \lipsum[1-3] \afterpage{ \begin{tcolorbox}[breakable=true] \breakablecontent \end{tcolorbox} } \begin{tcolorbox}[breakable=#1] \nonbreakablecontent \end{tcolorbox} } % Naive Attempt to fix this: %\makeatletter %\renewcommand{\mytest}[1]{ % \lipsum[1-3] % \afterpage{ % \tcb@break@allowedtrue\tcb@ignorenobreaktrue % \begingroup % \begin{tcolorbox}[breakable=true] % \breakablecontent % \end{tcolorbox} % \endgroup % \tcb@break@allowedtrue\tcb@ignorenobreaktrue % } % \tcb@break@allowedtrue\tcb@ignorenobreaktrue % \begin{tcolorbox}[breakable=#1] % \nonbreakablecontent % \end{tcolorbox} %} %\makeatother \begin{document} \section{Expected behavior} \mytest{false} \clearpage \section{Unexpected behavior} \mytest{true} \end{document} ```
https://tex.stackexchange.com/users/82912
Tcolorbox unbroken box prevents next breakable box from breaking
false
I think, the problem really is related to `\afterpage` where you place the first `tcolorbox` in. Without this, the breakpoints work as expected. I am unsure why you need this. Maybe a workaround could be to place a simple `\clearpage` right before the following `tcolorbox`? MWE: ``` \documentclass{article} \usepackage[most]{tcolorbox} \usepackage{lipsum} \tcbset{enhanced} \newcommand{\breakablecontent}{\lipsum[1-12]} \newcommand{\nonbreakablecontent}{\rule{\columnwidth}{\columnwidth}} \newcommand{\mytest}[1]{ \lipsum[1-3] \clearpage \begin{tcolorbox}[breakable=true] \breakablecontent \end{tcolorbox} \clearpage \begin{tcolorbox}[breakable=#1] \nonbreakablecontent \end{tcolorbox} } \begin{document} \section{Expected behavior} \mytest{false} \clearpage \section{Unexpected behavior} \mytest{true} \end{document} ```
2
https://tex.stackexchange.com/users/47927
686833
318,634
https://tex.stackexchange.com/questions/637357
0
I need help in citing research articles using BibTeX for journal papers having an Article Number instead of Pages Numbers? For instance, I ran BibTeX for a paper that appeared in MDPI Electronics journal. It compiled well, but when I see the PDF output, Article Number is not showing up in it. How to fix this problem? Your help is highly appreciated. ``` @Article{electronics10212707, AUTHOR = {Djebbar, Fatiha}, TITLE = {Securing IoT Data Using Steganography: A Practical Implementation Approach}, JOURNAL = {Electronics}, VOLUME = {10}, YEAR = {2021}, NUMBER = {21}, ARTICLE-NUMBER = {2707} } ```
https://tex.stackexchange.com/users/251241
How to cite articles using BibTeX for journal papers having an Article Number instead of Page Numbers?
false
The preferable solution, if possible, is to use [biblatex](https://www.ctan.org/pkg/biblatex). It supports article numbers with the `eid` field. Alternatively... a) if you use the ACM article master, you can use the field `articleno` b) if you use the IEEEtran master, you can use the field `paper` ``` @Article{electronics10212707, author = {Djebbar, Fatiha}, journal = {Electronics}, title = {Securing {IoT} Data Using Steganography: A Practical Implementation Approach}, year = {2021}, number = {21}, volume = {10}, % Do not forget page numbers pages = {1--17}, % biblatex field eid = {2707}, % ACM field articleno = {2707}, % IEEE field paper = {2707}, } ``` Note that the article still has page numbers, they just start at 1. If you cannot use biblatex, or the publisher does not support the field, I often see two alternative approaches in practice: 1. Use the article number *instead* of the pages: ``` @Article{electronics10212707, % ... pages = {2707}, } ``` 2. *Prefix* the pages with the article number: ``` @Article{electronics10212707, % ... pages = {2707:1--17}, } ``` I personally do not love either, but there you go. p.s. Make sure to properly brace "IoT" in the title to prevent it from being lowercased.
0
https://tex.stackexchange.com/users/102094
686840
318,636
https://tex.stackexchange.com/questions/686838
0
I start with a fresh installation of Ubuntu 22. I installed pdflatex from the command line. Compiling this code ``` \documentclass{standalone} \begin{document} Test \end{document} ``` produces the error: ``` pdflatex test.tex This is pdfTeX, Version 3.141592653-2.6-1.40.22 (TeX Live 2022/dev/Debian) (preloaded format=pdflatex) restricted \write18 enabled. entering extended mode (./test.tex LaTeX2e <2021-11-15> patch level 1 L3 programming layer <2022-01-21> ! LaTeX Error: File `standalone.cls' not found. Type X to quit or <RETURN> to proceed, or enter new name. (Default extension: cls) ``` What is wrong and how to fix?
https://tex.stackexchange.com/users/114719
File `standalone.cls' not found
true
LaTeX works with binaries as well as a huge set of package and class files. So it can be thought of as a bundle. Installing a binary file like `pdflatex` without installing the other parts of the bundle is barely of any use in most of the contexts. Hence, one way to get a *useful* installation (on the operating system specified by the OP) is to use the following command on a bash terminal. ``` sudo apt-get install texlive-full ```
2
https://tex.stackexchange.com/users/174620
686845
318,637
https://tex.stackexchange.com/questions/686832
0
I think I've stumbled upon a tcolorbox bug: whenever there are two consecutive breakable boxes, neither can fit unbroken in the current page, and the content of the first is unbreakable (e.g. an image) while the content of the second is breakable (e.g. text), then the first is moved to the next page as expected, but for some reason, the second one is not broken and end-up overflowing from the page. Making the first box unbreakable (which should change basically nothing since it can not be broken) fixes the problem, which makes me think that this is due to tcolorbox somehow wrongly applying the decision to not break the first box to the second box. The actual use case is a PhD thesis where every figure, theorem (and fact, proposition, remark, etc.) and proof is in a breakable tcolorbox. This problem happens at unexpected places because the figures float while the theorems do not, which makes manually making some boxes unbreakable unmanageable. I've looked at the [code for the beakable](https://github.com/T-F-S/tcolorbox/blob/67963e25ceb3a685c5521413eea52cb5128ddc1a/tex/latex/tcolorbox/tcbbreakable.code.tex), tried changing the values of booleans `\tcb@break@allowedtrue` and `\tcb@ignorenobreaktrue` and placing the box in a group (to prevent value changes from leaking to the other box), but this had no effect. ``` \documentclass{article} \usepackage[most]{tcolorbox} \usepackage{afterpage} \usepackage{lipsum} \tcbset{enhanced} \newcommand{\breakablecontent}{\lipsum[1-12]} \newcommand{\nonbreakablecontent}{\rule{\columnwidth}{\columnwidth}} \newcommand{\mytest}[1]{ \lipsum[1-3] \afterpage{ \begin{tcolorbox}[breakable=true] \breakablecontent \end{tcolorbox} } \begin{tcolorbox}[breakable=#1] \nonbreakablecontent \end{tcolorbox} } % Naive Attempt to fix this: %\makeatletter %\renewcommand{\mytest}[1]{ % \lipsum[1-3] % \afterpage{ % \tcb@break@allowedtrue\tcb@ignorenobreaktrue % \begingroup % \begin{tcolorbox}[breakable=true] % \breakablecontent % \end{tcolorbox} % \endgroup % \tcb@break@allowedtrue\tcb@ignorenobreaktrue % } % \tcb@break@allowedtrue\tcb@ignorenobreaktrue % \begin{tcolorbox}[breakable=#1] % \nonbreakablecontent % \end{tcolorbox} %} %\makeatother \begin{document} \section{Expected behavior} \mytest{false} \clearpage \section{Unexpected behavior} \mytest{true} \end{document} ```
https://tex.stackexchange.com/users/82912
Tcolorbox unbroken box prevents next breakable box from breaking
false
Using the magazine library as suggested by Ulrike Fischer fixes the overflow problem but the unbreakable content is inexplicably shifted downwards, outside of its box. Using floats instead of afterpage works. ``` \documentclass{article} \usepackage[most]{tcolorbox} \usepackage{afterpage} \usepackage{lipsum} \tcbset{enhanced} \newcommand{\breakablecontent}{\lipsum[1-12]} \newcommand{\nonbreakablecontent}{\rule{\columnwidth}{\columnwidth}} \newboxarray{a} % Does not work weirdly \newcommand{\mytest}[1]{ \lipsum[1-3]\\ \begin{tcolorbox}[breakable=true, reset and store to box array=a] \breakablecontent \end{tcolorbox} \afterpage{ \consumeboxarray[a]{1}{} \consumeboxarray[a]{2}{} \consumeboxarray[a]{3}{} } \begin{tcolorbox}[breakable=#1] \nonbreakablecontent \end{tcolorbox} } % Works \renewcommand{\mytest}[1]{ \lipsum[1-3]\\ \begin{tcolorbox}[breakable=true, reset and store to box array=a] \breakablecontent \end{tcolorbox} \begin{figure}[p]\consumeboxarray[a]{1}{}\end{figure} \begin{figure}[p]\consumeboxarray[a]{2}{}\end{figure} \begin{figure}[p]\consumeboxarray[a]{3}{}\end{figure} \begin{tcolorbox}[breakable=#1] \nonbreakablecontent \end{tcolorbox} } \begin{document} \section{Expected behavior} \mytest{false} \clearpage \section{Unexpected behavior} \mytest{true} \end{document} ```
2
https://tex.stackexchange.com/users/82912
686850
318,641
https://tex.stackexchange.com/questions/660876
0
Is there a command that lets me use the color of a certain node (e.g. the node with the name "Node 1")? Something like `\nodecolor{Node 1}` or similar? I am trying to use the color of a certain node as a variable.
https://tex.stackexchange.com/users/209759
Tikz nodes - command for its color
false
As announced above, here is a slightly modified and expanded version of Qrrbrbirlbel's code. This version uses user-readable colour names (without @) that can be used directly again in TikZ options. I have also extended the principle to stroke, fill and concept colours (of mindmaps), which are all stored in similar variables in the PGF/TikZ innards. If this question/answer makes it into tikz-ext, feel free to use this code. ``` % !TEX TS-program = pdflatex \documentclass[tikz]{standalone} \usetikzlibrary{mindmap} \colorlet{root-color}{blue} \colorlet{root-textcolor}{red} \colorlet{col1}{red} \colorlet{col2}{green} % %%% Saving node colors %%% see <https://tex.stackexchange.com/questions/660876/tikz-nodes-command-for-its-color/662011#662011> % \makeatletter \newcommand*\nodetextcolor[1]{\@ifundefinedcolor{text color of #1}{.}{text color of #1}} \newcommand*\nodefillcolor[1]{\@ifundefinedcolor{fill color of #1}{.}{fill color of #1}} \newcommand*\nodedrawcolor[1]{\@ifundefinedcolor{draw color of #1}{.}{draw color of #1}} \newcommand*\nodeconceptcolor[1]{\@ifundefinedcolor{concept color of #1}{.}{concept color of #1}} \tikzset{ save node text color/.style={ execute at begin node=% latex only \ifx\tikz@textcolor\@empty \xglobal\colorlet{text color of \tikz@fig@name}{.}% \else \xglobal\colorlet{text color of \tikz@fig@name}{\tikz@textcolor}% \fi }, save node draw color/.style={ execute at begin node=% latex only \ifx\tikz@strokecolor\@empty \xglobal\colorlet{draw color of \tikz@fig@name}{.}% \else \xglobal\colorlet{draw color of \tikz@fig@name}{\tikz@strokecolor}% \fi }, save node fill color/.style={ execute at begin node=% latex only \ifx\tikz@fillcolor\@empty \xglobal\colorlet{fill color of \tikz@fig@name}{.}% \else \xglobal\colorlet{fill color of \tikz@fig@name}{\tikz@fillcolor}% \fi }, save node concept color/.style={ execute at begin node=% latex only \ifx\tikz@concept@color\@empty \xglobal\colorlet{concept color of \tikz@fig@name}{.}% \else \xglobal\colorlet{concept color of \tikz@fig@name}{\tikz@concept@color}% \fi }, save node colors/.style = { save node concept color, save node fill color, save node draw color, save node text color } } \makeatother \DeclareDocumentCommand\info{m}{ \node [ annotation, right, draw = draw color of #1, text = text color of #1, fill = concept color of #1!10, ] (#1-info) at (#1.east) {#1}; } \begin{document} \begin{tikzpicture}[ save node colors, ] %%% The Mindmap itsself \path[ mindmap, concept color = root-color, every node/.style = { concept, }, root/.style = { text = root-textcolor, }, level 1 concept/.append style = { sibling angle = 90, }, level 2 concept/.append style = { sibling angle = 90, }, ] node[root] (root) {Root} [clockwise from = 45] child[concept color = col1] { node (L1) {L1} child [concept color = violet] { node (L1-1) {L1-1} } child [concept color = orange] { node (L1-2) {L1-2} } } child[concept color = col2] { node (L2) {L2} child [concept color = purple] { node (L2-1) {L2-1} } child [concept color = teal] { node (L2-2) {L2-2} } } ; %% Information nodes %%%%%%%%%%%%%%%%%%%%%%%%%%%% \info{root} \info{L1} \info{L1-1} \info{L1-2} \info{L2} \info{L2-1} \info{L2-2} \end{tikzpicture}% \end{document} ```
0
https://tex.stackexchange.com/users/77667
686855
318,643
https://tex.stackexchange.com/questions/686852
3
Sometimes, I want to redefine some ***cs*** in a range, generally a macro definition. Like: ``` \def *[[csname>]]* { *[[**Redefine** some cs]]* *[[Actual function of this macro]]* *[[**Recover** the redefined cs]]* } ``` What mainly needed to do is define macros of `***Redefine***` and `***Recover***`, let's call them `\redefine` and `\recover`. For recovering, a hardly conflict ***cs*** should be used to store the meaning of ***cs*** to be redefined, and their names should be relative. Here I use "the csname of its csname" : ``` \def\redefine#1#2{ \expandafter \let \csname\string#1\endcsname #1 \relax \def#1{#2} } ``` Where `#1` is the ***cs*** to be redefined. Now I found that the original meaning can not be recover. ``` \def\recover#1{ \let #1 \csname\string#1\endcsname } ``` ~~It seems that `\csname\string#1\endcsname` can not be expanded before `\let`, because `#` `1` are two different tokens but treated as argument replacement in macro definition iff they successively appear. Meanwhile `\expandafter` just skip 1 token.~~ Maybe `\def` but not `\let` can be used in most cases, I still want to know any way to make the 2nd token be expanded before the 1st when the 1st token is an argument? --- i.e. Some shorter primitive cs are defined: ``` \let\epaf\expandafter \let\str\string \let\nep\noexpand \let\cs\csname \let\sc\endcsname ... ``` for a macro named `\mfont` that parse a sentence until `\relax`, and set lots of font attribute, and make a single cs set latin font and unicode font at the same time. It use lots of primitive cs to parse sentence, definiiton is hard to read if keep the long name. After a block from `\mfont` to `\relax` , shoter names should be recovered. `\mfont` should define font for global but the shorter names should be valid just in the `\mfont` range.
https://tex.stackexchange.com/users/248249
How to \expandafter a \let#1 in macro definition
true
You had spurious spaces, and missing `\expandafter` ``` % no space!!!! \def\redefine#1#2{% \expandafter \let \csname\string#1\endcsname #1% \def#1{#2}% } % no space!!!! \def\recover#1{% % missing \expandafter \expandafter \let \expandafter #1\csname\string#1\endcsname } {\tt \string\sin=\meaning\sin} \redefine\sin{hello} {\tt \string\sin=\meaning\sin} \recover\sin {\tt \string\sin=\meaning\sin} \bye ```
4
https://tex.stackexchange.com/users/1090
686862
318,646
https://tex.stackexchange.com/questions/686852
3
Sometimes, I want to redefine some ***cs*** in a range, generally a macro definition. Like: ``` \def *[[csname>]]* { *[[**Redefine** some cs]]* *[[Actual function of this macro]]* *[[**Recover** the redefined cs]]* } ``` What mainly needed to do is define macros of `***Redefine***` and `***Recover***`, let's call them `\redefine` and `\recover`. For recovering, a hardly conflict ***cs*** should be used to store the meaning of ***cs*** to be redefined, and their names should be relative. Here I use "the csname of its csname" : ``` \def\redefine#1#2{ \expandafter \let \csname\string#1\endcsname #1 \relax \def#1{#2} } ``` Where `#1` is the ***cs*** to be redefined. Now I found that the original meaning can not be recover. ``` \def\recover#1{ \let #1 \csname\string#1\endcsname } ``` ~~It seems that `\csname\string#1\endcsname` can not be expanded before `\let`, because `#` `1` are two different tokens but treated as argument replacement in macro definition iff they successively appear. Meanwhile `\expandafter` just skip 1 token.~~ Maybe `\def` but not `\let` can be used in most cases, I still want to know any way to make the 2nd token be expanded before the 1st when the 1st token is an argument? --- i.e. Some shorter primitive cs are defined: ``` \let\epaf\expandafter \let\str\string \let\nep\noexpand \let\cs\csname \let\sc\endcsname ... ``` for a macro named `\mfont` that parse a sentence until `\relax`, and set lots of font attribute, and make a single cs set latin font and unicode font at the same time. It use lots of primitive cs to parse sentence, definiiton is hard to read if keep the long name. After a block from `\mfont` to `\relax` , shoter names should be recovered. `\mfont` should define font for global but the shorter names should be valid just in the `\mfont` range.
https://tex.stackexchange.com/users/248249
How to \expandafter a \let#1 in macro definition
false
Besides spurious spaces, your code for `\recover` does ``` \let #1 \csname\string#1\endcsname ``` If you call `\recover\foo` you get ``` \let\foo\csname\string\foo\endcsname ``` so you are redefining `\foo` to be `\csname`, printing `\foo` (as a string) and get an error message about a badly placed `\endcsname`. You need ``` \expandafter\let\expandafter#1\csname\string#1\endcsname ``` so the token is formed *before* `\let` starts to act. Alternative method where you need not worry about spurious spaces and `\expandafter`. The `c` argument type means “form a control sequence token” (it uses `\csname...\endcsname` internally and applies the correct `\expandafter` sequence. Also `\cs_set:Npn` is the equivalent of `\def` (actually `\long\def`, but it's unimportant in this context). ``` \input expl3-generic \ExplSyntaxOn \cs_new_protected:Npn \redefine #1 #2 { % save the current meaning of #1 \cs_set_eq:cN { \token_to_str:N #1 } #1 \cs_set:Npn #1 { #2 } } \cs_new_protected:Npn \recover #1 { \cs_set_eq:Nc #1 { \token_to_str:N #1 } } \ExplSyntaxOff {\tt \string\sin=\meaning\sin} \redefine\sin{hello} {\tt \string\sin=\meaning\sin} \recover\sin {\tt \string\sin=\meaning\sin} \bye ``` If you don't want to go this route, you can and should define your own syntactic sugar. But `expl3` offers you *much* more than `\cs_set_eq:NN` and variants thereof. ``` \def\cslet#1{\expandafter\let\csname#1\endcsname} \def\letcs#1#2{\expandafter\let\expandafter#1\csname#2\endcsname} \def\redefine#1#2{% % save the current meaning of #1 \cslet{\string#1}#1% % redefine #1 \def#1{#2}% } \def\recover#1{\letcs#1{\string#1}} {\tt \string\sin=\meaning\sin} \redefine\sin{hello} {\tt \string\sin=\meaning\sin} \recover\sin {\tt \string\sin=\meaning\sin} \bye ```
3
https://tex.stackexchange.com/users/4427
686872
318,652
https://tex.stackexchange.com/questions/686867
0
In my markdown document I have a complex latex table with a caption, in which I would like to add a reference. ``` The table can be seen below... \begin{table}[ht] \captionof{table}{Some complex table \protect\hyperlink{ref-doe}{(Doe et al., 2011}} \label{tbl:complexTable} \centering \begin{tblr}{ ... } \end{table} Table [@tbl:complexTable] shows... ``` With `tablenos` I am usually able to reference the paper with the `Table: Some complex table [@doe]` and when converting to pdf, the `@doe` reference is listed in the bibliography chapter. **However since the reference is inside the latex block, it doesn't show in the bibliography chapter. How do I solve this?**
https://tex.stackexchange.com/users/266934
Reference citation in latex block in pandoc
true
--- --- ``` --- format: pdf link-citations: true references: - type: article-journal id: doe author: - family: Doe given: D. D. issued: year: 2011 title: 'Very foo and too munch foo' container-title: Journal of Foo volume: 171 issue: 2 page: 737--778 nocite: | @doe --- The table can be seen below... \begin{table}[h] \caption{Some complex table \protect\hyperlink{ref-doe}{(Doe, 2011)}} \label{tbl-complexTable} \centering \begin{tabular}{|c|}\hline x\\\hline\end{tabular} \end{table} <!-- A @doe markdown cite. --> ### References ::: {#refs} ::: ``` If you are exporting references with `citeproc`, the references are added as text in the LaTeX export, and in citations are just hyperlinks to items. There are not true citation commands to be processed by bibtex or biber programs. From the markdown point of view, the LaTeX parts do not exist, and therefore if there are not any `@doe` in the markdown side, there are nothing to link and nothing to be referenced. In the LaTeX part you add a link to nowhere, not a command to include a cite and a reference. There are at least three ways to surpass this problem: One could be simply add `@doe` or `[@doe]` somewhere in the markdown part. This will make the target, so the link to nowhere will work now. The only problem could be that you do not want other link except that of the caption. In the example, this "extra cite" is deactivated in a HTML comment. If you want to test it, turn the HTML comment in plain text, and remove the `nocite` directive, that is the second method: Use `nocite` in the YAML header you cab include references that you do not what to mention in text. This will create the target without the link, but you provide it in the LaTeX code. To test it, run the example "as is". The third way is to use `natbib` or `biblatex` citation methods. In this case, list the references and format the cite is an external business for bibtex or biber programs, and pandoc just washes his hands. You will need the references in bibtex (.bib) format, and specify the citation method, adding in the YAML header at least: ``` bibliography: references.bib # or whatever.bib citation-method: natbib # or biblatex (default is citeproc) ``` The natbib and biblatex methods will leave `@doe` or `[@doe]` as a true LaTeX citation command (not just a hyperlink) and also some LaTeX commands at end of the document to print the references, so you cannot read the text of the references in the exported LaTeX code, but in the PDF only. That is, instead of be export the cite as `\protect\hyperlink{target}{text}` leave it as a true citation command, e.g., \textcite{doe} or \autocite{doe} (depending of the cite style, and the `citation-method`). The commands generated in each case in main markdown text is what you must translate to the table caption manually, and they will make the cite and the reference even if there are not `@doe` in markdown text or `nocite` in the header. Note: sometimes is not clear for pandoc what is markdown and what is another markup language that should not be touched. It is always better to enclose the LaTeX part in this way: ``` ```{=latex} \begin{whatever} \end{whatever} ``` ```
2
https://tex.stackexchange.com/users/11604
686876
318,653
https://tex.stackexchange.com/questions/686877
0
my question is if there is an "easy" way to draw a line between each node of a square with every node of the other squares which have been drawn symmetrically, here is the code of what I'm talking about. Thanks in advance for your help. ``` \begin{tikzpicture} \begin{scope}[shift={(90:3)}, rotate=45] \foreach \x in{0,90,180,270}{\draw[blue] (\x:1)--(\x+90:1);}; \foreach \x in{0,90,180,270}{\draw[blue] (\x:1)node[circle, fill=blue!20, draw]{};}; \end{scope} \begin{scope}[shift={(210:3)}, rotate=165] \foreach \x in{0,90,180,270}{\draw[blue] (\x:1)--(\x+90:1);}; \foreach \x in{0,90,180,270}{\draw[blue] (\x:1)node[circle, fill=blue!20, draw]{};}; \end{scope} \begin{scope}[shift={(330:3)}, rotate=285] \foreach \x in{0,90,180,270}{\draw[blue] (\x:1)--(\x+90:1);}; \foreach \x in{0,90,180,270}{\draw[blue] (\x:1)node[circle, fill=blue!20, draw]{};}; \end{scope} %\foreach \x in{90,210,330}{\draw[thin] (0,0)--(\x:3);}; \end{tikzpicture} ```
https://tex.stackexchange.com/users/284230
lines between nodes
false
Sorry, but it is not enterally clear (to me) how dots between rectangles should be connected. Something like this? If not, please provide a sketch which show what you after. ``` \documentclass[margin=3mm]{standalone} \usepackage{tikz} \usetikzlibrary{positioning} \begin{document} \begin{tikzpicture}[ node distance =6mm and 12mm, dot/.style = {circle, draw=blue, fill=blue!20, inner sep=2pt}, N/.style = {draw=blue, minimum size=10mm, node contents={}} ] \node (n1) [N]; \foreach \i [count=\j] in {north west, north east, south east, south west} \node (n1-\j) [dot] at (n1.\i) {}; \node (n2) [N, above right=of n1]; \foreach \i [count=\j] in {north west, north east, south east, south west} \node (n2-\j) [dot] at (n2.\i) {}; \node (n3) [N, below right=of n2]; \foreach \i [count=\j] in {north west, north east, south east, south west} \node (n3-\j) [dot] at (n3.\i) {}; \foreach \i in {1,2,3,4} \draw[very thin, teal] (n1-\i) -- (n2-\i) (n2-\i) -- (n3-\i); \foreach \i in {1,2,3,4} \draw[very thin, teal] (n1-\i) to[bend right=15] (n3-\i); \end{tikzpicture} \end{document} ``` **Addendum:** According to your comment, t5his is starting point which show how you can connect dots from one rectangle to all dots in other rectangles: ``` \documentclass[margin=3mm]{standalone} \usepackage{tikz} \usetikzlibrary{positioning} \begin{document} \begin{tikzpicture}[ node distance =6mm and 12mm, dot/.style = {circle, draw=blue, fill=blue!20, inner sep=2pt}, N/.style = {draw=blue, minimum size=10mm, node contents={}} ] \node (n1) [N]; \foreach \i [count=\j] in {north west, north east, south east, south west} \node (n1-\j) [dot] at (n1.\i) {}; \node (n2) [N, above right=of n1]; \foreach \i [count=\j] in {north west, north east, south east, south west} \node (n2-\j) [dot] at (n2.\i) {}; \node (n3) [N, below right=of n2]; \foreach \i [count=\j] in {north west, north east, south east, south west} \node (n3-\j) [dot] at (n3.\i) {}; \foreach \i in {1,2,3,4} \draw[very thin, teal] (n1-1) -- (n2-\i) (n1-1) to[bend right] (n3-\i) % (n1-2) -- (n2-\i) (n1-2) to[bend right] (n3-\i); % etc. for connections of other dots I left to you \end{tikzpicture} \end{document} ```
1
https://tex.stackexchange.com/users/18189
686886
318,656
https://tex.stackexchange.com/questions/34580
202
I need to output the below text but since `\` is a special character, I cannot: ``` [RegularExpression(@"\d+")] ``` Also sometimes I need use dollar sign `$` as well but it seems to be a special char, too. What is the way to escape those in LaTeX? **UPDATE:** I used `\verb` as suggested but I am unable to run commands inside it. Also, in the output the font and the opacity of the text is different than the default one: ``` \verb|[RegularExpression(\newline @"\d+")]| ```
https://tex.stackexchange.com/users/8254
Escape character in LaTeX
false
A note: **`\textasciitilde` and `\textasciicircum` are unnecessarily verbose. Use `\^{}` and `\~{}` instead.** --- Some clarification is needed. `\^` and `\~` themselves are not individual "characters" like `\%` `\_` or `\#` are, but rather they're command to "place an accent on the following character", like how `\'a` gives `á`. So there must be "something" (`{}`) that follows the `\^` -- in particular `{\^}` will not work. You can think of this as putting `^` on an empty base. Nevertheless, in all cases, `\^{}` and `\~{}` gives the exact same result as typesetting the character at slot 94 and 126 from the font file directly. You can test it yourself by compiling this document: ``` %! TEX program = pdflatex \documentclass{article} %\usepackage[T1]{fontenc} % optional \begin{document} \pagenumbering{gobble} \texttt{\textasciicircum\^{}\symbol{94}\^a\^b} \textasciicircum\^{}\symbol{94}\^a\^b \texttt{\textasciitilde\~{}\symbol{126}\~a\~b} \textasciitilde\~{}\symbol{126}\~a\~b %{\^} % does not work! \end{document} ``` Output: This is because the command is [implemented](https://i.stack.imgur.com/77rrz.png "source2e screenshot") (after some composite-character table lookup) with TeX's primitive `\accent` command, but: so `\accent ⟨accent⟩ ⟨nothing follows⟩` gives just `\char ⟨accent⟩`. --- Another note: In OT1 font encoding, `\texttt{...}` used with `_{}\` does not give the best result. Refer to: ``` \documentclass{article} \usepackage[OT1]{fontenc} \begin{document} \pagenumbering{gobble} \texttt{\& \% \$ \# \_ \{ \} \textbackslash} \texttt{\& \% \$ \# \symbol{95} \symbol{123} \symbol{125} \symbol{92}} \end{document} ``` Output: There are a few ways to fix it: * [`\usepackage[T1]{fontenc}`](https://tex.stackexchange.com/a/48633/250119) * `\symbol{...}` (see the example above) Refer to my answer in <https://tex.stackexchange.com/a/643285/250119> for an explanation what's going on.
0
https://tex.stackexchange.com/users/250119
686889
318,658
https://tex.stackexchange.com/questions/686892
0
I want to create a custom list while using enumitem and polyglossia. Running `latexmk main` on this `main.tex`: ``` \documentclass[12pt, a4paper]{report} \usepackage{polyglossia} \setmainlanguage{czech} \usepackage{enumitem} \newlist{enumfp}{enumerate}{1} \setlist[enumfp]{label=\textbf{FP-\arabic*},ref=FP-\arabic*} \begin{document} \begin{enumfp} \item A \item B \item C \end{enumfp} \end{document} ``` Produces this output ``` ! Missing number, treated as zero. <to be read again> \c@- l.10 \item A ? ! Missing number, treated as zero. <to be read again> \c@- l.11 \item B ? ! Missing number, treated as zero. <to be read again> \c@- l.12 \item C ? [1] (main.aux) ) ``` But as soon as I remove the polyglossia package and setmainlanguage, the document is produced without any problems. `.latexmkrc`: ``` $pdf_mode = 5; $xelatex = "xelatex --shell-escape %O %S"; $xdvipdfmx = "xdvipdfmx -z 0 -o %D %O %S"; $dvi_mode = 0; $postscript_mode = 0; $hash_calc_ignore_pattern{'timestamp'} = '^'; ```
https://tex.stackexchange.com/users/144491
Enumitem custom list does not work with polyglossia
false
The problem is the hyphen `-` inside the label. Polyglossia replaces it with something else. Using the `hyphenat` package's `\hyp{}` solved the problem. ``` \documentclass[12pt, a4paper]{report} \usepackage{polyglossia} \setmainlanguage{czech} \usepackage{hyphenat} \usepackage{enumitem} \newlist{enumfp}{enumerate}{1} \setlist[enumfp]{label=\textbf{FP\hyp{}\arabic*},ref=FP\hyp{}\arabic*} \begin{document} \begin{enumfp} \item A \item B \item C \end{enumfp} \end{document} ```
0
https://tex.stackexchange.com/users/144491
686893
318,659