# Tag Info

1

I think that a certain degree of caution is required here in the way we classify packages. While some people may consider ifthen obsolete, it is certainly not marked officially as obsolete. Compare ifthen's CTAN page with subfigure's. This is not to say that there are not often better options, but the existence of better alternatives does not, just in ...

4

You can do it with regular expression, after checking the argument is blank: if the argument matches just a token or a token followed by a _ and a subscript, then use no parentheses. \documentclass{article} \usepackage{amsmath} \usepackage{expl3,xparse,l3regex} \DeclareMathOperator{\fvop}{fv} \ExplSyntaxOn \NewDocumentCommand{\fv}{m} { \fvop ...

3

The concept of “single symbol” is somewhat vague: I can suggest an exact test as to whether the argument is, or is not, a single token. \documentclass{article} \makeatletter \newcommand*\IsOnlyOneToken[1]{% TT\fi \@IsOnlyOneToken#1\@@@ } \@ifdefinable\@IsOnlyOneToken{\def\@IsOnlyOneToken#1#2\@@@{% \ifx\@empty#2\@empty }} \makeatother ...

1

With xstring package you can retrieve the length of a string: \documentclass{article} \usepackage{xstring} \usepackage{ifthen} \newcommand\fv[1]{% fv~% \ifthenelse{\equal{#1}{}}{}{% \StrLen{#1}[\mylen]% \ifthenelse{\equal{\mylen}{1}}{#1}{(#1)}% }% } \begin{document} \fv{e}\par \fv{e1 e2} \end{document}

2


1

First things first: the \section instruction (in standard LaTeX) does not initiate an environment. But, you kind of forsaw that you would need to change the interface with respect to the last said. At least my solution needs sections to be grouped inside environments. The conditional logic isn't that complex in the end. Say you have two conditionals ...

3

You can achieve it by testing if doi is empty inside the function format.url. Replace your format.url by the following: FUNCTION {format.url} { doi empty${ url duplicate$ empty${ pop$ "" } { "\urlprefix\url{" swap$* "}" * } if$ } { "" } if\$ }

1

Here is a solution. suppose your file is question.tex \documentclass{article} \usepackage{comment} \usepackage{xcolor} \newtheorem{sol}{Solution} %\newif\ifshow % uncomment this line for normal use % uncomment next line for solutions %\showtrue \ifshow \newenvironment{bluesol} {\begin{sol} \color{blue}} {\end{sol}} \else ...

1

The problem is that \ref{...} is not a number, but a set of instruction for printing a number. You can use the refcount package that provides \getrefnumber that expands to 0 if the reference has not yet been established or to the reference itself. I've made some other small changes (in particular protected several end-of-lines). For part/parts the syntax ...

3

The argument of section is used in more than one place. It can wander in the header and the toc. Some commands ("fragile commands", see http://www.tex.ac.uk/cgi-bin/texfaq2html?label=protect) can break in this case. Either use \protect\onetimegloss{foo} or \section[text for toc and header]{\onetimegloss{foo}} or define a robust command with ...

1

The packages ifluatex provide for \ifluatex and ifpdf for \ifpdf statements. Use it \ifluatex ... \else ... \fi (\ifpdf as well) \documentclass{article} \usepackage{ifluatex} \usepackage{ifpdf} \ifluatex \usepackage{luaotfload} \else \ifpdf \usepackage[utf8]{inputenc} \typeout{PDF only} \fi \fi \begin{document} \ifluatex Yeah, it's lualatex ...

Top 50 recent answers are included