\VerbatimInput : .dat ファイルの長い行を調整する

\VerbatimInput : .dat ファイルの長い行を調整する

このドキュメントでは、\VerbatimInputは を呼び出しますtest_2.dat

test_2.dat行が長すぎるため、コンパイルするとその行全体が表示されない PDF が生成されます。

ここに画像の説明を入力してください

を使用するとadjustbox、逐語的なテキストを調整できます。

 \begin{adjustbox}{max width=\linewidth}
 \begin{BVerbatim}

 text

 \end{BVerbatim}
 \end{adjustbox}

ただし、この解決策は、テキストがそのまま直接導入される場合にのみ有効です。

\VerbatimInputこのファイルを呼び出す必要があるため、を使用する必要がありますtesst_2.dat

adjustbox内部に含める方法はありますか\VerbatimInput?

\VerbatimInputまたは、このテキストを縮小する解決策はありますか?

これらはファイル.textest_2.datファイルです:

 \documentclass[12pt]{article}

 \usepackage[left=2.5cm,top=2.5cm,right=2.5cm,bottom=2.5cm]{geometry}
 \usepackage[utf8]{inputenc}
 \usepackage{enumitem}
 \usepackage{fancyvrb}
 \usepackage{color,soul}
 \usepackage[dvipsnames]{xcolor}




 \begin{document}


 \RecustomVerbatimCommand{\VerbatimInput}{VerbatimInput}%
 {fontsize=\footnotesize,
  %
  frame=lines,  % top and bottom rule only
  framesep=2em, % separation between frame and text
  rulecolor=\color{Gray},
  %
  label=\fbox{\color{Black}test.dat},
  labelposition=topline,
  %
  %commandchars=\|\(\), % escape character and argument delimiters for
                  % commands within the verbatim
  %commentchar=*        % comment character
 }

 \VerbatimInput{./test_2.dat}

 \end{document}

ファイルtest_2.dat

 #####l.253:


        AL          BL         LC        AA       BB        CC           E


     2.75319    2.75319    2.75319    60.67009  65.70804  68.04220     

 14.756876   # -> reorientation volumregfddfg l.253:


        AL          BL         LC        AA       BB        CC           E


     2.75319    2.75319    2.75319    60.67009  65.70804  68.04220     

 14.756876   # -> reorientation volumregfddfg l.253:


        AL          BL         LC        AA       BB        CC           E


     2.75319    2.75319    2.75319    60.67009  65.70804  68.04220     

 14.756876   # -> reorientation volumregfddfg l.253:


        AL          BL         LC        AA       BB        CC           E


     2.75319    2.75319    2.75319    60.67009  65.70804  68.04220     

 14.756876   # -> reorientation volumregfddfg l.253:


        AL          BL         LC        AA       BB        CC           E


     2.75319    2.75319    2.75319    60.67009  65.70804  68.04220     

    14.756876   # -> reorientation volumregfddfg 



 #l.253:
        AL          BL         LC        AA       BB        CC           E
     2.75319    2.75319    2.75319    60.67009  65.70804       68.04220          14.756876   # -> reorientation volumregfddfg 



 #l.253:
        AL          BL         LC        AA       BB        CC           E
     2.75319    2.75319    2.75319    60.67009  65.70804  68.04220          14.756876   # -> reorientation volumregfddfg 



 ####l.253:
        AL          BL         LC        AA       BB        CC           E
     2.75319    2.75319    2.75319    60.67009  65.70804  68.04220          14.756876   # -> reorientation volumregfddfg l.253:
        AL          BL         LC        AA       BB        CC           E
     2.75319    2.75319    2.75319    60.67009  65.70804  68.04220          14.756876   # -> reorientation volumregfddfg l.253:
        AL          BL         LC        AA       BB        CC           E
     2.75319    2.75319    2.75319    60.67009  65.70804  68.04220          14.756876   # -> reorientation volumregfddfg l.253:
        AL          BL         LC        AA       BB        CC           E
     2.75319    2.75319    2.75319    60.67009  65.70804  68.04220          14.756876   # -> reorientation volumregfddfg 

 #l.253:
        AL          BL         LC        AA       BB        CC           E
     2.75319    2.75319    2.75319    60.67009  65.70804  68.04220          14.756876   # -> reorientation volumregfddfg 



 #l.253:
        AL          BL         LC        AA       BB        CC           E
     2.75319    2.75319    2.75319    60.67009  65.70804  68.04220          14.756876   # -> reorientation volumregfddfg 


 #####l.253:
        AL          BL         LC        AA       BB        CC           E
     2.75319    2.75319    2.75319    60.67009  65.70804  68.04220          14.756876   # -> reorientation volumregfddfg l.253:
        AL          BL         LC        AA       BB        CC           E
     2.75319    2.75319    2.75319    60.67009  65.70804  68.04220          14.756876   # -> reorientation volumregfddfg l.253:
        AL          BL         LC        AA       BB        CC           E
     2.75319    2.75319    2.75319    60.67009  65.70804  68.04220          14.756876   # -> reorientation volumregfddfg l.253:
        AL          BL         LC        AA       BB        CC           E
     2.75319    2.75319    2.75319    60.67009  65.70804  68.04220          14.756876   # -> reorientation volumregfddfg l.253:
        AL          BL         LC        AA       BB        CC           E
     2.75319    2.75319    2.75319    60.67009  65.70804  68.04220          14.756876   # -> reorientation volumregfddfg 



 ####l.253:
        AL          BL         LC        AA       BB        CC           E
     2.75319    2.75319    2.75319    60.67009  65.70804  68.04220          14.756876   # -> reorientation volumregfddfg l.253:
        AL          BL         LC        AA       BB        CC           E
     2.75319    2.75319    2.75319    60.67009  65.70804  68.04220          14.756876   # -> reorientation volumregfddfg l.253:
        AL          BL         LC        AA       BB        CC           E
     2.75319    2.75319    2.75319    60.67009  65.70804  68.04220          14.756876   # -> reorientation volumregfddfg l.253:
        AL          BL         LC        AA       BB        CC           E
     2.75319    2.75319    2.75319    60.67009  65.70804  68.04220          14.756876   # -> reorientation volumregfddfg 

 ####l.253:
        AL          BL         LC        AA       BB        CC           E
     2.75319    2.75319    2.75319    60.67009  65.70804  68.04220          14.756876   # -> reorientation volumregfddfg l.253:
        AL          BL         LC        AA       BB        CC           E
     2.75319    2.75319    2.75319    60.67009  65.70804  68.04220          14.756876   # -> reorientation volumregfddfg l.253:
        AL          BL         LC        AA       BB        CC           E
     2.75319    2.75319    2.75319    60.67009  65.70804  68.04220          14.756876   # -> reorientation volumregfddfg l.253:
        AL          BL         LC        AA       BB        CC           E
     2.75319    2.75319    2.75319    60.67009  65.70804  68.04220          14.756876   # -> reorientation volumregfddfg 


      #l.253:
        AL          BL         LC        AA       BB        CC           E
     2.75319    2.75319    2.75319    60.67009  65.70804  68.04220          14.756876   # -> reorientation volumregfddfg 

新しい編集: @egreg のコメントに従って:

\BVerbatimInput以下に示すように、内でを使用しています\begin{adjustbox}が、これによりページ区切りのない PDF が生成され、test_2.datファイルの残りのコンテンツは表示されません。

ファイルを通常通り表示させる方法はありますかtest_2.dat? -test_2.datファイルが、必要な数の PDF ページを占めるようにする - ?

ここに画像の説明を入力してください

 \documentclass[12pt]{article}

 \usepackage[left=2.5cm,top=2.5cm,right=2.5cm,bottom=2.5cm]{geometry}
 \usepackage[utf8]{inputenc}
 \usepackage{enumitem}
 \usepackage{adjustbox}
 \usepackage{fancyvrb}
 \usepackage{color,soul}
 \usepackage[dvipsnames]{xcolor}


 \begin{document}

 \begin{adjustbox}{max width=\linewidth}
 \RecustomVerbatimCommand{\BVerbatimInput}{BVerbatimInput}%
 {fontsize=\footnotesize,
 %
 frame=lines,  % top and bottom rule only
 framesep=2em, % separation between frame and text
 rulecolor=\color{Gray},
 %
 label=\fbox{\color{Black}test.dat},
 labelposition=topline,
  %
 %commandchars=\|\(\), % escape character and argument delimiters for
                  % commands within the verbatim
 %commentchar=*        % comment character
 }

 \BVerbatimInput{./test_2.dat}
 \end{adjustbox}

 \end{document}

答え1

「自動」でこれを行う方法はないと思いますが、フォントサイズを簡単に調整できます。

\fontsize{7}{9}\selectfont

いいね。

\documentclass[12pt]{article}

\usepackage[left=2.5cm,top=2.5cm,right=2.5cm,bottom=2.5cm]{geometry}
\usepackage[utf8]{inputenc}
\usepackage{enumitem}
\usepackage{fancyvrb}
\usepackage{color,soul}
\usepackage[dvipsnames]{xcolor}

\RecustomVerbatimCommand{\VerbatimInput}{VerbatimInput}{
  fontsize=\footnotesize % default
  %
  frame=lines,  % top and bottom rule only
  framesep=2em, % separation between frame and text
  rulecolor=\color{Gray},
  %
  label=\fbox{\color{Black}test.dat},
  labelposition=topline,
  %
  %commandchars=\|\(\), % escape character and argument delimiters for
                        % commands within the verbatim
  %commentchar=*        % comment character
 }

\begin{document}

\VerbatimInput[fontsize=\fontsize{7}{9}\selectfont]{\jobname.dat}

\end{document}

ここに画像の説明を入力してください

追加する必要があるかもしれません

\RequirePackage{fix-cm}

\documentclassフォント サイズをより細かく制御したい場合は、文書の一番上、 の前に を入力します。

答え2

を使用したいくつかの可能性を次に示しますverbatimbox

 \documentclass[12pt]{article}

 \usepackage[left=2.5cm,top=2.5cm,right=2.5cm,bottom=2.5cm]{geometry}
 \usepackage[utf8]{inputenc}
 \usepackage{enumitem}
 \usepackage{fancyvrb}
 \usepackage{color,soul}
 \usepackage[dvipsnames]{xcolor}
\usepackage{verbatimbox}



 \begin{document}


 \RecustomVerbatimCommand{\VerbatimInput}{VerbatimInput}%
 {fontsize=\footnotesize,
  %
  frame=lines,  % top and bottom rule only
  framesep=2em, % separation between frame and text
  rulecolor=\color{Gray},
  %
  label=\fbox{\color{Black}test.dat},
  labelposition=topline,
  %
  %commandchars=\|\(\), % escape character and argument delimiters for
                  % commands within the verbatim
  %commentchar=*        % comment character
 }

% \VerbatimInput{./test_2.dat}

%\clearpage
\noindent\hrulefill\raisebox{-2pt}{\fbox{\color{Black}shifted test.dat}}\hrulefill
\verbfilenobox[\leavevmode\kern-35pt\scriptsize]{./test_2.dat}

\clearpage
\noindent\hrulefill\raisebox{-2pt}{\fbox{\color{Black}blank lines retained tiny test.dat}}\hrulefill
\verbfilenobox[\leavevmode\tiny]{./test_2.dat}

\clearpage
\noindent\hrulefill\raisebox{-2pt}{\fbox{\color{Black}tiny test.dat}}\hrulefill
\verbfilenobox[\tiny]{./test_2.dat}

\clearpage
\noindent\hrulefill\raisebox{-2pt}{\fbox{\color{Black}too wide test.dat}}\hrulefill
\verbfilenobox{./test_2.dat}
 \end{document}

ここに画像の説明を入力してください

ここに画像の説明を入力してください

ここに画像の説明を入力してください

関連情報