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.

1 vote
3 answers
160 views

I made a complex number command

So I've written a command as a homework assignment to render complex numbers correctly. Like, when I write \complfull{5}{-2} the output is 5-2i \documentclass{scrartcl} \usepackage{amsmath} \...
editilly's user avatar
3 votes
1 answer
54 views

Checking if the contents of the \item's of a \list environment are entirely in inline math mode

I have a list \begin{list}{}{} \item[(1)] First things first. \item[(2)] There are \(1 + 1 = 2\) types of "normal" math \[e^{2\pi i} + 1 = 2\] \item[(3)] Third time's \(\...
grepgrok's user avatar
0 votes
2 answers
65 views

Macro expansion crashes oddly

Here is my mwe.tex \documentclass[12pt]{report} \usepackage{xifthen} \usepackage{xstring} \def\test{\textnormal{test}} \newcounter{wordCount} \setcounter{wordCount}{0} \newcounter{AllWord} \...
hsmyers's user avatar
  • 1,573
3 votes
1 answer
89 views

How to use the penpos/penstroke inside a parametrized macro?

I am trying to create parameterized macro to draw a shape with penpos and penstroke macros in MetaPost (Metafont?) with plain.mp base but I am getting a error. Running the code below, def curve_st(...
sigsegv's user avatar
  • 625
4 votes
1 answer
85 views

How to define a custom axis attribute to reuse multiple axis settings?

edit: This post originally was named "Why is siunitx throwing an \endcsname inside newcommand?", but the rename does reflect the intention of the question better I think. Why is this code (...
VanC's user avatar
  • 57
2 votes
1 answer
73 views

Switch between notations for factorial

I am working with an old textbook where the factorial of $n$ is denoted by $\varPi(n)$. I would like to make a document where one can choose in the preamble whether to use this notation or the usual ...
tomdeneckere's user avatar
0 votes
1 answer
57 views

Comparison of macros fails

I am new to LaTex and have been given a problem by my colleagues. They define a document type in a TeX file (e.g. 'svvr', 'srs', ...). This external definition corresponds to lines 4 and 5 in my ...
ruriger's user avatar
5 votes
2 answers
151 views

macro to change line color in tikz

I am new both to tikz and macros in latex and appreciate your help. I have a simple code for two similar diagrams as follows: \documentclass{article} \usepackage{tikz} \newcommand\tpdrrr{ \tikz{ \...
lhz157's user avatar
  • 53
0 votes
1 answer
68 views

Is there a way to keep the "boldness" of text, in mathmode

Is there a way to keep the "boldness" of text, in math mode: eg: \documentclass{standalone} \newcommand{\mathkeepboldness}[1]{\ensuremath{#1}} % this should keep the text formating \begin{...
flobue's user avatar
  • 5
0 votes
1 answer
27 views

Problem command and tikzcd

When I compile this $$ \begin{tikzcd}[column sep={small},nodes={inner sep=2pt}] {| +1 \rangle} & {\langle +2|} \\ {\langle +3 |} & {| +4 \rangle} \arrow[no head, from=1-1, to=2-2] \arrow[no ...
MathBug's user avatar
  • 105
3 votes
2 answers
59 views

Custom LaTeX Command for Consecutive Superscripts with Correct Alignment After Large Symbols

I am writing my master's thesis on Formal Concept Analysis and I want to create a custom command for the derivation operators. They are superscript arrows with some optional argument, and would look ...
Samuel Jose Molina Ruiz's user avatar
1 vote
1 answer
60 views

Behavior of braces in macros

I am learning about macros to define commands with a variable number of arguments (following this). I saw a behavior that, to me, looks unexpected. If the \newcommand has a brace containing the ...
Ax11's user avatar
  • 15
3 votes
2 answers
429 views

How to make variants of an existing command without copying the code of the command?

I'm making some new commands such as a version of \prod but with a \Psi instead of the \Pi, but it's very complicated, because of the superscript and subscript that are respectivly directly on the top ...
Karl LÉOGNANY's user avatar
1 vote
1 answer
49 views

\mathchoice in subscript/superscript

I attempted to redefine certain math relations using \mathchoice so that they don't need to be grouped when used as subscripts and superscripts just like how they behaved originally. However, the MWE ...
FR09's user avatar
  • 159
1 vote
0 answers
122 views

Converting cleveref macros to standard LaTeX

My goal is to create a function in Emacs Lisp to interactively convert macros provided by the cleveref package (\cref, \Cref, etc.) into standard LaTeX: For example: \cref{sec:1} --> section~\ref{...
Gabriele's user avatar
  • 2,003

15 30 50 per page
1
3 4
5
6 7
554