The macro \ttfamily does not read up to }: it is a declaration that sets (locally) the current font and its action continues until the current group ends.
You can do this, but it's conceptually wrong to begin with.
\long\def\mymacro#1{--#1--}
\long\def\mynewmacro{\egroup\iftrue\expandafter\mymacro\expandafter{\else}\fi}
\mymacro{lorem ipsum
dolores
}
{\mynewmacro lorem ipsum
dolores
}
\bye
The \egroup balances the initial {; then we have the problem to make \mymacro into seeing an explicit { and to get rid of the necessary } (because \def wouldn't accept an unbalanced list of tokens). The \iftrue test follows the true branch; actually what it does is simply disappearing, leaving
\expandafter\mymacro\expandafter{\else}\fi
on the input stream, but with TeX knowing it should ignore the \else part. With \expandafter we reach this \else, whose expansion removes everything up to \fi. So at the end we remain with
\mymacro{\fi
so by general rule \mymacro will read up to the matching }. The remaining \fi will expand leaving nothing at all.
Note, however, that you can't call this as \begingroup\mynewmacro ...\endgroup nor use \bgroup and \egroup.
\ttfamilydoes not read ahead to the end of the group, it is not equivalent to a macro with argument in the way you suggest with\mymacro– David Carlisle Jan 22 '18 at 22:28\mymacro. – Werner Jan 22 '18 at 22:31\textttyou sometimes get overfull boxes, because hyphenation doesn't work properly. That's a known issue. I want to insert a\linebreak[1]after every character so as mentioned here: https://tex.stackexchange.com/questions/324042. I want a new command that replaces\textttand ideally I also want a command that replaces\ttfamilyto have that functionality. But it appears that\ttfamilyis special in that sense. – Volker Jan 23 '18 at 07:17\mynewmacrocould go wrong that's better to give up with it. Since you want to process text in a special way, a command with argument is what you need. – egreg Jan 23 '18 at 07:40\newmboxso you can say{\newmbox abc}instead of\mbox{abc}. It doesn't make sense. – egreg Jan 23 '18 at 07:47\end{foo}than}a syntax such as you suggest is never going to work. – David Carlisle Jan 23 '18 at 08:58\ttfamily. How would I also have the feature that long words don't run into the next cell or the document margin? I don't care about proper hyphenation because the words may not be english words, but hashes or other random strings of characters. – Volker Jan 23 '18 at 13:52&or\\rather than}– David Carlisle Jan 23 '18 at 14:20makecellpackage – David Carlisle Jan 23 '18 at 14:23