{strings} are sequences of characters (most commonly literal constants).

learn more… | top users | synonyms (1)

5
votes
2answers
194 views

Changing catcode for commercial at (@) inside a macro to get it matched in pattern.

This question is related to TikZ: pgfutil-common: pgfutil@in@ - how does it work? and is a result of coping with that problem. I've already read How to change #catcode in a macro, but it didn't help ...
5
votes
1answer
420 views

TikZ: pgfutil-common: pgfutil@in@ - how does it work?

Having been writing small lib for TikZ, I tried to use this macro in order to search for @. Code compiled, but the result was false, despite that I was sure it was in tested string. So, I decided to ...
2
votes
1answer
1k views

How to pass a \def parameter to an inner command (StrSubstitute)?

I'm attempting to create 2 macros to simulate an array list as in Java for example. I'm using xstring StrSubstitute for this purpose, but I'm having a problem. Below is the code, it's a bit long as it ...
6
votes
1answer
872 views

How to capture the result of \StrSubstitute into a macro?

I have a macro, say defined as follows: \edef \temp{A.input 1} I want to replace the dot with hyphen and have the result being stored in \mystart. Something like that: \edef ...
6
votes
2answers
999 views

Nest StrLen and ifthenelse commands

Here is a sample of code I am working on: \documentclass[10pt]{report} \usepackage{xstring} \usepackage{ifthen} \begin{document} \StrLen{123456}\\ %Prints 6 ...
2
votes
4answers
293 views

Replacing entries in a csv list

I want to replace entries in a csv list, where the list parser can be arbitrary (eg: ,;:|). An example follows: \def\x{r;s;t;x;y;z} In this list I want to efficiently replace r,t,x by a,b,c via, ...
8
votes
1answer
297 views

How do I store the upper case counterpart of a string?

I have a string stored in a variable \word, and I want to store its upper case counterpart in another variable \WORD. If I try \def\WORD{\MakeUppercase{\word}} \show\WORD then the message ...
24
votes
2answers
5k views

How do I split a string?

I need to split a string into one or more substrings. I know that I could use the xstring package, but I'd like to do it using only inbuilt TeX/LaTeX commands. So, if I say \def\MyTeXKnowledge{Not ...
13
votes
7answers
1k views

How to get the string with \

Apologized for my unclear description. I wish I could explain my problem more clearly. In document, I wish I can just write something as "how to use \cmd \mbox in xxx" or "what is \cmd minipage ...
6
votes
2answers
376 views

xstring functions in section/paragraph headers

In the following example, \documentclass{article} \usepackage{xstring} \newcommand\foo[1]{\StrSubstitute{#1}{love}{hate}} \begin{document} \section*{\foo{I love Mondays}} \end{document} if I ...
12
votes
1answer
4k views

Replacing a substring

I've got a string like this: aXYbXYc, and need to replace the XY substring with a right arrow: a $\to$ b $\to$ c. Is there any function (also provided by external packages) to help me do that?
7
votes
3answers
1k views

Evaluating a string to a command

How do I construct a string in LaTeX (perhaps with variables) that calls the LaTeX macro with the corresponding name? For example, say I have defined a comment as \def\Comment1{Example text.} and ...
5
votes
1answer
329 views

Performing String Manipulation on result of \cite{}

I would like to perform some string manipulation (using the xstring package) on the result of a \cite{} (the bib package is given to me, and wouldn't allow what I want to do without a major rewrite). ...
0
votes
1answer
218 views

stringstrings replacement for XeTeX?

To construct a lower-case filename out of the mixed-case argument given to a command, I used stringstrings in LaTeX. Now I switched to XeTeX and it seems the fontspec-package has some interference ...
27
votes
2answers
1k views

Introspection and reflection with LaTeX/TeX macros

Below is a short program that can use \meaning and \string to let a combination of LaTeX and TeX commands to print out the listing of macros. Unsurprisingly (nothing can surprise me with TeX any ...
11
votes
3answers
2k views

String replacement in LaTeX

I'd like to know how to replace parts of a string in LaTeX. Specifically I'm given a measurement (like 3pt, 10mm, etc) and I'd like to remove the units of that measurement (so 3pt-->3, 10mm-->10, ...
13
votes
2answers
1k views

LaTeX: collecting “values” and spitting them out several times?

I'm cleaning up some old LaTeX documents describing an API. In the process I'm creating my own little style for describing the API, but I've bumped up against a bit that seems to force me into a ...