2

\VerbatimInput calls a test.dat file, and produces the following output, where the long lines are not entirely seen:

enter image description here

A solution for this is use \BVerbatimInput together with \begin{adjustbox}. This solves the long lines. However, the information of test.dat shown is cut at the end of the first page:

enter image description here

Is there a way to make the rest of the content of test.dat to be shown in the following pages ?

The code that produces these two examples:

  \documentclass[12pt]{article}

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


  \begin{document}

  \section{VerbatimInput}

  \RecustomVerbatimCommand{\VerbatimInput}{VerbatimInput}%
  {fontsize=\footnotesize,
  %
  frame=lines,
  framesep=2em,
  rulecolor=\color{Gray},
  %
  label=\fbox{\color{Black}test.dat},
  labelposition=topline,
  }

  \VerbatimInput{./test.dat}


  \clearpage

  \section{BVerbatimInput and adjustbox}

  \begin{adjustbox}{max width=\linewidth}
  \RecustomVerbatimCommand{\BVerbatimInput}{BVerbatimInput}%
  {fontsize=\footnotesize,
  %
  frame=lines,
  framesep=2em,
  rulecolor=\color{Gray},
  %
  label=\fbox{\color{Black}test.dat},
  labelposition=topline,
  }

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

  \end{document}

The test.dat file:

 #####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 
1
  • With the verbatimbox package, you could use \verbfilenobox[\footnotesize]{test.dat}. This will not line break, but will shrink the size of the verbatim font and will page break. Dec 29, 2017 at 14:35

1 Answer 1

2

Well adjustbox is for boxes not multiples pages. The resulting box can't be broken across pages. However, I (the author of adjustbox) worked on some keys to break contained paragraphs into multiple boxes which then can be placed on multiple pages. Get a current version of the package (Version v1.0 – 2012/05/21) and check out the split and pagebreak keys in the manual (section 4.15 Experimental Keys). Please note that the page breaking is done by splitting the scaled box and not by doing normal page breaks between lines. This means the last line can be vertically cut into two parts!

I would actually recommend to not use adjustbox altogether but to set the font size accordantly.

1
  • Thanks for your comment. I have been studying section 4.15. If you look in the "code that produces these two examples" (in the post), inside the section entitled \section{BVerbatimInput and adjustbox}, I am not quite sure how split and pagebreak keys could be introduced inside the \BVerbatimInput{./test.dat} declaration. If you could provide a MWE using the ./test.dat I would appreciate it enormously. Again, thank you for all your effort.
    – DavidC.
    Dec 29, 2017 at 15:25

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.