Tag Info

Hot answers tagged

19

TeX's scanner (eyes) convert characters in a file to tokens. That only happens once, macro replacement text and all expansion processing processes tokens (which are [character-code,catcode] pairs. the catcode table affects the conversion of characters to character tokens. So your definition locally makes the catcode of _ 13 so if a _ character is encounted ...


13

\verb has no effect on tokens (even if you expanded \FileName), so you want something more like this \def\FileName{A_B} \documentclass{article} \usepackage[T1]{fontenc} \begin{document} \texttt{\detokenize\expandafter{\FileName}} \end{document}


11

The \scantokens command is not “dangerous” by itself, but it can have surprising effects. How does it work? Its argument is scanned like for a \write operation, but all symbolic tokens are considered unexpandable, based on the current category codes; the result is placed in a “pseudofile” that is read in exactly as if \input was used. This has various ...


7

\sindex, like \index expands no macro by design, unless it's called as argument to another command. However, your \rmBrcs command doesn't work purely by expansion, in particular \StrDel is not performed during a \write operation, so you don't get what you want anyway with the trick \newcommand{\Sindex}[2][]{\sindex[#1]{#2}} or similar. You have to take ...


6

Aren't we mixing 2e conventions and expl3 conventions here? As an alternative to Joseph's answer how about: Have a version of \overset in expl3 conventions, i.e., \cs_set_eq:NN \overset:nn \overset % not a very good expl3 name though :-) Provide the variant you need here, i.e., \cs_generate_variant:Nn \overset:nn { no } Then use simply ...


5

An explicit number can be expanded without changing it and the unwanted command sequence can be redefined to vanish itself, when expanded: % Setup \makeatletter \newif\ifintheway \def\@citeb{foobar} \def\bfoobar{\inthewayfalse 17} % Extract the number from \csname b\@citeb\endcsname % and store it in the macro \mynumber \begingroup ...


4

In short: Omit the curly braces around #1, #2, ... Example: \href{http://stbarnabaschapel.net/asm/proj{#2}.asm} If #2 is foobar, then it expands to: \href{http://stbarnabaschapel.net/asm/proj{foobar}.asm} The curly braces are not going away, because they are not parsed as argument. Thus the curly braces become part of the URL. Also \href{{#1}} is ...


4

While one could use \tl_put_right:NV or similar here, there would be something of a loss of efficiency as you've got to introduce a brace group and that need several steps. Instead, I would here us an x-type expansion and appropriate control: \tl_set:Nn \l_tmpa_tl { \emph { emph } } \tl_set:Nx \l_tmpb_tl { \exp_not:N \overset { o } { \exp_not:V \l_tmpa_tl ...


2

You need to fully expand the argument of \substitute before you use this command. That can be arranged but not with a \@for mapping, which is non-expandable. As you are already using xparse I'd just write this in expl3. See code comments for details: \documentclass{article} \usepackage{expl3,xparse} \ExplSyntaxOn % User command taking ones comma-list ...


2

You need to define \rmbrcs as expand-only macro: \def\rmbrcs#1{\expandafter\rmbrcsA#1()\end} \def\rmbrcsA#1(#2)#3\end{\ifx\end#3\end #1\else \rmbrcsA#1#2#3\end\fi} There is no need to worry about tail recursion (dangling \fi) as the argument here will be simple text not some recursive thing.


1

May be defining your own seq_mapthread_inline? \cs_new_protected:Npn \aellet_seq_mapthread_inline:NNn #1 #2 #3 { \cs_set:Npn \__aellet_tmp:w ##1 ##2 { #3 } \seq_mapthread_function:NNN #1 #2 \__aellet_tmp:w }


1

As for your second question, you have it basically ok. Just modify these lines as following (treat them as submolecules): \path node(A){\chemfig{ !{\sera{1}}-[,0.3,,,draw=none] !{\serb{2}}-[,0.3,,,draw=none] !{\sera{3}}-[,0.3,,,draw=none] }}; Compiling it with pdflatex should do the work.



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