I'm looking for a command like \return with which I can manually exit a TeX file, which is included by \input.
(At the end of my TeX file are some notices, which I sometimes want to print, sometimes not.)
I'm looking for a command like \return with which I can manually exit a TeX file, which is included by \input.
(At the end of my TeX file are some notices, which I sometimes want to print, sometimes not.)
I would recommend you use either an environment, or an \ifdefined to select if the notices are displayed or not:

With the "environment" version you can use \DisableMyNotices and \EnableMyNotices to toggle if you want to see the notices or not.
\ifdefined\documentclass{article}
\usepackage{xcolor}
\usepackage{mdframed}
\usepackage{filecontents}
\begin{filecontents*}{MyInput.tex}
This is text I want always included.
\ifdefined\IncludeNotices
\fcolorbox{red}{yellow!40}{%
These are notices that I only want sometimes.%
}%
\fi
\end{filecontents*}
\begin{document}
Using normal input I get just the text\par
\begin{mdframed}
\input{MyInput}
\end{mdframed}
\bigskip
But with \verb|\IncludeNotices| defined:\par
\def\IncludeNotices{}
\begin{mdframed}
\input{MyInput}
\end{mdframed}
\end{document}
\documentclass{article}
\usepackage{xcolor}
\usepackage{mdframed}
\usepackage{environ}
\NewEnviron{MyNotices}{}%
\newcommand{\EnableMyNotices}{\RenewEnviron{MyNotices}{\BODY}}
\newcommand{\DisableMyNotices}{\RenewEnviron{MyNotices}{}}
\usepackage{filecontents}
\begin{filecontents*}{MyInput.tex}
This is text I want always included.
\begin{MyNotices}
\fcolorbox{red}{yellow!40}{%
These are notices that I only want sometimes.%
}%
\end{MyNotices}
\end{filecontents*}
\begin{document}
\DisableMyNotices
With \verb|\DisableMyNotices| defined:\par
\begin{mdframed}
\input{MyInput}
\end{mdframed}
\bigskip
\EnableMyNotices
But with \verb|\EnableMyNotices| defined:\par
\begin{mdframed}
\input{MyInput}
\end{mdframed}
\end{document}
\endinput– Ulrike Fischer May 12 '14 at 08:26