I am having issues with inline listings line wrapping. As you can see in the linked image, the period ending the sentence is on the next line due to wrapping of the cite-website
text. The listings package decided to wrap the text even though the whole of it is on the first line. If the red hook-arrow was not there, the period would fit there.
MWE:
\documentclass[twoside]{article}
\usepackage{lmodern}
\usepackage{amssymb,amsmath}
\usepackage{microtype}
\UseMicrotypeSet[protrusion]{basicmath} % disable protrusion for tt fonts
\usepackage{listings}
\usepackage[vmargin=1in,headheight=13pt,twoside,twocolumn,a5paper]{geometry}
\usepackage{accsupp}
\usepackage{MnSymbol}
\usepackage{textcomp}
\usepackage[usenames,dvipsnames,svgnames,table]{xcolor}
\newcommand{\noncopy}[1]{%
\BeginAccSupp{method=escape,ActualText={}}%
#1%
\EndAccSupp{}%
}
\lstset{breaklines=true,
xleftmargin=1.5em,framexleftmargin=1em,
basicstyle=\ttfamily,
upquote=true,
literate={`}{{\BeginAccSupp{method=plain,ActualText=`}‵\EndAccSupp{}}}1
{"}{{\BeginAccSupp{method=plain,ActualText="}"\EndAccSupp{}}}1
{'}{{\BeginAccSupp{method=plain,ActualText='}'\EndAccSupp{}}}1,
showstringspaces=false,
numbers=left, numberstyle=\scriptsize\noncopy,
%postbreak=\raisebox{0ex}[0ex][0ex]{\noncopy{\ensuremath{\color{red}\hookrightarrow}}},
prebreak=\raisebox{0ex}[0ex][0ex]{\noncopy{\ensuremath{\color{red}\rhookswarrow}}}
}
\begin{document}
Foo bar baaz \lstinline!cite-website!.
\end{document}
UPDATE 1
Here is smaller MWE. I am keeping the above in the post because I am actually using all those things in the actual document:
\documentclass[twoside]{article}
\usepackage{lmodern}
\usepackage{amssymb,amsmath}
\usepackage{listings}
\usepackage[vmargin=1in,headheight=13pt,twoside,twocolumn,a5paper]{geometry}
\usepackage{MnSymbol}
\usepackage{textcomp}
\lstset{breaklines=true,
basicstyle=\ttfamily,
showstringspaces=false,
prebreak=\raisebox{0ex}[0ex][0ex]{\ensuremath{\rhookswarrow}}}
\begin{document}
Foo bar baaz \lstinline!cite-website!.
\end{document}
listings
, have you had a look atminted
? It is a pretty good package to highlight code. Also, if you're inserting a URL, you could use\url
provided byhyperref
.org-mode
which I convert to LaTeX using Pandoc. It supports minted highlighting by default but the last time I tried it was not wrapping long lines, which is something I need.cite-website
is actually a name of a tool that I have created.\mintinline
doesn't support line breaks because it is intended to be use to single keywords. If you have snippets of code which are quite long, then perhaps you want them in their own small listings instead of having them inline?