Strange output of typeset C++ code











up vote
1
down vote

favorite
1












I use listing typography C++ code, it performs very well when formatting LaTeX code, but it has very strange character output when used to typeset C++ code. Here is my WME:



documentclass{standalone} 

usepackage{tcolorbox,listings}
usepackage{listings}
usepackage{tikz}
usepackage{framed}

definecolor{background}{HTML}{EEEEEE}
definecolor{comments}{HTML}{868686}
definecolor{darkred}{RGB}{139,0,0}
definecolor{darkblue}{RGB}{0,0,139}
definecolor{chartreuse}{RGB}{127,255,0}
definecolor{drakgreen}{RGB}{0,128,0}
definecolor{lightgray}{RGB}{238,239,240}


lstset{
language=C++,
keywordstyle=color{darkblue},
basicstyle=normalfontttfamily,
commentstyle=color{comments}ttfamily,
stringstyle=rmfamily,
numbers=none,
numberstyle=scriptsize,
numbersep=8pt,
showstringspaces=false,
breaklines=true,
frameround=ftff,
%frame=single,
captionpos=t,
belowcaptionskip=0em,
belowskip=0em
}
lstdefinestyle{mystyle}{
language=C++,
extendedchars=true,
breaklines=true,
breakatwhitespace=true,
basicstyle=ttfamily,
numbers=none
}

tcbuselibrary{listings,skins,breakable}
newtcblisting{code}{
arc=0mm,
top=0mm,
bottom=0mm,
left=3mm,
right=0mm,
width=textwidth,
boxrule=1pt,
%colback=blue!20,
colback=lightgray,
listing only,
listing options={style=mystyle},
breakable
}

begin{document}
begin{code}
#include <iostream>
#include <fstream>
#include <functional>
#include <chrono>

using namespace std;
using namespace std::chrono;

int fib(int n) {
function<int (int,int,int)> iter;
iter=[n,&iter](int a,int b,int i) {
if(i>=n) {
return a;
}
else {
return iter(b,b+a,i+1);
}
};
return iter(0,1,0);
}

uint64_t count = 0;

uint64_t fibonacci(int n)
{
++::count;
if (::count - (::count >> 32 << 32) == 0)
cout << ::count << "n";
//++::count;
if (n == 1 || n == 2) {
return 1;
}
else
return fibonacci(n - 1) + fibonacci(n - 2);
}

end{code}

end{document}


enter image description here



Where is the problem?



No errors or warnings.The resulting list is:



(c.listing) [1

] (c.aux)

*File List*
standalone.cls 2018/03/26 v1.3a Class to compile TeX sub-files standalone
shellesc.sty 2016/06/07 v0.02a unified shell escape interface for LaTeX
ifluatex.sty 2016/05/16 v1.4 Provides the ifluatex switch (HO)
ifpdf.sty 2018/09/07 v3.3 Provides the ifpdf switch
ifxetex.sty 2010/09/12 v0.6 Provides ifxetex conditional
xkeyval.sty 2014/12/03 v2.7a package option processing (HA)
xkeyval.tex 2014/12/03 v2.7a key=value parser (HA)
standalone.cfg 2018/03/26 v1.3a Default configuration file for 'standalone'
class
article.cls 2014/09/29 v1.4h Standard LaTeX document class
size10.clo 2014/09/29 v1.4h Standard LaTeX file (size option)
tcolorbox.sty 2018/07/26 version 4.14 text color boxes
pgf.sty 2015/08/07 v3.0.1a (rcs-revision 1.15)
pgfrcs.sty 2015/08/07 v3.0.1a (rcs-revision 1.31)
everyshi.sty 2001/05/15 v3.00 EveryShipout Package (MS)
pgfrcs.code.tex
pgfcore.sty 2010/04/11 v3.0.1a (rcs-revision 1.7)
graphicx.sty 2017/06/01 v1.1a Enhanced LaTeX Graphics (DPC,SPQR)
graphics.sty 2017/06/25 v1.2c Standard LaTeX Graphics (DPC,SPQR)
trig.sty 2016/01/03 v1.10 sin cos tan (DPC)
graphics.cfg 2016/06/04 v1.11 sample graphics configuration
xetex.def 2017/06/24 v5.0h Graphics/color driver for xetex
pgfsys.sty 2014/07/09 v3.0.1a (rcs-revision 1.48)
pgfsys.code.tex
pgfsyssoftpath.code.tex 2013/09/09 (rcs-revision 1.9)
pgfsysprotocol.code.tex 2006/10/16 (rcs-revision 1.4)
xcolor.sty 2016/05/11 v2.12 LaTeX color extensions (UK)
color.cfg 2016/01/02 v1.6 sample color configuration
pgfcore.code.tex
pgfcomp-version-0-65.sty 2007/07/03 v3.0.1a (rcs-revision 1.7)
pgfcomp-version-1-18.sty 2007/07/23 v3.0.1a (rcs-revision 1.1)
verbatim.sty 2014/10/28 v1.5q LaTeX2e package for verbatim enhancements
environ.sty 2014/05/04 v0.3 A new way to define environments
trimspaces.sty 2009/09/17 v1.1 Trim spaces around a token list
etoolbox.sty 2018/08/19 v2.5f e-TeX tools for LaTeX (JAW)
listings.sty 2018/09/02 1.7 (Carsten Heinz)
lstmisc.sty 2018/09/02 1.7 (Carsten Heinz)
listings.cfg 2018/09/02 1.7 listings configuration
tikz.sty 2015/08/07 v3.0.1a (rcs-revision 1.151)
pgffor.sty 2013/12/13 v3.0.1a (rcs-revision 1.25)
pgfkeys.sty
pgfkeys.code.tex
pgfmath.sty
pgfmath.code.tex
pgffor.code.tex
tikz.code.tex
framed.sty 2011/10/22 v 0.96: framed or shaded text with page breaks
lstlang1.sty 2018/09/02 1.7 listings language file
lstlang1.sty 2018/09/02 1.7 listings language file
lstmisc.sty 2018/09/02 1.7 (Carsten Heinz)
pdftexcmds.sty 2018/09/10 v0.29 Utility functions of pdfTeX for LuaTeX (HO)
infwarerr.sty 2016/05/16 v1.4 Providing info/warning/error messages (HO)
ltxcmds.sty 2016/05/16 v1.23 LaTeX kernel commands for general use (HO)
c.listing
***********

)









share|improve this question
























  • Which strange output do you mean? Which version of package listings do you use (check the log file please). Which TeX distribution and version do you use (Please add the first line of your log file to your question)?
    – Kurt
    3 hours ago












  • I mean it produces a lot of ^ and I characters, which is not available in my C++ code.The first line of log file is:This is XeTeX, Version 3.14159265-2.6-0.99999 (MiKTeX 2.9.6880 64-bit) (preloaded format=xelatex 2018.11.12) 30 NOV 2018 10:20 entering extended mode **./c.tex (c.tex LaTeX2e <2018-04-01> patch level 5
    – mcmxciv
    3 hours ago












  • The listings's version is 1.7,which was released on September 5, 2018
    – mcmxciv
    3 hours ago










  • Well, I can compile your code without characters ^ in the output, my system is current MiKTeX 2.9. Do you get any error messages or warnings? Please add command listfiles as first command in your code and compile three times. Add the resulting list of used packages and version numbers to your question.
    – Kurt
    3 hours ago






  • 1




    The output of ^^I indicates the problem is related to tab characters in your code. I can't reproduce the problem, though, even if I replace the spaces in your example by tabs. Perhaps try adding literate={^^I}{{}}4 to your lstdefinestyle{mystyle} options.
    – siracusa
    2 hours ago















up vote
1
down vote

favorite
1












I use listing typography C++ code, it performs very well when formatting LaTeX code, but it has very strange character output when used to typeset C++ code. Here is my WME:



documentclass{standalone} 

usepackage{tcolorbox,listings}
usepackage{listings}
usepackage{tikz}
usepackage{framed}

definecolor{background}{HTML}{EEEEEE}
definecolor{comments}{HTML}{868686}
definecolor{darkred}{RGB}{139,0,0}
definecolor{darkblue}{RGB}{0,0,139}
definecolor{chartreuse}{RGB}{127,255,0}
definecolor{drakgreen}{RGB}{0,128,0}
definecolor{lightgray}{RGB}{238,239,240}


lstset{
language=C++,
keywordstyle=color{darkblue},
basicstyle=normalfontttfamily,
commentstyle=color{comments}ttfamily,
stringstyle=rmfamily,
numbers=none,
numberstyle=scriptsize,
numbersep=8pt,
showstringspaces=false,
breaklines=true,
frameround=ftff,
%frame=single,
captionpos=t,
belowcaptionskip=0em,
belowskip=0em
}
lstdefinestyle{mystyle}{
language=C++,
extendedchars=true,
breaklines=true,
breakatwhitespace=true,
basicstyle=ttfamily,
numbers=none
}

tcbuselibrary{listings,skins,breakable}
newtcblisting{code}{
arc=0mm,
top=0mm,
bottom=0mm,
left=3mm,
right=0mm,
width=textwidth,
boxrule=1pt,
%colback=blue!20,
colback=lightgray,
listing only,
listing options={style=mystyle},
breakable
}

begin{document}
begin{code}
#include <iostream>
#include <fstream>
#include <functional>
#include <chrono>

using namespace std;
using namespace std::chrono;

int fib(int n) {
function<int (int,int,int)> iter;
iter=[n,&iter](int a,int b,int i) {
if(i>=n) {
return a;
}
else {
return iter(b,b+a,i+1);
}
};
return iter(0,1,0);
}

uint64_t count = 0;

uint64_t fibonacci(int n)
{
++::count;
if (::count - (::count >> 32 << 32) == 0)
cout << ::count << "n";
//++::count;
if (n == 1 || n == 2) {
return 1;
}
else
return fibonacci(n - 1) + fibonacci(n - 2);
}

end{code}

end{document}


enter image description here



Where is the problem?



No errors or warnings.The resulting list is:



(c.listing) [1

] (c.aux)

*File List*
standalone.cls 2018/03/26 v1.3a Class to compile TeX sub-files standalone
shellesc.sty 2016/06/07 v0.02a unified shell escape interface for LaTeX
ifluatex.sty 2016/05/16 v1.4 Provides the ifluatex switch (HO)
ifpdf.sty 2018/09/07 v3.3 Provides the ifpdf switch
ifxetex.sty 2010/09/12 v0.6 Provides ifxetex conditional
xkeyval.sty 2014/12/03 v2.7a package option processing (HA)
xkeyval.tex 2014/12/03 v2.7a key=value parser (HA)
standalone.cfg 2018/03/26 v1.3a Default configuration file for 'standalone'
class
article.cls 2014/09/29 v1.4h Standard LaTeX document class
size10.clo 2014/09/29 v1.4h Standard LaTeX file (size option)
tcolorbox.sty 2018/07/26 version 4.14 text color boxes
pgf.sty 2015/08/07 v3.0.1a (rcs-revision 1.15)
pgfrcs.sty 2015/08/07 v3.0.1a (rcs-revision 1.31)
everyshi.sty 2001/05/15 v3.00 EveryShipout Package (MS)
pgfrcs.code.tex
pgfcore.sty 2010/04/11 v3.0.1a (rcs-revision 1.7)
graphicx.sty 2017/06/01 v1.1a Enhanced LaTeX Graphics (DPC,SPQR)
graphics.sty 2017/06/25 v1.2c Standard LaTeX Graphics (DPC,SPQR)
trig.sty 2016/01/03 v1.10 sin cos tan (DPC)
graphics.cfg 2016/06/04 v1.11 sample graphics configuration
xetex.def 2017/06/24 v5.0h Graphics/color driver for xetex
pgfsys.sty 2014/07/09 v3.0.1a (rcs-revision 1.48)
pgfsys.code.tex
pgfsyssoftpath.code.tex 2013/09/09 (rcs-revision 1.9)
pgfsysprotocol.code.tex 2006/10/16 (rcs-revision 1.4)
xcolor.sty 2016/05/11 v2.12 LaTeX color extensions (UK)
color.cfg 2016/01/02 v1.6 sample color configuration
pgfcore.code.tex
pgfcomp-version-0-65.sty 2007/07/03 v3.0.1a (rcs-revision 1.7)
pgfcomp-version-1-18.sty 2007/07/23 v3.0.1a (rcs-revision 1.1)
verbatim.sty 2014/10/28 v1.5q LaTeX2e package for verbatim enhancements
environ.sty 2014/05/04 v0.3 A new way to define environments
trimspaces.sty 2009/09/17 v1.1 Trim spaces around a token list
etoolbox.sty 2018/08/19 v2.5f e-TeX tools for LaTeX (JAW)
listings.sty 2018/09/02 1.7 (Carsten Heinz)
lstmisc.sty 2018/09/02 1.7 (Carsten Heinz)
listings.cfg 2018/09/02 1.7 listings configuration
tikz.sty 2015/08/07 v3.0.1a (rcs-revision 1.151)
pgffor.sty 2013/12/13 v3.0.1a (rcs-revision 1.25)
pgfkeys.sty
pgfkeys.code.tex
pgfmath.sty
pgfmath.code.tex
pgffor.code.tex
tikz.code.tex
framed.sty 2011/10/22 v 0.96: framed or shaded text with page breaks
lstlang1.sty 2018/09/02 1.7 listings language file
lstlang1.sty 2018/09/02 1.7 listings language file
lstmisc.sty 2018/09/02 1.7 (Carsten Heinz)
pdftexcmds.sty 2018/09/10 v0.29 Utility functions of pdfTeX for LuaTeX (HO)
infwarerr.sty 2016/05/16 v1.4 Providing info/warning/error messages (HO)
ltxcmds.sty 2016/05/16 v1.23 LaTeX kernel commands for general use (HO)
c.listing
***********

)









share|improve this question
























  • Which strange output do you mean? Which version of package listings do you use (check the log file please). Which TeX distribution and version do you use (Please add the first line of your log file to your question)?
    – Kurt
    3 hours ago












  • I mean it produces a lot of ^ and I characters, which is not available in my C++ code.The first line of log file is:This is XeTeX, Version 3.14159265-2.6-0.99999 (MiKTeX 2.9.6880 64-bit) (preloaded format=xelatex 2018.11.12) 30 NOV 2018 10:20 entering extended mode **./c.tex (c.tex LaTeX2e <2018-04-01> patch level 5
    – mcmxciv
    3 hours ago












  • The listings's version is 1.7,which was released on September 5, 2018
    – mcmxciv
    3 hours ago










  • Well, I can compile your code without characters ^ in the output, my system is current MiKTeX 2.9. Do you get any error messages or warnings? Please add command listfiles as first command in your code and compile three times. Add the resulting list of used packages and version numbers to your question.
    – Kurt
    3 hours ago






  • 1




    The output of ^^I indicates the problem is related to tab characters in your code. I can't reproduce the problem, though, even if I replace the spaces in your example by tabs. Perhaps try adding literate={^^I}{{}}4 to your lstdefinestyle{mystyle} options.
    – siracusa
    2 hours ago













up vote
1
down vote

favorite
1









up vote
1
down vote

favorite
1






1





I use listing typography C++ code, it performs very well when formatting LaTeX code, but it has very strange character output when used to typeset C++ code. Here is my WME:



documentclass{standalone} 

usepackage{tcolorbox,listings}
usepackage{listings}
usepackage{tikz}
usepackage{framed}

definecolor{background}{HTML}{EEEEEE}
definecolor{comments}{HTML}{868686}
definecolor{darkred}{RGB}{139,0,0}
definecolor{darkblue}{RGB}{0,0,139}
definecolor{chartreuse}{RGB}{127,255,0}
definecolor{drakgreen}{RGB}{0,128,0}
definecolor{lightgray}{RGB}{238,239,240}


lstset{
language=C++,
keywordstyle=color{darkblue},
basicstyle=normalfontttfamily,
commentstyle=color{comments}ttfamily,
stringstyle=rmfamily,
numbers=none,
numberstyle=scriptsize,
numbersep=8pt,
showstringspaces=false,
breaklines=true,
frameround=ftff,
%frame=single,
captionpos=t,
belowcaptionskip=0em,
belowskip=0em
}
lstdefinestyle{mystyle}{
language=C++,
extendedchars=true,
breaklines=true,
breakatwhitespace=true,
basicstyle=ttfamily,
numbers=none
}

tcbuselibrary{listings,skins,breakable}
newtcblisting{code}{
arc=0mm,
top=0mm,
bottom=0mm,
left=3mm,
right=0mm,
width=textwidth,
boxrule=1pt,
%colback=blue!20,
colback=lightgray,
listing only,
listing options={style=mystyle},
breakable
}

begin{document}
begin{code}
#include <iostream>
#include <fstream>
#include <functional>
#include <chrono>

using namespace std;
using namespace std::chrono;

int fib(int n) {
function<int (int,int,int)> iter;
iter=[n,&iter](int a,int b,int i) {
if(i>=n) {
return a;
}
else {
return iter(b,b+a,i+1);
}
};
return iter(0,1,0);
}

uint64_t count = 0;

uint64_t fibonacci(int n)
{
++::count;
if (::count - (::count >> 32 << 32) == 0)
cout << ::count << "n";
//++::count;
if (n == 1 || n == 2) {
return 1;
}
else
return fibonacci(n - 1) + fibonacci(n - 2);
}

end{code}

end{document}


enter image description here



Where is the problem?



No errors or warnings.The resulting list is:



(c.listing) [1

] (c.aux)

*File List*
standalone.cls 2018/03/26 v1.3a Class to compile TeX sub-files standalone
shellesc.sty 2016/06/07 v0.02a unified shell escape interface for LaTeX
ifluatex.sty 2016/05/16 v1.4 Provides the ifluatex switch (HO)
ifpdf.sty 2018/09/07 v3.3 Provides the ifpdf switch
ifxetex.sty 2010/09/12 v0.6 Provides ifxetex conditional
xkeyval.sty 2014/12/03 v2.7a package option processing (HA)
xkeyval.tex 2014/12/03 v2.7a key=value parser (HA)
standalone.cfg 2018/03/26 v1.3a Default configuration file for 'standalone'
class
article.cls 2014/09/29 v1.4h Standard LaTeX document class
size10.clo 2014/09/29 v1.4h Standard LaTeX file (size option)
tcolorbox.sty 2018/07/26 version 4.14 text color boxes
pgf.sty 2015/08/07 v3.0.1a (rcs-revision 1.15)
pgfrcs.sty 2015/08/07 v3.0.1a (rcs-revision 1.31)
everyshi.sty 2001/05/15 v3.00 EveryShipout Package (MS)
pgfrcs.code.tex
pgfcore.sty 2010/04/11 v3.0.1a (rcs-revision 1.7)
graphicx.sty 2017/06/01 v1.1a Enhanced LaTeX Graphics (DPC,SPQR)
graphics.sty 2017/06/25 v1.2c Standard LaTeX Graphics (DPC,SPQR)
trig.sty 2016/01/03 v1.10 sin cos tan (DPC)
graphics.cfg 2016/06/04 v1.11 sample graphics configuration
xetex.def 2017/06/24 v5.0h Graphics/color driver for xetex
pgfsys.sty 2014/07/09 v3.0.1a (rcs-revision 1.48)
pgfsys.code.tex
pgfsyssoftpath.code.tex 2013/09/09 (rcs-revision 1.9)
pgfsysprotocol.code.tex 2006/10/16 (rcs-revision 1.4)
xcolor.sty 2016/05/11 v2.12 LaTeX color extensions (UK)
color.cfg 2016/01/02 v1.6 sample color configuration
pgfcore.code.tex
pgfcomp-version-0-65.sty 2007/07/03 v3.0.1a (rcs-revision 1.7)
pgfcomp-version-1-18.sty 2007/07/23 v3.0.1a (rcs-revision 1.1)
verbatim.sty 2014/10/28 v1.5q LaTeX2e package for verbatim enhancements
environ.sty 2014/05/04 v0.3 A new way to define environments
trimspaces.sty 2009/09/17 v1.1 Trim spaces around a token list
etoolbox.sty 2018/08/19 v2.5f e-TeX tools for LaTeX (JAW)
listings.sty 2018/09/02 1.7 (Carsten Heinz)
lstmisc.sty 2018/09/02 1.7 (Carsten Heinz)
listings.cfg 2018/09/02 1.7 listings configuration
tikz.sty 2015/08/07 v3.0.1a (rcs-revision 1.151)
pgffor.sty 2013/12/13 v3.0.1a (rcs-revision 1.25)
pgfkeys.sty
pgfkeys.code.tex
pgfmath.sty
pgfmath.code.tex
pgffor.code.tex
tikz.code.tex
framed.sty 2011/10/22 v 0.96: framed or shaded text with page breaks
lstlang1.sty 2018/09/02 1.7 listings language file
lstlang1.sty 2018/09/02 1.7 listings language file
lstmisc.sty 2018/09/02 1.7 (Carsten Heinz)
pdftexcmds.sty 2018/09/10 v0.29 Utility functions of pdfTeX for LuaTeX (HO)
infwarerr.sty 2016/05/16 v1.4 Providing info/warning/error messages (HO)
ltxcmds.sty 2016/05/16 v1.23 LaTeX kernel commands for general use (HO)
c.listing
***********

)









share|improve this question















I use listing typography C++ code, it performs very well when formatting LaTeX code, but it has very strange character output when used to typeset C++ code. Here is my WME:



documentclass{standalone} 

usepackage{tcolorbox,listings}
usepackage{listings}
usepackage{tikz}
usepackage{framed}

definecolor{background}{HTML}{EEEEEE}
definecolor{comments}{HTML}{868686}
definecolor{darkred}{RGB}{139,0,0}
definecolor{darkblue}{RGB}{0,0,139}
definecolor{chartreuse}{RGB}{127,255,0}
definecolor{drakgreen}{RGB}{0,128,0}
definecolor{lightgray}{RGB}{238,239,240}


lstset{
language=C++,
keywordstyle=color{darkblue},
basicstyle=normalfontttfamily,
commentstyle=color{comments}ttfamily,
stringstyle=rmfamily,
numbers=none,
numberstyle=scriptsize,
numbersep=8pt,
showstringspaces=false,
breaklines=true,
frameround=ftff,
%frame=single,
captionpos=t,
belowcaptionskip=0em,
belowskip=0em
}
lstdefinestyle{mystyle}{
language=C++,
extendedchars=true,
breaklines=true,
breakatwhitespace=true,
basicstyle=ttfamily,
numbers=none
}

tcbuselibrary{listings,skins,breakable}
newtcblisting{code}{
arc=0mm,
top=0mm,
bottom=0mm,
left=3mm,
right=0mm,
width=textwidth,
boxrule=1pt,
%colback=blue!20,
colback=lightgray,
listing only,
listing options={style=mystyle},
breakable
}

begin{document}
begin{code}
#include <iostream>
#include <fstream>
#include <functional>
#include <chrono>

using namespace std;
using namespace std::chrono;

int fib(int n) {
function<int (int,int,int)> iter;
iter=[n,&iter](int a,int b,int i) {
if(i>=n) {
return a;
}
else {
return iter(b,b+a,i+1);
}
};
return iter(0,1,0);
}

uint64_t count = 0;

uint64_t fibonacci(int n)
{
++::count;
if (::count - (::count >> 32 << 32) == 0)
cout << ::count << "n";
//++::count;
if (n == 1 || n == 2) {
return 1;
}
else
return fibonacci(n - 1) + fibonacci(n - 2);
}

end{code}

end{document}


enter image description here



Where is the problem?



No errors or warnings.The resulting list is:



(c.listing) [1

] (c.aux)

*File List*
standalone.cls 2018/03/26 v1.3a Class to compile TeX sub-files standalone
shellesc.sty 2016/06/07 v0.02a unified shell escape interface for LaTeX
ifluatex.sty 2016/05/16 v1.4 Provides the ifluatex switch (HO)
ifpdf.sty 2018/09/07 v3.3 Provides the ifpdf switch
ifxetex.sty 2010/09/12 v0.6 Provides ifxetex conditional
xkeyval.sty 2014/12/03 v2.7a package option processing (HA)
xkeyval.tex 2014/12/03 v2.7a key=value parser (HA)
standalone.cfg 2018/03/26 v1.3a Default configuration file for 'standalone'
class
article.cls 2014/09/29 v1.4h Standard LaTeX document class
size10.clo 2014/09/29 v1.4h Standard LaTeX file (size option)
tcolorbox.sty 2018/07/26 version 4.14 text color boxes
pgf.sty 2015/08/07 v3.0.1a (rcs-revision 1.15)
pgfrcs.sty 2015/08/07 v3.0.1a (rcs-revision 1.31)
everyshi.sty 2001/05/15 v3.00 EveryShipout Package (MS)
pgfrcs.code.tex
pgfcore.sty 2010/04/11 v3.0.1a (rcs-revision 1.7)
graphicx.sty 2017/06/01 v1.1a Enhanced LaTeX Graphics (DPC,SPQR)
graphics.sty 2017/06/25 v1.2c Standard LaTeX Graphics (DPC,SPQR)
trig.sty 2016/01/03 v1.10 sin cos tan (DPC)
graphics.cfg 2016/06/04 v1.11 sample graphics configuration
xetex.def 2017/06/24 v5.0h Graphics/color driver for xetex
pgfsys.sty 2014/07/09 v3.0.1a (rcs-revision 1.48)
pgfsys.code.tex
pgfsyssoftpath.code.tex 2013/09/09 (rcs-revision 1.9)
pgfsysprotocol.code.tex 2006/10/16 (rcs-revision 1.4)
xcolor.sty 2016/05/11 v2.12 LaTeX color extensions (UK)
color.cfg 2016/01/02 v1.6 sample color configuration
pgfcore.code.tex
pgfcomp-version-0-65.sty 2007/07/03 v3.0.1a (rcs-revision 1.7)
pgfcomp-version-1-18.sty 2007/07/23 v3.0.1a (rcs-revision 1.1)
verbatim.sty 2014/10/28 v1.5q LaTeX2e package for verbatim enhancements
environ.sty 2014/05/04 v0.3 A new way to define environments
trimspaces.sty 2009/09/17 v1.1 Trim spaces around a token list
etoolbox.sty 2018/08/19 v2.5f e-TeX tools for LaTeX (JAW)
listings.sty 2018/09/02 1.7 (Carsten Heinz)
lstmisc.sty 2018/09/02 1.7 (Carsten Heinz)
listings.cfg 2018/09/02 1.7 listings configuration
tikz.sty 2015/08/07 v3.0.1a (rcs-revision 1.151)
pgffor.sty 2013/12/13 v3.0.1a (rcs-revision 1.25)
pgfkeys.sty
pgfkeys.code.tex
pgfmath.sty
pgfmath.code.tex
pgffor.code.tex
tikz.code.tex
framed.sty 2011/10/22 v 0.96: framed or shaded text with page breaks
lstlang1.sty 2018/09/02 1.7 listings language file
lstlang1.sty 2018/09/02 1.7 listings language file
lstmisc.sty 2018/09/02 1.7 (Carsten Heinz)
pdftexcmds.sty 2018/09/10 v0.29 Utility functions of pdfTeX for LuaTeX (HO)
infwarerr.sty 2016/05/16 v1.4 Providing info/warning/error messages (HO)
ltxcmds.sty 2016/05/16 v1.23 LaTeX kernel commands for general use (HO)
c.listing
***********

)






lstlisting






share|improve this question















share|improve this question













share|improve this question




share|improve this question








edited 3 hours ago

























asked 3 hours ago









mcmxciv

477




477












  • Which strange output do you mean? Which version of package listings do you use (check the log file please). Which TeX distribution and version do you use (Please add the first line of your log file to your question)?
    – Kurt
    3 hours ago












  • I mean it produces a lot of ^ and I characters, which is not available in my C++ code.The first line of log file is:This is XeTeX, Version 3.14159265-2.6-0.99999 (MiKTeX 2.9.6880 64-bit) (preloaded format=xelatex 2018.11.12) 30 NOV 2018 10:20 entering extended mode **./c.tex (c.tex LaTeX2e <2018-04-01> patch level 5
    – mcmxciv
    3 hours ago












  • The listings's version is 1.7,which was released on September 5, 2018
    – mcmxciv
    3 hours ago










  • Well, I can compile your code without characters ^ in the output, my system is current MiKTeX 2.9. Do you get any error messages or warnings? Please add command listfiles as first command in your code and compile three times. Add the resulting list of used packages and version numbers to your question.
    – Kurt
    3 hours ago






  • 1




    The output of ^^I indicates the problem is related to tab characters in your code. I can't reproduce the problem, though, even if I replace the spaces in your example by tabs. Perhaps try adding literate={^^I}{{}}4 to your lstdefinestyle{mystyle} options.
    – siracusa
    2 hours ago


















  • Which strange output do you mean? Which version of package listings do you use (check the log file please). Which TeX distribution and version do you use (Please add the first line of your log file to your question)?
    – Kurt
    3 hours ago












  • I mean it produces a lot of ^ and I characters, which is not available in my C++ code.The first line of log file is:This is XeTeX, Version 3.14159265-2.6-0.99999 (MiKTeX 2.9.6880 64-bit) (preloaded format=xelatex 2018.11.12) 30 NOV 2018 10:20 entering extended mode **./c.tex (c.tex LaTeX2e <2018-04-01> patch level 5
    – mcmxciv
    3 hours ago












  • The listings's version is 1.7,which was released on September 5, 2018
    – mcmxciv
    3 hours ago










  • Well, I can compile your code without characters ^ in the output, my system is current MiKTeX 2.9. Do you get any error messages or warnings? Please add command listfiles as first command in your code and compile three times. Add the resulting list of used packages and version numbers to your question.
    – Kurt
    3 hours ago






  • 1




    The output of ^^I indicates the problem is related to tab characters in your code. I can't reproduce the problem, though, even if I replace the spaces in your example by tabs. Perhaps try adding literate={^^I}{{}}4 to your lstdefinestyle{mystyle} options.
    – siracusa
    2 hours ago
















Which strange output do you mean? Which version of package listings do you use (check the log file please). Which TeX distribution and version do you use (Please add the first line of your log file to your question)?
– Kurt
3 hours ago






Which strange output do you mean? Which version of package listings do you use (check the log file please). Which TeX distribution and version do you use (Please add the first line of your log file to your question)?
– Kurt
3 hours ago














I mean it produces a lot of ^ and I characters, which is not available in my C++ code.The first line of log file is:This is XeTeX, Version 3.14159265-2.6-0.99999 (MiKTeX 2.9.6880 64-bit) (preloaded format=xelatex 2018.11.12) 30 NOV 2018 10:20 entering extended mode **./c.tex (c.tex LaTeX2e <2018-04-01> patch level 5
– mcmxciv
3 hours ago






I mean it produces a lot of ^ and I characters, which is not available in my C++ code.The first line of log file is:This is XeTeX, Version 3.14159265-2.6-0.99999 (MiKTeX 2.9.6880 64-bit) (preloaded format=xelatex 2018.11.12) 30 NOV 2018 10:20 entering extended mode **./c.tex (c.tex LaTeX2e <2018-04-01> patch level 5
– mcmxciv
3 hours ago














The listings's version is 1.7,which was released on September 5, 2018
– mcmxciv
3 hours ago




The listings's version is 1.7,which was released on September 5, 2018
– mcmxciv
3 hours ago












Well, I can compile your code without characters ^ in the output, my system is current MiKTeX 2.9. Do you get any error messages or warnings? Please add command listfiles as first command in your code and compile three times. Add the resulting list of used packages and version numbers to your question.
– Kurt
3 hours ago




Well, I can compile your code without characters ^ in the output, my system is current MiKTeX 2.9. Do you get any error messages or warnings? Please add command listfiles as first command in your code and compile three times. Add the resulting list of used packages and version numbers to your question.
– Kurt
3 hours ago




1




1




The output of ^^I indicates the problem is related to tab characters in your code. I can't reproduce the problem, though, even if I replace the spaces in your example by tabs. Perhaps try adding literate={^^I}{{}}4 to your lstdefinestyle{mystyle} options.
– siracusa
2 hours ago




The output of ^^I indicates the problem is related to tab characters in your code. I can't reproduce the problem, though, even if I replace the spaces in your example by tabs. Perhaps try adding literate={^^I}{{}}4 to your lstdefinestyle{mystyle} options.
– siracusa
2 hours ago















active

oldest

votes











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%2f462499%2fstrange-output-of-typeset-c-code%23new-answer', 'question_page');
}
);

Post as a guest















Required, but never shown






























active

oldest

votes













active

oldest

votes









active

oldest

votes






active

oldest

votes
















draft saved

draft discarded




















































Thanks for contributing an answer to TeX - LaTeX Stack Exchange!


  • Please be sure to answer the question. Provide details and share your research!

But avoid



  • Asking for help, clarification, or responding to other answers.

  • Making statements based on opinion; back them up with references or personal experience.


To learn more, see our tips on writing great answers.





Some of your past answers have not been well-received, and you're in danger of being blocked from answering.


Please pay close attention to the following guidance:


  • Please be sure to answer the question. Provide details and share your research!

But avoid



  • Asking for help, clarification, or responding to other answers.

  • Making statements based on opinion; back them up with references or personal experience.


To learn more, see our tips on writing great answers.




draft saved


draft discarded














StackExchange.ready(
function () {
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2ftex.stackexchange.com%2fquestions%2f462499%2fstrange-output-of-typeset-c-code%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

サソリ

広島県道265号伴広島線

Setup Asymptote in Texstudio