# Tag Info

11

You're going to get different results because you're comparing the definitions of the two macros. \MakeUppercase{1} is not the same as \MakeLowercase{1} It's worth noting that the \MakeUppercase and \MakeLowercase macros are themselves complicated enough that the naïve approaches to trying to expand them to get the results in plain text will still not give ...

9

Like Donald Hosek said, \ifx doesn’t expand its arguments. You’re comparing the unexpanded macros \MakeUppercase{1} and \MakeLowercase{1}. You could fix this by fully expanding the macros you compare. However, that doesn’t give you a complete solution, because \MakeUppercase and \MakeLowercase are not expandable. So, \edef\upperone{{\MakeUppercase 1}} ...

6

The test fails to show equality on (at least) two levels. First level \MakeUppercase and \MakeLowercase are instructions to print the uppercased or lowercased versions of their arguments. They don't “directly” transform their arguments. Second level \ifx only compares the “surface meaning” of two tokens without any macro expansion. In particular, two macros (...

6

The reason for the error is that the array does not contain integers but ifnum requires an integer. You can use pgfmathparse to parse the entry from the array and pgfmathresult in the ifnum statement. Also you need to use i-1 otherwise the last array index is out of bounds, because arrays are indexed starting with 0. \def\array{{1,0,1,1,1,1}} \foreach \i in {...

5

The manual of the etoolbox package says: \ifstrequal{⟨string⟩}{⟨string⟩}{⟨true⟩}{⟨false⟩} Compares two strings and executes ⟨true⟩ if they are equal, and ⟨false⟩ otherwise. The strings are not expanded in the test and the comparison is category code agnostic. Control sequence tokens in any of the ⟨string⟩ arguments will be detokenized and treated as ...

3

The “official” source for TeX primitive commands is the TeXbook, whose TeX source is available online (even on CTAN), but not for making the printed copy. The source starts with % This manual is copyright (C) 1984 by the American Mathematical Society. % All rights are reserved! % The file is distributed only for people to see its examples of TeX input, % not ...

2

The problem is that \ifstrequal does no expansion to its arguments. This might be solved by forcing expansion, but let me present a different solution based on expl3 and its richer supply of functions and tests. \documentclass{article} \usepackage{xparse} \ExplSyntaxOn \NewDocumentCommand{\inject}{m} { \utkarsh_inject:n { #1 } } \tl_new:N \...

2


2

amsthm's internal macro \@ifempty is what you need. Alternatively, you can use \ifstrempty{<string>}{<true code>}{<false code>} from etoolbox package. \documentclass{article} \usepackage{amsthm} \makeatletter \newtheoremstyle{mytheorem} {\topsep} {\topsep} {} {1em} {\bfseries} {.} { } {% \@ifempty{#3} {\thmname{#1}...

2

You need something expandable, ifthen and xifthen won't work. \documentclass[12pt]{article} \usepackage{hyperref} \begin{document} \ExplSyntaxOn \newcommand{\gesetze}[2] { http\c_colon_str//www.gesetze-im-internet.de/#1/ \tl_if_blank:nF {#2}{__#2.html} } \ExplSyntaxOff \href{\gesetze{bgb}{622}}{This is the 622nd paragraph in the law.} \href{...

1

If you want to link to a specific paragraph/section or the entire law with some text more often, you can define a dedicated command for that. I'm using etoolbox's \ifblank to test if the string is empty, because I generally prefer etoolbox tests over ifthen, but that is just a matter of style. \documentclass[12pt]{article} \usepackage{etoolbox} \usepackage{...

1

Note that line 167 of beamerbasetitle.sty contains \author{}, hence \beamer@shortauthor is always defined and initially empty, and one can/should test if meaningful \author{...} is used by \ifx\beamer@shortauthor\@empty. The following example outputs "No author given Some more information" on first frame, and "Author | Some more information&...

1

You can achieve this using the following code: \usepackage{xstring} \usepackage{ifthen} \newcommand{\F}[1]{ \StrLeft{#1}{1}[\firstletter]% \StrRight{#1}{1}[\lastletter]% \ifthenelse{\equal{(}{\firstletter} \AND \equal{)}{\lastletter}}{F#1}{F(#1)}% } It basically checks what the first and last characters of the argument are, and if those are '(' ...

1

This should be solved by using ##1 instead of #1, because you want to define a command inside the argument passed to another macro. See What is the meaning of double pound symbol (number sign, hash character) ##1 in an argument? for more information.

1

I found a solution to my issue, which is not perfect, but should work well enough. Here is the code: \documentclass{beamer} \makeatletter \defbeamertemplate*{frametitle}{regular}{% \def\agendatoken{@special-frametitle-agenda}% \ifx\agendatoken\beamer@shortframetitle Agenda% \else \insertsection\ \textbf{\insertframetitle}% \fi} \newcommand{\agendapage}{\...

1


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