New answers tagged conditionals
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,
]{...
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}
\...
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⟩}
\...
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}
{%...
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, \...
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}
\...
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{%
...
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 ...
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 ...
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 ...
Top 50 recent answers are included
Related Tags
conditionals × 1860macros × 353
tikz-pgf × 125
ifthenelse × 85
tex-core × 81
environments × 79
etoolbox × 79
tables × 56
beamer × 56
loops × 49
expansion × 47
expl3 × 44
strings × 44
sectioning × 41
programming × 39
biblatex × 38
counters × 34
formatting × 33
math-mode × 31
spacing × 31
cross-referencing × 30
optional-arguments × 30
pdftex × 29
compiling × 29
xstring × 29