So I have a code, modified from this answer by User "ShreevatsaR", which can be called at using
\tooltips{...}
The code works great, for any characters inside it.
For example, for:
\tooltips{疊音詞疊音詞疊音詞}
Only ... the code will jam for punctuation marks.
The code is not designed for punctuation marks, which is fine. Because the code runs some character encoding conversion which is not needed for punctuation marks.
But, the problem is, currently I cannot compile something as such:
\tooltips{疊音詞(疊、音、詞。)疊音詞}
In fact, I have to manually copy and paste untill I end up getting all of the punctuation marks outside of the command, and re-initializing the environment for those parts which are not punctuation marks:
\tooltips{疊音詞}(\tooltips{疊}、\tooltips{音}、\tooltips{詞}。)\tooltips{疊音詞}
Which is a bit time-consuming. Is there any way to do this automatically please?
Please note that, for this question, the answer doesn't require the specific \tooltips{
...}
command to be used. For my part, you can replace the command by any sort of command, e.g. as such:
From:
\any{疊音詞(疊、音、詞。)疊音詞}
To:
\any{疊音詞}(\any{疊}、\any{音}、\any{詞}。)\any{疊音詞}
Also, the Chinese characters are not necessary. They could be anything which is not in a pre-defined list of items to be excluded, e.g.:
From:
\any{AQ(D、Y、F。)PIOP}
To:
\any{AQ}(\any{D}、\any{Y}、\any{F}。)\any{PIOP}
The point is to exclude any punctuation marks (in this case (
and 、
and 。
and )
.
I would be satisfied with:
- an answer that either thus excludes all possible punctuation marks, however Tex may figure out those ...
- or an answer that allows a list of punctuation marks to be specified (e.g.
,
and?
and.
and"
and and-
in the following example).
From:
\any{AQ,D?Y.F'-PIOP}
To:
\any{AQ},\any{D}?\any{Y}.\any{F}'-\any{PIOP}
\something{A
ZB C}
to\something{A}
Z\something{B C}
. That is, to take any Z and place it outside of a command (so not to let the command apply its algorithm to the Z).