# Tag Info

6

\documentclass{article} \usepackage[T1]{fontenc} \def\foo#1{\par \texttt{<\detokenize{#1}>} \expandafter\if\relax\detokenize\expandafter{\romannumeral0#1}\relax \if X#1X% empty\else not empty\fi \else not empty\fi} \begin{document} \foo{} \foo{ } \foo{\empty} \foo{{}} \foo{\sqrt} \foo{\csname @gobble\endcsname{hello}} \end{document}

5

You can use a \romannumeral trick: \if\relax\detokenize\expandafter{\romannumeral-\Q#1}\relax The missing space after \Q will trigger expansion of #1 (after macro substitution, of course). Since this expansion ends at the first unexpandable token, this should be what you want. However a leading space will be ignored. \def\notempty{\relax} ...

5

The syntax of \@ifnextchar is \@ifnextchar<test-token>{<true>}{<false>}<token> If <test-token> is the same as <token>, then the <true> code is inserted, otherwise <false> is inserted and the input stream will become either <true><token> or <false><token> Note that <token> ...

4

You haven't given any indication of what this code is intended to do and it is a very bizarre mix of latex3, latex2e and tex primitives, so I haven't attempted to guess what it is doing, but this version runs without error. \documentclass[a4paper]{report} \usepackage{amsmath,xparse} \makeatletter \newif\ifinvd@lims\invd@limsfalse \newif\iflr\lrfalse ...

3

To understand what is wrong with your code, I'd add a \tl_show:n \cs_new_protected:Nn \mypkg_display_instrument:nn { \tl_show:n {#1} #2 \IfNoValueF {#1} {\\(#1)~(should~appear~only~if~"NoValue"~is~false) } } That will reveal that you are not getting -NoValue- as #1: you are getting \tl_mypkg_status. That's exactly what you'd expect from ...

2

Ulrike Fischer gave a hint about low-level \ifnum query, this version uses the \ifnumgreater macro from the etoolbox package (and provides a comparison). In my point of view, \VarOne should not be used as a macro but as a counter, as long only integer values are concerned. \documentclass{article} \newcommand{\VarOne}{1500} \usepackage{etoolbox}% ...

1

Here is a mildly-automated version of your request using some magic from Order items in enumerate environment automatically: \documentclass{article} \usepackage{environ,etoolbox,multido} % Taken from http://tex.stackexchange.com/a/128318/5764 \makeatletter \newcounter{varoneitem}\newcounter{listcount}[varoneitem] \let\olditem\item% Store regular \item ...

1

From this source, I got a solution to my problem: \usepackage{etoolbox} \usepackage{refcount} \newcommand{\mypageref}[2]{ \ifnumequal{\getpagerefnumber{#1}}{\getpagerefnumber{#2}} {S. \pageref{#1}} {S. \pageref{#1}\ --\ \pageref{#2}} }

1

This should do the trick. \documentclass{article} % Beginning of definitions \usepackage{environ} \newif\ifappendix \NewEnviron{maybeappendix}[1] {\ifappendix \expandafter\global\expandafter\let\csname putmaybeappendix#1\endcsname\BODY% \else \expandafter\newcommand\csname putmaybeappendix#1\endcsname{}\BODY% \fi} ...

1

Two remarks : \isin seems impossible to put inside path command. So you have to do (as proposed by @jfbu) : {\ifthenelse{...}{\path (right) edge (\name);} {\path (left) edge (\name);}} to be able to use \isin{\name}{#2} you have to expand \name befor to pass it to \isin like this \expandafter\isin\name{#2} so finaly you can ...

1

Have you tried the ifmtarg package? It provides the macro \@ifmtarg{<arg>}{<Code for arg empty>} {<Code for arg not empty>} Use texdoc ifmtarg for the documentation.

1

The simplest solution (given that the apa biblatex style is used) is to store the translation in the titleaddon field (which is one of the standard biblatex fields).

Only top voted, non community-wiki answers of a minimum length are eligible