Skip to main content

Questions tagged [macros]

{macros} is for questions specifically concerning TeX's macro processor. Note that, because TeX uses macros ubiquitously, most questions about code that uses macros are not looking for information about how macros work, and so are not appropriate for this tag.

458 questions with no upvoted or accepted answers
8 votes
0 answers
2k views

When is \ensuremath really needed?

A rather popular question is When not to use \ensuremath for math macro?. Some good answers there explain why \ensuremath is often overused. egreg has an "\ensuremath-only-when-really-needed campaign"....
Olius's user avatar
  • 181
7 votes
0 answers
281 views

Redefining Commands: Safety and Best Practices

There's plenty of questions on this site about redefining specific commands, but I couldn't find a more general, comprehensive question about the safety and best practices of redefining commands in ...
steve's user avatar
  • 2,256
5 votes
0 answers
84 views

What variant float lists exist?

I saw question wrapfig and wraptable not obeying \FloatBarrier and resolved to put \wrapfill\WFclear into placeins.sty. But I also wonder if there are more alternative float types or alternative ...
Donald Arseneau's user avatar
5 votes
1 answer
2k views

Insert code snippet via keyboard shortcut in TeXworks

I know there already are questions (1, 2) on creating keyboard shortcuts in TeXworks. The discussion (also in the Google thread referred to), however, seems a little outdated. By now, there is the ...
Bernd's user avatar
  • 1,795
4 votes
0 answers
95 views

Redefine overlay-aware beamer command using xparse

Suppose to want the \texttt command accept two optional arguments with a default value before and after the mandatory one, in order to specify anything (here spaces) that should be prepended or ...
Axel Krypton's user avatar
  • 1,093
4 votes
1 answer
376 views

Is there a good way to make a wordcount macro in LaTeX?

I have used this command to count words in LaTeX, but it has some weaknesses: Although it is supposed to surpress error messages, it does not always do this (see picture). It cannot count words ...
Vebjorn's user avatar
  • 1,884
4 votes
0 answers
169 views

What are the available macros for algebra and calculus?

The polynom package can provide all the steps of a long division of polynomials if I just provide the polynomials: \documentclass{article} \usepackage{polynom} \begin{document} \polylongdiv{x^4-3x^3-...
Chilote's user avatar
  • 189
4 votes
0 answers
682 views

xparse - \NewExpandableDocumentCommand - what is the rule for calculating the amount of expansion-steps it takes to obtain the replacement text?

According to the documentation of the package xparse the syntax of \NewExpandableDocumentCommand is: \NewExpandableDocumentCommand ⟨function⟩ {⟨arg spec⟩} {⟨code&...
Ulrich Diez's user avatar
  • 29.7k
4 votes
2 answers
407 views

counters, newcount and pgfcalendar, macros

I am trying to use the pdfcalendar library, but I think I'm confused by the definitions. My Question: What kind of LaTeX counter/macro/variable can I use with pgfcalendar functions? Do I have to ...
Tim's user avatar
  • 1,559
4 votes
0 answers
431 views

looking for selective latex command replacement methods

I have a perl script for generating wordpress (or physicsforums or wikipedia) style latex markup from standalone latex files, but it has grown into a bit of a monstrosity and has also recently met it'...
Peeter Joot's user avatar
  • 3,045
3 votes
0 answers
68 views

Are there tricks for detecting whether a `\csname..\endcsname`-thingie went wrong and, if so, delivering additional messages explaining the issue?

For the sake of having expandable tokens expanded before stringification I sometimes combine \csname..\endcsname-expansion with \string as in \chardef\stopromannumeral=`\^^00 \edef\gobbleToPrefix{% \...
Ulrich Diez's user avatar
  • 29.7k
3 votes
0 answers
149 views

General (dis)advantages of ways to define new commands

I have a question about the many ways to define a new command. I looked through the web and TeX.SE but couldn't find a complete answer (only some partly answers like, here, here, here, or here). I ...
lukeflo's user avatar
  • 1,597
3 votes
0 answers
98 views

How to treat the output of a command as an "ordinary text"?

In the following example, how can I treat the output of \cite as it was a simple string of text? \documentclass{article} \usepackage[style=numeric-comp]{biblatex} \begin{filecontents*}{\jobname.bib} @...
CarLaTeX's user avatar
  • 64.7k
3 votes
0 answers
67 views

Diminishing size of nested brackets

I'm writing in a notation that uses lots of nested brackets, e.g. [[], [[]], [[], []]] This easily gets difficult to read and is a lot more readable when written like $\Bigl[ \bigl[ \bigr], \bigl[ [], ...
Edwin Agnew's user avatar
3 votes
0 answers
77 views

Adding superscript and subscript at the correct place within a custom command

I was writing part of a slightly mathematical paper in LaTeX and I came across the following problem. I worked out an alternative (and good) solution to my problem, but I'm very curious if anyone ...
Lluís Alemany-Puig's user avatar

15 30 50 per page
1
2 3 4 5
31