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

learn more… | top users | synonyms (1)

0
votes
0answers
29 views

Latex lstlisting: stringstyle not working

I defined my own language Drools and I want that the words between "" have the color red. I used stringstyle to do that but this doesn't work. Am I forgetting something because I couldn't find any ...
5
votes
2answers
132 views

Unexpanded string replace

This question is related to Carry out substring replacement on variable's contents. Is it possible to perform string replace on an arbitrary string, without expansion? MWE: ...
7
votes
3answers
75 views

How to handle input strings in tables, when the input string has line breaks in it?

I have a document template I've written that has worked well until now. It includes input to define things like the name of the document, doc control numbers, etc. Unfortunately, I have a case of ...
0
votes
0answers
15 views

\maketitle redefinition and several authors

for the moment I've redefined \maketitle as \makeatletter \def\maketitle{% \begin{center} \vspace*{3mm}% \textbf{\large{\MakeUppercase{\@title}}}% \par\vspace*{5mm}{\@author}% ...
3
votes
2answers
43 views

How do I perform an expandable string comparison?

I need to perform a string comparison (string equality). If the macro is non-expandable (e.g. contains \def or \let), it causes problems in the place where it is used. I tried using \ifthenelse from ...
7
votes
3answers
81 views

String comparison

\documentclass{article} \usepackage{xifthen, xstring} \newcommand{\IfOne}[3]{ \if\TokenIsIn#1 #2 \else #3 \fi } \newcommand{\IfTwo}[3]{ \ifthenelse{\equal{\TokenIsIn}{#1}}{#2}{#3} ...
0
votes
0answers
18 views

Splitting volume name in bibtex

I would need to check the content of the "volume" field when reading a bibtex entry, and in case split it into two parts. For instance, I have in the bibtex file: journal = "Phys. Lett.", ...
8
votes
2answers
864 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{} ...
1
vote
1answer
27 views

converting file: url to path

I am creating LaTeX files using a template engine. The problem I am running into is that the template engine is designed for generating web pages and generates URLs for external files, such as images. ...
4
votes
2answers
49 views

How to use \nameref with xstring package to check string length

I need to measure a number of characters in string, that I returned from label through \nameref command. Here is my MWE: \documentclass{article} \usepackage{hyperref} \usepackage{xstring} ...
4
votes
1answer
43 views

Open and decode

I use \pato{R}{2015}{07}{27}{A}{1}{4}{black} to \input my sub-archive R20150727A1-4.tex, and it works for me. How can I perform a new command, say \otap{R20150727A1-4}, that decode and assign for ...
1
vote
0answers
28 views

`string replace` before plotting

The package pgfplotstable defines a key string replace* that can be used to replace strings inside a typeset table (in \pgfplotstabletypeset); for instance (quoting from the manual) ...
4
votes
4answers
170 views

Expandable macro with loops and advanced string functions?

This might be a very basic problem (as a follow-up to this question) but I cannot figure out how to do it: I need a macro \mycmd{sometext} that yields a string depending on the first character of its ...
9
votes
1answer
168 views

What packages provide text/command substitution for LaTeX, XeTeX and LuaLaTeX?

I am aware of the following: xesearch - Allows both text and command substitution. Only for XeLaTeX Simple example: \usepackage{xesearch} \SearchList{list1}{Hello}}{hlw} Any time "hlw" is ...
2
votes
1answer
49 views

Truncate parameter before newline

I want to truncate (cut/shorten) a string that contains newline (\\ or \newline) in such a way that only the first line remains. My problem is, that I use the todonotes package and have command ...
2
votes
1answer
21 views

Passing length in form of a string instead of measure [duplicate]

I'd like to pass a measure of length in form of a string, i.e. \setlength{string} or \setlength{'string'} instead of \setlength{2.5cm} I seem to remember seeing something like that somewhere ...
1
vote
1answer
31 views

hypertarget with accents

with XeLaTeX (so native Unicode input), I would like to create a macro which, from a string, will create an hypertarget which anchor's name contain string. \documentclass{article} ...
6
votes
2answers
104 views

Use \item as a string in comparison

I wish to design a convenience command \lazycmd that works like this (simplified version): \newcommand{\lazycmd}[1]{% ... } % Use case 1. \lazycmd{ \item one \item two } % Use case 2. ...
4
votes
1answer
556 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 ...
10
votes
5answers
6k views

How can I draw oval circle around a string?

How can I draw oval circle around a string? For example, when I have "1,3,4,6", how can I put them in a circle?
0
votes
1answer
52 views

Biblatex abbrevation for no editor second try

Referring to my previous question I now try to solve the problem with the missing editor for a proceeding or inproceeding entry. So if I write the command \noeditor into the field editor one should ...
3
votes
1answer
73 views

biblatex: string manipulation after processing of bibtex @STRING

I am using biblatex 3.1 in conjunction with some BibTeX (.bib) files. These files begin with @STRING macros like @STRING{CUP="Cambridge University Press"} and contain entries that have this form: ...
1
vote
1answer
141 views

Convert numbers in string to string

I store some strings in a variable \def\nomVAR{A12Z4E} and I want to create some other command using the content of \nomVAR. LaTeX doesn't accept to declare variable with number in its name. So the ...
5
votes
1answer
40 views

How to get a customized number of decimal places in tex.sprint / directlua / qrCode?

The number of decimal places is "9" in the following example: string.format("\%0.9f", X). How can one achieve the replacement of the fixed "9" decimal places with "NumberOfDecimalPlaces" (in ...
8
votes
3answers
359 views

Changing the alignment character (default: &) in tabular-like environments

I want to define a simple tabular environment that treats spaces as the column separators. So something like a b c d should be treated as a & b & c & d. I've tried using \StrSubstitute but ...
3
votes
1answer
91 views

Problem defining a string column with PGFPlotsTable

First, I am fresh new with the PGFPlotTable package! I have the following CSV file that I would like to plot in a LaTeX table: ...
1
vote
1answer
79 views

Is it possible to get rid off of { and } in the definition of a command?

My purpose is to write simple commands that put graves and other accents symbols above Greek letters. I am facing the following problem: Let say \grave{i} puts the grave symbol above I (for example: ...
4
votes
2answers
36 views

Problem with \IfSubStringInString and special characters

It seems that IfSubStringInString has a problem if the sub string contains umlauts or other non-ASCII characters, as is illustrated by the following example: \usepackage[utf8]{inputenc} ...
3
votes
1answer
52 views

Remove \par from string

I have to put a string in various places of a book. This string is stored in a macro \newcommand{\subtitle}[1]{% \newcommand{\thesubtitle}{#1} } \subtitle{The quite long \par subtitle} Long ...
2
votes
1answer
52 views

Case Sentence With xstring

I have a LaTeX document that gives me the following error: ! Argument of \@xs@IfStrEq@@ has an extra }. The document is as follows: \documentclass{article} %PAQUETES ...
21
votes
3answers
28k views

\uppercase in \newcommand

I tried to use \uppercase in \newcommand: \newcommand\universidad{My University} \newcommand\Universidad{\uppercase{\universidad}} When I use this I get My University and not MY ...
2
votes
2answers
45 views

Replace \\ command only within \chapter

I am converting .tex files to .epub. I need to selectively replace the string "\\" ONLY within chapters command to a single blank space. example: \chapter{My title \\ on two rows} becomes: ...
3
votes
1answer
70 views

Need help for macro to split a string and put the substrings into temp variables

I have something like this: \documentclass{article} \newcommand*\tableData[2]{string1,string2,string3}{string4} \newcommand*{\String1}[1]{#1} \newcommand*{\String2}[1]{#1} ...
4
votes
1answer
109 views

Carry out substring replacement on variable's contents

Say I have a variable that contains some non-plain text, for instance \def\var{Caro \textit{et al.}}, and I want to make a substring substitution of Caro for \underline{Caro}. If I try to follow the ...
6
votes
4answers
223 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, ...
2
votes
1answer
77 views

Treat environment content as string, replace substrings and interpret afterwards

I would like to define an environment which "parses" its content and changes it before displaying it. An additional difficulty comes because I also need to replace whitespaces. The more flexibility ...
1
vote
1answer
140 views

String diagrams in monoidal categories

I'm writing a paper which contains a chapter on a certain kind of monoidal categories (spherical, that is) and I would like to include the usual graphical calculus for morphisms. In particular, I'm ...
7
votes
1answer
215 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
88 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} ...
2
votes
5answers
229 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
73 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 ...
6
votes
3answers
142 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 ...
7
votes
5answers
937 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 ? ...
3
votes
3answers
92 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
21 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
51 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
421 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
96 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
95 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
58 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 ...