All Questions
Tagged with macros programming
121
questions
2
votes
2
answers
130
views
Build a new command "newsymbol" with NewDocumentCommand
I want to create a new command \newsymbol, which functions like \newcommand, but with the difference that math is ensured. I also have another reason, why I want to define this new command, namely so ...
3
votes
2
answers
119
views
Best Practices for Integrating Computer Algebra Systems (CAS) into LaTeX Documents
I am currently working on enhancing my LaTeX documents to involve complex mathematical equations. Managing these equations manually often leads to errors, especially when changing dependent equations ...
6
votes
2
answers
359
views
if_exist macros in LaTeX 3: what are they doing if they do not check the type of things they are supposed to check?
In the documentation of interface3, for several macros with the pattern xxxx_if_exist for xxxx being bool, str, seq and many others the following appear:
Tests whether the <boolean> is ...
1
vote
1
answer
203
views
Is LaTeX a programming framework of TeX?
My take from What is the difference between TeX and LaTeX? is that TeX is the programming language that renders the document. LaTeX is a well-known macro package for TeX with the aim to make the ...
0
votes
2
answers
114
views
A macro to check command expandability
I would like to create a command that checks whether an expression is fully expandable, and crashes if not (ideally printing an error message). I would like to do that without a specific TeX engine in ...
1
vote
0
answers
91
views
Design a generic numeric comparator function using expl3 working for strings, counters, numexpr, dimexpr
I would like to design a generic compare function between numbers, ideally expandable with the following signature:
\NewExpandableDocumentCommand{\compare}{r[] m m m m m}{%CODE HERE%}
that would be ...
4
votes
3
answers
148
views
Problem with a command that prefixes words only if needed when the arguments are provided through macros
Consider the following code coming from this answer, where it adds a prefix to a word, only if the prefix is missing.
\documentclass[border=6pt,varwidth]{standalone}
\ExplSyntaxOn
\...
5
votes
4
answers
322
views
An expandable command that adds a string to an argument if the string is missing
I would like to write and expandable command which adds a string S1 at the beginning of another string S2 if S2 does not start with S1 in order to ensure that my string always start by S1.
I currently ...
1
vote
1
answer
38
views
Command color not working with the name of a color built through macros
Consider the following code and especially the command \nicecolorname which builds the name of a color following the pattern ["nice"][shade][hue]. In its current name, the command \color is ...
1
vote
3
answers
81
views
Branch over number of characters of an argument provided to a macro
I currently have the following command:
\newcommand*{\setfontshape}[1]{\@ifnotmtarg{#1}{\csname#1shape\endcsname}}
that helps me produce the command: \scshape from text sc.
I would like to modify my ...
0
votes
0
answers
55
views
Automatically calculate years of experience from provided start/end dates
I'm very very new to LaTeX and not even sure if this is possible.
\resumeSubheading
{Undergraduate Research Assistant}
{6 Years \& 3 Months} % 1 <---------------...
0
votes
0
answers
99
views
Using external dependencies in my Latex main file
I'm using the package "snapshot" to generate a list of external dependencies of my filename.tex file. This list's result is stored in a filename.dep file.
The goal would be to use this ...
7
votes
2
answers
672
views
Why can't I use <some macro> inside the argument of <some other macro>?
I have some macro X and Y, which works well when used independently. However, when I try to put one inside another, it results in some error.
Why is that the case and how can I fix it?
Note: this is ...
1
vote
1
answer
155
views
Blackout censor macro capable of handling italic and bold fonts
In the following TeX stackexchange answer, the author provides an excellent \blackout macro that produces very aesthetically pleasing underline effect.
However, this macro does not work well with any ...
2
votes
1
answer
77
views
Macros that can scan the contents of their arguments
I was thinking that it since the architecture of LaTeX is a collection of pre-processors on top of TeX, that it may be possible that some macros could in theory do some sort of find-and-replace within ...