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

12
votes
1answer
307 views

Text being output when none should be

I am confused as to why the MWE below produces any black text. As the code is below, the output is: However, if you comment out the \IfStrEq line then it works fine and the black text goes away? ...
10
votes
3answers
523 views

TeX capacity exceeded while parsing a date string

I'm trying to parse a date (say, a due date) in a DD-MMM-YYYY format, e.g., 06-May-2012 and create macros \dueday, \duemonth, and \dueyear. I use xstring's commands to extract the substrings. Then I ...
9
votes
4answers
4k views

How to cut a section title in the header

I redefine my headers as in the following MWE: \documentclass[12pt]{article} \usepackage{xstring} \usepackage{fancyhdr} \fancypagestyle{monstyle}{% \fancyhf{} % remove everything ...
4
votes
1answer
65 views

Passing escaped special characters for use as a URL through macros

From an earlier question on Escaping special characters for use as a URL, using \string to escape the special URL characters in the second example works great: \DefineMyFormatLinkParameters{% ...
4
votes
2answers
118 views

How to test if a given reference belongs to a list of labels?

This question is a prolongation of my previous question How to choose from a list for using result in \ref?. I got really good and interesting answers. Unfortunately I can not implement them for my ...
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 ...
10
votes
3answers
2k views

Extract number from string and compare problem

I try to extract the year, month and day from a string and write different text depending on the given date. I thought I could use xstring and etoolbox, but I can'st get it to work. Here's the code ...
6
votes
2answers
441 views

Using xstring to check .tex file name

I am having difficulty in using xtring to check the file name of the .tex file. All three of the cases shown below produce the wrong output. Surprisingly in my actual more complicated usage, the ...
5
votes
5answers
2k views

Process a string with replacing and splitting

I have an input string like "123-45" or "1-3-5" or "2-4; 6-8" where the minus signed should be removed. This is easy with the xstring package. \StrSubstitute{#1}{-}{} The next step is to split the ...
4
votes
1answer
64 views

Command doesn't expand into other commands after string substitution

The MWE should explain it all (use LuaLaTeX): \documentclass[11pt]{memoir} \usepackage[T1]{fontenc} \usepackage{fontspec} \usepackage{xstring} \usepackage{easylist} \begin{document} ...
11
votes
2answers
213 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 ...
9
votes
3answers
246 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 ...
8
votes
1answer
146 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: ...
8
votes
4answers
276 views

choose from a list with xstring

I want a command that does the following: \variation{1}{aaa;bbb;ccc} ----> aaa \variation{2}{aaa;bbb;ccc} ----> bbb \variation{3}{aaa;bbb;ccc} ----> ccc The string in the second input can ...
5
votes
1answer
121 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} ...
5
votes
2answers
85 views

How to choose from a list for using result in \ref?

Recently, in choose from a list with xstring, Geoff was asking about defining the command \variation that does the following: \variation{1}{aaa;bbb;ccc} ----> aaa \variation{2}{aaa;bbb;ccc} ...
5
votes
1answer
782 views

Generate labels using xstring and \Makelowercase

I am trying to write a command that allows me to reference a subsection with a generated label. The idea is that when I declare a step \step{Long Name With Many Uppercase Letters}, the generated ...
5
votes
1answer
172 views

Substituting strings only when not bounded by letters or numbers

Using StrSubstitute from xstring I can find and replace matches. For e.g.: \StrSubstitute{I like to eat fish.}{fish}{apples} gives "I like to eat apples." \StrSubstitute{Do you want to ...
5
votes
2answers
561 views

Feeding arguments to xstring macros

In Footnotes with automatic final period, the comment was made to provide the possibility to add a period . to a footnote conditionally, based on whether the footnote already has a period or not. I ...
4
votes
1answer
123 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 ...
4
votes
2answers
212 views

controling padding using the xstring package

in order to pad some text with a predefined padding, im using the xstrings package my current code is \documentclass{minimal} \usepackage{xstring} ...
3
votes
2answers
36 views

Formatting Strings in Dynamic Variables with xstring

I need to format a string resulting from a dynamic variable set in a separate program for a LaTeX generated report. In particular, if a variable has a negative value (starts with a minus sign), I ...
2
votes
1answer
490 views

XeLaTeX - Devanagari page numbers in \tableofcontents [duplicate]

Possible Duplicate: How to get devanagari numerals in latex or xetex I am using XeLaTeX (XeTeX, Version 3.1415926-2.4-0.9998 on TeX Live 2012/W32TeX). I want Devanagari (Indic) page ...
1
vote
1answer
154 views

Customize text format of captions by parsing content of \@caption

I need the first sentence of my captions to appear on its own line in a \large, bold font. I also need to same document to easily produce standard captions (all same font, no line breaks). I have ...