Text FormattingReplacing characters in a string

Information and discussion about LaTeX's general text formatting features (e.g. bold, italic, enumerations, ...)
Post Reply
anthonymoss78
Posts: 1
Joined: Fri Sep 18, 2020 4:47 pm

Replacing characters in a string

Post by anthonymoss78 »

Hi,

I have a latex variable

Code: Select all

\newcommand{\allStrings}{ string1:string2:string3}
How can I split this string up by the seperator and then write onto new lines (with a tab in front ) so it looks like a list .
So that in the output pdf looks something like the following :
ie
Strings : string1
string2
string3

Anyadvice would be brilliant ..... I am able to split up the string and write in one a new line ... However, i am unable to tab it out (see my function below)

Code: Select all

\usepackage{xstring}

\newcommand{\specialtext}[1]{%
    \StrSubstitute{#1}{:}{\tab   \hfill  \break  }[\myspecialtext]
    \textbf{\myspecialtext}}
thanks guys
Anthony (I am a newbie on this forum so thanks in advance for any help)

Recommended reading 2024:

LaTeXguide.org • LaTeX-Cookbook.net • TikZ.org

NEW: TikZ book now 40% off at Amazon.com for a short time.

Post Reply