I have a latex file in which I would like to replace the content inside a \caption environment.
In particular, I want to use bold text and change the size. As an example:
%ORIGINAL
\caption{ Some text }
%...
\env2{ \caption{ Other text } }
to something like this
%NEW FILE
\caption{ \scriptsize\textbf{ Some text } }
%...
\env2 { \caption {\scriptsize\textbf{ Other text } } }
I am able to use sed to extract the text between the two patterns "\caption{" and the closing "}" as shown in this question: How to use sed/grep to extract text between two words?
And I am as well able to replace the inner text with a known string, as shown here : replace a unknown string between two known strings with sed
My question is: how do I keep the unknown strings inside the newly added environment, just using a single sed command and replacing only the surrounding strings ? Maybe something like:
START-PATTERN [new-environments] [Inner-text] [closing-brackets] END-PATTERN
Thank you.