コンピュータクワガタ

かっぱのかっぱによるコンピュータ関連のサイトです

TeXでverbatimとeclbkboxの組み合わせ。

http://oku.edu.mie-u.ac.jp/~okumura/texfaq/qa/24810.html
上記より引用。以下の記述を組み込めばうまくいきました。

\makeatletter
\def\breakbox{%
   \vskip\breakboxskip\relax
   \setbox\bk@bxb\vbox\bgroup
      \advance\linewidth -2\fboxrule
      \advance\linewidth -2\fboxsep
      \hsize\linewidth\@parboxrestore
      \@setminipage%%% added
      \parindent\breakboxparindent\relax}
\def\endbreakbox{%
      \ifvmode \vskip-\lastskip \fi%%% added
      \egroup
   \ifhmode\par\fi
  {\noindent\bk@lcnt\@ne
   \@bkconttrue\baselineskip\z@\lineskiplimit\z@
   \lineskip\z@\vfuzz\maxdimen
   \bk@split\bk@addfsepht\bk@addskipdp
   \ifvoid\bk@bxb      % Only one line
      \def\bk@fstln{%
         \bk@addfsepdp
         \vbox{\hrule\@height\fboxrule\bk@line\hrule\@height\fboxrule}}%
   \else               % More than one line
      \def\bk@fstln{\vbox{\hrule\@height\fboxrule\bk@line}\hfil
         \advance\bk@lcnt\@ne
         \loop
            \bk@split\bk@addskipdp\leavevmode
            \ifvoid\bk@bxb      % The last line
               \@bkcontfalse\bk@addfsepdp
               \vtop{\bk@line\hrule\@height\fboxrule}%
            \else               % 2,...,(n-1)
               \bk@line
            \fi
            \hfil\advance\bk@lcnt\@ne
         \if@bkcont\repeat}%
   \fi
   \leavevmode\bk@fstln
   \par}%
   \vskip\breakboxskip\relax}

\def\verbatim@readfile#1{%
   \verbatim@startline
   \openin\verbatim@in@stream #1\relax
   \ifeof\verbatim@in@stream
      \typeout{No file #1.}%
   \else
      \let\@verbatim@prevline\relax%%% added
      \@addtofilelist{#1}%
      \ProvidesFile{#1}[(verbatim)]%
      \expandafter\endlinechar\expandafter\m@ne
      \expandafter\verbatim@read@file
      \expandafter\endlinechar\the\endlinechar\relax
      \closein\verbatim@in@stream
   \fi
   \verbatim@finish}
\def\verbatim@read@file{%
   \read\verbatim@in@stream to\next
   \ifeof\verbatim@in@stream\else
      \ifx\@verbatim@prevline\relax\else
         \expandafter\verbatim@addtoline\expandafter{\@verbatim@prevline}%
         \verbatim@processline
         \verbatim@startline
      \fi
      \let\@verbatim@prevline\next
      \expandafter\verbatim@read@file
   \fi}
\makeatother
広告