3
votes
2answers
70 views

Generate comma separated list with some non-empty strings

I'm trying to generate a comma separated list that uses strings that may or may not be empty. For example \mylist{\stringA,\stringB,\stringC} would expand to A, C if B is empty or B, C if A is empty, ...
6
votes
3answers
107 views

xstring test for numbers within a range

I'm working on a document command that has a variety of optional arguments for different results. I need to add an option that yields 'true' for an optional argument within a range of numbers, for ...
8
votes
2answers
109 views

Illegal parameter when nesting commands

I keep getting illegal parameter errors when trying to define a command that contains another previously defined command. I know that you have to be careful with nested definitions, but I didn't think ...
5
votes
1answer
67 views

Using xstring macros in edef

I've tried to use \protect to make the following \edef work but no luck. Can it be done somehow? \documentclass{article} \usepackage{xstring} \begin{document} \def\abc{a,b,c} ...
8
votes
1answer
102 views

Undefined Macro in Package xstring

I have a very basic problem. I am trying to use the xstring package in a Latex document and I keep getting the following error message for an undefined control sequence: (c:/Program Files ...
9
votes
3answers
180 views

Command doing the same job as StrBefore but being expandable

I am looking for a command allowing me to get 3 as output if the input is 3.2. \StrBefore{3.2}{.} works fine for this purpose but is not expandable and I need to call it in another macro inside a ...
4
votes
3answers
538 views

Misplaced \omit and \multicolumn in \IfEqCase

I have the following code with a command that creates rows for a tabular: \documentclass[letterpaper,10pt]{article} \usepackage[utf8]{inputenc} \usepackage{xstring} \newcommand*{\condrow}[2]{ ...
4
votes
1answer
93 views

Dynamic Table/Multirow with xstring macro

i'm getting a little bit lost with the following. As i'm quite new to using TeX for more than just typesetting, i hope to get some help here. I already searched this forum for some helpful posts and ...
5
votes
2answers
82 views

Passing value to \bibleverse

Please help me to find out, how to pass a value to a command, which has additional arguments enclosed in (...). \usepackage{bibleref} \usepackage{xstring} \begin{document} \bibleverse{Gen}(9:9) ...
8
votes
2answers
328 views

StrSubstitute for multiple replacements in a loop?

I am trying to replace multiple keywords using \StrSubstitute inside a loop using foreach - but unable to accumulate all the results. The result of each \StrSubstitute call is getting lost inside the ...
2
votes
1answer
203 views

xstring StrSubstitute and table

I got a problem with xstring \StrSubstitute in combination with a table. I would like to replace newline (\\) in a variable with the \newline command to generate a second line in a paragraphed table ...
29
votes
5answers
1k views

Censoring Curse Words with Grawlixes

Suppose that I would like to censor a curse word <word> using grawlixes, e.g. "What the #@$! are you doing?!" How can I define a command \censor such that \censor{<word>} results in a ...
3
votes
1answer
53 views

How can by macro as parameter of other macro?

\StrPosition{AQ2 K863 1065 J1065}{ } give 4 \StrMid{AQ2 K863 1065 J1065}{1}{4} give AQ2 \StrMid{AQ2 K863 1065 J1065}{1}{\StrPosition{AQ2 K863 1065 J1065}{ } } i want AQ2 but give error message.
2
votes
1answer
176 views

Cutting string with formula or cite

I am trying to define a macro that would take a string and paint its ending, for example: \def\paintString#1{% \saveexploremode% \exploregroups% \textcolor{white}{\StrGobbleRight{#1}{5}}% ...
8
votes
3answers
163 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
1answer
109 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
148 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 ...
3
votes
1answer
136 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 ...
8
votes
2answers
267 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 ...
2
votes
1answer
153 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
1answer
179 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
326 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 ...
3
votes
1answer
132 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 ...
6
votes
2answers
385 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 ...