TransWikia.com

textpos toggling noshowtext option

TeX - LaTeX Asked by Randi on December 5, 2020

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?

2 Answers

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):

newififTP@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.

Correct answer by Werner on December 5, 2020

Since textpos v1.8, you can do

TPoptions{showtext=false}

(or true) to control showing and hiding the text.

Answered by Norman Gray on December 5, 2020

Add your own answers!

Ask a Question

Get help from others!

© 2024 TransWikia.com. All rights reserved. Sites we Love: PCI Database, UKBizDB, Menu Kuliner, Sharing RPP