后@JPi回答如何在我的环境中使用 \scalebox?并评论指出这个问题环境中的 \BODY 中的逐字内容我试过:
- 将内容写入文件
- 以逐字模式打印,
scalebox
并用\input
然而,从这个逻辑来看,似乎不可能按照我试图的方式将逐字逐句的内容包裹起来。也许我错过了问题解释中的一些内容环境中的 \BODY 中的逐字内容?
仔细想想,混合使用verbatim
和listings
包看起来是多余的。所以我们可以verbatim
从中删除用法,只使用,listings
因为它已经可以逐字输出。
现在的问题是,listings
可以放进去吗scalebox
?
\documentclass[10pt,a5paper,twoside]{memoir}
\usepackage[T1]{fontenc}
\usepackage[utf8]{inputenc}
\usepackage[brazil]{babel}
\usepackage[showframe,pass]{geometry}
\usepackage{graphicx}
\makeatletter
% Verbatim in environ’s \BODY
% https://tex.stackexchange.com/questions/51239/verbatim-in-environ-s-body
\RequirePackage{listings}
\lst@RequireAspects{writefile}
\lstnewenvironment{myenvironment}
{
% Write file to given filename
\lst@BeginWriteFile{\jobname.mul}
}
{
% closes output file
\lst@EndWriteFile
\scalebox{.2}
{
% Uncommenting this, throws the errors
% \begin{verbatim}
\input{\jobname.mul}
% \end{verbatim}
}
}
\makeatother
\begin{document}
This is normal text.
\begin{myenvironment}
How to make this environment be {\bfseries verbatim}?
\end{myenvironment}
\scalebox{.2}{This is a scale box example.}
\begin{verbatim}
This is a verbatim example.
\end{verbatim}
\end{document}
但是如果我取消注释周围的逐字环境,就会引发\input{\jobname.mul}
各种错误。
! LaTeX Error: Something's wrong--perhaps a missing \item.
See the LaTeX manual or LaTeX Companion for explanation.
Type H <return> for immediate help.
...
l.213 \end{myenvironment}
Try typing <return> to proceed.
If that doesn't work, type X <return> to quit.
! LaTeX Error: Something's wrong--perhaps a missing \item.
See the LaTeX manual or LaTeX Companion for explanation.
Type H <return> for immediate help.
...
l.213 \end{myenvironment}
Try typing <return> to proceed.
If that doesn't work, type X <return> to quit.
! LaTeX Error: Something's wrong--perhaps a missing \item.
See the LaTeX manual or LaTeX Companion for explanation.
Type H <return> for immediate help.
...
l.213 \end{myenvironment}
Try typing <return> to proceed.
If that doesn't work, type X <return> to quit.
! Missing \endgroup inserted.
<inserted text>
\endgroup
l.213 \end{myenvironment}
I've inserted something that you may have forgotten.
(See the <inserted text> above.)
With luck, this will get me unwedged. But if you
really didn't forget anything, try typing `2' now; then
my insertion and my current dilemma will both disappear.
! Missing \endgroup inserted.
<inserted text>
\endgroup
l.213 \end{myenvironment}
I've inserted something that you may have forgotten.
(See the <inserted text> above.)
With luck, this will get me unwedged. But if you
really didn't forget anything, try typing `2' now; then
my insertion and my current dilemma will both disappear.
! Missing } inserted.
<inserted text>
}
l.213 \end{myenvironment}
I've inserted something that you may have forgotten.
(See the <inserted text> above.)
With luck, this will get me unwedged. But if you
really didn't forget anything, try typing `2' now; then
my insertion and my current dilemma will both disappear.
! Missing } inserted.
<inserted text>
}
l.213 \end{myenvironment}
I've inserted something that you may have forgotten.
(See the <inserted text> above.)
With luck, this will get me unwedged. But if you
really didn't forget anything, try typing `2' now; then
my insertion and my current dilemma will both disappear.
LaTeX Font Info: Try loading font information for T1+cmtt on input line 213.
(D:\User\Documents\latex\texmfs\install\tex\latex\base\t1cmtt.fd
File: t1cmtt.fd 2014/09/29 v2.5h Standard LaTeX font definitions
)
! Argument of \verbatim@ has an extra }.
<inserted text>
\par
l.213 \end{myenvironment}
I've run across a `}' that doesn't seem to match anything.
For example, `\def\a#1{...}' and `\a}' would produce
this error. If you simply proceed now, the `\par' that
I've just inserted will cause me to report a runaway
argument that might be the root of the problem. But if
your `}' was spurious, just type `2' and it will go away.
Runaway argument?
\input {\jobname .mul} \end {verbatim}
! Paragraph ended before \verbatim@ was complete.
<to be read again>
\par
l.213 \end{myenvironment}
I suspect you've forgotten a `}', causing me to apply this
control sequence to too much text. How can we recover?
My plan is to forget the whole thing and hope for the best.
! Extra }, or forgotten \endgroup.
<recently read> }
l.213 \end{myenvironment}
I've deleted a group-closing symbol because it seems to be
spurious, as in `$x}$'. But perhaps the } is legitimate and
you forgot something else, as in `\hbox{$x}'. In such cases
the way to recover is to insert both the forgotten and the
deleted material, e.g., by typing `I$}'.
! Extra }, or forgotten \endgroup.
\Gscale@box ...cale@y {#2}\setbox \z@ \hbox {{#3}}
\setbox \tw@ \hbox {\Gscal...
l.213 \end{myenvironment}
I've deleted a group-closing symbol because it seems to be
spurious, as in `$x}$'. But perhaps the } is legitimate and
you forgot something else, as in `\hbox{$x}'. In such cases
the way to recover is to insert both the forgotten and the
deleted material, e.g., by typing `I$}'.
有关的: