2

Is there a way of toggling the textpos option [noshowtext]?

I would like some textboxes to show the frame but not the text. And others to show both frame and text, but can't seem to find a way of toggling this, the package does not specify it.

Any ideas?

  • that is awesome! it works. Can you explain the \TP@showtextfalse and \TP@showtexttrue parts? Thanks – Randi Apr 22 '14 at 21:09
4

textpos sets a boolean (or IF-condition) depending on whether you provide the noshowtext option or not. More specifically, from textpos.dtx, it defines (comments added):

\newif\ifTP@showtext% Create a condition \ifTP@showtext
\TP@showtexttrue% Set condition to TRUE
\DeclareOption{noshowtext}{\TP@showtextfalse}% Set condition to FALSE...
                                             % if you use \usepackage[noshowtext]{textpos}

If you add

\makeatletter
\newcommand{\NoShowText}{\TP@showtextfalse}% Set condition \ifTP@showtext to FALSE
\newcommand{\ShowText}{\TP@showtexttrue}% Set condition \ifTP@showtext to TRUE
\makeatother

to your document preamble, it provides a user-interface to setting the condition as either being TRUE or FALSE mid-document (rather than at package-load). So, they now act as a switch:

  • Use \NoShowText to de-activate the showing of text; and
  • Use \ShowText to activate the showing of text again.

This works because the condition is evaluated within the textpos constructions. If the constructions were created based on whether or not you load the package with/without the option, then it would be a different story; one may have to rewrite certain macros. But this doesn't seem to be the case here.

  • @Werner is correct -- this will work to switch the box text on and off. One should note, however, that the @ in the macro name is telling you that this is an implementation detail of the class, which the package author (ie, me, in this case!) could change without warning and without scruple. That's unlikely to happen here, but it's wise to be conscious of that general potential downside to using packages' internal macros. – Norman Gray Feb 24 '15 at 14:38

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.