I would like to use an environment that makes everything inside... invisible!
I would like that during the .tex
compilation to read everything but not render some parts of my LaTeX document.
The problem of \begin{comment}
... Is that the code inside is not "read". I know my problem is unusual, but in fact I want the code inside to be read (it will generate a file), but I don't want it to be rendered (it normally write lines and lines of codes I don't want)
The problem of \phantom
is that it is still "rendered" as a blank rectangle. If I do that I have a huge blank space
(In fact, I want to use SageTex, which "mix" SageMath and LaTeX. There is a way to write a sage code directly in the .tex
file. You have to compile with LaTeX the document. It will produce a .sage
document, that I have to compile with sage this time. Finally, I have to compile with LaTeX so that the Sage calculations are "understood" by LaTeX. For example I can write a sage code "x = 2 + 2
", and use $\sage{x}$
, it will render 4
. But my problem is that by doing that, it always render first verbatim "x = 2 + 2
". And I don't want to see that. I want my calculations to be hidden, not rendered, such that, at viewing the .pdf
we can't determine if sage was used or not)
Simple example :
\usepackage{sagetex}
\begin{document}
%\begin{comment}
\begin{sageblock}
U = 12
\end{sageblock}
%\end{comment}
U = $\sage{U}$
\end{document}
I want a simple render "U = 12
" in a "LaTeX way". With this I have it two times. Once in a "sage code way", and once the well-rendered "LaTeX way"
The solution of StefanH :
\newcommand\donotshow[1]{\smash{\vphantom{#1}}}
Seems to work well, but I still have an error. I think it's because I don't want to use only \donotshow{something}
but \donotshow{ an environment, with multiple lines}
dtx
files, from which the style file as well as its manual can be generated.filecontents
environment (standard LaTeX)? Anywhere before\begin{document}
you can use\begin{filecontents}{somefile.txt} Some text written to a file named somefile.txt. \end{filecontents}
to write stuff to external files.