Skip to main content

New answers tagged

0 votes

Conditional formatting in table of contents (toc) with ifx

After some fidgeting, I discarded going down the conditional expression route and added some positive and negative space (using vspace) near the title of toc. Below is the MWE \documentclass[10pt, ]{...
bhache's user avatar
  • 57
1 vote

Hide custom environment content based on boolean

A simpler answer with xparse and booleans, it can be nested, and no expansion problems \documentclass{article} \newif\ifshow \NewDocumentEnvironment{testenv}{ +b }{\ifshow#1\fi}{} \begin{document} \...
A. Marchand's user avatar
3 votes
Accepted

doing something only when document option "final" is declared

The packacke ifdraft provides a simple interface for that. It provides the commands \ifdraft {⟨draft case⟩} {⟨final case⟩} \ifoptiondraft {⟨option draft is given⟩} {⟨option draft is not given⟩} \...
Bastian's user avatar
  • 723
3 votes
Accepted

default-valued optional (boolean) parameter for a new command in tikz

Here are a few possibilities (which are already outlined in the comments by @JasperHabicht and @Qrrbrbirlbel). \documentclass[tikz, border=0.2cm]{standalone} \NewDocumentCommand\drawscopeLTCMD{s} {%...
Skillmon's user avatar
  • 63.1k
4 votes

default-valued optional (boolean) parameter for a new command in tikz

Since it's a boolean parameter, the closest and easiest would be a optional *, indicated by the s in the argument specification of \NewDocumentCommand. We can test this argument with \IfBooleanT, \...
Qrrbrbirlbel's user avatar
0 votes

How do I conditionally execute something based on a documentclass option?

Based on TH.'s answer here and Will Robertson's answer elsewhere, I suggest the following: \usepackage{etoolbox} % for toggle-based conditionals \newtoggle{mytoggle} \togglefalse{mytoggle} \...
dremodaris's user avatar
5 votes

collcell and \IfBlankTF comparison not working

A change in array hasn't been reflected in collcell, so an internal token causes confusion. Try \documentclass{article} \usepackage{array} \usepackage{collcell} \makeatletter \def\collect@cell@arg#1{% ...
Joseph Wright's user avatar
  • 263k
7 votes
Accepted

Counter in Loop

I tried to get around that by defining a value \def \col {5*(\m-1)+\n} but that defines \col as the string, not the value. TeX is not a programming language. You only define what the macro should ...
Qrrbrbirlbel's user avatar
6 votes

Counter in Loop

Probably you don't need to nest \foreach-loops but can do with tuples where components are separated by /: \documentclass{standalone} \usepackage{tikz} \begin{document} \begin{tikzpicture} \foreach ...
Ulrich Diez's user avatar
  • 30.1k
6 votes

Counter in Loop

Quick and dirty solution: \documentclass{standalone} \usepackage{tikz} % ateb: https://tex.stackexchange.com/a/724372/ \begin{document} \begin{tikzpicture} \foreach \m [count=\i from 0, evaluate=\i ...
cfr's user avatar
  • 211k

Top 50 recent answers are included