\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 

NEW 편집: @egreg의 의견에 따라:

\BVerbatimInput아래와 같이 내부에서 을 사용하고 있지만 \begin{adjustbox}이렇게 하면 페이지 나누기가 없고 파일의 나머지 내용이 test_2.dat표시되지 않는 PDF가 생성됩니다.

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}

여기에 이미지 설명을 입력하세요

여기에 이미지 설명을 입력하세요

여기에 이미지 설명을 입력하세요

관련 정보