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

learn more… | top users | synonyms (1)

5
votes
2answers
61 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 ...
1
vote
1answer
28 views

Changing the font family of a string type column using pgfplotstable

Suppose I'm using Beamer, pgfplotstable and the professionalfonts font theme. I'd like to use the computer modern font also in a string type column. Here is a MWE: \documentclass{beamer} \...
6
votes
5answers
570 views

strip last character from parameter if it is 's'

I have a semantic annotation \monster to annotate mentions of monsters so that they are indexed: \newcommand{\indexMonster}[1]{\index{#1}} \newcommand{\monster}[1]{#1\indexMonster{#1}} Now, most of ...
17
votes
3answers
580 views

Extract first word in a string

The title pretty much says it all, I need a command to get the first word in a string. Based on this answer to another question of mine, I tried this: \documentclass{article} \makeatletter \...
1
vote
1answer
44 views

Listing Python code with Strings and all characters

I have a little issue concerning the representation of a string in Python. I have the following Python Code #!/usr/bin/env python import sys import math import string from vmtk import pypes from ...
1
vote
2answers
90 views

Automatically generate new commands and keyval definitions

I would like to automatically define new commands and keyval definitions anytime that a command beginning with the prefix \fn is used within a string. Part I below is the stub that needs to be ...
0
votes
0answers
13 views

Variable name space problem [duplicate]

I have a problem with defining a variable in latex. Here is the deal: I create a variable containing a string like this: \newcommand{\company}{{Company Name}} It works, but the problem is when I ...
5
votes
2answers
36 views

footnote inside a tested string

I would like to create a footnote within a command that tests the parent string (using xstring), such as: \documentclass{article} \usepackage{etex} \usepackage{xstring} \begin{document} \...
1
vote
1answer
41 views

How to exclude math environments from string replacement?

I would like to have a command which applies another command to each line of the input. My approach is the following simple string replacement: \documentclass{article} \usepackage{xstring,xparse} \...
0
votes
0answers
61 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
149 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: \documentclass{article}...
7
votes
3answers
79 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
19 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}% \par\vspace*{...
7
votes
3answers
93 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
958 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
29 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
57 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} \begin{...
4
votes
1answer
46 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
36 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
174 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
189 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
54 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
23 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
35 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} \usepackage{...
6
votes
2answers
105 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
568 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
7k 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
54 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
83 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
186 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
42 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 ...
9
votes
3answers
381 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 ...
4
votes
1answer
125 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: truncatedtime;meanfinalfloatvalue;floatvaluedifference;datap2count;...
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
41 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} \usepackage{...
3
votes
1answer
59 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
54 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 %\usepackage[arial,utf8]{...
22
votes
3answers
30k 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
46 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
73 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} \newcommand*{\String3}[1]{...
4
votes
1answer
122 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
229 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
88 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
169 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
231 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} \begin{...
3
votes
1answer
98 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
233 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 "self-...
2
votes
0answers
74 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
148 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 ...