\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текст?

Это файлы .texи test_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}

введите описание изображения здесь

введите описание изображения здесь

введите описание изображения здесь

Связанный контент