The inserted code has extra blank lines
up vote
0
down vote
favorite
I'm using listings to format blocks of code in my xeLaTeX.When I insert this picture into Anki's card, the inserted code has extra blank lines. Following is my MWE:
documentclass{standalone}
usepackage{tcolorbox,listings}
usepackage{fontspec}
setmonofont{Consolas}
usepackage{color}
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=[LaTeX]Tex,
keywordstyle=color{darkblue},
texcsstyle=*color{blue},
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,
literate=
*{{}{{textcolor{darkred}{{}}}{1}
{}}{{textcolor{darkred}{}}}}{1}
{[}{{textcolor{darkred}{[}}}{1}
{]}{{textcolor{darkred}{]}}}{1},
}
lstdefinestyle{mystyle}{
language=[LaTeX]Tex,
extendedchars=true,
breaklines=true,
breakatwhitespace=true,
basicstyle=ttfamily,
numbers=none,
keywordstyle=color{darkblue},
keywordstyle=[2]color{blue},
keywordstyle=[3]color{darkblue},
keywordstyle=[4]color{drakgreen},
alsoletter = {!},
keywords=[2]{definecolor,node,addplot},
keywords=[3]{usepackage},
keywords=[4]{begin,end,document,figure,figure*,axis}
}
tcbuselibrary{listings,skins,breakable}
newtcblisting{code}{
arc=0mm,
top=0mm,
bottom=0mm,
left=3mm,
right=0mm,
width=textwidth,
boxrule=1pt,
colback=lightgray,
listing only,
listing options={style=mystyle},
breakable
}
begin{document}
begin{code}
begin{tikzpicture}
filldraw [gray] (0,0) circle (2pt)
(1,1) circle (2pt)
(2,1) circle (2pt)
(2,0) circle (2pt);
draw (0,0) .. controls (1,1) and (2,1) .. (2,0);
end{tikzpicture}
end{code}
[/latex]
When executed, that is, run via pdflatex or via latex followed by dvips, the resulting will contain something that looks like this:
We are working on
begin{tikzpicture}
draw (-1.5,0) -- (1.5,0);
draw (0,-1.5) -- (0,1.5);
end{tikzpicture}.
begin{document}
How to eliminate the extra blank lines at the top?
listings
add a comment |
up vote
0
down vote
favorite
I'm using listings to format blocks of code in my xeLaTeX.When I insert this picture into Anki's card, the inserted code has extra blank lines. Following is my MWE:
documentclass{standalone}
usepackage{tcolorbox,listings}
usepackage{fontspec}
setmonofont{Consolas}
usepackage{color}
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=[LaTeX]Tex,
keywordstyle=color{darkblue},
texcsstyle=*color{blue},
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,
literate=
*{{}{{textcolor{darkred}{{}}}{1}
{}}{{textcolor{darkred}{}}}}{1}
{[}{{textcolor{darkred}{[}}}{1}
{]}{{textcolor{darkred}{]}}}{1},
}
lstdefinestyle{mystyle}{
language=[LaTeX]Tex,
extendedchars=true,
breaklines=true,
breakatwhitespace=true,
basicstyle=ttfamily,
numbers=none,
keywordstyle=color{darkblue},
keywordstyle=[2]color{blue},
keywordstyle=[3]color{darkblue},
keywordstyle=[4]color{drakgreen},
alsoletter = {!},
keywords=[2]{definecolor,node,addplot},
keywords=[3]{usepackage},
keywords=[4]{begin,end,document,figure,figure*,axis}
}
tcbuselibrary{listings,skins,breakable}
newtcblisting{code}{
arc=0mm,
top=0mm,
bottom=0mm,
left=3mm,
right=0mm,
width=textwidth,
boxrule=1pt,
colback=lightgray,
listing only,
listing options={style=mystyle},
breakable
}
begin{document}
begin{code}
begin{tikzpicture}
filldraw [gray] (0,0) circle (2pt)
(1,1) circle (2pt)
(2,1) circle (2pt)
(2,0) circle (2pt);
draw (0,0) .. controls (1,1) and (2,1) .. (2,0);
end{tikzpicture}
end{code}
[/latex]
When executed, that is, run via pdflatex or via latex followed by dvips, the resulting will contain something that looks like this:
We are working on
begin{tikzpicture}
draw (-1.5,0) -- (1.5,0);
draw (0,-1.5) -- (0,1.5);
end{tikzpicture}.
begin{document}
How to eliminate the extra blank lines at the top?
listings
add a comment |
up vote
0
down vote
favorite
up vote
0
down vote
favorite
I'm using listings to format blocks of code in my xeLaTeX.When I insert this picture into Anki's card, the inserted code has extra blank lines. Following is my MWE:
documentclass{standalone}
usepackage{tcolorbox,listings}
usepackage{fontspec}
setmonofont{Consolas}
usepackage{color}
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=[LaTeX]Tex,
keywordstyle=color{darkblue},
texcsstyle=*color{blue},
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,
literate=
*{{}{{textcolor{darkred}{{}}}{1}
{}}{{textcolor{darkred}{}}}}{1}
{[}{{textcolor{darkred}{[}}}{1}
{]}{{textcolor{darkred}{]}}}{1},
}
lstdefinestyle{mystyle}{
language=[LaTeX]Tex,
extendedchars=true,
breaklines=true,
breakatwhitespace=true,
basicstyle=ttfamily,
numbers=none,
keywordstyle=color{darkblue},
keywordstyle=[2]color{blue},
keywordstyle=[3]color{darkblue},
keywordstyle=[4]color{drakgreen},
alsoletter = {!},
keywords=[2]{definecolor,node,addplot},
keywords=[3]{usepackage},
keywords=[4]{begin,end,document,figure,figure*,axis}
}
tcbuselibrary{listings,skins,breakable}
newtcblisting{code}{
arc=0mm,
top=0mm,
bottom=0mm,
left=3mm,
right=0mm,
width=textwidth,
boxrule=1pt,
colback=lightgray,
listing only,
listing options={style=mystyle},
breakable
}
begin{document}
begin{code}
begin{tikzpicture}
filldraw [gray] (0,0) circle (2pt)
(1,1) circle (2pt)
(2,1) circle (2pt)
(2,0) circle (2pt);
draw (0,0) .. controls (1,1) and (2,1) .. (2,0);
end{tikzpicture}
end{code}
[/latex]
When executed, that is, run via pdflatex or via latex followed by dvips, the resulting will contain something that looks like this:
We are working on
begin{tikzpicture}
draw (-1.5,0) -- (1.5,0);
draw (0,-1.5) -- (0,1.5);
end{tikzpicture}.
begin{document}
How to eliminate the extra blank lines at the top?
listings
I'm using listings to format blocks of code in my xeLaTeX.When I insert this picture into Anki's card, the inserted code has extra blank lines. Following is my MWE:
documentclass{standalone}
usepackage{tcolorbox,listings}
usepackage{fontspec}
setmonofont{Consolas}
usepackage{color}
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=[LaTeX]Tex,
keywordstyle=color{darkblue},
texcsstyle=*color{blue},
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,
literate=
*{{}{{textcolor{darkred}{{}}}{1}
{}}{{textcolor{darkred}{}}}}{1}
{[}{{textcolor{darkred}{[}}}{1}
{]}{{textcolor{darkred}{]}}}{1},
}
lstdefinestyle{mystyle}{
language=[LaTeX]Tex,
extendedchars=true,
breaklines=true,
breakatwhitespace=true,
basicstyle=ttfamily,
numbers=none,
keywordstyle=color{darkblue},
keywordstyle=[2]color{blue},
keywordstyle=[3]color{darkblue},
keywordstyle=[4]color{drakgreen},
alsoletter = {!},
keywords=[2]{definecolor,node,addplot},
keywords=[3]{usepackage},
keywords=[4]{begin,end,document,figure,figure*,axis}
}
tcbuselibrary{listings,skins,breakable}
newtcblisting{code}{
arc=0mm,
top=0mm,
bottom=0mm,
left=3mm,
right=0mm,
width=textwidth,
boxrule=1pt,
colback=lightgray,
listing only,
listing options={style=mystyle},
breakable
}
begin{document}
begin{code}
begin{tikzpicture}
filldraw [gray] (0,0) circle (2pt)
(1,1) circle (2pt)
(2,1) circle (2pt)
(2,0) circle (2pt);
draw (0,0) .. controls (1,1) and (2,1) .. (2,0);
end{tikzpicture}
end{code}
[/latex]
When executed, that is, run via pdflatex or via latex followed by dvips, the resulting will contain something that looks like this:
We are working on
begin{tikzpicture}
draw (-1.5,0) -- (1.5,0);
draw (0,-1.5) -- (0,1.5);
end{tikzpicture}.
begin{document}
How to eliminate the extra blank lines at the top?
listings
listings
asked 6 mins ago
mcmxciv
375
375
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%2f462321%2fthe-inserted-code-has-extra-blank-lines%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