Quantcast
Channel: Active questions tagged starred-version - TeX - LaTeX Stack Exchange
Viewing all articles
Browse latest Browse all 63

Testing for \Foo vs \Foo*

$
0
0

This is a follow up to this post whose problem statement (roughly): create a macro that saves a macro and options (\includepdf[angle=90, scale=0.85]), such as to be able to invoke it later (presumably repeatedly). Now I'd like to be able to do the same, but optionally with a star. (\newwatermark*[page=\thepage,angle=45]). For now, I'm trying to create a function that take as argument a macro and optionally a star, and that dispatches to different implementations whether that star is present or not. The code below compiles forever...

PS : preferably with package expl3.

\documentclass{article}\usepackage{xparse}\ExplSyntaxOn\cs_new_protected:Npn \__erw_test:w #1 #2 \q_stop{  \token_if_eq_charcode:NNTF *#2{T}{F}}\cs_new_protected:Nn \__erw_test:n{  \__erw_test:w #1 \q_stop \q_stop}\NewDocumentCommand\Foo{s}{  foo\IfBooleanT{#1}{star}}\ExplSyntaxOff\begin{document}\ExplSyntaxOn%\peek_charcode:NTF* { star } { no~star }\__erw_test:n{\Foo}%\__erw_test:n{\Foo*}\ExplSyntaxOff\end{document}

Viewing all articles
Browse latest Browse all 63

Trending Articles



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