Left frame tcolotbox disappears when broken up by new page











up vote
3
down vote

favorite












In the code given below, if there is a page break for the tcolorbox, the left grey line that I wanted, disappears. If however, the tcolorbox is not broken, the left line is present.



enter image description here



Can you help me get the left grey line to also appear when the tcolorbox is broken? Thanks!



CODE



documentclass[a4paper, 10pt, oneside, fleqn, openright]{book}
usepackage[no-math]{fontspec}

usepackage{polyglossia}
setdefaultlanguage{french}
setotherlanguages{english}

newcommand{codeimg}{$vcenter{hbox{includegraphics[height=baselineskip]{example-image-a}}}$}
newcommand{codeimgpy}{$vcenter{hbox{includegraphics[height=baselineskip]{example-image-b}}}$}
newcommand{codeimgcpp}{$vcenter{hbox{includegraphics[height=baselineskip]{example-image-c}}}$}

usepackage{calc}
usepackage[usenames,dvipsnames,svgnames,table]{xcolor}
usepackage{pdfpages,graphicx}
usepackage{mdframed}
usepackage{listings}
usepackage{filecontents}
definecolor{mybluei}{RGB}{0,173,239}
definecolor{myblueii}{RGB}{63,200,244}
definecolor{myblueiii}{RGB}{199,234,253}
definecolor{light-gray}{gray}{0.92}

definecolor{mainColor}{RGB}{211, 47, 47} % some dark red

renewcommandlstlistingname{Code}
lstset{
language=Python,
numbers=left,
numbersep= 7mm,
numberstyle=color{Black},
stepnumber=1,
tabsize=3,
breakatwhitespace=false,
breaklines=true,
captionpos=b,
basicstyle=color{Black}ttfamily,
commentstyle=color{LimeGreen},
keywordstyle=color{BurntOrange}bfseries,
stringstyle=color{WildStrawberry},
keywords={var, func, extends},
frame=leftline,
framesep=0mm,
xleftmargin=3mm,
framesep=2mm,
framerule=0mm,
abovecaptionskip=5mm,
aboveskip=baselineskip,
belowskip=baselineskip
}

usepackage{tcolorbox}
newcounter{data}
newcounter{result}
newcounter{pythoncode}
newcounter{cppcode}
newcounter{matlab}
tcbuselibrary{skins,breakable,listings}

newtcbinputlisting[use counter=matlab,list inside=matlab,number within=chapter]{inputmatlab}[3]{listing options={style=Matlab-editor},%
enhanced,noparskip,breakable,colback=light-gray,colframe=DarkSlateGray,opacitybacktitle=.8,%
fonttitle=bfseries,before upper={hspace*{-1em}codeimg~#2},%
title after break={centeringfootnotesizeitshapestrut Matlab Code~thematlab~--~continued},%
listing only,listing options={xleftmargin=-1mm,#1,style=Matlab-editor},
after upper={centeringstrut {bfseries Matlab Code~thematlab:}~#2},
frame hidden,arc=0pt,outer arc=0pt,boxrule=0pt,frame code={draw[gray,line width=2mm] ([xshift=-0.5pt]frame.north west) -- ([xshift=-0.5pt]frame.south west);},
%
listing file={#3},#1}

newtcbinputlisting[use counter=cppcode,list inside=cppcode,number within=chapter]{inputcppcode}[3]{listing options={language=C++},%
enhanced,noparskip,breakable,colback=light-gray,colframe=DarkSlateGray,opacitybacktitle=.8,%
fonttitle=bfseries,before upper={hspace*{-1em}codeimgcpp~#2},%
title after break={centeringfootnotesizeitshapestrut C++ Code~thecppcode~--~continued},%
listing only,listing options={xleftmargin=-1mm,#1,language=C++},
after upper={centeringstrut {bfseries C++ Code~thecppcode:}~#2},
frame hidden,arc=0pt,outer arc=0pt,boxrule=0pt,frame code={draw[gray,line width=2mm] ([xshift=-0.5pt]frame.north west) -- ([xshift=-0.5pt]frame.south west);},
%
listing file={#3},#1}

usepackage[numbered,framed]{matlab-prettifier}

begin{filecontents*}{sample.m}
% create a file for output
!touch testFile.txt
fid = fopen('testFile.text', 'w')
for i=1:10
fprintf(fid,'%6.2f n', i);
end
end{filecontents*}

begin{filecontents*}{cppcodex.cpp}
#include <iostream>
using namespace std;

int main()
{
int firstNumber, secondNumber, sumOfTwoNumbers;

cout << "Enter two integers: ";
cin >> firstNumber >> secondNumber;

// sum of two numbers in stored in variable sumOfTwoNumbers
sumOfTwoNumbers = firstNumber + secondNumber;

// Prints sum
cout << firstNumber << " + " << secondNumber << " = " << sumOfTwoNumbers;

return 0;
}
end{filecontents*}

begin{document}

inputmatlab{Expansion Algorithm}{sample.m}

vspace*{7cm}

inputcppcode{Example C++ Code}{cppcodex.cpp}

end{document}









share|improve this question


























    up vote
    3
    down vote

    favorite












    In the code given below, if there is a page break for the tcolorbox, the left grey line that I wanted, disappears. If however, the tcolorbox is not broken, the left line is present.



    enter image description here



    Can you help me get the left grey line to also appear when the tcolorbox is broken? Thanks!



    CODE



    documentclass[a4paper, 10pt, oneside, fleqn, openright]{book}
    usepackage[no-math]{fontspec}

    usepackage{polyglossia}
    setdefaultlanguage{french}
    setotherlanguages{english}

    newcommand{codeimg}{$vcenter{hbox{includegraphics[height=baselineskip]{example-image-a}}}$}
    newcommand{codeimgpy}{$vcenter{hbox{includegraphics[height=baselineskip]{example-image-b}}}$}
    newcommand{codeimgcpp}{$vcenter{hbox{includegraphics[height=baselineskip]{example-image-c}}}$}

    usepackage{calc}
    usepackage[usenames,dvipsnames,svgnames,table]{xcolor}
    usepackage{pdfpages,graphicx}
    usepackage{mdframed}
    usepackage{listings}
    usepackage{filecontents}
    definecolor{mybluei}{RGB}{0,173,239}
    definecolor{myblueii}{RGB}{63,200,244}
    definecolor{myblueiii}{RGB}{199,234,253}
    definecolor{light-gray}{gray}{0.92}

    definecolor{mainColor}{RGB}{211, 47, 47} % some dark red

    renewcommandlstlistingname{Code}
    lstset{
    language=Python,
    numbers=left,
    numbersep= 7mm,
    numberstyle=color{Black},
    stepnumber=1,
    tabsize=3,
    breakatwhitespace=false,
    breaklines=true,
    captionpos=b,
    basicstyle=color{Black}ttfamily,
    commentstyle=color{LimeGreen},
    keywordstyle=color{BurntOrange}bfseries,
    stringstyle=color{WildStrawberry},
    keywords={var, func, extends},
    frame=leftline,
    framesep=0mm,
    xleftmargin=3mm,
    framesep=2mm,
    framerule=0mm,
    abovecaptionskip=5mm,
    aboveskip=baselineskip,
    belowskip=baselineskip
    }

    usepackage{tcolorbox}
    newcounter{data}
    newcounter{result}
    newcounter{pythoncode}
    newcounter{cppcode}
    newcounter{matlab}
    tcbuselibrary{skins,breakable,listings}

    newtcbinputlisting[use counter=matlab,list inside=matlab,number within=chapter]{inputmatlab}[3]{listing options={style=Matlab-editor},%
    enhanced,noparskip,breakable,colback=light-gray,colframe=DarkSlateGray,opacitybacktitle=.8,%
    fonttitle=bfseries,before upper={hspace*{-1em}codeimg~#2},%
    title after break={centeringfootnotesizeitshapestrut Matlab Code~thematlab~--~continued},%
    listing only,listing options={xleftmargin=-1mm,#1,style=Matlab-editor},
    after upper={centeringstrut {bfseries Matlab Code~thematlab:}~#2},
    frame hidden,arc=0pt,outer arc=0pt,boxrule=0pt,frame code={draw[gray,line width=2mm] ([xshift=-0.5pt]frame.north west) -- ([xshift=-0.5pt]frame.south west);},
    %
    listing file={#3},#1}

    newtcbinputlisting[use counter=cppcode,list inside=cppcode,number within=chapter]{inputcppcode}[3]{listing options={language=C++},%
    enhanced,noparskip,breakable,colback=light-gray,colframe=DarkSlateGray,opacitybacktitle=.8,%
    fonttitle=bfseries,before upper={hspace*{-1em}codeimgcpp~#2},%
    title after break={centeringfootnotesizeitshapestrut C++ Code~thecppcode~--~continued},%
    listing only,listing options={xleftmargin=-1mm,#1,language=C++},
    after upper={centeringstrut {bfseries C++ Code~thecppcode:}~#2},
    frame hidden,arc=0pt,outer arc=0pt,boxrule=0pt,frame code={draw[gray,line width=2mm] ([xshift=-0.5pt]frame.north west) -- ([xshift=-0.5pt]frame.south west);},
    %
    listing file={#3},#1}

    usepackage[numbered,framed]{matlab-prettifier}

    begin{filecontents*}{sample.m}
    % create a file for output
    !touch testFile.txt
    fid = fopen('testFile.text', 'w')
    for i=1:10
    fprintf(fid,'%6.2f n', i);
    end
    end{filecontents*}

    begin{filecontents*}{cppcodex.cpp}
    #include <iostream>
    using namespace std;

    int main()
    {
    int firstNumber, secondNumber, sumOfTwoNumbers;

    cout << "Enter two integers: ";
    cin >> firstNumber >> secondNumber;

    // sum of two numbers in stored in variable sumOfTwoNumbers
    sumOfTwoNumbers = firstNumber + secondNumber;

    // Prints sum
    cout << firstNumber << " + " << secondNumber << " = " << sumOfTwoNumbers;

    return 0;
    }
    end{filecontents*}

    begin{document}

    inputmatlab{Expansion Algorithm}{sample.m}

    vspace*{7cm}

    inputcppcode{Example C++ Code}{cppcodex.cpp}

    end{document}









    share|improve this question
























      up vote
      3
      down vote

      favorite









      up vote
      3
      down vote

      favorite











      In the code given below, if there is a page break for the tcolorbox, the left grey line that I wanted, disappears. If however, the tcolorbox is not broken, the left line is present.



      enter image description here



      Can you help me get the left grey line to also appear when the tcolorbox is broken? Thanks!



      CODE



      documentclass[a4paper, 10pt, oneside, fleqn, openright]{book}
      usepackage[no-math]{fontspec}

      usepackage{polyglossia}
      setdefaultlanguage{french}
      setotherlanguages{english}

      newcommand{codeimg}{$vcenter{hbox{includegraphics[height=baselineskip]{example-image-a}}}$}
      newcommand{codeimgpy}{$vcenter{hbox{includegraphics[height=baselineskip]{example-image-b}}}$}
      newcommand{codeimgcpp}{$vcenter{hbox{includegraphics[height=baselineskip]{example-image-c}}}$}

      usepackage{calc}
      usepackage[usenames,dvipsnames,svgnames,table]{xcolor}
      usepackage{pdfpages,graphicx}
      usepackage{mdframed}
      usepackage{listings}
      usepackage{filecontents}
      definecolor{mybluei}{RGB}{0,173,239}
      definecolor{myblueii}{RGB}{63,200,244}
      definecolor{myblueiii}{RGB}{199,234,253}
      definecolor{light-gray}{gray}{0.92}

      definecolor{mainColor}{RGB}{211, 47, 47} % some dark red

      renewcommandlstlistingname{Code}
      lstset{
      language=Python,
      numbers=left,
      numbersep= 7mm,
      numberstyle=color{Black},
      stepnumber=1,
      tabsize=3,
      breakatwhitespace=false,
      breaklines=true,
      captionpos=b,
      basicstyle=color{Black}ttfamily,
      commentstyle=color{LimeGreen},
      keywordstyle=color{BurntOrange}bfseries,
      stringstyle=color{WildStrawberry},
      keywords={var, func, extends},
      frame=leftline,
      framesep=0mm,
      xleftmargin=3mm,
      framesep=2mm,
      framerule=0mm,
      abovecaptionskip=5mm,
      aboveskip=baselineskip,
      belowskip=baselineskip
      }

      usepackage{tcolorbox}
      newcounter{data}
      newcounter{result}
      newcounter{pythoncode}
      newcounter{cppcode}
      newcounter{matlab}
      tcbuselibrary{skins,breakable,listings}

      newtcbinputlisting[use counter=matlab,list inside=matlab,number within=chapter]{inputmatlab}[3]{listing options={style=Matlab-editor},%
      enhanced,noparskip,breakable,colback=light-gray,colframe=DarkSlateGray,opacitybacktitle=.8,%
      fonttitle=bfseries,before upper={hspace*{-1em}codeimg~#2},%
      title after break={centeringfootnotesizeitshapestrut Matlab Code~thematlab~--~continued},%
      listing only,listing options={xleftmargin=-1mm,#1,style=Matlab-editor},
      after upper={centeringstrut {bfseries Matlab Code~thematlab:}~#2},
      frame hidden,arc=0pt,outer arc=0pt,boxrule=0pt,frame code={draw[gray,line width=2mm] ([xshift=-0.5pt]frame.north west) -- ([xshift=-0.5pt]frame.south west);},
      %
      listing file={#3},#1}

      newtcbinputlisting[use counter=cppcode,list inside=cppcode,number within=chapter]{inputcppcode}[3]{listing options={language=C++},%
      enhanced,noparskip,breakable,colback=light-gray,colframe=DarkSlateGray,opacitybacktitle=.8,%
      fonttitle=bfseries,before upper={hspace*{-1em}codeimgcpp~#2},%
      title after break={centeringfootnotesizeitshapestrut C++ Code~thecppcode~--~continued},%
      listing only,listing options={xleftmargin=-1mm,#1,language=C++},
      after upper={centeringstrut {bfseries C++ Code~thecppcode:}~#2},
      frame hidden,arc=0pt,outer arc=0pt,boxrule=0pt,frame code={draw[gray,line width=2mm] ([xshift=-0.5pt]frame.north west) -- ([xshift=-0.5pt]frame.south west);},
      %
      listing file={#3},#1}

      usepackage[numbered,framed]{matlab-prettifier}

      begin{filecontents*}{sample.m}
      % create a file for output
      !touch testFile.txt
      fid = fopen('testFile.text', 'w')
      for i=1:10
      fprintf(fid,'%6.2f n', i);
      end
      end{filecontents*}

      begin{filecontents*}{cppcodex.cpp}
      #include <iostream>
      using namespace std;

      int main()
      {
      int firstNumber, secondNumber, sumOfTwoNumbers;

      cout << "Enter two integers: ";
      cin >> firstNumber >> secondNumber;

      // sum of two numbers in stored in variable sumOfTwoNumbers
      sumOfTwoNumbers = firstNumber + secondNumber;

      // Prints sum
      cout << firstNumber << " + " << secondNumber << " = " << sumOfTwoNumbers;

      return 0;
      }
      end{filecontents*}

      begin{document}

      inputmatlab{Expansion Algorithm}{sample.m}

      vspace*{7cm}

      inputcppcode{Example C++ Code}{cppcodex.cpp}

      end{document}









      share|improve this question













      In the code given below, if there is a page break for the tcolorbox, the left grey line that I wanted, disappears. If however, the tcolorbox is not broken, the left line is present.



      enter image description here



      Can you help me get the left grey line to also appear when the tcolorbox is broken? Thanks!



      CODE



      documentclass[a4paper, 10pt, oneside, fleqn, openright]{book}
      usepackage[no-math]{fontspec}

      usepackage{polyglossia}
      setdefaultlanguage{french}
      setotherlanguages{english}

      newcommand{codeimg}{$vcenter{hbox{includegraphics[height=baselineskip]{example-image-a}}}$}
      newcommand{codeimgpy}{$vcenter{hbox{includegraphics[height=baselineskip]{example-image-b}}}$}
      newcommand{codeimgcpp}{$vcenter{hbox{includegraphics[height=baselineskip]{example-image-c}}}$}

      usepackage{calc}
      usepackage[usenames,dvipsnames,svgnames,table]{xcolor}
      usepackage{pdfpages,graphicx}
      usepackage{mdframed}
      usepackage{listings}
      usepackage{filecontents}
      definecolor{mybluei}{RGB}{0,173,239}
      definecolor{myblueii}{RGB}{63,200,244}
      definecolor{myblueiii}{RGB}{199,234,253}
      definecolor{light-gray}{gray}{0.92}

      definecolor{mainColor}{RGB}{211, 47, 47} % some dark red

      renewcommandlstlistingname{Code}
      lstset{
      language=Python,
      numbers=left,
      numbersep= 7mm,
      numberstyle=color{Black},
      stepnumber=1,
      tabsize=3,
      breakatwhitespace=false,
      breaklines=true,
      captionpos=b,
      basicstyle=color{Black}ttfamily,
      commentstyle=color{LimeGreen},
      keywordstyle=color{BurntOrange}bfseries,
      stringstyle=color{WildStrawberry},
      keywords={var, func, extends},
      frame=leftline,
      framesep=0mm,
      xleftmargin=3mm,
      framesep=2mm,
      framerule=0mm,
      abovecaptionskip=5mm,
      aboveskip=baselineskip,
      belowskip=baselineskip
      }

      usepackage{tcolorbox}
      newcounter{data}
      newcounter{result}
      newcounter{pythoncode}
      newcounter{cppcode}
      newcounter{matlab}
      tcbuselibrary{skins,breakable,listings}

      newtcbinputlisting[use counter=matlab,list inside=matlab,number within=chapter]{inputmatlab}[3]{listing options={style=Matlab-editor},%
      enhanced,noparskip,breakable,colback=light-gray,colframe=DarkSlateGray,opacitybacktitle=.8,%
      fonttitle=bfseries,before upper={hspace*{-1em}codeimg~#2},%
      title after break={centeringfootnotesizeitshapestrut Matlab Code~thematlab~--~continued},%
      listing only,listing options={xleftmargin=-1mm,#1,style=Matlab-editor},
      after upper={centeringstrut {bfseries Matlab Code~thematlab:}~#2},
      frame hidden,arc=0pt,outer arc=0pt,boxrule=0pt,frame code={draw[gray,line width=2mm] ([xshift=-0.5pt]frame.north west) -- ([xshift=-0.5pt]frame.south west);},
      %
      listing file={#3},#1}

      newtcbinputlisting[use counter=cppcode,list inside=cppcode,number within=chapter]{inputcppcode}[3]{listing options={language=C++},%
      enhanced,noparskip,breakable,colback=light-gray,colframe=DarkSlateGray,opacitybacktitle=.8,%
      fonttitle=bfseries,before upper={hspace*{-1em}codeimgcpp~#2},%
      title after break={centeringfootnotesizeitshapestrut C++ Code~thecppcode~--~continued},%
      listing only,listing options={xleftmargin=-1mm,#1,language=C++},
      after upper={centeringstrut {bfseries C++ Code~thecppcode:}~#2},
      frame hidden,arc=0pt,outer arc=0pt,boxrule=0pt,frame code={draw[gray,line width=2mm] ([xshift=-0.5pt]frame.north west) -- ([xshift=-0.5pt]frame.south west);},
      %
      listing file={#3},#1}

      usepackage[numbered,framed]{matlab-prettifier}

      begin{filecontents*}{sample.m}
      % create a file for output
      !touch testFile.txt
      fid = fopen('testFile.text', 'w')
      for i=1:10
      fprintf(fid,'%6.2f n', i);
      end
      end{filecontents*}

      begin{filecontents*}{cppcodex.cpp}
      #include <iostream>
      using namespace std;

      int main()
      {
      int firstNumber, secondNumber, sumOfTwoNumbers;

      cout << "Enter two integers: ";
      cin >> firstNumber >> secondNumber;

      // sum of two numbers in stored in variable sumOfTwoNumbers
      sumOfTwoNumbers = firstNumber + secondNumber;

      // Prints sum
      cout << firstNumber << " + " << secondNumber << " = " << sumOfTwoNumbers;

      return 0;
      }
      end{filecontents*}

      begin{document}

      inputmatlab{Expansion Algorithm}{sample.m}

      vspace*{7cm}

      inputcppcode{Example C++ Code}{cppcodex.cpp}

      end{document}






      tcolorbox tcbinputlisting






      share|improve this question













      share|improve this question











      share|improve this question




      share|improve this question










      asked yesterday









      Joe

      3,48731948




      3,48731948






















          2 Answers
          2






          active

          oldest

          votes

















          up vote
          2
          down vote













          I don't know why your tex code doesn't work as expected.



          I suggest a workaround using exras={frame code={draw[gray,line width=2mm] ([xshift=-0.5pt]frame.north west) -- ([xshift=-0.5pt]frame.south west);}} within tcolorbox options:



          documentclass[a4paper, 10pt, oneside, fleqn, openright]{book}
          usepackage[no-math]{fontspec}
          usepackage{lipsum}
          usepackage{polyglossia}
          setdefaultlanguage{french}
          setotherlanguages{english}

          newcommand{codeimg}{$vcenter{hbox{includegraphics[height=baselineskip]{example-image-a}}}$}
          newcommand{codeimgpy}{$vcenter{hbox{includegraphics[height=baselineskip]{example-image-b}}}$}
          newcommand{codeimgcpp}{$vcenter{hbox{includegraphics[height=baselineskip]{example-image-c}}}$}

          usepackage{calc}
          usepackage[usenames,dvipsnames,svgnames,table]{xcolor}
          usepackage{pdfpages,graphicx}
          usepackage{mdframed}
          usepackage{listings}
          usepackage{filecontents}
          definecolor{mybluei}{RGB}{0,173,239}
          definecolor{myblueii}{RGB}{63,200,244}
          definecolor{myblueiii}{RGB}{199,234,253}
          definecolor{light-gray}{gray}{0.92}

          definecolor{mainColor}{RGB}{211, 47, 47} % some dark red

          renewcommandlstlistingname{Code}
          lstset{
          language=Python,
          numbers=left,
          numbersep= 7mm,
          numberstyle=color{Black},
          stepnumber=1,
          tabsize=3,
          breakatwhitespace=false,
          breaklines=true,
          captionpos=b,
          basicstyle=color{Black}ttfamily,
          commentstyle=color{LimeGreen},
          keywordstyle=color{BurntOrange}bfseries,
          stringstyle=color{WildStrawberry},
          keywords={var, func, extends},
          frame=leftline,
          framesep=0mm,
          xleftmargin=3mm,
          framesep=2mm,
          framerule=0mm,
          abovecaptionskip=5mm,
          aboveskip=baselineskip,
          belowskip=baselineskip
          }

          usepackage{tcolorbox}
          newcounter{data}
          newcounter{result}
          newcounter{pythoncode}
          newcounter{cppcode}
          newcounter{matlab}
          tcbuselibrary{skins,breakable,listings}

          newtcbinputlisting[use counter=matlab,list inside=matlab,number within=chapter]{inputmatlab}[3]{listing options={style=Matlab-editor},%
          enhanced,noparskip,breakable,colback=light-gray,colframe=DarkSlateGray,opacitybacktitle=.8,%
          fonttitle=bfseries,before upper={hspace*{-1em}codeimg~#2},%
          title after break={centeringfootnotesizeitshapestrut Matlab Code~thematlab~--~continued},%
          listing only,listing options={xleftmargin=-1mm,#1,style=Matlab-editor},
          after upper={centeringstrut {bfseries Matlab Code~thematlab:}~#2},
          frame hidden,arc=0pt,outer arc=0pt,boxrule=0pt,
          extras={frame code={draw[gray,line width=2mm] ([xshift=-0.5pt]frame.north west) -- ([xshift=-0.5pt]frame.south west);}},
          %
          listing file={#3},#1}

          newtcbinputlisting[use counter=cppcode,list inside=cppcode,number within=chapter]{inputcppcode}[3]{listing options={language=C++},%
          enhanced,noparskip,breakable,colback=light-gray,colframe=DarkSlateGray,opacitybacktitle=.8,%
          fonttitle=bfseries,before upper={hspace*{-1em}codeimgcpp~#2},%
          title after break={centeringfootnotesizeitshapestrut C++ Code~thecppcode~--~continued},%
          listing only,listing options={xleftmargin=-1mm,#1,language=C++},
          after upper={centeringstrut {bfseries C++ Code~thecppcode:}~#2},
          frame hidden,arc=0pt,outer arc=0pt,boxrule=0pt,
          extras={frame code={draw[gray,line width=2mm] ([xshift=-0.5pt]frame.north west) -- ([xshift=-0.5pt]frame.south west);}},
          %
          listing file={#3},#1}

          usepackage[numbered,framed]{matlab-prettifier}

          begin{filecontents*}{sample.m}
          % create a file for output
          !touch testFile.txt
          fid = fopen('testFile.text', 'w')
          for i=1:10
          fprintf(fid,'%6.2f n', i);
          end

          end{filecontents*}

          begin{filecontents*}{cppcodex.cpp}
          #include <iostream>
          using namespace std;

          int main()
          {
          int firstNumber, secondNumber, sumOfTwoNumbers;

          cout << "Enter two integers: ";
          cin >> firstNumber >> secondNumber;

          // sum of two numbers in stored in variable sumOfTwoNumbers
          sumOfTwoNumbers = firstNumber + secondNumber;

          // Prints sum
          cout << firstNumber << " + " << secondNumber << " = " << sumOfTwoNumbers;

          return 0;
          }
          end{filecontents*}

          begin{document}

          inputmatlab{Expansion Algorithm}{sample.m}

          vspace*{7cm}

          inputcppcode{Example C++ Code}{cppcodex.cpp}

          end{document}


          enter image description here






          share|improve this answer






























            up vote
            2
            down vote













            Another workaround. Instead of frame hidden and boxrule=0pt, don't hide the frame and define a certain leftrule=... which survives in broken boxes.



            documentclass[a4paper, 10pt, oneside, fleqn, openright]{book}
            usepackage[no-math]{fontspec}

            usepackage{polyglossia}
            setdefaultlanguage{french}
            setotherlanguages{english}

            newcommand{codeimg}{$vcenter{hbox{includegraphics[height=baselineskip]{example-image-a}}}$}
            newcommand{codeimgpy}{$vcenter{hbox{includegraphics[height=baselineskip]{example-image-b}}}$}
            newcommand{codeimgcpp}{$vcenter{hbox{includegraphics[height=baselineskip]{example-image-c}}}$}

            usepackage{calc}
            usepackage[usenames,dvipsnames,svgnames,table]{xcolor}
            usepackage{pdfpages,graphicx}
            usepackage{mdframed}
            usepackage{listings}
            usepackage{filecontents}
            definecolor{mybluei}{RGB}{0,173,239}
            definecolor{myblueii}{RGB}{63,200,244}
            definecolor{myblueiii}{RGB}{199,234,253}
            definecolor{light-gray}{gray}{0.92}

            definecolor{mainColor}{RGB}{211, 47, 47} % some dark red

            renewcommandlstlistingname{Code}
            lstset{
            language=Python,
            numbers=left,
            numbersep= 7mm,
            numberstyle=color{Black},
            stepnumber=1,
            tabsize=3,
            breakatwhitespace=false,
            breaklines=true,
            captionpos=b,
            basicstyle=color{Black}ttfamily,
            commentstyle=color{LimeGreen},
            keywordstyle=color{BurntOrange}bfseries,
            stringstyle=color{WildStrawberry},
            keywords={var, func, extends},
            frame=leftline,
            framesep=0mm,
            xleftmargin=3mm,
            framesep=2mm,
            framerule=0mm,
            abovecaptionskip=5mm,
            aboveskip=baselineskip,
            belowskip=baselineskip
            }

            usepackage{tcolorbox}
            newcounter{data}
            newcounter{result}
            newcounter{pythoncode}
            newcounter{cppcode}
            newcounter{matlab}
            tcbuselibrary{skins,breakable,listings}

            newtcbinputlisting[use counter=matlab,list inside=matlab,number within=chapter]{inputmatlab}[3]{listing options={style=Matlab-editor},%
            enhanced,noparskip,breakable,colback=light-gray,colframe=DarkSlateGray,opacitybacktitle=.8,%
            fonttitle=bfseries,before upper={hspace*{-1em}codeimg~#2},%
            title after break={centeringfootnotesizeitshapestrut Matlab Code~thematlab~--~continued},%
            listing only,listing options={xleftmargin=-1mm,#1,style=Matlab-editor},
            after upper={centeringstrut {bfseries Matlab Code~thematlab:}~#2},
            %frame hidden, %<---------------------------------------
            arc=0pt,
            outer arc=0pt,
            boxrule=0pt,
            leftrule=1mm, %<----------------------------
            % frame code={draw[gray,line width=2mm] ([xshift=-0.5pt]frame.north west) -- ([xshift=-0.5pt]frame.south west);},
            %
            listing file={#3},#1}

            newtcbinputlisting[use counter=cppcode,list inside=cppcode,number within=chapter]{inputcppcode}[3]{listing options={language=C++},%
            enhanced,noparskip,breakable,colback=light-gray,colframe=DarkSlateGray,opacitybacktitle=.8,%
            fonttitle=bfseries,before upper={hspace*{-1em}codeimgcpp~#2},%
            title after break={centeringfootnotesizeitshapestrut C++ Code~thecppcode~--~continued},%
            listing only,listing options={xleftmargin=-1mm,#1,language=C++},
            after upper={centeringstrut {bfseries C++ Code~thecppcode:}~#2},
            % frame hidden, %<------------------------------
            arc=0pt,
            outer arc=0pt,
            boxrule=0pt,
            leftrule=1mm, %<---------------------------------
            %frame code={draw[gray,line width=2mm] ([xshift=-0.5pt]frame.north west) -- ([xshift=-0.5pt]frame.south west);},
            %
            listing file={#3},#1}

            usepackage[numbered,framed]{matlab-prettifier}

            begin{filecontents*}{sample.m}
            % create a file for output
            !touch testFile.txt
            fid = fopen('testFile.text', 'w')
            for i=1:10
            fprintf(fid,'%6.2f n', i);
            end
            end{filecontents*}

            begin{filecontents*}{cppcodex.cpp}
            #include <iostream>
            using namespace std;

            int main()
            {
            int firstNumber, secondNumber, sumOfTwoNumbers;

            cout << "Enter two integers: ";
            cin >> firstNumber >> secondNumber;

            // sum of two numbers in stored in variable sumOfTwoNumbers
            sumOfTwoNumbers = firstNumber + secondNumber;

            // Prints sum
            cout << firstNumber << " + " << secondNumber << " = " << sumOfTwoNumbers;

            return 0;
            }
            end{filecontents*}

            begin{document}

            inputmatlab{Expansion Algorithm}{sample.m}

            vspace*{7cm}

            inputcppcode{Example C++ Code}{cppcodex.cpp}

            end{document}


            enter image description here






            share|improve this answer





















              Your Answer








              StackExchange.ready(function() {
              var channelOptions = {
              tags: "".split(" "),
              id: "85"
              };
              initTagRenderer("".split(" "), "".split(" "), channelOptions);

              StackExchange.using("externalEditor", function() {
              // Have to fire editor after snippets, if snippets enabled
              if (StackExchange.settings.snippets.snippetsEnabled) {
              StackExchange.using("snippets", function() {
              createEditor();
              });
              }
              else {
              createEditor();
              }
              });

              function createEditor() {
              StackExchange.prepareEditor({
              heartbeatType: 'answer',
              convertImagesToLinks: false,
              noModals: true,
              showLowRepImageUploadWarning: true,
              reputationToPostImages: null,
              bindNavPrevention: true,
              postfix: "",
              imageUploader: {
              brandingHtml: "Powered by u003ca class="icon-imgur-white" href="https://imgur.com/"u003eu003c/au003e",
              contentPolicyHtml: "User contributions licensed under u003ca href="https://creativecommons.org/licenses/by-sa/3.0/"u003ecc by-sa 3.0 with attribution requiredu003c/au003e u003ca href="https://stackoverflow.com/legal/content-policy"u003e(content policy)u003c/au003e",
              allowUrls: true
              },
              onDemand: true,
              discardSelector: ".discard-answer"
              ,immediatelyShowMarkdownHelp:true
              });


              }
              });














               

              draft saved


              draft discarded


















              StackExchange.ready(
              function () {
              StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2ftex.stackexchange.com%2fquestions%2f460682%2fleft-frame-tcolotbox-disappears-when-broken-up-by-new-page%23new-answer', 'question_page');
              }
              );

              Post as a guest















              Required, but never shown

























              2 Answers
              2






              active

              oldest

              votes








              2 Answers
              2






              active

              oldest

              votes









              active

              oldest

              votes






              active

              oldest

              votes








              up vote
              2
              down vote













              I don't know why your tex code doesn't work as expected.



              I suggest a workaround using exras={frame code={draw[gray,line width=2mm] ([xshift=-0.5pt]frame.north west) -- ([xshift=-0.5pt]frame.south west);}} within tcolorbox options:



              documentclass[a4paper, 10pt, oneside, fleqn, openright]{book}
              usepackage[no-math]{fontspec}
              usepackage{lipsum}
              usepackage{polyglossia}
              setdefaultlanguage{french}
              setotherlanguages{english}

              newcommand{codeimg}{$vcenter{hbox{includegraphics[height=baselineskip]{example-image-a}}}$}
              newcommand{codeimgpy}{$vcenter{hbox{includegraphics[height=baselineskip]{example-image-b}}}$}
              newcommand{codeimgcpp}{$vcenter{hbox{includegraphics[height=baselineskip]{example-image-c}}}$}

              usepackage{calc}
              usepackage[usenames,dvipsnames,svgnames,table]{xcolor}
              usepackage{pdfpages,graphicx}
              usepackage{mdframed}
              usepackage{listings}
              usepackage{filecontents}
              definecolor{mybluei}{RGB}{0,173,239}
              definecolor{myblueii}{RGB}{63,200,244}
              definecolor{myblueiii}{RGB}{199,234,253}
              definecolor{light-gray}{gray}{0.92}

              definecolor{mainColor}{RGB}{211, 47, 47} % some dark red

              renewcommandlstlistingname{Code}
              lstset{
              language=Python,
              numbers=left,
              numbersep= 7mm,
              numberstyle=color{Black},
              stepnumber=1,
              tabsize=3,
              breakatwhitespace=false,
              breaklines=true,
              captionpos=b,
              basicstyle=color{Black}ttfamily,
              commentstyle=color{LimeGreen},
              keywordstyle=color{BurntOrange}bfseries,
              stringstyle=color{WildStrawberry},
              keywords={var, func, extends},
              frame=leftline,
              framesep=0mm,
              xleftmargin=3mm,
              framesep=2mm,
              framerule=0mm,
              abovecaptionskip=5mm,
              aboveskip=baselineskip,
              belowskip=baselineskip
              }

              usepackage{tcolorbox}
              newcounter{data}
              newcounter{result}
              newcounter{pythoncode}
              newcounter{cppcode}
              newcounter{matlab}
              tcbuselibrary{skins,breakable,listings}

              newtcbinputlisting[use counter=matlab,list inside=matlab,number within=chapter]{inputmatlab}[3]{listing options={style=Matlab-editor},%
              enhanced,noparskip,breakable,colback=light-gray,colframe=DarkSlateGray,opacitybacktitle=.8,%
              fonttitle=bfseries,before upper={hspace*{-1em}codeimg~#2},%
              title after break={centeringfootnotesizeitshapestrut Matlab Code~thematlab~--~continued},%
              listing only,listing options={xleftmargin=-1mm,#1,style=Matlab-editor},
              after upper={centeringstrut {bfseries Matlab Code~thematlab:}~#2},
              frame hidden,arc=0pt,outer arc=0pt,boxrule=0pt,
              extras={frame code={draw[gray,line width=2mm] ([xshift=-0.5pt]frame.north west) -- ([xshift=-0.5pt]frame.south west);}},
              %
              listing file={#3},#1}

              newtcbinputlisting[use counter=cppcode,list inside=cppcode,number within=chapter]{inputcppcode}[3]{listing options={language=C++},%
              enhanced,noparskip,breakable,colback=light-gray,colframe=DarkSlateGray,opacitybacktitle=.8,%
              fonttitle=bfseries,before upper={hspace*{-1em}codeimgcpp~#2},%
              title after break={centeringfootnotesizeitshapestrut C++ Code~thecppcode~--~continued},%
              listing only,listing options={xleftmargin=-1mm,#1,language=C++},
              after upper={centeringstrut {bfseries C++ Code~thecppcode:}~#2},
              frame hidden,arc=0pt,outer arc=0pt,boxrule=0pt,
              extras={frame code={draw[gray,line width=2mm] ([xshift=-0.5pt]frame.north west) -- ([xshift=-0.5pt]frame.south west);}},
              %
              listing file={#3},#1}

              usepackage[numbered,framed]{matlab-prettifier}

              begin{filecontents*}{sample.m}
              % create a file for output
              !touch testFile.txt
              fid = fopen('testFile.text', 'w')
              for i=1:10
              fprintf(fid,'%6.2f n', i);
              end

              end{filecontents*}

              begin{filecontents*}{cppcodex.cpp}
              #include <iostream>
              using namespace std;

              int main()
              {
              int firstNumber, secondNumber, sumOfTwoNumbers;

              cout << "Enter two integers: ";
              cin >> firstNumber >> secondNumber;

              // sum of two numbers in stored in variable sumOfTwoNumbers
              sumOfTwoNumbers = firstNumber + secondNumber;

              // Prints sum
              cout << firstNumber << " + " << secondNumber << " = " << sumOfTwoNumbers;

              return 0;
              }
              end{filecontents*}

              begin{document}

              inputmatlab{Expansion Algorithm}{sample.m}

              vspace*{7cm}

              inputcppcode{Example C++ Code}{cppcodex.cpp}

              end{document}


              enter image description here






              share|improve this answer



























                up vote
                2
                down vote













                I don't know why your tex code doesn't work as expected.



                I suggest a workaround using exras={frame code={draw[gray,line width=2mm] ([xshift=-0.5pt]frame.north west) -- ([xshift=-0.5pt]frame.south west);}} within tcolorbox options:



                documentclass[a4paper, 10pt, oneside, fleqn, openright]{book}
                usepackage[no-math]{fontspec}
                usepackage{lipsum}
                usepackage{polyglossia}
                setdefaultlanguage{french}
                setotherlanguages{english}

                newcommand{codeimg}{$vcenter{hbox{includegraphics[height=baselineskip]{example-image-a}}}$}
                newcommand{codeimgpy}{$vcenter{hbox{includegraphics[height=baselineskip]{example-image-b}}}$}
                newcommand{codeimgcpp}{$vcenter{hbox{includegraphics[height=baselineskip]{example-image-c}}}$}

                usepackage{calc}
                usepackage[usenames,dvipsnames,svgnames,table]{xcolor}
                usepackage{pdfpages,graphicx}
                usepackage{mdframed}
                usepackage{listings}
                usepackage{filecontents}
                definecolor{mybluei}{RGB}{0,173,239}
                definecolor{myblueii}{RGB}{63,200,244}
                definecolor{myblueiii}{RGB}{199,234,253}
                definecolor{light-gray}{gray}{0.92}

                definecolor{mainColor}{RGB}{211, 47, 47} % some dark red

                renewcommandlstlistingname{Code}
                lstset{
                language=Python,
                numbers=left,
                numbersep= 7mm,
                numberstyle=color{Black},
                stepnumber=1,
                tabsize=3,
                breakatwhitespace=false,
                breaklines=true,
                captionpos=b,
                basicstyle=color{Black}ttfamily,
                commentstyle=color{LimeGreen},
                keywordstyle=color{BurntOrange}bfseries,
                stringstyle=color{WildStrawberry},
                keywords={var, func, extends},
                frame=leftline,
                framesep=0mm,
                xleftmargin=3mm,
                framesep=2mm,
                framerule=0mm,
                abovecaptionskip=5mm,
                aboveskip=baselineskip,
                belowskip=baselineskip
                }

                usepackage{tcolorbox}
                newcounter{data}
                newcounter{result}
                newcounter{pythoncode}
                newcounter{cppcode}
                newcounter{matlab}
                tcbuselibrary{skins,breakable,listings}

                newtcbinputlisting[use counter=matlab,list inside=matlab,number within=chapter]{inputmatlab}[3]{listing options={style=Matlab-editor},%
                enhanced,noparskip,breakable,colback=light-gray,colframe=DarkSlateGray,opacitybacktitle=.8,%
                fonttitle=bfseries,before upper={hspace*{-1em}codeimg~#2},%
                title after break={centeringfootnotesizeitshapestrut Matlab Code~thematlab~--~continued},%
                listing only,listing options={xleftmargin=-1mm,#1,style=Matlab-editor},
                after upper={centeringstrut {bfseries Matlab Code~thematlab:}~#2},
                frame hidden,arc=0pt,outer arc=0pt,boxrule=0pt,
                extras={frame code={draw[gray,line width=2mm] ([xshift=-0.5pt]frame.north west) -- ([xshift=-0.5pt]frame.south west);}},
                %
                listing file={#3},#1}

                newtcbinputlisting[use counter=cppcode,list inside=cppcode,number within=chapter]{inputcppcode}[3]{listing options={language=C++},%
                enhanced,noparskip,breakable,colback=light-gray,colframe=DarkSlateGray,opacitybacktitle=.8,%
                fonttitle=bfseries,before upper={hspace*{-1em}codeimgcpp~#2},%
                title after break={centeringfootnotesizeitshapestrut C++ Code~thecppcode~--~continued},%
                listing only,listing options={xleftmargin=-1mm,#1,language=C++},
                after upper={centeringstrut {bfseries C++ Code~thecppcode:}~#2},
                frame hidden,arc=0pt,outer arc=0pt,boxrule=0pt,
                extras={frame code={draw[gray,line width=2mm] ([xshift=-0.5pt]frame.north west) -- ([xshift=-0.5pt]frame.south west);}},
                %
                listing file={#3},#1}

                usepackage[numbered,framed]{matlab-prettifier}

                begin{filecontents*}{sample.m}
                % create a file for output
                !touch testFile.txt
                fid = fopen('testFile.text', 'w')
                for i=1:10
                fprintf(fid,'%6.2f n', i);
                end

                end{filecontents*}

                begin{filecontents*}{cppcodex.cpp}
                #include <iostream>
                using namespace std;

                int main()
                {
                int firstNumber, secondNumber, sumOfTwoNumbers;

                cout << "Enter two integers: ";
                cin >> firstNumber >> secondNumber;

                // sum of two numbers in stored in variable sumOfTwoNumbers
                sumOfTwoNumbers = firstNumber + secondNumber;

                // Prints sum
                cout << firstNumber << " + " << secondNumber << " = " << sumOfTwoNumbers;

                return 0;
                }
                end{filecontents*}

                begin{document}

                inputmatlab{Expansion Algorithm}{sample.m}

                vspace*{7cm}

                inputcppcode{Example C++ Code}{cppcodex.cpp}

                end{document}


                enter image description here






                share|improve this answer

























                  up vote
                  2
                  down vote










                  up vote
                  2
                  down vote









                  I don't know why your tex code doesn't work as expected.



                  I suggest a workaround using exras={frame code={draw[gray,line width=2mm] ([xshift=-0.5pt]frame.north west) -- ([xshift=-0.5pt]frame.south west);}} within tcolorbox options:



                  documentclass[a4paper, 10pt, oneside, fleqn, openright]{book}
                  usepackage[no-math]{fontspec}
                  usepackage{lipsum}
                  usepackage{polyglossia}
                  setdefaultlanguage{french}
                  setotherlanguages{english}

                  newcommand{codeimg}{$vcenter{hbox{includegraphics[height=baselineskip]{example-image-a}}}$}
                  newcommand{codeimgpy}{$vcenter{hbox{includegraphics[height=baselineskip]{example-image-b}}}$}
                  newcommand{codeimgcpp}{$vcenter{hbox{includegraphics[height=baselineskip]{example-image-c}}}$}

                  usepackage{calc}
                  usepackage[usenames,dvipsnames,svgnames,table]{xcolor}
                  usepackage{pdfpages,graphicx}
                  usepackage{mdframed}
                  usepackage{listings}
                  usepackage{filecontents}
                  definecolor{mybluei}{RGB}{0,173,239}
                  definecolor{myblueii}{RGB}{63,200,244}
                  definecolor{myblueiii}{RGB}{199,234,253}
                  definecolor{light-gray}{gray}{0.92}

                  definecolor{mainColor}{RGB}{211, 47, 47} % some dark red

                  renewcommandlstlistingname{Code}
                  lstset{
                  language=Python,
                  numbers=left,
                  numbersep= 7mm,
                  numberstyle=color{Black},
                  stepnumber=1,
                  tabsize=3,
                  breakatwhitespace=false,
                  breaklines=true,
                  captionpos=b,
                  basicstyle=color{Black}ttfamily,
                  commentstyle=color{LimeGreen},
                  keywordstyle=color{BurntOrange}bfseries,
                  stringstyle=color{WildStrawberry},
                  keywords={var, func, extends},
                  frame=leftline,
                  framesep=0mm,
                  xleftmargin=3mm,
                  framesep=2mm,
                  framerule=0mm,
                  abovecaptionskip=5mm,
                  aboveskip=baselineskip,
                  belowskip=baselineskip
                  }

                  usepackage{tcolorbox}
                  newcounter{data}
                  newcounter{result}
                  newcounter{pythoncode}
                  newcounter{cppcode}
                  newcounter{matlab}
                  tcbuselibrary{skins,breakable,listings}

                  newtcbinputlisting[use counter=matlab,list inside=matlab,number within=chapter]{inputmatlab}[3]{listing options={style=Matlab-editor},%
                  enhanced,noparskip,breakable,colback=light-gray,colframe=DarkSlateGray,opacitybacktitle=.8,%
                  fonttitle=bfseries,before upper={hspace*{-1em}codeimg~#2},%
                  title after break={centeringfootnotesizeitshapestrut Matlab Code~thematlab~--~continued},%
                  listing only,listing options={xleftmargin=-1mm,#1,style=Matlab-editor},
                  after upper={centeringstrut {bfseries Matlab Code~thematlab:}~#2},
                  frame hidden,arc=0pt,outer arc=0pt,boxrule=0pt,
                  extras={frame code={draw[gray,line width=2mm] ([xshift=-0.5pt]frame.north west) -- ([xshift=-0.5pt]frame.south west);}},
                  %
                  listing file={#3},#1}

                  newtcbinputlisting[use counter=cppcode,list inside=cppcode,number within=chapter]{inputcppcode}[3]{listing options={language=C++},%
                  enhanced,noparskip,breakable,colback=light-gray,colframe=DarkSlateGray,opacitybacktitle=.8,%
                  fonttitle=bfseries,before upper={hspace*{-1em}codeimgcpp~#2},%
                  title after break={centeringfootnotesizeitshapestrut C++ Code~thecppcode~--~continued},%
                  listing only,listing options={xleftmargin=-1mm,#1,language=C++},
                  after upper={centeringstrut {bfseries C++ Code~thecppcode:}~#2},
                  frame hidden,arc=0pt,outer arc=0pt,boxrule=0pt,
                  extras={frame code={draw[gray,line width=2mm] ([xshift=-0.5pt]frame.north west) -- ([xshift=-0.5pt]frame.south west);}},
                  %
                  listing file={#3},#1}

                  usepackage[numbered,framed]{matlab-prettifier}

                  begin{filecontents*}{sample.m}
                  % create a file for output
                  !touch testFile.txt
                  fid = fopen('testFile.text', 'w')
                  for i=1:10
                  fprintf(fid,'%6.2f n', i);
                  end

                  end{filecontents*}

                  begin{filecontents*}{cppcodex.cpp}
                  #include <iostream>
                  using namespace std;

                  int main()
                  {
                  int firstNumber, secondNumber, sumOfTwoNumbers;

                  cout << "Enter two integers: ";
                  cin >> firstNumber >> secondNumber;

                  // sum of two numbers in stored in variable sumOfTwoNumbers
                  sumOfTwoNumbers = firstNumber + secondNumber;

                  // Prints sum
                  cout << firstNumber << " + " << secondNumber << " = " << sumOfTwoNumbers;

                  return 0;
                  }
                  end{filecontents*}

                  begin{document}

                  inputmatlab{Expansion Algorithm}{sample.m}

                  vspace*{7cm}

                  inputcppcode{Example C++ Code}{cppcodex.cpp}

                  end{document}


                  enter image description here






                  share|improve this answer














                  I don't know why your tex code doesn't work as expected.



                  I suggest a workaround using exras={frame code={draw[gray,line width=2mm] ([xshift=-0.5pt]frame.north west) -- ([xshift=-0.5pt]frame.south west);}} within tcolorbox options:



                  documentclass[a4paper, 10pt, oneside, fleqn, openright]{book}
                  usepackage[no-math]{fontspec}
                  usepackage{lipsum}
                  usepackage{polyglossia}
                  setdefaultlanguage{french}
                  setotherlanguages{english}

                  newcommand{codeimg}{$vcenter{hbox{includegraphics[height=baselineskip]{example-image-a}}}$}
                  newcommand{codeimgpy}{$vcenter{hbox{includegraphics[height=baselineskip]{example-image-b}}}$}
                  newcommand{codeimgcpp}{$vcenter{hbox{includegraphics[height=baselineskip]{example-image-c}}}$}

                  usepackage{calc}
                  usepackage[usenames,dvipsnames,svgnames,table]{xcolor}
                  usepackage{pdfpages,graphicx}
                  usepackage{mdframed}
                  usepackage{listings}
                  usepackage{filecontents}
                  definecolor{mybluei}{RGB}{0,173,239}
                  definecolor{myblueii}{RGB}{63,200,244}
                  definecolor{myblueiii}{RGB}{199,234,253}
                  definecolor{light-gray}{gray}{0.92}

                  definecolor{mainColor}{RGB}{211, 47, 47} % some dark red

                  renewcommandlstlistingname{Code}
                  lstset{
                  language=Python,
                  numbers=left,
                  numbersep= 7mm,
                  numberstyle=color{Black},
                  stepnumber=1,
                  tabsize=3,
                  breakatwhitespace=false,
                  breaklines=true,
                  captionpos=b,
                  basicstyle=color{Black}ttfamily,
                  commentstyle=color{LimeGreen},
                  keywordstyle=color{BurntOrange}bfseries,
                  stringstyle=color{WildStrawberry},
                  keywords={var, func, extends},
                  frame=leftline,
                  framesep=0mm,
                  xleftmargin=3mm,
                  framesep=2mm,
                  framerule=0mm,
                  abovecaptionskip=5mm,
                  aboveskip=baselineskip,
                  belowskip=baselineskip
                  }

                  usepackage{tcolorbox}
                  newcounter{data}
                  newcounter{result}
                  newcounter{pythoncode}
                  newcounter{cppcode}
                  newcounter{matlab}
                  tcbuselibrary{skins,breakable,listings}

                  newtcbinputlisting[use counter=matlab,list inside=matlab,number within=chapter]{inputmatlab}[3]{listing options={style=Matlab-editor},%
                  enhanced,noparskip,breakable,colback=light-gray,colframe=DarkSlateGray,opacitybacktitle=.8,%
                  fonttitle=bfseries,before upper={hspace*{-1em}codeimg~#2},%
                  title after break={centeringfootnotesizeitshapestrut Matlab Code~thematlab~--~continued},%
                  listing only,listing options={xleftmargin=-1mm,#1,style=Matlab-editor},
                  after upper={centeringstrut {bfseries Matlab Code~thematlab:}~#2},
                  frame hidden,arc=0pt,outer arc=0pt,boxrule=0pt,
                  extras={frame code={draw[gray,line width=2mm] ([xshift=-0.5pt]frame.north west) -- ([xshift=-0.5pt]frame.south west);}},
                  %
                  listing file={#3},#1}

                  newtcbinputlisting[use counter=cppcode,list inside=cppcode,number within=chapter]{inputcppcode}[3]{listing options={language=C++},%
                  enhanced,noparskip,breakable,colback=light-gray,colframe=DarkSlateGray,opacitybacktitle=.8,%
                  fonttitle=bfseries,before upper={hspace*{-1em}codeimgcpp~#2},%
                  title after break={centeringfootnotesizeitshapestrut C++ Code~thecppcode~--~continued},%
                  listing only,listing options={xleftmargin=-1mm,#1,language=C++},
                  after upper={centeringstrut {bfseries C++ Code~thecppcode:}~#2},
                  frame hidden,arc=0pt,outer arc=0pt,boxrule=0pt,
                  extras={frame code={draw[gray,line width=2mm] ([xshift=-0.5pt]frame.north west) -- ([xshift=-0.5pt]frame.south west);}},
                  %
                  listing file={#3},#1}

                  usepackage[numbered,framed]{matlab-prettifier}

                  begin{filecontents*}{sample.m}
                  % create a file for output
                  !touch testFile.txt
                  fid = fopen('testFile.text', 'w')
                  for i=1:10
                  fprintf(fid,'%6.2f n', i);
                  end

                  end{filecontents*}

                  begin{filecontents*}{cppcodex.cpp}
                  #include <iostream>
                  using namespace std;

                  int main()
                  {
                  int firstNumber, secondNumber, sumOfTwoNumbers;

                  cout << "Enter two integers: ";
                  cin >> firstNumber >> secondNumber;

                  // sum of two numbers in stored in variable sumOfTwoNumbers
                  sumOfTwoNumbers = firstNumber + secondNumber;

                  // Prints sum
                  cout << firstNumber << " + " << secondNumber << " = " << sumOfTwoNumbers;

                  return 0;
                  }
                  end{filecontents*}

                  begin{document}

                  inputmatlab{Expansion Algorithm}{sample.m}

                  vspace*{7cm}

                  inputcppcode{Example C++ Code}{cppcodex.cpp}

                  end{document}


                  enter image description here







                  share|improve this answer














                  share|improve this answer



                  share|improve this answer








                  edited yesterday

























                  answered yesterday









                  Hafid Boukhoulda

                  977515




                  977515






















                      up vote
                      2
                      down vote













                      Another workaround. Instead of frame hidden and boxrule=0pt, don't hide the frame and define a certain leftrule=... which survives in broken boxes.



                      documentclass[a4paper, 10pt, oneside, fleqn, openright]{book}
                      usepackage[no-math]{fontspec}

                      usepackage{polyglossia}
                      setdefaultlanguage{french}
                      setotherlanguages{english}

                      newcommand{codeimg}{$vcenter{hbox{includegraphics[height=baselineskip]{example-image-a}}}$}
                      newcommand{codeimgpy}{$vcenter{hbox{includegraphics[height=baselineskip]{example-image-b}}}$}
                      newcommand{codeimgcpp}{$vcenter{hbox{includegraphics[height=baselineskip]{example-image-c}}}$}

                      usepackage{calc}
                      usepackage[usenames,dvipsnames,svgnames,table]{xcolor}
                      usepackage{pdfpages,graphicx}
                      usepackage{mdframed}
                      usepackage{listings}
                      usepackage{filecontents}
                      definecolor{mybluei}{RGB}{0,173,239}
                      definecolor{myblueii}{RGB}{63,200,244}
                      definecolor{myblueiii}{RGB}{199,234,253}
                      definecolor{light-gray}{gray}{0.92}

                      definecolor{mainColor}{RGB}{211, 47, 47} % some dark red

                      renewcommandlstlistingname{Code}
                      lstset{
                      language=Python,
                      numbers=left,
                      numbersep= 7mm,
                      numberstyle=color{Black},
                      stepnumber=1,
                      tabsize=3,
                      breakatwhitespace=false,
                      breaklines=true,
                      captionpos=b,
                      basicstyle=color{Black}ttfamily,
                      commentstyle=color{LimeGreen},
                      keywordstyle=color{BurntOrange}bfseries,
                      stringstyle=color{WildStrawberry},
                      keywords={var, func, extends},
                      frame=leftline,
                      framesep=0mm,
                      xleftmargin=3mm,
                      framesep=2mm,
                      framerule=0mm,
                      abovecaptionskip=5mm,
                      aboveskip=baselineskip,
                      belowskip=baselineskip
                      }

                      usepackage{tcolorbox}
                      newcounter{data}
                      newcounter{result}
                      newcounter{pythoncode}
                      newcounter{cppcode}
                      newcounter{matlab}
                      tcbuselibrary{skins,breakable,listings}

                      newtcbinputlisting[use counter=matlab,list inside=matlab,number within=chapter]{inputmatlab}[3]{listing options={style=Matlab-editor},%
                      enhanced,noparskip,breakable,colback=light-gray,colframe=DarkSlateGray,opacitybacktitle=.8,%
                      fonttitle=bfseries,before upper={hspace*{-1em}codeimg~#2},%
                      title after break={centeringfootnotesizeitshapestrut Matlab Code~thematlab~--~continued},%
                      listing only,listing options={xleftmargin=-1mm,#1,style=Matlab-editor},
                      after upper={centeringstrut {bfseries Matlab Code~thematlab:}~#2},
                      %frame hidden, %<---------------------------------------
                      arc=0pt,
                      outer arc=0pt,
                      boxrule=0pt,
                      leftrule=1mm, %<----------------------------
                      % frame code={draw[gray,line width=2mm] ([xshift=-0.5pt]frame.north west) -- ([xshift=-0.5pt]frame.south west);},
                      %
                      listing file={#3},#1}

                      newtcbinputlisting[use counter=cppcode,list inside=cppcode,number within=chapter]{inputcppcode}[3]{listing options={language=C++},%
                      enhanced,noparskip,breakable,colback=light-gray,colframe=DarkSlateGray,opacitybacktitle=.8,%
                      fonttitle=bfseries,before upper={hspace*{-1em}codeimgcpp~#2},%
                      title after break={centeringfootnotesizeitshapestrut C++ Code~thecppcode~--~continued},%
                      listing only,listing options={xleftmargin=-1mm,#1,language=C++},
                      after upper={centeringstrut {bfseries C++ Code~thecppcode:}~#2},
                      % frame hidden, %<------------------------------
                      arc=0pt,
                      outer arc=0pt,
                      boxrule=0pt,
                      leftrule=1mm, %<---------------------------------
                      %frame code={draw[gray,line width=2mm] ([xshift=-0.5pt]frame.north west) -- ([xshift=-0.5pt]frame.south west);},
                      %
                      listing file={#3},#1}

                      usepackage[numbered,framed]{matlab-prettifier}

                      begin{filecontents*}{sample.m}
                      % create a file for output
                      !touch testFile.txt
                      fid = fopen('testFile.text', 'w')
                      for i=1:10
                      fprintf(fid,'%6.2f n', i);
                      end
                      end{filecontents*}

                      begin{filecontents*}{cppcodex.cpp}
                      #include <iostream>
                      using namespace std;

                      int main()
                      {
                      int firstNumber, secondNumber, sumOfTwoNumbers;

                      cout << "Enter two integers: ";
                      cin >> firstNumber >> secondNumber;

                      // sum of two numbers in stored in variable sumOfTwoNumbers
                      sumOfTwoNumbers = firstNumber + secondNumber;

                      // Prints sum
                      cout << firstNumber << " + " << secondNumber << " = " << sumOfTwoNumbers;

                      return 0;
                      }
                      end{filecontents*}

                      begin{document}

                      inputmatlab{Expansion Algorithm}{sample.m}

                      vspace*{7cm}

                      inputcppcode{Example C++ Code}{cppcodex.cpp}

                      end{document}


                      enter image description here






                      share|improve this answer

























                        up vote
                        2
                        down vote













                        Another workaround. Instead of frame hidden and boxrule=0pt, don't hide the frame and define a certain leftrule=... which survives in broken boxes.



                        documentclass[a4paper, 10pt, oneside, fleqn, openright]{book}
                        usepackage[no-math]{fontspec}

                        usepackage{polyglossia}
                        setdefaultlanguage{french}
                        setotherlanguages{english}

                        newcommand{codeimg}{$vcenter{hbox{includegraphics[height=baselineskip]{example-image-a}}}$}
                        newcommand{codeimgpy}{$vcenter{hbox{includegraphics[height=baselineskip]{example-image-b}}}$}
                        newcommand{codeimgcpp}{$vcenter{hbox{includegraphics[height=baselineskip]{example-image-c}}}$}

                        usepackage{calc}
                        usepackage[usenames,dvipsnames,svgnames,table]{xcolor}
                        usepackage{pdfpages,graphicx}
                        usepackage{mdframed}
                        usepackage{listings}
                        usepackage{filecontents}
                        definecolor{mybluei}{RGB}{0,173,239}
                        definecolor{myblueii}{RGB}{63,200,244}
                        definecolor{myblueiii}{RGB}{199,234,253}
                        definecolor{light-gray}{gray}{0.92}

                        definecolor{mainColor}{RGB}{211, 47, 47} % some dark red

                        renewcommandlstlistingname{Code}
                        lstset{
                        language=Python,
                        numbers=left,
                        numbersep= 7mm,
                        numberstyle=color{Black},
                        stepnumber=1,
                        tabsize=3,
                        breakatwhitespace=false,
                        breaklines=true,
                        captionpos=b,
                        basicstyle=color{Black}ttfamily,
                        commentstyle=color{LimeGreen},
                        keywordstyle=color{BurntOrange}bfseries,
                        stringstyle=color{WildStrawberry},
                        keywords={var, func, extends},
                        frame=leftline,
                        framesep=0mm,
                        xleftmargin=3mm,
                        framesep=2mm,
                        framerule=0mm,
                        abovecaptionskip=5mm,
                        aboveskip=baselineskip,
                        belowskip=baselineskip
                        }

                        usepackage{tcolorbox}
                        newcounter{data}
                        newcounter{result}
                        newcounter{pythoncode}
                        newcounter{cppcode}
                        newcounter{matlab}
                        tcbuselibrary{skins,breakable,listings}

                        newtcbinputlisting[use counter=matlab,list inside=matlab,number within=chapter]{inputmatlab}[3]{listing options={style=Matlab-editor},%
                        enhanced,noparskip,breakable,colback=light-gray,colframe=DarkSlateGray,opacitybacktitle=.8,%
                        fonttitle=bfseries,before upper={hspace*{-1em}codeimg~#2},%
                        title after break={centeringfootnotesizeitshapestrut Matlab Code~thematlab~--~continued},%
                        listing only,listing options={xleftmargin=-1mm,#1,style=Matlab-editor},
                        after upper={centeringstrut {bfseries Matlab Code~thematlab:}~#2},
                        %frame hidden, %<---------------------------------------
                        arc=0pt,
                        outer arc=0pt,
                        boxrule=0pt,
                        leftrule=1mm, %<----------------------------
                        % frame code={draw[gray,line width=2mm] ([xshift=-0.5pt]frame.north west) -- ([xshift=-0.5pt]frame.south west);},
                        %
                        listing file={#3},#1}

                        newtcbinputlisting[use counter=cppcode,list inside=cppcode,number within=chapter]{inputcppcode}[3]{listing options={language=C++},%
                        enhanced,noparskip,breakable,colback=light-gray,colframe=DarkSlateGray,opacitybacktitle=.8,%
                        fonttitle=bfseries,before upper={hspace*{-1em}codeimgcpp~#2},%
                        title after break={centeringfootnotesizeitshapestrut C++ Code~thecppcode~--~continued},%
                        listing only,listing options={xleftmargin=-1mm,#1,language=C++},
                        after upper={centeringstrut {bfseries C++ Code~thecppcode:}~#2},
                        % frame hidden, %<------------------------------
                        arc=0pt,
                        outer arc=0pt,
                        boxrule=0pt,
                        leftrule=1mm, %<---------------------------------
                        %frame code={draw[gray,line width=2mm] ([xshift=-0.5pt]frame.north west) -- ([xshift=-0.5pt]frame.south west);},
                        %
                        listing file={#3},#1}

                        usepackage[numbered,framed]{matlab-prettifier}

                        begin{filecontents*}{sample.m}
                        % create a file for output
                        !touch testFile.txt
                        fid = fopen('testFile.text', 'w')
                        for i=1:10
                        fprintf(fid,'%6.2f n', i);
                        end
                        end{filecontents*}

                        begin{filecontents*}{cppcodex.cpp}
                        #include <iostream>
                        using namespace std;

                        int main()
                        {
                        int firstNumber, secondNumber, sumOfTwoNumbers;

                        cout << "Enter two integers: ";
                        cin >> firstNumber >> secondNumber;

                        // sum of two numbers in stored in variable sumOfTwoNumbers
                        sumOfTwoNumbers = firstNumber + secondNumber;

                        // Prints sum
                        cout << firstNumber << " + " << secondNumber << " = " << sumOfTwoNumbers;

                        return 0;
                        }
                        end{filecontents*}

                        begin{document}

                        inputmatlab{Expansion Algorithm}{sample.m}

                        vspace*{7cm}

                        inputcppcode{Example C++ Code}{cppcodex.cpp}

                        end{document}


                        enter image description here






                        share|improve this answer























                          up vote
                          2
                          down vote










                          up vote
                          2
                          down vote









                          Another workaround. Instead of frame hidden and boxrule=0pt, don't hide the frame and define a certain leftrule=... which survives in broken boxes.



                          documentclass[a4paper, 10pt, oneside, fleqn, openright]{book}
                          usepackage[no-math]{fontspec}

                          usepackage{polyglossia}
                          setdefaultlanguage{french}
                          setotherlanguages{english}

                          newcommand{codeimg}{$vcenter{hbox{includegraphics[height=baselineskip]{example-image-a}}}$}
                          newcommand{codeimgpy}{$vcenter{hbox{includegraphics[height=baselineskip]{example-image-b}}}$}
                          newcommand{codeimgcpp}{$vcenter{hbox{includegraphics[height=baselineskip]{example-image-c}}}$}

                          usepackage{calc}
                          usepackage[usenames,dvipsnames,svgnames,table]{xcolor}
                          usepackage{pdfpages,graphicx}
                          usepackage{mdframed}
                          usepackage{listings}
                          usepackage{filecontents}
                          definecolor{mybluei}{RGB}{0,173,239}
                          definecolor{myblueii}{RGB}{63,200,244}
                          definecolor{myblueiii}{RGB}{199,234,253}
                          definecolor{light-gray}{gray}{0.92}

                          definecolor{mainColor}{RGB}{211, 47, 47} % some dark red

                          renewcommandlstlistingname{Code}
                          lstset{
                          language=Python,
                          numbers=left,
                          numbersep= 7mm,
                          numberstyle=color{Black},
                          stepnumber=1,
                          tabsize=3,
                          breakatwhitespace=false,
                          breaklines=true,
                          captionpos=b,
                          basicstyle=color{Black}ttfamily,
                          commentstyle=color{LimeGreen},
                          keywordstyle=color{BurntOrange}bfseries,
                          stringstyle=color{WildStrawberry},
                          keywords={var, func, extends},
                          frame=leftline,
                          framesep=0mm,
                          xleftmargin=3mm,
                          framesep=2mm,
                          framerule=0mm,
                          abovecaptionskip=5mm,
                          aboveskip=baselineskip,
                          belowskip=baselineskip
                          }

                          usepackage{tcolorbox}
                          newcounter{data}
                          newcounter{result}
                          newcounter{pythoncode}
                          newcounter{cppcode}
                          newcounter{matlab}
                          tcbuselibrary{skins,breakable,listings}

                          newtcbinputlisting[use counter=matlab,list inside=matlab,number within=chapter]{inputmatlab}[3]{listing options={style=Matlab-editor},%
                          enhanced,noparskip,breakable,colback=light-gray,colframe=DarkSlateGray,opacitybacktitle=.8,%
                          fonttitle=bfseries,before upper={hspace*{-1em}codeimg~#2},%
                          title after break={centeringfootnotesizeitshapestrut Matlab Code~thematlab~--~continued},%
                          listing only,listing options={xleftmargin=-1mm,#1,style=Matlab-editor},
                          after upper={centeringstrut {bfseries Matlab Code~thematlab:}~#2},
                          %frame hidden, %<---------------------------------------
                          arc=0pt,
                          outer arc=0pt,
                          boxrule=0pt,
                          leftrule=1mm, %<----------------------------
                          % frame code={draw[gray,line width=2mm] ([xshift=-0.5pt]frame.north west) -- ([xshift=-0.5pt]frame.south west);},
                          %
                          listing file={#3},#1}

                          newtcbinputlisting[use counter=cppcode,list inside=cppcode,number within=chapter]{inputcppcode}[3]{listing options={language=C++},%
                          enhanced,noparskip,breakable,colback=light-gray,colframe=DarkSlateGray,opacitybacktitle=.8,%
                          fonttitle=bfseries,before upper={hspace*{-1em}codeimgcpp~#2},%
                          title after break={centeringfootnotesizeitshapestrut C++ Code~thecppcode~--~continued},%
                          listing only,listing options={xleftmargin=-1mm,#1,language=C++},
                          after upper={centeringstrut {bfseries C++ Code~thecppcode:}~#2},
                          % frame hidden, %<------------------------------
                          arc=0pt,
                          outer arc=0pt,
                          boxrule=0pt,
                          leftrule=1mm, %<---------------------------------
                          %frame code={draw[gray,line width=2mm] ([xshift=-0.5pt]frame.north west) -- ([xshift=-0.5pt]frame.south west);},
                          %
                          listing file={#3},#1}

                          usepackage[numbered,framed]{matlab-prettifier}

                          begin{filecontents*}{sample.m}
                          % create a file for output
                          !touch testFile.txt
                          fid = fopen('testFile.text', 'w')
                          for i=1:10
                          fprintf(fid,'%6.2f n', i);
                          end
                          end{filecontents*}

                          begin{filecontents*}{cppcodex.cpp}
                          #include <iostream>
                          using namespace std;

                          int main()
                          {
                          int firstNumber, secondNumber, sumOfTwoNumbers;

                          cout << "Enter two integers: ";
                          cin >> firstNumber >> secondNumber;

                          // sum of two numbers in stored in variable sumOfTwoNumbers
                          sumOfTwoNumbers = firstNumber + secondNumber;

                          // Prints sum
                          cout << firstNumber << " + " << secondNumber << " = " << sumOfTwoNumbers;

                          return 0;
                          }
                          end{filecontents*}

                          begin{document}

                          inputmatlab{Expansion Algorithm}{sample.m}

                          vspace*{7cm}

                          inputcppcode{Example C++ Code}{cppcodex.cpp}

                          end{document}


                          enter image description here






                          share|improve this answer












                          Another workaround. Instead of frame hidden and boxrule=0pt, don't hide the frame and define a certain leftrule=... which survives in broken boxes.



                          documentclass[a4paper, 10pt, oneside, fleqn, openright]{book}
                          usepackage[no-math]{fontspec}

                          usepackage{polyglossia}
                          setdefaultlanguage{french}
                          setotherlanguages{english}

                          newcommand{codeimg}{$vcenter{hbox{includegraphics[height=baselineskip]{example-image-a}}}$}
                          newcommand{codeimgpy}{$vcenter{hbox{includegraphics[height=baselineskip]{example-image-b}}}$}
                          newcommand{codeimgcpp}{$vcenter{hbox{includegraphics[height=baselineskip]{example-image-c}}}$}

                          usepackage{calc}
                          usepackage[usenames,dvipsnames,svgnames,table]{xcolor}
                          usepackage{pdfpages,graphicx}
                          usepackage{mdframed}
                          usepackage{listings}
                          usepackage{filecontents}
                          definecolor{mybluei}{RGB}{0,173,239}
                          definecolor{myblueii}{RGB}{63,200,244}
                          definecolor{myblueiii}{RGB}{199,234,253}
                          definecolor{light-gray}{gray}{0.92}

                          definecolor{mainColor}{RGB}{211, 47, 47} % some dark red

                          renewcommandlstlistingname{Code}
                          lstset{
                          language=Python,
                          numbers=left,
                          numbersep= 7mm,
                          numberstyle=color{Black},
                          stepnumber=1,
                          tabsize=3,
                          breakatwhitespace=false,
                          breaklines=true,
                          captionpos=b,
                          basicstyle=color{Black}ttfamily,
                          commentstyle=color{LimeGreen},
                          keywordstyle=color{BurntOrange}bfseries,
                          stringstyle=color{WildStrawberry},
                          keywords={var, func, extends},
                          frame=leftline,
                          framesep=0mm,
                          xleftmargin=3mm,
                          framesep=2mm,
                          framerule=0mm,
                          abovecaptionskip=5mm,
                          aboveskip=baselineskip,
                          belowskip=baselineskip
                          }

                          usepackage{tcolorbox}
                          newcounter{data}
                          newcounter{result}
                          newcounter{pythoncode}
                          newcounter{cppcode}
                          newcounter{matlab}
                          tcbuselibrary{skins,breakable,listings}

                          newtcbinputlisting[use counter=matlab,list inside=matlab,number within=chapter]{inputmatlab}[3]{listing options={style=Matlab-editor},%
                          enhanced,noparskip,breakable,colback=light-gray,colframe=DarkSlateGray,opacitybacktitle=.8,%
                          fonttitle=bfseries,before upper={hspace*{-1em}codeimg~#2},%
                          title after break={centeringfootnotesizeitshapestrut Matlab Code~thematlab~--~continued},%
                          listing only,listing options={xleftmargin=-1mm,#1,style=Matlab-editor},
                          after upper={centeringstrut {bfseries Matlab Code~thematlab:}~#2},
                          %frame hidden, %<---------------------------------------
                          arc=0pt,
                          outer arc=0pt,
                          boxrule=0pt,
                          leftrule=1mm, %<----------------------------
                          % frame code={draw[gray,line width=2mm] ([xshift=-0.5pt]frame.north west) -- ([xshift=-0.5pt]frame.south west);},
                          %
                          listing file={#3},#1}

                          newtcbinputlisting[use counter=cppcode,list inside=cppcode,number within=chapter]{inputcppcode}[3]{listing options={language=C++},%
                          enhanced,noparskip,breakable,colback=light-gray,colframe=DarkSlateGray,opacitybacktitle=.8,%
                          fonttitle=bfseries,before upper={hspace*{-1em}codeimgcpp~#2},%
                          title after break={centeringfootnotesizeitshapestrut C++ Code~thecppcode~--~continued},%
                          listing only,listing options={xleftmargin=-1mm,#1,language=C++},
                          after upper={centeringstrut {bfseries C++ Code~thecppcode:}~#2},
                          % frame hidden, %<------------------------------
                          arc=0pt,
                          outer arc=0pt,
                          boxrule=0pt,
                          leftrule=1mm, %<---------------------------------
                          %frame code={draw[gray,line width=2mm] ([xshift=-0.5pt]frame.north west) -- ([xshift=-0.5pt]frame.south west);},
                          %
                          listing file={#3},#1}

                          usepackage[numbered,framed]{matlab-prettifier}

                          begin{filecontents*}{sample.m}
                          % create a file for output
                          !touch testFile.txt
                          fid = fopen('testFile.text', 'w')
                          for i=1:10
                          fprintf(fid,'%6.2f n', i);
                          end
                          end{filecontents*}

                          begin{filecontents*}{cppcodex.cpp}
                          #include <iostream>
                          using namespace std;

                          int main()
                          {
                          int firstNumber, secondNumber, sumOfTwoNumbers;

                          cout << "Enter two integers: ";
                          cin >> firstNumber >> secondNumber;

                          // sum of two numbers in stored in variable sumOfTwoNumbers
                          sumOfTwoNumbers = firstNumber + secondNumber;

                          // Prints sum
                          cout << firstNumber << " + " << secondNumber << " = " << sumOfTwoNumbers;

                          return 0;
                          }
                          end{filecontents*}

                          begin{document}

                          inputmatlab{Expansion Algorithm}{sample.m}

                          vspace*{7cm}

                          inputcppcode{Example C++ Code}{cppcodex.cpp}

                          end{document}


                          enter image description here







                          share|improve this answer












                          share|improve this answer



                          share|improve this answer










                          answered yesterday









                          Ignasi

                          90k4163302




                          90k4163302






























                               

                              draft saved


                              draft discarded



















































                               


                              draft saved


                              draft discarded














                              StackExchange.ready(
                              function () {
                              StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2ftex.stackexchange.com%2fquestions%2f460682%2fleft-frame-tcolotbox-disappears-when-broken-up-by-new-page%23new-answer', 'question_page');
                              }
                              );

                              Post as a guest















                              Required, but never shown





















































                              Required, but never shown














                              Required, but never shown












                              Required, but never shown







                              Required, but never shown

































                              Required, but never shown














                              Required, but never shown












                              Required, but never shown







                              Required, but never shown







                              Popular posts from this blog

                              Accessing regular linux commands in Huawei's Dopra Linux

                              Can't connect RFCOMM socket: Host is down

                              Kernel panic - not syncing: Fatal Exception in Interrupt