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

learn more… | top users | synonyms (1)

2
votes
1answer
22 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 ...
2
votes
1answer
104 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
200 views

Writing macros for tikz-cd arrow options

I'm trying to write a macro to let me write shorthand for tikz-cd arrows. For instance instead of having to write out the full command \arrow[swap, dotted]{r}{f^*} I'd like to have a shorthand ...
2
votes
1answer
267 views

Latex: splitting/processing strings inside a latex command

Let's say I have \ingredients {% \unit[375]{g} & Farina 00\\ \unit[250]{g} & Burro\\ \unit[3]{g} & Sale\\ 1 & Limone } (you got me: I'm dealing with xcookybooky) ...
2
votes
1answer
174 views

Macro to get character width in ConTeXt

Background Looking to adjust the location of the first letter in a word based on its width. Problem The calculation resembles: \define[1]\StyleChapterChar{% \cldcontext{string.sub("#1",1,1)}% } ...
2
votes
2answers
169 views

use string variable as format string in \begin{tabu}

I have the following problem. I'm using the tabu package to create tables but instead of a format string like this: \begin{tabu}{ccc} I want to use a format string like this (as string variable): \...
2
votes
1answer
598 views

from string to command

What exactly happens in: \newcommand{\mystring}[1]{\gdef\@mystring{#1}} when \mystring{mystring} is used later in the document? It is known that mystring will be put in \mystring but I would like ...
2
votes
1answer
53 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
53 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]{...
2
votes
1answer
110 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 }...
2
votes
1answer
102 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 ...
2
votes
1answer
117 views

Substrings in ConTeXt

Problem Trying to get the first letter of a word for a chapter heading. The chapter style is being applied as follows: \setuphead[chapter][ command=\StyleChapter, % Hide the header's ...
2
votes
1answer
203 views

How to create a pre-processing command that accepts plain text and generates formatted text (based on configurable options)

Looking for the best way of creating a string-processing command in latex to achieve things like below: Given a long piece of normal text, and a set of keywords, automatically format the matching ...
2
votes
1answer
82 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 ...
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 ...
2
votes
1answer
177 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 ...
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 ...
2
votes
1answer
23 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
2answers
868 views

Arbitrary string assigned to variable?

How can I assign an arbitrary string - that may include special characters or even macronames - to a variable just as it is? e.g. like this: \newcommand{\mystring}{\assignstring{abc{}\w'\macroname \\}...
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: ...
1
vote
2answers
46 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} ...
1
vote
1answer
32 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{...
1
vote
2answers
346 views

\pgfmathdectobase macro \pgfmathresult digit index or bitwise operators

Is there a way to access each digit of a macro returned by \pgfmathdectobase (or \pgfmathresult) which is a binary number ? This would be useful for a function which prints the power set of a given ...
1
vote
1answer
40 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} \...
1
vote
1answer
154 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 ...
1
vote
1answer
166 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 ...
1
vote
1answer
218 views

How to expand keyval options immediately

I am trying to build up a macro that creates other macros depending on kvoptions' options. But then, the outcoming macros are dependent on the actual state of the options instead of their state at the ...
1
vote
1answer
891 views

Using \footnotesize in tikz node labels

I have used \footnotesize to scale labels before and it has produced the desired results. But am having problems when I pass this as part of the label to a macro. The following MWE compiles but not if ...
1
vote
1answer
41 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
87 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 ...
1
vote
1answer
28 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. ...
1
vote
1answer
104 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 ...
1
vote
1answer
86 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
1answer
57 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: \...
1
vote
1answer
246 views

Extra the word 'numberstyle' in listing

What's wrong with this ? I define listing style like below. \definecolor{codegreen}{rgb}{0,0.6,0} \definecolor{codegray}{rgb}{0.5,0.5,0.5} \definecolor{codepurple}{rgb}{0.58,0,0.82} \definecolor{...
1
vote
1answer
122 views

Making Back-Referencing More Pretty

The question Back-referencing in LaTeX was marked a duplicate, so I can't post to that thread. Nonetheless, I found the code provided there by Ryan Reich to be a good learning exercise. His solution ...
1
vote
0answers
34 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) \...
1
vote
1answer
165 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 ...
1
vote
0answers
22 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} \def\parametre{...
1
vote
1answer
40 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
0answers
58 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 ...
1
vote
0answers
21 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: ...
1
vote
0answers
88 views

Listings: Format part of a string differently (markup language inside a string) [closed]

I made a new language definition for a .NET template engine where part of the strings in the C# code are markup. Example: string templateString = @"{% for name in names %} Hallo {{ name }} {% ...
0
votes
1answer
3k views

“backspace” a character

It's not really "backspace" a character: I define a command, for example \foo representing bar, actually a macro for replacement. I need to produce the string bars with \foo. It's impossible to just ...
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 ...
0
votes
1answer
50 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 ...
0
votes
1answer
145 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 ...
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 ...
0
votes
0answers
17 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*{...
0
votes
0answers
48 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 ...