Tag Info

5

Several ways, one way to do it with two \expandafter is \documentclass{standalone} \def\myvar{foobar} \begin{document} \makeatletter \in@{foo}{foobar}\ifin@ Yes\else No\fi, \def\zz{\in@{foo}} \expandafter\zz\expandafter{\myvar}\ifin@ Yes\else No\fi \makeatother \end{document}

5

\in@ doesn't expand its arguments; you can easily define a new macro \ein@ that expands (once) its argument: \documentclass{article} \def\myvar{foobar} \makeatletter \def\ein@#1#2{% \expandafter\ein@@\expandafter{#2}{#1}% } \def\ein@@#1#2{\in@{#2}{#1}} \makeatother \begin{document} \makeatletter \in@{foo}{foobar}\ifin@ Yes\else No\fi, ...

5

Your code doesn't work because you're issuing \makeatletter at the wrong time; category codes are not changed when tokens have already been absorbed. You need \makeatletter \section{\textbackslash section\f@size pt} \makeatother but it's better to use a specific macro. \documentclass{article} \newcommand{\cs}[1]{\textbackslash #1} \makeatletter ...

5

I'd just query \@currsize. \documentclass{article} \makeatletter \newcommand\queryfont[3]{% \ifx\@currsize#1 #2% \else #3% \fi } \makeatother \begin{document} \queryfont\small{This is small}{This is not small} \small \queryfont\small{This is small}{This is not small} \end{document}

5

You're not passing a set of options but something that contains a set of options. The error message is a bit misleading, because the expansion takes place when issuing the error, so it appears you have passed the right options. No key-value based package performs expansion when absorbing key-value pairs, because it could be disastrous. So the solution is to ...

4

{\small \f@size} is not a number. You should better store the f@size-value first: \documentclass{article} \usepackage{ifthen} \begin{document} \makeatletter \ifthenelse{\f@size=9}{the size is 9}{the size is not 9} \makeatother \makeatletter \small \ifthenelse{\f@size=9}{the size is 9}{the size is not 9} \makeatother \makeatletter {\small ...

4

Is this what you have in mind? The \definesizecommand macro is able to define a command that behaves differently in the various sizes. This command can also have arguments, as shown by \baz. \documentclass{article} \usepackage{relsize} \usepackage{xparse} \ExplSyntaxOn % relsize builds a list \rs@fontsizes of the form % ...

4

It is imho not a good idea to redefine such accent commands. But in your case you can make \turc robust: \documentclass{scrartcl} \usepackage{natbib} \let\turc\c \usepackage{etoolbox} \robustify\turc \renewcommand{\c}{\ensuremath{c^\pi}} \begin{document} \citep{ABC} \bibliographystyle{plainnat} \bibliography{lit} \end{document}

3

I've stored the font size \f@size of \small first (before \begin{document} and use \ifthenelse{...} to compare this with the current size. \documentclass{article} \usepackage{xifthen} \makeatletter {\small\xdef\smallfontsize{\f@size}} \makeatother \begin{document} \makeatletter \large \ifthenelse{\f@size = \smallfontsize }{the size is small}{the size ...

2

When you do \let\turc\c you are essentially defining \def\turc{\OT1-cmd \c \OT1\c} Note that \OT1-cmd is a single control sequence, as well as \OT1\c; they can't ordinarily be written or used without special tricks. Simplifying a bit, the purpose of \OT1-cmd is twofold: during normal typesetting, it ignores the following \c token and uses \OT1\c, which ...

1

The LaTeX kernel has some non publicized programming tools, such as while loops. The more well-know \loop is not appropriate here inside the tabular for a number of reasons, one being that it makes a local definition which will get lost, the other one is that \cline also uses \loop and this would clash. Here is a one-liner to get user access to one LaTeX ...

1

Please refer to the MEW instructions to have a consistent one. This is an expl3 based solution. To switch the rowcolor, the compiler should be informed if the new insertion is (or not) a weapon subtype. In such case, it have to hold on the previous rowcolor. Otherwise, it switches it. The compiler is informed about subtypes via \weapon*. ...

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