I need to modify an argument of macro.
For example #4
equals to 1.1 Optimal solution of RNASP
When I write Figure #4
, output is this:
Figure 1.1 Optimal solution of RNASP
But I need this:
Figure 1.1: Optimal solution of RNASP
I suppose I need some text operations like:
- Split text to two. Figure number and text.
- Add "Figure" word to start and ":" to end of the first part
- Make first part bold
- Combine first and second part and set as new variable to use in macro
Macro:
\def\@mymacro#1#2#3#4#5{
...
\vskip 2cm
Figure #4
...
}
Edit: I figured out that, for example in one instance #4
equals to the following string. I obtained it by making \detokenize{#4}
\hyper@linkstart {link}{\Hy@tocdestname }{\numberline {1.1}{\ignorespaces Optimal solution of RNASP.\relax }}\hyper@-linkend
When I make detokenize these functions work:
\StrLen{\detokenize{#4}}
\StrLeft{\detokenize{#4}}{30}
But this doesn't work:
\StrBetween{\detokenize{#4}}{foo}{bar}
Besides I need to put a :
just after the figure number and make bold before the start of the caption.
Edit: Although having other class functions and definitions, I removed my other content and created an overleaf project. String manipulation can be seen on 206-208 of the gsu12.def file. https://www.overleaf.com/16674170vmvhjncqjndv
I get this error:
https://ibb.co/gZUn2d
\@mymacro
creating an instance of afigure
float? If it's the latter, have you considered loading and using thecaption
package?\l@figure
or\@dottedtocline
? your overleaf code uses classgsufbe
and many many packages so is not at all minimal. The crucial thing here is that your are usinghyperref
hence the decoration you saw with\detokenize
.\numberline
to do what your want. But the question is too vague without indication of which macro exactly you are hacking into.