provides macros manipulating strings of tokens. For a basic use, tokens can be alphanumeric chars, but the macros can also be useful for manipulating tokens

learn more… | top users | synonyms

3
votes
0answers
16 views

Biblatex ibid in lowercase if prenote is present

I've defined my own biblatex style (see MWE) which uses citations in footnotes. I've patched the prenote command, because otherwise biblatex writes the prenote text in lowercase (note: I don't want to ...
2
votes
0answers
36 views

Centering \dot in a symbol macro (\listofsymbol)

I was trying to achieve the results of get a variable listed in listofsymbol's generated list, when called with a -dot suffix. If was trying also to find a way to center dot in variables with ...
3
votes
1answer
47 views

How to modify Bibtex URL tags in Latex?

I want to cut the URL tags defined in a Bibtex file. For example I want to crop the prefix "mailto:" so that it won't be shown. But the hyperlink still has to contain it. The following command does ...
4
votes
2answers
47 views

xmakefirstuc combined with MakeTextLowercase

I am trying to convert a string as in the example, with all lowercase characters except the first. However, xmakefirstuc does not like me that much. Here's my MWE: % arara: pdflatex ...
2
votes
1answer
52 views

Retrieving text from a “database text” file

I refer to my question and the solutions in String comparison in \ifthenelse I hope I can make my question clear enough, I am not a technician. I use a kind of database file (simple text file) with ...
9
votes
3answers
139 views

Generating a table based on a list and a number of columns

Sometimes a table is used to compact a large number of items. Example: a b c d e f g h j k l Instead of listing all items separately. We want to define a command that eases the implementation of ...
3
votes
1answer
57 views

includegraphics and xstring package

I would really like to do something like the following: \includegraphics{\StrSubstitute{No Spaces}{ }{}} However, this gives me an Undefined control sequence error. I saw some other posts about ...
3
votes
1answer
59 views

makeidx, xstring, forloop and utf8 conflict

I'm using Danish characters in strings that I split with \StrCut from the ×string package and use within a \forLoop from the forloop package. The result is not good. Consider this small example: ...
4
votes
2answers
53 views

Replacing substrings by linebreaks

I have a LaTeX document with several authors that I enter like \author{First Author \& Second Author \& .... In some places in the document I want to print these authors with a linebreak ...
6
votes
1answer
47 views

Substitute string in subscript

I want to define a command to shorten formula like this a^1,\cdots,a^n, using a placeholder (-) instead of index, the code is \usepackage{xstring} ...
4
votes
1answer
84 views

Extract from a token containing a list with math content

I have a token which contains a list consisting of: a date in YYYY-MM-DD format, followed by a colon, and some text which may contain math. The text will consist of a sentence or two (i.e., no ...
2
votes
1answer
85 views

Underline/Bold/Highlight multiple names in a bibliography

This is a variation of the question posted here: Now I want to highlight multiple names in a bibliography. Here is the erroneous solution that I tried. \documentclass[11pt,letter]{article} ...
3
votes
2answers
85 views

Generate comma separated list with some non-empty strings

I'm trying to generate a comma separated list that uses strings that may or may not be empty. For example \mylist{\stringA,\stringB,\stringC} would expand to A, C if B is empty or B, C if A is empty, ...
2
votes
1answer
129 views

gitinfo (xstring): tag info does not work because of “tag:” before version number

I'm making the switch from subversion to git, and I'm quite happy with the gitinfo package. The only thing I cannot get to work is to show a version number from the tag. I have identified the ...
2
votes
2answers
86 views

How do I use IfStrEqCase within a siunitx command?

I am having trouble using \IfStrEqCase from xstring inside \num from siunitx: \documentclass{article} \usepackage{xstring} \usepackage{siunitx} \newcommand{\bla}[1]{% \IfStrEqCase{#1}{{a}{1}% ...
8
votes
1answer
106 views

\IfStrEqCase having problem with last optional parameter

It's been a while since I asked an embarrassing question, and am pretty sure this is another one of those: This code below attempts to use \IfStrEqCase from the xstring package and results in: ...
6
votes
3answers
118 views

xstring test for numbers within a range

I'm working on a document command that has a variety of optional arguments for different results. I need to add an option that yields 'true' for an optional argument within a range of numbers, for ...
2
votes
1answer
135 views

Latex: splitting/processing strings inside a latex command

Let's say I have \ingredients {% \unit[375]{g} & Farina 00\\ \unit[250]{g} & Burro\\ \unit[3]{g} & Sale\\ 1 & Limone } (you got me: I'm dealing with xcookybooky) ...
5
votes
2answers
116 views

How to use xstring commands in biblatex DeclareFieldFormat?

I'm trying to tweak a biblatex bibliography. One problem is the rendering of entries with eprint fields. Sometimes, I have something like eprint = "hep-ph/0207124", sometimes its ...
4
votes
1answer
136 views

How to remove the first and last letter of a string

My example. Need from the string "$${{15}\over{4}}$$" get the string "${{15}\over{4}}$". \documentclass[14pt]{extarticle} \usepackage{xstring} \usepackage{amsmath} \def\f(#1){(#1)^2-5*(#1)+6} ...
8
votes
2answers
116 views

Illegal parameter when nesting commands

I keep getting illegal parameter errors when trying to define a command that contains another previously defined command. I know that you have to be careful with nested definitions, but I didn't think ...
4
votes
1answer
91 views

Loading file after converting to ASCII characters

I am writing a document on phonetics using the media9 package to include pronunciations of some of the words in the document. The words that are to be pronounced are in Danish, and thus their ...
5
votes
1answer
154 views

Forcing the first choice of an newtcblisting environment

I have created a new environment based on "tcblisting" from package "tcolorbox" is code (MWE) is as follows: \documentclass[10pt]{article} \usepackage{tcolorbox} ...
5
votes
1answer
76 views

Using xstring macros in edef

I've tried to use \protect to make the following \edef work but no luck. Can it be done somehow? \documentclass{article} \usepackage{xstring} \begin{document} \def\abc{a,b,c} ...
2
votes
0answers
156 views

Why can't I get a conditional command to work in a macro invoked within a tikzpicture?

I wanted to create a macro that can be invoked in the middle of a tikz path and behave differently, conditional on one of the arguments. Here is an example document: \documentclass[a4paper]{amsart} ...
4
votes
0answers
86 views

How to include part of an external git hash as text inside a document?

This is my first time asking a question on a site like this. Please tell me if I should do something differently, thanks! I want to include a short version of the latest commit hash from git as a ...
8
votes
1answer
117 views

Undefined Macro in Package xstring

I have a very basic problem. I am trying to use the xstring package in a Latex document and I keep getting the following error message for an undefined control sequence: (c:/Program Files ...
9
votes
3answers
195 views

Command doing the same job as StrBefore but being expandable

I am looking for a command allowing me to get 3 as output if the input is 3.2. \StrBefore{3.2}{.} works fine for this purpose but is not expandable and I need to call it in another macro inside a ...
2
votes
1answer
65 views

How to use \StrBefore in \chapter with optional argument

I want to trim the chapter titles in toc up to first dot. \documentclass{book} \usepackage{xstring} \newcommand{\chap}[1]{% \chapter[\StrBefore{#1}{.}]{#1} } \begin{document} \chap{Some title. ...
4
votes
3answers
645 views

Misplaced \omit and \multicolumn in \IfEqCase

I have the following code with a command that creates rows for a tabular: \documentclass[letterpaper,10pt]{article} \usepackage[utf8]{inputenc} \usepackage{xstring} \newcommand*{\condrow}[2]{ ...
7
votes
1answer
114 views

Count the number of references containing substring in field

I have several references in a document. I'd like to display some statistics regarding the references - for example, citations with author Smith, citations between year xxxx and yyyy, citations ...
9
votes
1answer
228 views

Trouble using xstring to edit input parameter strings

I am trying to use \StrDel to modify a parameter to use within a command. For example, say my .tex file contains: \command{Word Anotherword} and the .sty file I reference contains: ...
4
votes
1answer
103 views

Dynamic Table/Multirow with xstring macro

i'm getting a little bit lost with the following. As i'm quite new to using TeX for more than just typesetting, i hope to get some help here. I already searched this forum for some helpful posts and ...
10
votes
2answers
136 views

Is it possible to use \index{\command} inside a \DeclareDocumentCommand?

So I've been writing a book of sorts where I've used xparse to create some commands and environments. Now, when the thing is almost done, I realised a index would be great to have! One of the ...
2
votes
1answer
177 views

Use xstring to replace a macro with different macro

xstring staff... Target I want to create two labels at beginning and end of specific text respectively. I have sucessfully writen some code to do this, see the following code: \usepackage{xstring} ...
5
votes
2answers
84 views

Passing value to \bibleverse

Please help me to find out, how to pass a value to a command, which has additional arguments enclosed in (...). \usepackage{bibleref} \usepackage{xstring} \begin{document} \bibleverse{Gen}(9:9) ...
8
votes
2answers
375 views

StrSubstitute for multiple replacements in a loop?

I am trying to replace multiple keywords using \StrSubstitute inside a loop using foreach - but unable to accumulate all the results. The result of each \StrSubstitute call is getting lost inside the ...
11
votes
2answers
190 views

How to process a list and ignore spaces?

This question is part of a new package: metrix. Typeset metric/prosodic symbols standalone and above syllables. I’m wrinting a new package and I need to process a list (using etoolbox at the ...
5
votes
2answers
201 views

Transforming string into tabular row

Trying to have a command converting a string into a (tabular) row, where each cell of the row is (a function of) each character of the string. (\tilerow is my attempt, \tiletext is just for ...
2
votes
1answer
238 views

xstring StrSubstitute and table

I got a problem with xstring \StrSubstitute in combination with a table. I would like to replace newline (\\) in a variable with the \newline command to generate a second line in a paragraphed table ...
2
votes
1answer
80 views

StrSubstitute not working nicely with pgfplots

This question is related to my older question here, but now slightly different. I now have a function that is supposed to take two multivalued arguments. One contains the columns i want to plot. If i ...
32
votes
6answers
2k views

Censoring Curse Words with Grawlixes

Suppose that I would like to censor a curse word <word> using grawlixes, e.g. "What the #@$! are you doing?!" How can I define a command \censor such that \censor{<word>} results in a ...
6
votes
2answers
117 views

xstring substitution with font commands fails in error

I want to substitute some spaces with normal font \dots in between name parts typeset in \ttfamily. Below example works except for the commented part which fails miserably with the error: TeX ...
3
votes
1answer
55 views

How can by macro as parameter of other macro?

\StrPosition{AQ2 K863 1065 J1065}{ } give 4 \StrMid{AQ2 K863 1065 J1065}{1}{4} give AQ2 \StrMid{AQ2 K863 1065 J1065}{1}{\StrPosition{AQ2 K863 1065 J1065}{ } } i want AQ2 but give error message.
4
votes
1answer
145 views

Check for special character in verbatim environment

I would like to substitute a > in the beginning of each line of a Verbatim environment with another character. Consider: \documentclass{article} \usepackage{fancyvrb,xstring} ...
2
votes
1answer
192 views

Cutting string with formula or cite

I am trying to define a macro that would take a string and paint its ending, for example: \def\paintString#1{% \saveexploremode% \exploregroups% \textcolor{white}{\StrGobbleRight{#1}{5}}% ...
8
votes
3answers
168 views

xstring command in renewcommand

I'm trying renew \texttt command with condition on ending . or ,. But after making this: \usepackage{xstring} \let\OldTexttt\texttt \renewcommand{\texttt}[1]{% \OldTexttt{\hspace{0.4em}#1}% ...
5
votes
2answers
983 views

Upright bold greek with condition in math mode

Good day! I googled the whole stackechange, but was not able to find the answer. I'm quite new to Latex, so my approach is not proper. I try to define a macro, that should format greek letter as ...
1
vote
1answer
125 views

xstring macros inside foreach

I don't really understand what is the problem here, but I guess it has to do with expansion and fragile macros since when I do the same outside of \path it works. Code: \documentclass{article} ...
9
votes
1answer
191 views

Manipulate title field's strings in biblatex

I need to take the first string (considering First~Second a single string) from the title field from anonym entries and: Format this first string differently from the rest of the title, e.g.: ...