{strings} are sequences of characters (most commonly literal constants).
2
votes
1answer
42 views
How to store and append text for later use (inside enumerate environment)
I'm trying to make a traceability matrix (or table). For my purpose it's easiest if I can create rows anywhere in the document, store them in some kind of container and later use this container to ...
3
votes
0answers
74 views
Change the way XeTeX sees a string before running/building PDF
For some reason, I'm really struggling to articulate my question, so let me apologise in advance. I may not be approaching this from the right angle.
I'm working in XeTeX (and it's far too late to ...
4
votes
3answers
56 views
Automatically construct image file name
I have a lot of images numbered like so:
image_0001.png
image_0002.png
image_0003.png
...
I would like to set up a Latex command to include a specific numbered image, for example:
...
2
votes
2answers
36 views
use string variable as format string in \begin{tabu}
I have the following problem. I'm using the tabu package to create tables but instead of a format string like this: \begin{tabu}{ccc} I want to use a format string like this (as string variable): ...
1
vote
1answer
47 views
How to expand keyval options immediately
I am trying to build up a macro that creates other macros depending on kvoptions' options. But then, the outcoming macros are dependent on the actual state of the options instead of their state at the ...
3
votes
1answer
84 views
Compare strings
I have some troubles by comparing strings in my beamer theme.
I would like to compare the "techno" argument with a string (iOS, Android, Java,...) : if techno =="iOS" logo_path = "some_image" else if ...
3
votes
1answer
39 views
How to select all occurrences of a specified word in a string and append another word to each of them?
When using infix-RPN package, we can use \infixtoRPN to convert infix expression to RPN expression. The output of the conversion can be retrieved by invoking \RPN.
\infixtoRPN{cos(x)+sin(x)}, for ...
1
vote
0answers
59 views
Numeric representation of a string [duplicate]
I am able to sort more than one numeric column in pgfplotstable. However, since, I was not able to convert a string to a numeric value (e.g. via using hash of string), I could not sort data according ...
1
vote
1answer
83 views
Making Back-Referencing More Pretty
The question Back-referencing in LaTeX was marked a duplicate, so I can't post to that thread. Nonetheless, I found the code provided there by Ryan Reich to be a good learning exercise. His solution ...
14
votes
3answers
189 views
Parsing strings containing diacritical marks (macros?)
I apologize that this question may seem very much like several other recent ones I have asked (Parsing leading hardspaces, Parsing a \$ as part of an improved \getargs command). They are all related ...
2
votes
0answers
42 views
Listings: Format part of a string differently (markup language inside a string)
I made a new language definition for a .NET template engine where part of the strings in the C# code are markup.
Example:
string templateString = @"{% for name in names %}
Hallo {{ name }}
{% ...
15
votes
3answers
400 views
\string command behavior - Plain TeX
I would like to learn Plain TeX and I'm reading Knuth's "The TeXBook". At Chapter 7, Knuth talks about the \string command and how it converts control sequences into lists of characters tokens.
Why ...
6
votes
1answer
71 views
How to detect that some macro expands to empty string or spaces only?
I need to check several macros and do some actions only if their expansion is not empty nor space only.
In pseudo code I would look like this
\if\macroToBeTested
\doSomething
...
7
votes
4answers
199 views
Tokenizing and parsing a word
After a 10+ year LaTeX hiatus I am returning and slowly getting hold again of macro writing.
I now want to parse a string like "fisis" into the first letter "f" and the second half "isis". Case ...
6
votes
4answers
184 views
Logical String Length
How do I do a conditional 'if then else' statement, based on length of string being greater than (or less than, or equal) a specified value.
For example, something Like
\def\mystring{XYZ}
...
4
votes
1answer
53 views
String lowercase equality (newbie question)
i'd like to test if a string, once transformed into lowercase is equal to a given string. Here a MWE of what i'm talking about :
\documentclass[a4paper,10pt]{report}
\usepackage[francais]{babel}
...
4
votes
1answer
79 views
Translate string into TIPA
I am writing a project about phonetics using the tipa package. The problem is, I need to publish two separate versions of my project using different phonetic notation standards. When considering the ...
5
votes
2answers
192 views
Replace asterisk with nothing in string
I have a function which grabs cells out of a table and returns them. Many of these cells end with two asterisks, and I would not like these returned from the function if they are present. For ...
8
votes
1answer
129 views
How to replace a given string in a bibliography with biblatex?
Mendeley allows you to emphasise Latin names in article or report titles using HTML notation like so:
A treatise on the ecology of <I>Rattus rattus</I>
Using biblatex, the tags are ...
5
votes
1answer
55 views
Testing for commercial at (@) in a string [duplicate]
Possible Duplicate:
Changing catcode for commercial at (@) inside a macro to get it matched in pattern.
I want to test whether a string contains the @ sign. I came up with the following ...
3
votes
1answer
108 views
Get two short subtitles out of a too long title
Is there a way to get n shorter strings out of a long one in Latex? Let's say I have something like \title{A very long title} and I want it to be broken into two pieces such that I can later use ...
3
votes
2answers
147 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 ...
11
votes
3answers
555 views
How to concatenate strings into a single command?
I'd like to concatenate several parts of math text into a single command, and i read a great solution here on this site, allowing me to create this working example of what i mean :
...
3
votes
1answer
108 views
How to use @STRING variables in the note field of a .bib file?
I defined a @STRING in my .bib file as follows:
@STRING{mytext = {Last accessed: }}
This is an entry in the bibliography.
@ARTICLE{knuth:1974,
author = {Knuth, Donald E.},
title = {{C}omputer ...
2
votes
1answer
180 views
from string to command
What exactly happens in:
\newcommand{\mystring}[1]{\gdef\@mystring{#1}}
when \mystring{mystring} is used later in the document? It is known that mystring will be put in \mystring but I would like ...
4
votes
1answer
157 views
The command \string does not print curly braces of its argument
While printing the List of Symbols, I would like, in a draft, to print the definition commands as well. For instance, consider the following commands:
\providecommand{\perm}{\ensuremath{\pi}}
...
6
votes
1answer
163 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
2answers
414 views
Error using \string
Consider
\documentclass{article}
\usepackage{lmodern}
\usepackage[T1]{fontenc}
\begin{document}
\texttt{\string\iftrue}
%% \texttt =\long macro:
%% #1->\ifmmode
%% ...
11
votes
2answers
579 views
Alphabetic comparison of two strings
I tried to compare two strings (alphabetically), but I found some problems using the \pdfstrcmp command: 1- because it needs pdftex; 2- because it is case sensitive.
The first problem is not so ...
3
votes
2answers
162 views
Number of \ (backslash) characters in a string
I'm trying to built a code that counts the number of \ in a string. My code can work with any other symbols (for example, if I need to count the number of 'a's, that works). I already tried to modify ...
3
votes
1answer
150 views
PGF loop variables in string comparisons
In a bigger context, I need to check whether an integer parameter is contained in a set of numbers. I decided to encode sets as strings; elements are separated by !. I don't know whether this is the ...
20
votes
4answers
977 views
How to convert a one digit number to a two digit number
I have a table that represents a timetable for bus, so each cell contains time of departure as hour followed by minute, both as two digits, but sometimes I don't have two digits,just one so I have to ...
6
votes
1answer
148 views
Comparing LaTeX3 token list to string
Is there a way to compare a LaTeX3 token list to string without having to create a temporary token list? I though I'd use \tl_use:N to get the contents of the token list for the comparison, but that ...
3
votes
1answer
141 views
How to compare two dates using TeX primitives
This is a follow up to TeX capacity exceeded while parsing a date string
I want to compare two dates, say today's date and a due date. I have the due date information stored (as number strings) in ...
10
votes
3answers
327 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 ...
2
votes
3answers
184 views
How to replace an expression in several TeX files?
Can I replace all instances of one string expressions in the TeX files in one directory?
For example, let's say I want to replace all \frac with \myfrac in more than one file simultaneously.
1
vote
2answers
193 views
Arbitrary string assigned to variable?
How can I assign an arbitrary string - that may include special characters or even macronames - to a variable just as it is?
e.g. like this: \newcommand{\mystring}{\assignstring{abc{}\w'\macroname ...
7
votes
1answer
266 views
Macro to extract (typeset) 'plain text' from a command?
Sorry to come back again with a similar post title (I had a post with this same title, then renamed it to PDF Metadata - Macro to extract (typeset) 'plain text' from a command?) - but I hope now the ...
2
votes
1answer
127 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 ...
0
votes
0answers
274 views
Drawing nodes in tikz based on macro with Itemize environment [closed]
I am working on a project where I need to built a number of enumerations. Each of the items of the enumerations has the form:
\item Name: description
Therefore I've written a small macro, I here ...
5
votes
2answers
303 views
String test, with complicated arguments
I have a command \mycom{} which takes 1 argument. The command should perform a test on the argument and do something accordingly. For simple arguments, I can use \ifthenelse, but I need to consider ...
15
votes
3answers
853 views
Extract first & last characters of macro argument?
In LaTeX, how do I extract/isolate/determine the first and last characters of a macro argument?
Specifically, in the case I'm dealing with, the argument happens to be a base-10 integer (call it N). ...
8
votes
3answers
630 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 ...
2
votes
0answers
99 views
listings bug: space after quote collapsed when inlined with spaceflexible/fullflexible columns [duplicate]
Possible Duplicate:
listings bug: space after literate replacement lost with spaceflexible/fullflexible columns
I seem to have stumbled upon a minor bug in listings (version 1.4 as of ...
2
votes
2answers
186 views
String manipulation in ConTeXt
The ConTeXt wiki has an article about string manipulation, however, when I copy the code directly into my tex file, it compiles this code as text and does not try to compile it. There must be some ...
4
votes
1answer
152 views
BibTeX author tag string limitation
I've stumbled upon a limitation within BibTeX. I have to cite a medline entry which admittedly has a huge list of authors. When I take them all, LaTeX refuses to compile my document, when they're ...
5
votes
1answer
129 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 ...
7
votes
2answers
547 views
Replacing characters in argument strings
I am trying to create a LaTeX command that will allow me to insert pre-defined tables with a minimum of fuss. This will also allow me to change the overall format of tables (e.g. caption above or ...
3
votes
2answers
137 views
Command representing an expansion of a summation
I am very new to using LaTeX to write equation. And I am now learning how to create my own command. I am going to write a command \Listn to help me to do this:
\Listn{\sumup}{(#1)}{+}
$\sumup{n}$\\
...
3
votes
1answer
3k views
Using string variable with LaTeX
I would like to define one variable containing some text that can be changed locally. The following code gives one example of the featuring I'm looking for.
\documentclass{article}
...

