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

learn more… | top users | synonyms (1)

3
votes
2answers
467 views

Split long string into paragraphs

How can I test a string to see if it has more than one paragraph, and split a string that contains multiple paragraphs into two strings, one with the first paragraph of the original, one with the ...
3
votes
1answer
825 views

Letting strings start with a capital letter

I am writing a small book and try to build up an index reference. To make it a little easier I wrote a small script that enables my to type a word and also add it to the index: ...
6
votes
3answers
493 views

Conditionally including a TikZ figure

I have the following construction for a figure. The background is, when \submit is defined, only the caption is included, but no figure. Otherwise the figure is included. The problem is that I have ...
6
votes
3answers
269 views

How to remove all dashes (-) using a macro?

In a package, I'm building macro names from the values of options passed to a function. Now, the values should also allow a - inside, but the command names I'm building with \csname do not. So, I need ...
6
votes
2answers
2k views

How to concatenate strings, to e.g. create commands that return lists?

I was thinking about Felix' Question, where he wanted to return lists in TikZ. My approach so far was to return the single results as individual \nodes, separated one centimeter each. Now I would like ...
3
votes
4answers
827 views

Generating dummy text programatically using TeX/LaTeX

As part of an attempt to debug another problem, I have a need for a TeX/LaTeX command that generates some dummy text in place. I know of lipsum and blindtext, but they are not what they want. What I ...
5
votes
3answers
548 views

Programmatically setting a counter to a substring

I'm trying to set a counter based on the name of the current job. I've got the number I need by doing something like \substring{\jobname}{5}{5}} using the stringstrings package, and if I just output ...
1
vote
1answer
720 views

Using \footnotesize in tikz node labels

I have used \footnotesize to scale labels before and it has produced the desired results. But am having problems when I pass this as part of the label to a macro. The following MWE compiles but not if ...
2
votes
2answers
322 views

Include LaTeX file named with substring of current filename

I'm frequently creating presentations with beamer and need both the handout and the presentation itself. To avoid editing the file when I need to compile the other, I use \ifdefined\ishandout ... at ...
1
vote
2answers
301 views

\pgfmathdectobase macro \pgfmathresult digit index or bitwise operators

Is there a way to access each digit of a macro returned by \pgfmathdectobase (or \pgfmathresult) which is a binary number ? This would be useful for a function which prints the power set of a given ...
6
votes
1answer
339 views

\StrLeft has no effect on \citetitle

\footfullcite uses too much space so I decided to define a own command. I called it \footshortcite. It only display a pre- and a post-Option and the Author with Year. However, I don't like that most ...
3
votes
1answer
175 views

Force stringification of a length

I'm trying to include a background image of the correct size based on the two variables \IApaperheight and \IApaperwidth. To do this, I'm converting the lengths to a rounded text value and ...
5
votes
2answers
184 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
390 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
750 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
892 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
286 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
285 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 ...
22
votes
2answers
4k 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
362 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 ...
11
votes
1answer
3k 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
972 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
326 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
207 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 ...
26
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
1k 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
963 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 ...