Skip to main content

Questions tagged [strings]

{strings} are sequences of characters (most commonly literal constants). However TeX doesn't have the same concept of strings as other languages, so for questions regarding text in general this tag does not apply. Usually when dealing with {strings} one also uses the primitive {pdfstrcmp} or dedicated packages, such as {xstring} or {expl3}'s string module (l3str).

1 vote
1 answer
25 views

Conditionally omit protocol from hyperlink texts based on URL (Cambridge University Press style)

The Cambridge University Press style guide mandates the following formatting for URLs: ’http://’ and ‘https://’ should not be included before ‘www.’. However, if a URL does not include ‘www.’ then ...
Psychonaut's user avatar
  • 3,184
2 votes
1 answer
38 views

Link produced by href taking a command as first argument is not working "as I want"

I am trying to define a command that takes a bib key, gets its title, author, and DOI, and makes a hyperlink in which the link is the DOI address and the text shown is the paper title. I need this to ...
mikiman's user avatar
  • 23
1 vote
1 answer
102 views

Test whether a string is in a list

\documentclass{article} \usepackage{expl3,xparse} \usepackage{currfile} \ExplSyntaxOn \NewDocumentCommand \IfStringInList {mmmm} { \clist_if_in:nnTF {#2} {#1} {#3} {#4} } \ExplSyntaxOff \begin{...
mario1000's user avatar
  • 336
2 votes
2 answers
48 views

Convert list to table, number of rows

A small program that recalculates the number of records in the source list (array) and converts the list of data into a table. It works if the number of rows in the table is \def\nRows{3} is ...
Juli's user avatar
  • 121
2 votes
1 answer
97 views

Comparing strings using LaTeX3

Yesterday I asked a question about the "currfile" package I wanted to use for writing a document about several pupils in my school and @cabuha provided a very nice answer for this problem: ...
mario1000's user avatar
  • 336
4 votes
1 answer
84 views

Problems when extracting chars from data imported from csv file

In a previous post I want to compare the last character of a string with other characters I asked how to compare the last character of a string with another char, and the solutions offered have solved ...
User's user avatar
  • 61
2 votes
2 answers
215 views

I want to compare the last character of a string with other characters

I want to compare the last character of a string with other characters. If I type \ifthenelse{\equal{f}{f}}{OK}{NOT OK} it returns OK. HOWEVER, if I type \substr{asdf}{-1}{1} it returns f, BUT \...
User's user avatar
  • 61
2 votes
0 answers
87 views

Latex text reversing with Babel package

I am using the babel package, which causes text-reversal when combined with amsmath. The exact list of packages I use is: \usepackage[utf8x]{inputenc} \usepackage[hebrew,english]{babel} % Workaround ...
TheEmeritus's user avatar
1 vote
1 answer
56 views

Print \twocolumn and \onecolumn [duplicate]

How can I print \twocolumn and \onecolumn because \\ makes a new line. \documentclass[a4paper,12pt]{article} \ExplSyntaxOn \NewDocumentCommand {\lumnar} {} { \\twocolumn~and~\\onecolumn~always~...
Franklin's user avatar
3 votes
2 answers
74 views

how to transfer from a text variable a small piece of text

with the following code, I set a variable \AcIII with the bla bla text. I would extract a part of variable (i.e. the first two bla bla) and store it on another variable (that I use next). Can I obtain ...
RenatoP's user avatar
  • 851
0 votes
3 answers
60 views

In Latex3, how to test if all tokens in the input verify a test (for example \token_if_letter or \token_if_space)?

In Latex3, I would like to write a function that checks if every token of an input verify a predicate. Basically I would like the multitoken version of this command: \NewDocumentCommand{\mychecksingle}...
Vincent's user avatar
  • 5,327
2 votes
3 answers
187 views

Find Text Between tabs [closed]

I copied a sheet from google sheet into a *.txt and want to format it to a pdf. I could separate it with \loop\unless\ifeof\mytextfile \read\mytextfile to\mytextline So I have in every loop one of ...
CHP's user avatar
  • 23
4 votes
3 answers
183 views

How to substitute placeholders in string with arguments?

I'm writing a document in two languages using the macro \enzh defined as below: \documentclass{article} \newif\ifen \entrue % comment out to switch to Chinese \newcommand{\enzh}[2]{\ifen#1\else#2\fi} ...
George Tian's user avatar
1 vote
2 answers
42 views

Splitting string and retrieving part of it

I would like to take a string in Beamer and retrieve part of it. The solution at How do I split a string? gets me very close to what I want; but using it as example, i.e. if the string is: \def\...
Rigel F. do C.'s user avatar
2 votes
1 answer
81 views

Why it appears that seqsplit fails to break some strings?

I know it is possible to break long lines using the seqsplit package. The following code block shows a minimal working example. \documentclass{article} \usepackage[a4paper, showframe]{geometry} \...
Rodrigo Morales's user avatar

15 30 50 per page
1
2 3 4 5
34