3

In the following code, I can hide in the paper any piece of text except the ones coming from the command \showthis.

Is there a way to hide output coming from other materials like pictures and tikz drawings for example ?

This would be to do a preprocessing for a tool to automate corrections of tests.

\documentclass[12pt]{article}

\usepackage{xcolor}

\makeatletter
\newcommand{\globalcolor}[1]{%
  \color{#1}\global\let\default@color\current@color
}
\makeatother

\AtBeginDocument{\globalcolor{white}}

\usepackage{lipsum}

\newcommand\showthis{{\color{black} JUST SHOW ME}}

\newcommand\blabla{bla, bla, bla, bla, bla, bla, bla, bla, bla, bla, bla, bla, bla, bla, bla, bla, bla, bla, bla, bla, bla, bla, bla, bla, bla, bla, bla, bla, bla, bla, bla, bla, bla, bla, bla, bla, bla, bla, bla, bla, bla, bla, bla, bla, bla, bla, bla, bla, bla, bla, bla, bla, bla, bla, bla, bla, bla, bla, bla, bla, bla, bla...}


\begin{document}

\lipsum[2]

\showthis{}

\lipsum[2]

\showthis{}

\blabla{} \showthis{} \blabla{}

\lipsum[2]


\end{document}
projetmbc
  • 13,315

1 Answers1

1

Is it something like thqt you are looking for ?

Hidetrue

enter image description here

Hidefalse

enter image description here

\documentclass[12pt]{article}
\usepackage{xcolor}
\newif\ifHide
\Hidetrue % hide the text 
%\Hidefalse % show the text

\usepackage{lipsum}

\newenvironment{Hidethis}{%
    \ifHide
    \begingroup\color{white}
    \fi}{%
    \ifHide
    \endgroup
    \fi}

\newcommand\blabla{bla, bla, bla, bla, bla, bla, bla, bla, bla, bla, bla, bla, bla, bla, bla, bla, bla, bla, bla, bla, bla, bla, bla, bla, bla, bla, bla, bla, bla, bla, bla, bla, bla, bla, bla, bla, bla, bla, bla, bla, bla, bla, bla, bla, bla, bla, bla, bla, bla, bla, bla, bla, bla, bla, bla, bla, bla, bla, bla, bla, bla, bla...}


\begin{document}

\begin{Hidethis}
\lipsum[2]
\end{Hidethis}

JUST SHOW ME

\begin{Hidethis}
\blabla{}
\end{Hidethis}
JUST SHOW ME
\begin{Hidethis}
\blabla{}
\end{Hidethis}

\begin{Hidethis}
\lipsum[2]
\end{Hidethis}
\end{document}
Tarass
  • 16,912
  • Thanks. But this solution is only for text. How can I manage pictures and other none textual materials. – projetmbc Mar 07 '18 at 12:04
  • @projetmbc do you the hidden parts disappear and take no more room or turn white but stay in place. – Tarass Mar 07 '18 at 22:09
  • Thanks for your solution but I am looking for a soft solution which uses a macro for the parts to be displayed instead of a macro for things to be hidden. – projetmbc Mar 11 '18 at 13:46
  • @projetmbc OK but do you want that the displayed parts stay at there places (hidden text takes his room) or hidden text vanishes and the displayed parts stick together? Am I clear ? – Tarass Mar 11 '18 at 14:17
  • @Tarras Yes I want that hidden texts take their room. – projetmbc Mar 12 '18 at 08:22
  • I have it in mind. I'll post if I'll found something. – Tarass Mar 12 '18 at 09:41