{strings} are sequences of characters (most commonly literal constants).
23
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 ...
12
votes
7answers
816 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 ...
14
votes
3answers
207 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 ...
5
votes
2answers
308 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 ...
5
votes
2answers
148 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 ...
20
votes
4answers
995 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 ...
17
votes
2answers
2k 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 ...
10
votes
3answers
333 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 ...
7
votes
2answers
595 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 ...
6
votes
2answers
984 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 ...
16
votes
3answers
904 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). ...
7
votes
1answer
249 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 ...
4
votes
1answer
306 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
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 ...
6
votes
2answers
436 views
Replace characters in string based on preceding and following character
The following two strings are the result of the expansion of a biblatex citation command:
Unicom Computer Corp. (in re), 13 F.3d 321, 30 Collier Bankr. Cas. 2d 655, 25 Bankr. Ct. Dec. 152 (9th ...
8
votes
2answers
69 views
How can I combine two text strings to represent the name of a command?
I want to combine one command with a text string to represent a second command. In MatLab it would be possible to concatenate these two strings into one string and evaluate this new string. However I ...
8
votes
3answers
670 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
1answer
78 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
...
13
votes
3answers
332 views
Extract the numerical and non-numerical portion from text
I would like to extract the leading number and subsequent text from a string. I have an idea of using the xstring package to gobble characters from the right until I end up with a number or an empty ...
8
votes
1answer
133 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
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 ...
4
votes
1answer
161 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}}
...
3
votes
4answers
490 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 ...
3
votes
1answer
143 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 ...