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

learn more… | top users | synonyms (1)

0
votes
0answers
10 views

Automatically removing, after compilation, parts of text enclosed in certain strings

Is it possible to create a macro, such that everything that is between the string composed of the characters "whitespace", "{", "L" and the string composed of "L", "]", "whitespace" is not displayed, ...
5
votes
1answer
75 views

LuaLaTeX: How to use a \char directive inside a string.gsub function?

Consider the following MWE: % !TEX TS-program = lualatex \documentclass{article} \usepackage{fontspec} \setmainfont[Ligatures=NoCommon]{Latin Modern Roman} \usepackage{luacode,luatexbase} ...
3
votes
1answer
30 views

Character replacement in unicode string

I need a command to replace (erase) the characters · and | from a string. Consider the following naive code: \documentclass{article} \usepackage[T1]{fontenc} \usepackage[utf8]{inputenc} ...
0
votes
0answers
23 views

How to replace a string in a table that is imported

I'm using Stata to generate tables in Latex, which I then import by using import: \import{/Users/me/path/to/}{table1} \import{/Users/me/path/to/}{table2} However, when I do this, I end up with some ...
2
votes
5answers
196 views

Package to test whether a string is in a list

Is there a package that provides a command for testing whether a string is in a list? I saw several answers that define their own commands to perform this or similar tasks, but I prefer a ...
2
votes
0answers
65 views

remove “” from lyx macro

I am using LyX and followed http://wiki.lyx.org/BibTeX/Biblatex. I don't want to use an absolute path with \addbibresource so I've tried following there example of using the \input@path macro. This ...
5
votes
3answers
105 views

Check occurrence of a macro inside another macro

With the substr (or xstring) package you can, of course, identify whether a control sequence contains some text string: \documentclass{article} \usepackage{substr} \def\somecontrolseq{some silly ...
3
votes
3answers
70 views

How can I embed xstring commands (with commands as tokens) within other xstring commands?

I'd like to manipulate strings. The following hello_en.txt should become hello. This is related to, and quite possibly a duplicate of, Command doing the same job as StrBefore but being expandable. ...
1
vote
0answers
17 views

How to split a long string in a variable? [duplicate]

I would like to split a long string (as in the example below) when this string is in a variable: \documentclass[a4paper]{article} ...
3
votes
1answer
45 views

Can Luatex (or latex) detect presence of non-latin1 character in string?

Using Luatex Unicode, I would like to detect whether or not a string contains any characters outside the Latin-1 set. If it does, then I would like to fork. Something like this: ...
7
votes
2answers
265 views

How to repeat over all characters in a string?

I have a command that formats a single character, let's call it \d{}. (In my case, \d{} adds a dot under a Chinese character, as this is the custom to emphasize Chinese texts). I want to define a ...
1
vote
1answer
50 views

double quote charater (’"’) with listings create problem

I have don't know how to fix the double quote character (’"’) with the listing package. Listing get this as the beginning of a string but it is not. Here is the colored minimal example to show the ...
2
votes
1answer
45 views

Comparing strings in a class file

I am modifying a correctly functioning class file to add some capabilities. I need to compare two strings - a) \@stringtextfromuser and b) ABC. I have loaded etoolbox, and xtsring and have tried ...
2
votes
1answer
35 views

Rearranging \cite arguments

I have the following requirement for my thesis: If I cite multiple citations, I should cite my papers first. The names of all my papers start with “my:”. So I want to define a new command that ...
1
vote
1answer
25 views

\ForEachX and string concatenation

I'm writing a class where I have an arbitrary number of strings that I'd like to concatenate, then loop over and typeset using \ForEachX from the forarray package. If I define a command to add to a ...
1
vote
2answers
38 views

How do I define a list of strings with the babel package and the ngerman option?

I try to make a pie chart, but can't get the labels right: This is the MWE: \documentclass{article} \usepackage[ngerman]{babel} \usepackage{tikz} \definecolorseries{colorser}{rgb}{last}{blue}{green} ...
3
votes
1answer
102 views

List of strings for tikzpicture

at first my MWE: \documentclass{article} \usepackage{tikz} \begin{document} \def\johnlist{{ala},{bla},{cla}} % \def\johnlist{2,3,5,7} %This instead of the line above works... \begin{tikzpicture} ...
4
votes
2answers
155 views

Replacing braces in strings

I know I should probably not want to, but say for the sake of discussion that I wanted to remove braces from a string for some purpose (background, now obsolete). From its package description, ...
1
vote
1answer
45 views

Dealing with braces in filenames for graphicx

For the purpose of managing a large reference document with many included files, I include links to these files in the margin. Broken down to an MWE, this is what I do: \documentclass{article} ...
1
vote
0answers
36 views

How to split a string to figure float with figure name, label and caption?

I am struggling with a shorthand macro that converts a string to a figure. At the end is a working, but unstable version what I am trying to do. The goal is to parse make a command (or macro) like ...
7
votes
2answers
139 views

Comparing strings extracted from Jobname

I have some code that parses \jobname, but it's not working as expected. I've included a minimal example below where the file name is HelloWorld.tex. When I print the \jobname, it comes out as ...
0
votes
1answer
34 views

Using fully expanded result as a simple string (with citet and \IfSubStr)

I am breaking my head with that problem, without finding anything that could help on Internet : The initial problem is that I write an essay in French but I need to include some articles written in ...
2
votes
1answer
19 views

Compare authors of two natbib references

I am trying to find out whether two references have the same author with natbib. But I seem to be unable to get basic string comparisons working. Without a deeper understanding, I have tried ...
1
vote
1answer
82 views

Wrong string color in embedded code

My problem is that when I use the correct quotation marks ``'', lstset does not recognize strings in my code and thus does not color-code them. When I use standard double quotes "", the leading ...
4
votes
1answer
76 views

Extract the last word from a sentence stored in a variable

I want to extract the last word of a sentence stored in a variable, e.g. \thevariable. Here is the minimal example. \documentclass{article} % Function to extract the last word of a sentence ...
0
votes
1answer
52 views

Get first letter of the document title

I'm trying to get the first letter of the document title, but I'm not getting. I'm using a code as: \usepakage{xtring} \StrLeft{\thetitle}{1}[\firstletter] Result of compilation: Undefined control ...
3
votes
1answer
84 views

Formatted number printout in LuaTeX?

I have this code that I copied from What is a simple example of something you can do with LuaTeX?. \documentclass{article} \usepackage{luacode} \def\score#1#2#3{% \directlua{ s1 = #1; ...
7
votes
5answers
430 views

Command to count characters in a specified string

Is there a way to count the number of characters in a specified string? Suppose I had the following code. \documentclass{article} \newcommand{\numchars}[1]{\noindent The string ``#1" has ? ...
4
votes
2answers
76 views

String comparisons not working with textgreek

Following the solution from this question as a guide - Are there any "if" commands like "\ifnum" in LaTeX? - I have setup a newcommand to perform a string comparison. ...
5
votes
1answer
42 views

Replacing an id (integer) with a string?

I have a tex document that contains sections that are automatically generated. These sections have strings that are observation IDs. I would like to have latex replace all occurrences of an ID with ...
3
votes
2answers
172 views

Substitute string that contains a backslash

I need to create a function that will transform a string such as: Hello\textbackslash{}Bye into this: Hello \\ Bye I have tried using StrSubstitute (from the xstring package) without success. I ...
4
votes
4answers
113 views

Recursive String Parsing

I have been working on writing a recursive stream processor in latex that converts a shorthand version of a set of highly used commands into a much longer form. The code below represents what I had ...
3
votes
2answers
195 views

Deleting duplicates from a comma-separated list of strings

This is a followup to Difference in compilation time between two slightly different versions. As became obvious when asking that question, the speed of that compilation is seriously affected by the ...
2
votes
1answer
82 views

Define an expandable function for comparing a token list to a string in LaTeX3

In LaTeX3, I could define a function for comparing a token list to a string \cs_generate_variant:Nn \tl_if_eq:nnTF { V } \cs_new_nopar:Npn \module_compare:n #1 { \tl_if_eq:VnTF \g_some_tl { #1 ...
7
votes
2answers
422 views

How to split input string in a LaTeX command?

I would like a new command: \myfunc{string}, where string is something like: "a,b,x,y,x" and the effect of the command should be the following: \func{a}\func{b}\func{x}\func{y}\func{x}, where \func{} ...
0
votes
0answers
44 views

Different bibtex tags content enclosing and string concatenation

I had noticed strange (in my opinion) behaviour of string concatenation in bibtex entry. I tested three different examples: @string{abc={ABC}} @string{def={DEF}} @string{abc="{ABC}"} ...
3
votes
1answer
124 views

Nested or variable functions of xstring

My idea is to use xstring package for dealing with some string tests. In my case, I used the \strLeft function for extracting the 3 first letters of a string. Then, I use this result in \IfStrEqCase ...
0
votes
0answers
35 views

How to load input file with given starting string but unknown end?

In the directory of my latex source there are input files: input_01.tex, input_02.tex, etc. It is very easy to load them with a for cycle. But how to load them if their names are: ...
5
votes
3answers
422 views

LaTeX: Access every character of an string variable

I'm using variables to create strings in that way \newcommand{\myText}{2014/12/20} \myText{} This works great. Now, I can to access every single character of this string (length is 10), because in ...
1
vote
0answers
20 views

Bibliography string 'print' undefined [duplicate]

I use biblatex and a special fonencoding for the cyrillic alphabet. Everything works fine, only the bibliography prints an additional, unwanted string 'print' at the end of each item. Here's my code: ...
0
votes
0answers
46 views

Strip control characters from token

I've added a hook to lstlisting to do some special highlighting. Now I've got it to highlight %-prefixed variables just fine, but I'd like to handle the special case "%this" in another way. ...
5
votes
1answer
227 views

Biblatex abbrevation for no author/editor/year/etc. in alphabetic style

I use an alphabetic citestyle with biblatex. Sometimes I have entries where no author or editor or year is given. For example there is often no editor for a proceeding. At the moment I leave the entry ...
9
votes
2answers
239 views

Replace every backslash in a string with a forwardslash

I would like to replace every backslash \ inside a macro (string) with a forwardslash /. The macro is intended to contain a filename in Windows notation which should be replaced by a valid (La)TeX ...
3
votes
1answer
103 views

Expand arguments in string substitution macro

Rewritten as minimum non-working example: \documentclass{article} \makeatletter \usepackage{xstring} \usepackage{xparse} \newcommand\textfromcase[1]{% \IfEqCase{#1}{% for the purposes of this ...
1
vote
1answer
54 views

A command for making a string of characters [duplicate]

How can I make a command (or is there an existing one?) which takes two arguments: 1) character type 2) N (count) and puts N number of characters side by side? \newcommand{\foo}[2] { % sample: ...
2
votes
1answer
62 views

Bibliography string 'by' undefined in Canadian

I use babel with the canadian language, and biblatex-chicago. If I use a @inbook reference with a bookauthor field, I get the following error: Bibliography string 'by' undefined at entry 'smith' on ...
8
votes
5answers
432 views

A command which concatenates a string an arbitrary number of times

I'm trying to define a command \repeatstring{#1}{#2} which repeats the string #2 #1 times. Here is what I tried: (it is based on what I found in How to concatenate strings into a single command?) ...
5
votes
2answers
91 views

xmakefirstuc combined with MakeTextLowercase

I am trying to convert a string as in the example, with all lowercase characters except the first. However, xmakefirstuc does not like me that much. Here's my MWE: % arara: pdflatex ...
8
votes
2answers
183 views

Creating bullet-list from string with delimiters

I want to create a bullet list from a string with delimiters in it. The delimiter in my example is | Example string: This is|A bullet|List from|A string I want to get that to become a bulletlist ...
8
votes
1answer
81 views

Defining a reusable string from within an environment

I write documents that rely heavily on the 'enumerate' environment. I'd like to turn any particular item from within that environment into a variable that I can use elsewhere. The idea is to ensure ...