Quantcast
Channel: Check for group as argument (expandable) - TeX - LaTeX Stack Exchange
Viewing all articles
Browse latest Browse all 5

Answer by David Carlisle for Check for group as argument (expandable)

$
0
0

This doesn't ignore space, I think it's easier to use strcmp, I added one extra test for {a} at the end:

enter image description here

\documentclass{article}\makeatletter\def\zz#1\zz{#1}\def\MyIfGroup#1{%\ifnum\expandafter\pdfstrcmp\expandafter{\zz#1\zz}{#1}=0\expandafter\@secondoftwo\else\expandafter\@firstoftwo\fi}\makeatother\begin{document}\MyIfGroup{{}}{true}{false}\MyIfGroup{ {}}{true}{false}\MyIfGroup{{} }{true}{false}\MyIfGroup{ {} }{true}{false}\MyIfGroup{ }{true}{false}\MyIfGroup{a}{true}{false}\MyIfGroup{{}a}{true}{false}\MyIfGroup{{a}}{true}{false}\end{document}

Viewing all articles
Browse latest Browse all 5

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>