1

Update:

Something went wrong! I thought the solution of Don Hosek worked, but when I tried it again I am getting the error:

Undefined control sequence. l.3 \RenewDocumentEnvironment {minipage}{m} %

Restating the problem and providing a MWE: I need to edit \minipage fragments of dozens of LaTeX documents. To facilitate editing and creation of xvdi for proofreading, I use a minimal LaTeX document, frame.tex, of the article class. But for ease of editing and proofreading, I need in frame.tex to redefine the minipage environment to a NO-OP, as if the pair of \minipage commands were commented out; otherwise, it is necessary to comment out each instance of the \minipage command in the documents I am editing.

File frame.tex

\documentclass[letterpaper]{article}

\RenewDocumentEnvironment{minipage}{m} %
                                    {} %
                                    {} %

\RenewDocumentEnvironment{center}{} %
                                 {} %
                                 {} %

\begin{document}

\input{sample}

\end{document}

File sample.tex

\begin{center}
\begin{minipage}{6in}

Text to be edited.

\end{minipage}\par
\end{center}
3
  • Environments are implemented using macros like \minipage and \endminipage (which are called by \begin and \end}. Of course, \renewenvironment is easier (and local), Nov 2, 2021 at 13:55
  • By "noop", do you mean that the renewed environment should do nothing while it allows the body of the environment to appear as is, or do nothing while it makes the body of the environment disappear into the ether?
    – Teepeemm
    Nov 2, 2021 at 17:56
  • Do nothing; the text I need to edit is in the minipage, but that causes difficulty in editing (small font, difficulty with xdvi). I need a "galley proof" for editing.
    – russ
    Nov 2, 2021 at 18:10

2 Answers 2

3

I'm not entirely clear what you're trying to do, but to redefine an environment you can use¹

\RenewDocumentEnvironment{minipage}{m} % ❶
      {} % ❷
      {} % ❸

The first set of braces ❶ defines the arguments to the environment (and minipage takes a width as a required argument so we put m here). The second ❷ defines what \begin{minipage} should do (you wanted a no-op) and the third ❸ what \end{minipage} should do.


  1. In general you should prefer \NewDocumentEnvironment and \NewDocumentCommand and their relatives to \newenvironment and \newcommand and their relatives.
0
0

Problem is solved by using \renewenvironment{minipage}. The solution is not perfect: it leaves an artifact on the first line of the output. But it is good enough, and serves my need for editing and proofreading.

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .