I am writing a custom, package using Texmaker with Pdftex. I have a function, which I would like to change a certain delimiter to whatever the user wishes if my provided delimiters are not good, or not preferable. example is as follows.
I have a Switch Case Function for which I would like to be able to change the delimiter "-
" either with predefined delimiters, or with a user input delimiter if they happen to need all of the provided delimiters.
The best case would be to remove all of the predefined delimiters and enable the user to type \usepackage[SwitchCaseDelimiter=""]{Customs}
and use it that way.
\NeedsTeXFormat{LaTeX2e}[1994/06/01]
\ProvidesPackage{Customs}[2019/16/12 Custom Function Package]
\RequirePackage{xparse}
%\RequirePackage{tikz}
%\RequirePackage{pdfpages}
%\RequirePackage{graphicx}
%\RequirePackage{capt-of}
%\RequirePackage{caption}
%\RequirePackage{geometry}
%\RequirePackage{catchfile}
\newcommand{\SCdelim}{,}
\DeclareOption{Semicolon}{\renewcommand{\SCdelim}{;}}
\DeclareOption{Colon}{\renewcommand{\SCdelim}{:}}
\DeclareOption{Exclaimation}{\renewcommand{\SCdelim}{!}}
\DeclareOption{Period}{\renewcommand{\SCdelim}{.}}
\DeclareOption{Minus}{\renewcommand{\SCdelim}{-}}
\DeclareOption{Equals}{\renewcommand{\SCdelim}{=}}
\DeclareOption{Carrot}{\renewcommand{\SCdelim}{^}}
\DeclareOption{LeftArrow}{\renewcommand{\SCdelim}{<}}
\DeclareOption{RightArrow}{\renewcommand{\SCdelim}{>}}
\DeclareOption{Arrows}{\renewcommand{\SCdelim}{<>}}
\DeclareOption{Other}{\renewcommand{\SCdelim}[1]{#1}}
\ProcessOptions\relax
\makeatletter
\newcommand\SwitchCase[2]{%
\def\tmpa{#1}%
\@for\tmp:=#2\do{\expandafter\zz@switch\tmp\zz@switch}%
}
\def\zz@switch#1-#2\zz@switch{% ideally change the delimiter in this line
\def\tmpb{#1}%
\ifx\tmpa\tmpb#2\fi}
\makeatother
\endinput
What I wanted to do was the following:
\def\zz@switch#1\SCDelim#2\zz@switch{% ideally change the delimiter in this line
\def\tmpb{#1}%
\ifx\tmpa\tmpb#2\fi}
The excessive amount of headers is merely to show what other headers are used in the package. there are about 5 or 6 more functions in the package but they are not relevant to the question. I only included my required packages so that any answers would not cause conflicts or errors with the packages already in use.
P.S. I apologize for any awkward wording, or weird coding.
Other
definition looks like it will cause issues later in the file) , have you tried it, what is the actual question? (please provide a test file that can be used to show any problems)[delim=!]
or[delim={=}]
etc