0

How using \myfunction{"TEST"} to \mysuperfunction{T}{E}{S}{T} I alvays have this same number of parameter

cgnieder
  • 66,645
eeeeee
  • 1
  • 3
    please clarify your question, what input do you want and what effect do you want to happen? – David Carlisle Jan 24 '22 at 20:44
  • 3
    Welcome. As it stands the question is very unclear. Can you please add some more details? – egreg Jan 24 '22 at 20:44
  • very simple. I have one string but i need 2 parameter in my function I wouldn't write {A}{B} but need write only one parameter {AB}. Shotrage my tex file – eeeeee Jan 24 '22 at 21:39
  • You might find https://tex.stackexchange.com/questions/233085/basics-of-parsing?r=SearchResults&s=1|39.7576 useful. – John Kormylo Jan 24 '22 at 21:47
  • in your comment the string goes from AB to a two parameter command, in the question the example is completely different starting from a "-delimited argument with 4 letters (so 6 in total) going to a 4 parameter command. which do you want, the answers would be completely different. – David Carlisle Jan 24 '22 at 21:52
  • i need in my tex file wrote \funkcja{TEST} and defining my function \newcommand[4]{{\it #1 \tt #2 \bf #3 \it #4}} i need write one string but get 4 parameter similar chars – eeeeee Jan 24 '22 at 22:10
  • 1
    Welcome to TeX.SE. Instead of describing what you want and then having to include comments to clarify, It is always best to compose a fully compilable MWE that illustrates the problem including the \documentclass and the appropriate packages so that those trying to help don't have to recreate it. Or at least provide as complete as possible test case. – Peter Grill Jan 25 '22 at 07:51
  • 1
    so please edit your question to say that, currently it asks about an input with " which is a completely different form Note also that \it , \bf haven't been defined by default in LaTex since 1993, I assume you want \textit{#1} \texttt{#2}... – David Carlisle Jan 25 '22 at 08:59

2 Answers2

1

Here is a possibility (if I understood the need correctly...):

\documentclass{article}

\def\mysuperfunction#1#2#3#4{{\it#1\tt#2\bf#3\it#4}} \newcommand\myfunction[1]{\mysuperfunction#1}

\begin{document} \myfunction{TESTwithlontext} \end{document}

And a solution without deprecated commands:

\documentclass{article}

\def\mysuperfunction#1#2#3#4{{\textit{#1}\texttt{#2}\textbf{#3}\textit{#4}}} \newcommand\myfunction[1]{\mysuperfunction#1}

\begin{document} \myfunction{TESTwithlontext} \end{document}

Paul Gaborit
  • 70,770
  • 10
  • 176
  • 283
0

Please always provide an example document as here, this answers the question as asked in the comments, the version in your question has " in the input which would complicate the answer slightly

enter image description here

\documentclass{article}

\newcommand\cmdA[4]{\textit{#1} \texttt{#2} \textbf{#3} \textit{#4}} \newcommand\cmdB[1]{\cmdA#1}

\begin{document}

TEST

\cmdA{T}{E}{S}{T}

\cmdB{TEST}

\end{document}

David Carlisle
  • 757,742