# Tag Info

2

The \pdfstrcmp primitive performs expansion: the linked answer does mention that the argument needs to be a 'string'. For comparing arbitrary input, prevent expansion using \unexpanded: \documentclass{article} \usepackage[utf8]{inputenc} \setlength\parindent{0pt} \usepackage{siunitx,microtype,textcomp,textgreek} \newcommand{\evaltest}[2]{% ...

1

Does it have to be pdfstrcmp? If not, you should look into etoolbox. E.g.: \documentclass{article} \usepackage[T1]{fontenc} \usepackage[utf8]{inputenc} \setlength\parindent{0pt} \usepackage{etoolbox} \usepackage{siunitx,microtype,textcomp,textgreek} \newcommand{\evaltest}[2]{% \ifnum\pdfstrcmp{#1}{#2}=0 #1 equals #2% \else #1 does ...

4

You can have different ways of comparing things and in the end send it to a variable. So below is only one way of many other ways such as storing the choices into keys and selecting them accordingly etc. This one is simple in particular because it assumes that there is no previous fill in the boxes so sets them to none. \usetikzlibrary{positioning} % In ...

4

\ifnum does nothing in the way you are using it. To achieve what you want you need the totcount package and to register your affiliations counter with it. \usepackage{totcount} \newtotcounter{affiliations} Then the redefinition of \affil must be \renewcommand{\affil}[1]{% \stepcounter{affiliations}% \ifnum\totvalue{affiliations}>1% ...

2

Whether this is intended to be accessible and will remain usable in the future I am not sure, but I have found that the glossaries package makes some fields accessible using commands formated similar to \glsentryshort{} and \glsentrylong{}. Most importantly, using these commands doesn't artificially trigger a counter that would prevent the appropriate first ...

5

My solution doesn't need any external package. The \showcat\macro is implemented. After \def\test{ger{\$##m}a~n \relax \foo} \edef\curentry{\string german \relax} \showcat\test \showcat\curentry we get the result: \test -> the letter g (catcode 11) the letter e (catcode 11) the letter r (catcode 11) begin-group character { (catcode 1) ...

2

In the second \ifx\entrytest\entrycurrent, \ifsomething is undefined, so the first \fi matches \ifx and the second \fi is out of place. It's not the macro name that makes something a conditional; only a token that is defined and is equivalent to one of the primitive conditionals counts. What \newif\ifsomething does is \let\ifsomething\iffalse ...

5

The experimental package l3tl-analysis does what you ask for. \documentclass{article} \usepackage{xparse,l3tl-analysis} \ExplSyntaxOn \NewDocumentCommand{\checktokenbytoken}{sm} { \IfBooleanTF{#1} { \tl_show_analysis:n { #2 } } { \tl_show_analysis:N #2 } } \ExplSyntaxOff \edef\xgerman{\string german\relax} ...

2

Due to how scanning for \noalign works, an unexpandable command (here \futurelet used by \@ifnextchar) starts a new alignment cell and it's too late for a line to be inserted. You have to do the scanning for the optional argument inside a \noalign group: \documentclass{standalone} \makeatletter \def\myline{% \noalign\bgroup \@ifnextchar[% ...

1

You could use \newcommand*\ifpdfexists[2][Bookmark]{% \IfFileExists{#2.pdf}{% \clearpage \pdfbookmark[1]{#1}{#1}% \includepdf[pages={-},fitpaper=true]{#2}\cleardoublepage}{\relax}} which incorporates the bookmark as part of the file/PDF inclusion. The optional argument to \ifpdfexists[<opt>]{<file>} represents the bookmark title. ...

10

During its trials tabularx makes various local definitions to stop things happening multiple times, or to stop you getting multiple warnings about the bad boxes for bad trials. In particular it does \hfuzz=\maxdimen (Actually without the =) so you get no overfull hbox warnings during the trials. On the final run it does a setting with all these ...

7

Among its primitive conditionals, TeX has \ifodd: \ifodd<number><true text>\else<false text>\fi Be careful though that testing \ifodd\value{page} (in LaTeX, it would be \ifodd\pageno in Plain TeX) is not reliable due to the asynchronous page breaking mechanism. Refer to If Then Else for odd page/even page for this specific problem. ...

5

You have \if\@sectiontype \if is true if the first two non expandable tokens after expansion are equal characters. \@sectiontype is expandable with definition \raggedright Fuel cells So it expands \raggedright which isdefined by \def\raggedright{% \let\\ .....} So it is going to compare \let with the first non expandable token in the ...

2

you can store it in commands \documentclass{article} \newcommand{\numtest}{1} \def\mt{\multicolumn{2}{c}{Long Text}} \def\mtt{text E & text F} \begin{document} \begin{tabular}{ll} text A & text B\\ text C & text D\\ \multicolumn{2}{c}{Long Text}\\ \ifnum \numtest=1 \mt\else \mtt\fi \end{tabular} \end{document}

5

You can't start a conditional in a cell and end it in another one, which would happen if the test is false. You can use \ifboolexpe of etoolbox: \documentclass{article} \usepackage{etoolbox} \newcommand{\numtest}{1} \begin{document} \begin{tabular}{ll} text A & text B\\ text C & text D\\ \multicolumn{2}{c}{Long Text}\\ \ifboolexpe{ test ...

4


10

You want % \iffalse % \begin{macrocode} %<*driver> \documentclass{ltxdoc} \usepackage[utf8]{inputenc} \usepackage[english]{babel} \begin{document} \DocInput{file.dtx} \end{document} %</driver> % \end{macrocode} % \fi % \begin{macrocode} %<*class> \RequirePackage{ifpdf} \ifpdf\RequirePackage[ plainpages=false, % ...

Top 50 recent answers are included