Skip to main content

Questions tagged [substitution]

{substitution} is for general input text or token sequence substitution or deletion

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
2 votes
1 answer
29 views

LyX - automatic glyph substitution in preamble?

I use LyX to write documents with a mix of Hebrew, English, and mathematics. The fonts I use are specific: David CLM (for Serif), Simple CLM (for Sans Serif), and Miriam Mono CLM (for Typewriter). ...
awning2-only's user avatar
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
1 answer
57 views

\newunicodechar only in bold environments?

Can't seem to find an answer online. I am using the Linux Libertine font with LuaLaTeX, but I'm having a problem with two characters: ɭ and ɳ. The problem is that Linux Libertine does not support ...
geordiekidd's user avatar
0 votes
0 answers
130 views

Dynamic LaTeX command substitution

The last solution in the following post is great and we can add other shortcuts. One thing I don't understand is that I can't add a shortcut with a _ : Exemple : \mathbb{R}_+ doesn't transform ...
Redji's user avatar
  • 13
0 votes
1 answer
71 views

Substitute text between delimiters (listings) [closed]

I want to format code within the lstlistings package via \lstdefinestyle. The goal is to substitute the text after the regex 'C:\ up to the regex .eps' with PATH. How can I realize this? The solution ...
FixFox's user avatar
  • 57
3 votes
1 answer
407 views

Automatically replace s with ſ with LuaTeX

I am looking for a way to replace all s with ſ in my LuaTeX document (preferably plain LuaTeX or OpTeX) unless: it is preceded by another s, it is at the end of a word. So it is similar to rule ...
user avatar
1 vote
1 answer
185 views

Using fontspec or XeTeX commands to replace certain characters in font

This will sound like a strange question, but there is a rhyme and reason for it. Is there a way to have fontspec or XeTeX commands affect only letters of one case--say lowercase? For example, ...
Mike Pugh's user avatar
  • 399
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
0 answers
86 views

Why LuaLaTeX adds features (like rot13) into any OpenType font in cache

The following program \documentclass{article} \usepackage{fontspec} \begin{document} \fontspec{Erewhon-regular.otf} Hello {\addfontfeature{RawFeature={rot13,!!??}} World !?} {\addfontfeature{...
Jacques André's user avatar
1 vote
1 answer
493 views

Why does a backwards R get replaced with a Cyrillic Ya?

I’m considering using a backwards R to represent a reflection (mirroing) operation. Although I expected \reflectbox to reflect the geometry of the character, somehow the character becomes replaced by ...
HoochBlake's user avatar
1 vote
1 answer
89 views

ConTeXt: String substitution to include macro

Background A Markdown document uses certain strings that are to be typeset in a special way. In this case, we'd like to typeset a.m. and p.m. as small caps wherever that text appears in the source ...
Dave Jarvis's user avatar
  • 12.4k
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
2 votes
1 answer
333 views

LuaLaTeX: String substitution only in text (not in code and commands)

You can perform a string substitution with Lua code using gsub (see this answer). With \AtBeginDocument you can limit the scope of the function to the document. But is it also possible to have the ...
keth-tex's user avatar
  • 462
1 vote
0 answers
85 views

Wildcard substitutions with Lua Font Handlers

Using LuaLateX fonts.handlers.otf.addfeature, is it possible to make a substitution with a wildcard search? For example, a substitution that would substitute any Cyrillic unicode character with a '.'? ...
luaplaying's user avatar
8 votes
3 answers
1k views

String to lowercase and replace spaces with underscore

I am trying to convert a predefined string in a variable to its lowercase and replace the spaces to underscore. But it's not working. The new string after conversion is like this: ...
t.abraham's user avatar
1 vote
1 answer
31 views

Auto-adjustment of length(size) of bar of substitution

Wrote below. \documentclass[border=0.1cm]{standalone} \begin{document} $\displaystyle \left(\exp\left(x\right)^{\left(i\right)}\right)|_{x=0} =\exp\left(x\right)|_{x=0}=1$\\\\ \end{document} ...
electrical apprentice's user avatar
9 votes
4 answers
682 views

String replacement in math mode

Writing a path in a graph as $a-b-c$ will not typeset as nicely as $a\text{-}b\text{-}c$, so I'm trying to create a macro that performs some string substitution. I tried using xstring, but ...
Henning Koehler'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
11 votes
2 answers
2k views

How can I print three greater-than symbols after each other (>>>)?

I am using \texttt to write my code snippets in Courier font including \texttt{>>>}. If I compile, this is substituted to ». How can I prevent that from happening? I am unable to escape with ...
User12547645's user avatar
2 votes
1 answer
142 views

Contextual substitution of one word by another with LuaLaTeX

I would like to be able to use LuaLaTeX in such a way that one word is replaced by another according to its context of use. Here's a simple example: replace the word " and " (with a space ...
B Legrand's user avatar
  • 445
1 vote
0 answers
41 views

Substitute repeating words [duplicate]

I have several equations where some text repeats, so I want to match each following word with a "»" in next equations. Important that "»" should be in the middle of the word above. Here is the demo ...
antshar's user avatar
  • 4,662
2 votes
1 answer
125 views

Set Hospital name and subsitute

I'm trying to default a letter which I have to write after every week. Every week, I'm visiting a different hospital, but will always send them the same letter. Is there a way to set the hospital ...
Chris Peh's user avatar
  • 321
0 votes
1 answer
394 views

Apply a string replacement on the citation as returned by \cite

I have biblatex with options \usepackage[backend=bibtex, style=authoryear]{biblatex} The citations made with \cite look like this: Smith, 2019 or Smith and Baker, 2019 and so on. I would like to ...
MannyC's user avatar
  • 173
3 votes
3 answers
419 views

Replace _{\mu with ^{\mu

Following this answer, I wrote a command that allows me to write \cont*{(D_\mu\phi)} to get the effect of (D_\mu\phi)^\dagger(D^\mu\phi). \def\replace#1#2#3{% \def\tmp##1#2{##1#3\tmp}% \tmp#1\...
SU3's user avatar
  • 519
6 votes
1 answer
249 views

Xelatex vs Lualatex and font substitution

As is known, in the Turkish language the i exists as distinct letters in two versions, with and without a dot (with very different pronunciations): the dotted couple i / İ and the dotless couple ı / I....
user41063's user avatar
  • 1,997
1 vote
1 answer
248 views

How to remove line marks?

I have about 900 lines code, and here is what a segment of few lines look like: 043 043 1.1 Definicija kategorije\\\ 044 044 1.2 Primjeri kategorija\\\ 045 045 1.3 Izomorfizmi\\\ 046 046 1.4 ...
nikola's user avatar
  • 331
2 votes
3 answers
482 views

substitutefont result and \f@family

Is there any way to retrieve the resulting font family of substitutefont, e.g. with \f@family? It seems that \f@family is not affected by \substitutefont{<encoding>}{<family>}{<new-...
ivankokan's user avatar
  • 1,076
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
1 vote
1 answer
168 views

Redefine German Unicode quotes as German LaTeX quotes

When writing German text, one quotes like this when wanting to use the "`correct"' quotes. As a user of NEO 2, I got the quotes the above code produces on my keyboard: „correct“ I heard you can ...
UTF-8's user avatar
  • 411
4 votes
1 answer
477 views

Specific font for a specific encoding or language

Is there a way to specify a specific font for a specific encoding or language? Using the default font for everything has proper shapes, but using garamondx has no proper shapes for cyrillic, even ...
gnucchi's user avatar
  • 966
2 votes
1 answer
273 views

Chemistry diagram variable substitution

I would like to write a script for doing my biochemistry homework that utilizes variable substitution. For example, I could create a base molecule using ChemFig with an X on it, then substitute that X ...
devin's user avatar
  • 33
2 votes
1 answer
511 views

Replacing a substring from a command

I have a problem where I seem to be unable to replace a string that is the output of a command. In my document I call the \outerfunction with an argument that is actually a list of key/value pairs. (...
Reinhard Mayr's user avatar
4 votes
3 answers
2k views

Replace a substring

This is actually a follow-up question to Replacing a substring from 6 years ago. I want to replace a substring in a long string. With \ReplaceStr from the xstring-package this works perfectly fine. ...
LABclimate's user avatar
8 votes
3 answers
5k views

Charter and Helvetica with greek letters in LaTeX or XeLaTeX

So I want to write a document (german) with Charter and Helvetica. The problem is that I need to have lowercase upright greek letters in the body as well as in the section headers in their respective ...
Philip's user avatar
  • 85
2 votes
1 answer
57 views

\newenvironment not a simple substitution?

I have two versions of the same document, one using \begin{inner}\end{inner} to substitute in the environment inner and the other with the body of inner substituted in manually. The first one triggers ...
the.punisher's user avatar
5 votes
1 answer
377 views

newtx math italic font replaced by Nimbus font. Should this happen?

I'm running the newtx package under TexLive 2016 and finding that the math italic font (ntxmi expected, OML encoding under the .sty file) is being replaced by a UWR/nimbus font (utmri8a). All other ...
John's user avatar
  • 2,400
2 votes
2 answers
477 views

Replace a text string in all 'table' environments

I input many tables into a tex file and want to replace "Standard errors in parentheses" in each table with "Any thing I want". example \documentclass[12pt,a4paper]{article} \usepackage[UTF8]{ctex} ...
XJ.C's user avatar
  • 303
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
9 votes
1 answer
1k views

What packages provide text/command substitution for LaTeX, XeTeX and LuaLaTeX?

I am aware of the following: xesearch - Allows both text and command substitution. Only for XeLaTeX Simple example: \usepackage{xesearch} \SearchList{list1}{Hello}}{hlw} Any time "hlw" is present ...
A Feldman's user avatar
  • 3,975
4 votes
1 answer
3k views

Substituting with \StrSubstitute does not work

I am having a problem substituting string using \StrSubstitute. The way I understand the function, as according to the documentation (page 7/8), it should work with three arguments. It should search ...
Marie. P.'s user avatar
  • 695
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
3 votes
2 answers
180 views

substitute widetilde in one font for another in plain tex

I am using newtx fonts in plain TeX. However, I prefer most of cmex to ntxexx. There is one exception (so far that I have found), the \widetilde, which is beautiful in ntxexx. I do not have any ...
Russ Lyons's user avatar
0 votes
0 answers
65 views

How to 'un-nest' nested macros?

Sometimes I have to typeset documents with nested definitions like these: \def\foo{\ensuremath{foo}\xspace} \def\baz{\ensuremath{\beta}\xspace} \def\qux{{\ensuremath{{\foo\mskip -3mu/\mskip -2mu\baz\...
Onner Irotsab's user avatar
10 votes
2 answers
168 views

Context sensitive glyph appears even when hyphenation removes the context

The Alegreya font has a pretty clever feature by which it substitutes the regular f glyph with a variant that has a longer cross stroke when the f is followed by t. The result is that the two cross ...
Sverre's user avatar
  • 21k
2 votes
1 answer
117 views

babelbib "disables" substitution in English, but not in German

I have a really weird problem: When changing the babel language in combination with the use of babelbib, certain substitutions stop working altogether. It took me hours to track down this cause. ...
Andreas Unterweger's user avatar