Skip to main content

Questions tagged [conditionals]

{conditionals} is about macros like \if and \ifx that may execute other macros depending on whether certain conditions are true or not. Popular packages are {etoolbox} and {ifthen}.

1 vote
1 answer
68 views

Help with loops – why is there an Ω?

I am just getting some experience with looping constructs in TeX/LaTeX. I thought I understood how \@tfor works, and things were mostly coming out as I wanted. But I ran into some unexpected ...
Louis Deaett's user avatar
4 votes
2 answers
168 views

conditional enumerate labels

I am writing a math book. I have exercises that have questions AND subquestions (for example 1 then 1.a, 1.b, 2 then 2.a, 2.b, 2.c etc.). I also have exercises that have one questions, without ...
stargazer45's user avatar
3 votes
1 answer
247 views

How does \if:w work?

I cannot work out how \if:w works and LaTeX3's manual does not show any example on how to use it: I want to check whether the document is currently in oneside or twoside mode: \if@twoside Twoside ...
Dave's user avatar
  • 327
4 votes
1 answer
103 views

Why \IfPackageAtLeastTF{⟨package⟩}{⟨date⟩}{\PassOptionsToPackage{⟨option⟩}{⟨package⟩}}{} doesn't pass ⟨option⟩ to ⟨package⟩?

My current version of parskip is 2021-03-14 so: \IfPackageAtLeastTF{parskip}{2018-08-24}{\PassOptionsToPackage{indent}{parskip}}{} \usepackage{parskip} should pass the indent option to parskip. But ...
Denis Bitouzé's user avatar
1 vote
1 answer
25 views

Displaying article title in fancyhdr header with conditionals

I use the tip found here How to display article title in fancyhdr header to display article title in fancy header. But I'm not able to make it works within a condition sequence. As an example, this ...
AEgidius's user avatar
2 votes
2 answers
138 views

Checking if a certain fragment is located earlier in the document

Very often I want to refer to a certain claim I mentioned earlier in the document: "As I said earlier, blah." Since I often rearrange material, I need to ensure that "blah" indeed ...
Jabot's user avatar
  • 149
1 vote
2 answers
44 views

Can I change the effect of a command depending on the environment in which it's invoked?

I need a user-defined command to behave differently depending on whether it's invoked inside a \begin{quotation} environment or not. Is that possible? I don't know where to start!
digitig's user avatar
  • 125
1 vote
1 answer
31 views

Analyze number of spreadtab rows for conditionally changing text elements in the document

again I need your help. I'm writing my invoices for my small music busines with LATEX scrlttr2 and with a spreadtab-tables. It is working very well, but I want to have an automatic selection of some ...
Mr_Nofreeze's user avatar
3 votes
2 answers
92 views

\ifnum to draw a tikzpicture, less than or equals

I want to make a conditional statement that draws one tikz picture for specific values of \t and another for different \t values. Here is a M(non)WE: \documentclass{article} \usepackage{tikz,ifthen} \...
Jasper's user avatar
  • 397
2 votes
2 answers
56 views

Switching between translations of the Bible, looking up text

I have a document with scriptures listed, that I can call. (I'm not sure this is the best way to do it, but it's based on this stackoverflow answer.) \documentclass{book} \makeatletter \newcommand\...
dnh37's user avatar
  • 181
1 vote
0 answers
19 views

Conditional Output with user input

I am trying to write a form in Latex where I'm asking a question an if the answer is no I whant to ask another question. I'm a real beginner in Latex and I need a little help how to start it. It ...
Andrea K's user avatar
0 votes
0 answers
30 views

Check if a file has been modified since last compile in Overleaf

I have an if-statement that I call in my .tex document in Overleaf \IfFileExists{mypdf.pdf} {\includegraphics[width=1\textwidth}{mypdf.pdf}} {\includestandalone[width=1\...
David G.'s user avatar
  • 329
2 votes
1 answer
43 views

How make raggedleft really right aligned in if/else environment?

For some reason, the \raggedleft isn't really right-aligned. I tried minipage but that apparently doesn't work in the if/else environment. \documentclass[ % handout, english,usenames,...
jay.sf's user avatar
  • 509
3 votes
2 answers
54 views

Array or tabular in Beamer breaks \if

I want to have an array or tabular environment in an \if statement in Beamer. If I have an article, this compiles just fine: \documentclass{article} \def\x{1} \begin{document} \if\x1 \begin{tabular}{...
Sam Jaques's user avatar
3 votes
3 answers
351 views

How to define a command (or similar) that makes a conditional expression reusable?

I'm struggling with the correct use of conditional expressions with ifthenelse at the moment. I would like to define a command (or similar) that represents a certain conditional expression in order to ...
Simon's user avatar
  • 145

15 30 50 per page
1
2 3 4 5
124