Change path to tcbinputlisting to just reflect file name
up vote
0
down vote
favorite
In the code given below, I have many Matlab files. I put the files into a folder called "Project/Matlab". The name that appears in the first line is now "Project/Matlab/sample.m".
[Note: I have to also change the code up slightly as given below to reflect the path change, inputmatlab{Expansion Algorithm}{Project/Matlab/sample.m}
].
How do I modify the code to just reflect the file name as shown below although the file is in a different folder? 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[most]{tcolorbox}
newcounter{data}
newcounter{result}
newcounter{pythoncode}
newcounter{cppcode}
newcounter{matlab}
tcbuselibrary{skins,breakable,listings}
DeclareTCBInputListing[use counter=matlab,list inside=matlab,number
within=chapter]{inputmatlab}{O{}+m+O{#2}+m}{listing options={style=Matlab-editor},%
enhanced,noparskip,breakable,colback=light-gray,colframe=DarkSlateGray,opacitybacktitle=.8,%
fonttitle=bfseries,before upper={hspace*{-1em}codeimg~#4},%
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={#4},#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{document}
inputmatlab{Expansion Algorithm}{sample.m}
end{document}
external-files tcbinputlisting
add a comment |
up vote
0
down vote
favorite
In the code given below, I have many Matlab files. I put the files into a folder called "Project/Matlab". The name that appears in the first line is now "Project/Matlab/sample.m".
[Note: I have to also change the code up slightly as given below to reflect the path change, inputmatlab{Expansion Algorithm}{Project/Matlab/sample.m}
].
How do I modify the code to just reflect the file name as shown below although the file is in a different folder? 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[most]{tcolorbox}
newcounter{data}
newcounter{result}
newcounter{pythoncode}
newcounter{cppcode}
newcounter{matlab}
tcbuselibrary{skins,breakable,listings}
DeclareTCBInputListing[use counter=matlab,list inside=matlab,number
within=chapter]{inputmatlab}{O{}+m+O{#2}+m}{listing options={style=Matlab-editor},%
enhanced,noparskip,breakable,colback=light-gray,colframe=DarkSlateGray,opacitybacktitle=.8,%
fonttitle=bfseries,before upper={hspace*{-1em}codeimg~#4},%
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={#4},#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{document}
inputmatlab{Expansion Algorithm}{sample.m}
end{document}
external-files tcbinputlisting
add a comment |
up vote
0
down vote
favorite
up vote
0
down vote
favorite
In the code given below, I have many Matlab files. I put the files into a folder called "Project/Matlab". The name that appears in the first line is now "Project/Matlab/sample.m".
[Note: I have to also change the code up slightly as given below to reflect the path change, inputmatlab{Expansion Algorithm}{Project/Matlab/sample.m}
].
How do I modify the code to just reflect the file name as shown below although the file is in a different folder? 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[most]{tcolorbox}
newcounter{data}
newcounter{result}
newcounter{pythoncode}
newcounter{cppcode}
newcounter{matlab}
tcbuselibrary{skins,breakable,listings}
DeclareTCBInputListing[use counter=matlab,list inside=matlab,number
within=chapter]{inputmatlab}{O{}+m+O{#2}+m}{listing options={style=Matlab-editor},%
enhanced,noparskip,breakable,colback=light-gray,colframe=DarkSlateGray,opacitybacktitle=.8,%
fonttitle=bfseries,before upper={hspace*{-1em}codeimg~#4},%
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={#4},#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{document}
inputmatlab{Expansion Algorithm}{sample.m}
end{document}
external-files tcbinputlisting
In the code given below, I have many Matlab files. I put the files into a folder called "Project/Matlab". The name that appears in the first line is now "Project/Matlab/sample.m".
[Note: I have to also change the code up slightly as given below to reflect the path change, inputmatlab{Expansion Algorithm}{Project/Matlab/sample.m}
].
How do I modify the code to just reflect the file name as shown below although the file is in a different folder? 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[most]{tcolorbox}
newcounter{data}
newcounter{result}
newcounter{pythoncode}
newcounter{cppcode}
newcounter{matlab}
tcbuselibrary{skins,breakable,listings}
DeclareTCBInputListing[use counter=matlab,list inside=matlab,number
within=chapter]{inputmatlab}{O{}+m+O{#2}+m}{listing options={style=Matlab-editor},%
enhanced,noparskip,breakable,colback=light-gray,colframe=DarkSlateGray,opacitybacktitle=.8,%
fonttitle=bfseries,before upper={hspace*{-1em}codeimg~#4},%
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={#4},#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{document}
inputmatlab{Expansion Algorithm}{sample.m}
end{document}
external-files tcbinputlisting
external-files tcbinputlisting
asked 9 mins ago
Joe
3,49231948
3,49231948
add a comment |
add a comment |
active
oldest
votes
active
oldest
votes
active
oldest
votes
active
oldest
votes
active
oldest
votes
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
StackExchange.ready(
function () {
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2ftex.stackexchange.com%2fquestions%2f461519%2fchange-path-to-tcbinputlisting-to-just-reflect-file-name%23new-answer', 'question_page');
}
);
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
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