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

8
votes
3answers
174 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
1k 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
127 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
195 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.: ...
4
votes
1answer
141 views

Expanded StrSubstitute

I am trying to use \StrSubstitute, but what I want is to expand it all the way to get the result string. \StrSubstitute{Řepa}{Ř}{Rzzz} then i use it with % somehow define \a as the result string ...
5
votes
1answer
128 views

\IfSubStr does not work when used as parameter of another macro

It seem that if macro \IfSubStr from package xstring is used as parameter it is not expanded like other macros are. Here is minimal demonstration: \usepackage{xstring} \newcommand{\copyArg}[1]{#1} ...
5
votes
2answers
164 views

\uppercase does not work with \IfSubStr?

I'm using \IfSubStr macro of xstring package to decide if user given options contains some letter and if they do I take some actions. I want case independent test on whether user options contain ...
5
votes
1answer
171 views

How to best split long strings?

I would like to do a simple \StrSplit (from the xstring package) on a string I have, however, the string in question may contain a \par, and it appears that \@xs@StrSpl@t@@, which I can only imagine ...
7
votes
2answers
411 views

LaTeX macro for Wikipedia article link

I'd like to create a LaTeX macro that will auto-create a link to a Wikipedia page for me. \usepackage{xstring} \usepackage{hyperref} % replaces the whitespace with '%20' ...
3
votes
1answer
146 views

spreadtab out of memory using STCopy and macro

The following code fills a table using \STCopy. It generates an 'out of save size error'e [MiKTeX 2.9]. If I make the table smaller (by commenting a row out) or remove the max call (and use only the ...
2
votes
1answer
367 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 ...
5
votes
0answers
1k views

MikTeX can’t find xstring [closed]

I’m not using MikTeX myself but someone I developed a class for. And it seems like there’s a problem with xstring. The following MWE compiles fine with my TeX Live 2012 but MikTeX (on Win 7) can’t ...
4
votes
2answers
189 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} ...
4
votes
2answers
110 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 ...
5
votes
2answers
80 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} ...
8
votes
4answers
240 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 ...
3
votes
2answers
191 views

canonicalize file path strings in TeX

I have a package which recursively loads many little modules (essentially tex files) from relative file paths. As modules may load other modules, I have to be careful not to load modules twice, so I ...
6
votes
2answers
567 views

Nesting of test commands (IfStrEq, IfSubStr etc.) of xstring

The following code does not work: \documentclass{article} \usepackage{xstring} \newcommand\checkempty[1]{ \IfStrEq{#1}{}{% Empty }{% NonEmpty } } \begin{document} ...
1
vote
1answer
141 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 ...
6
votes
1answer
304 views

Why can't I compare a string with \par?

First of all: the package xstring cannot recognize a \par as argument. When I for example do this: \usepackage{xstring} \def\apar{\par} \def\str{a string} \IfStrEq{\str}{\par}{% true part }{% false ...
5
votes
1answer
137 views

StrSubstitute and @ inside and outside \lstnewenvironment

While further working on code for my answer to Different approach to literate programming for LaTeX, I am encountering a problem to which I am sure there is a very simple solution, but it completely ...
4
votes
2answers
378 views

How to cut chapter title in header using xstring

I need to cut the chapter title that appears at page headers. I'm developing a latex generator software (http://github.com/caelum/tubaina, new contributors are welcome!), and because of ...
6
votes
2answers
433 views

Replacing ampersands in argument

I am trying to define a command which takes as an argument a string containing ampersands, and replaces every ampersand by a space. Following the ideas in Replacing characters in argument strings, I ...
10
votes
3answers
473 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 ...
8
votes
2answers
279 views

Why are some macros undefined inside an if case?

I'm trying to check if a string is only of one char, and I ran into this problem: LaTeX complains that \StrLeft in the comparison takes and additional argument: ! Argument of \@secondoftwo has an ...
8
votes
1answer
416 views

xstring character comparison and \meaning

\documentclass[pdftex,a4paper,12pt,oneside]{book}% \usepackage{xstring} \begin{document} \newcommand{\tmpa}{} \newcommand{\tmpb}{} \newcommand{\tmpc}{} \renewcommand{\tmpc}{abcdefg} \noindent ...
2
votes
1answer
156 views

Xstring dealing with macros

I wrote the \bib command to reference authors in my thesis not using numeric or alpha references of natbib. It copies a piece of text, cut the first 60 characters (the width of my page} and put it ...
5
votes
1answer
645 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 ...
12
votes
1answer
295 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? ...
9
votes
3answers
1k 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 ...
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 ...
1
vote
1answer
191 views

Getting an error when trying to use 'xstring' commands in my macro

When I try to compile the minimal example below, I get an error: ! Argument of \@xs@StrLeft has an extra }. <inserted text> \par l.33 \setInSCCF{abcdef} If I switch the ...
3
votes
3answers
352 views

Arguments expansion in IfSubStr

EDIT: Simplified question How can I make the following code print "Yes"? \IfSubStr{\textbf{AAA}}{AAA}{Yes}{No} Full question I'm playing with xstring's IfSubStr, but I don't really understand ...
5
votes
5answers
1k 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
3answers
971 views

Replace chars with xstring. Catcode problem

I try to do something like this (minimal example): \documentclass[]{article} \usepackage{mathtools} \usepackage{xstring} \newcommand{\foo}[1]{ \StrSubstitute{#1}{:}{\string&}[\fooo] ...
5
votes
1answer
165 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 ...
3
votes
1answer
137 views

Splitting parameters in a macro

I have a macro like this: \newcommand{\listanimals}[1]{ Animals in the farm: #1. } So using \listanimals{pig / sheep / cow / duck / goat} will print: Animals in the farm: pig / sheep / cow ...
3
votes
1answer
245 views

Using xstring utilities on \ref*{…}

In the following code, I would like to use \StrGobbleLeft{\ref*{#1}}{2} so as to use n instead #n where the last formatting is used to number special footnotes for links. \StrGobbleLeft{\ref*{#1}}{2} ...
6
votes
2answers
244 views

\StrMid and \MakeUppercase problem

What's wrong with this: \documentclass{minimal} \usepackage{xstring} \begin{document} \newcommand{\cim}{c1095} \StrMid{\MakeUppercase{\cim}}{1}{1} \StrMid{\cim}{2}{100} \end{document} ...
5
votes
2answers
486 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 ...
6
votes
2answers
404 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 ...