I am endeavouring to define a new environment, which contains a nested overpic environment, using my own set of default parameters.
My main goal is simply to have a new environment, like the below, that I can use in place of a regular overpic, to save my having to repeat all the below-encoded parameters.
I have been encountering myriad expansion- and brace- (or grouping) related errors. I first tried to solve this by using the environ package, as depicted below (all subsidiary macros are suitably-defined lengths, save \figDir, which is a path to the directory containing the image in question; these are shown in the next block of this question):
\NewEnviron{logoOverpic}[1]{%
\begin{overpic}[width=\linewidth, height=\seqLogoHeight, trim=\leftTrimLogo \botTrimLogo \rightTrimLogo \topTrimLogo, clip]{\figDir/#1}
\BODY%
\end{overpic}%
}{}
\newcommand{\addSeqLogoLabel}[2]{
\setcounter{putVPos}{44}
\put (17, \value{putVPos}) {
\fontsize{14pt}{18pt}\selectfont
%
% use fill colour as border as well, to get correct border-less size
\Large\textsf{#1}\hspace*{4pt}\fboxsep0pt\fcolorbox{#2}{#2}{\phantom{X}}
}
}
An example usage of this, is as follows:
\begin{logoOverpic}{logoMA0466_1}
\addSeqLogoLabel{\TFBS{CEBPB}~MA0466.1}{orange}
\end{logoOverpic}
I was previously obtaining errors of the form: "Argument of \Gread@parse@vp has an extra }."
I have been trying (in vain) to resolve this, by applying a related answer.
My efforts in those regards have clearly been quite poor, as they have only served to exacerbate the errors I obtain. I tried the following, though I realize it is not at all correct:
\NewEnviron{logoOverpic}[1]{%
\begingroup\edef\x{\endgroup\noexpand%
\begin{overpic}[width=\linewidth, height=\seqLogoHeight, trim=\leftTrimLogo \botTrimLogo \rightTrimLogo \topTrimLogo, clip]{\figDir/#1}}\x%
\BODY%
\end{overpic}%
}{}
I now obtain errors like the following three:
"Runaway argument?
main.tex, 396
clip,@nil ,\XKV@usepresetkeys {}{presett}\let \CurrentOption @empty \ETC.
! Paragraph ended before \Gread@parse@vp was complete.
<to be read again>
\par
l.396 \end{logoOverpic}
I suspect you've forgotten a `}', causing me to apply this
control sequence to too much text. How can we recover?
My plan is to forget the whole thing and hope for the best.
Extra }, or forgotten \endgroup.
main.tex, 396
<recently read> }
l.396 \end{logoOverpic}
I've deleted a group-closing symbol because it seems to be
spurious, as in $x}$'. But perhaps the } is legitimate and you forgot something else, as in\hbox{$x}'. In such cases
the way to recover is to insert both the forgotten and the
deleted material, e.g., by typing `I$}'.
Runaway argument?
main.tex, 441
\env@nil \end {logoOverpic} \label {fig:0.3:JASPAR_CEBPB} \end {subfi\ETC.
! Paragraph ended before \Gread@parse@vp was complete.
<to be read again>
\par
l.441
I suspect you've forgotten a `}', causing me to apply this
control sequence to too much text. How can we recover?
My plan is to forget the whole thing and hope for the best.
LaTeX Error: Not in outer par mode.
I would appreciate any suggestions that anyone might be able to offer!
At this stage, I do not provide a MWE. I do recognize that this makes it more difficult to assist me and apologize for any inconvenience.
I would greatly appreciate any suggestions that anyone might nonetheless be willing to proffer. Should no suitable suggestions be provided within a certain interval, I will endeavour to compose a proper MWE.
