Skip to main content

All Questions

Tagged with
Filter by
Sorted by
Tagged with
5 votes
2 answers
224 views

How to simplify input to a table with many columns?

While preparing a table on musical modes I came accross this situation: entering the 7 pitches as one column looks bad after compile, once accidentals occur finally I had to provide 7 columns instead ...
MS-SPO's user avatar
  • 16.3k
4 votes
3 answers
190 views

How to substitute placeholders in string with arguments?

I'm writing a document in two languages using the macro \enzh defined as below: \documentclass{article} \newif\ifen \entrue % comment out to switch to Chinese \newcommand{\enzh}[2]{\ifen#1\else#2\fi} ...
George Tian's user avatar
1 vote
2 answers
43 views

How to properly shorten if condition?

\documentclass{article} \title{} \author{} \date{} \begin{document} \newcommand{\mybold}[2]{\ifnum #1=1 \textbf{#2} \else{#2} \fi} \mybold{1}{This should be bold} \mybold{0}{This should NOT be bold} ...
nch7822's user avatar
  • 11
1 vote
2 answers
67 views

substitution with trailing space except before punctuation

I am currently using many simple substitutions like: \newcommand{\abc}{{\small ABC}} \newcommand{\ABC}{{\abc} } And then in my document text: I use \ABC if I want a space and if not then \abc. I'm ...
cjfp's user avatar
  • 13
3 votes
2 answers
172 views

Command to cycle through synonyms

Is it possible to define a command to cycle a list of predefined synonyms? For example, define a list of adverbs (however, nevertheless, nonetheless, notwithstanding) for the \adverb (or something ...
thompsonh's user avatar
0 votes
1 answer
39 views

Prevent substitution of "macro arguments" in macro invocation within macro definition

I'm getting the error Illegal parameter number in definition of \setuplateloadedpackages. for the following code. It seems like newcommand can't recognise that the "macro arguments" passed ...
Noldorin's user avatar
  • 979
5 votes
1 answer
158 views

Macro Substitution/Expansion in Environment Names

I've noticed that you can use macros for substitution into environment names: \def\itmz{itemize} \begin\itmz \item Item the first \item Item the second \end\itmz % works It also works ...
fmg's user avatar
  • 477
3 votes
1 answer
2k views

Define latex command in which argument is part of another command

Is there a way to define a LaTeX command in which an argument forms part of a command that is expanded inside the text defined by the command? For example, here's a MNWE (Minimal Non-Working Example--...
Mars's user avatar
  • 1,128
2 votes
2 answers
836 views

Multi-stage regular expression replacement

I'm trying to write a macro which will recognize certain sequences of characters in a string, and then map those onto a different set. In the particular case I have in mind, since there are multiple ...
junius's user avatar
  • 2,068
19 votes
2 answers
1k views

Is there any reason not to use \let to redefine a deprecated control sequence to the currently recommended one?

I understand that \bf and \it are both deprecated in the current version of LaTeX. To the best of my knowledge, the correct control sequences replacing them are \bfseries and \itshape. Is there any ...
A Feldman's user avatar
  • 3,975
3 votes
2 answers
194 views

How to implement a verbatim or null environment using a boolean within \newcommand

I am trying to use a boolean environment within a \newcommand statement to selectively implement a verbatim environment. When I set the boolean to true it should put the "Answer" within the verbatim ...
A Feldman's user avatar
  • 3,975
20 votes
4 answers
2k views

Is there a way to eliminate the "\" in frequently used LaTeX commands?

The "\" in all of the commands requires frequent finger gymnastics of the pinky of the right hand in LaTeX, at least for the touch typist. It occurred to me that although it makes things more ...
A Feldman's user avatar
  • 3,975