programming-journal / programming

21 stars 15 forks source link

Line numbers spill into margin #50

Closed m1dnight closed 3 years ago

m1dnight commented 3 years ago

Hi,

I am in the process of getting my submission published, but there are some issues. The line numbers of listings spill over into the margins. I have checked previous papers, and this is the intended behavior. However, if I understand correctly, there is a new publisher or so, and they require the line numbers to be inside the margins.

In an attempt to fix this, I noticed that the gray background of the listing is applied to the line numbers as well, and that doesn't look too good.

A minimal working example below.

% -*- coding: utf-8; -*-
% vim: set fileencoding=utf-8 :
\documentclass[english,crc]{programming}
%% First parameter: the language is 'english'.
%% Second parameter: use 'submission' for initial submission, remove it for camera-ready (see 5.1)

\usepackage[backend=biber,maxbibnames=2, maxcitenames=2, backend=biber]{biblatex}

%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%
% Packages and Commands specific to article (see 3)
%
% These ones  are used in the guide, replace with your own.
% 
\usepackage{listings}
\usepackage{hyperref}
\usepackage[capitalize]{cleveref}
\usepackage{multirow}
\usepackage{parcolumns}

% Fancy tables 
\usepackage[normalem]{ulem}

\usepackage[showframe]{geometry}
\usepackage{floatrow}
\usepackage{minted}
\usepackage{tikz}
\usepackage{float} 
\usepackage{xparse} 
\include{circles}
\usepackage{caption}
\usepackage[minted,xparse,breakable]{tcolorbox}

\floatsetup[listing]{style=Plaintop}    
\floatsetup[table]{style=Plaintop}  

% \floatsetup[figure]{style=Plainbottom}  
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
\include{commands}
\include{listings}

\usepackage{xcolor}
\usepackage{caption}
% %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
\lstdefinelanguage[programming]{TeX}[AlLaTeX]{TeX}{%
  deletetexcs={title,author,bibliography},%
  deletekeywords={tabular},
  morekeywords={abstract},%
  moretexcs={chapter},%
  moretexcs=[2]{title,author,subtitle,keywords,maketitle,titlerunning,authorinfo,affiliation,authorrunning,paperdetails,acks,email},
  moretexcs=[3]{addbibresource,printbibliography,bibliography},%
}%
\lstset{%
  language={[programming]TeX},%
  keywordstyle=\firamedium,
  stringstyle=\color{RosyBrown},%
  texcsstyle=*{\color{Purple}\mdseries},%
  texcsstyle=*[2]{\color{Blue1}},%
  texcsstyle=*[3]{\color{ForestGreen}},%
  commentstyle={\color{FireBrick}},%
  escapechar=`,}
\newcommand*{\CTAN}[1]{\href{http://ctan.org/tex-archive/#1}{\nolinkurl{CTAN:#1}}}

\makeatletter
\AtBeginEnvironment{minted}{\dontdofcolorbox}
\def\dontdofcolorbox{\renewcommand\fcolorbox[4][]{##4}}
\makeatother

\begin{document}

\title{The Art of the Meta Stream Protocol}
\subtitle{Torrents of Streams}% optional
% \titlerunning{Preparing Articles for Programming} %optional, in case that the title is too long; the running title should fit into the top page column

\author[a]{Christophe De Troyer}
\authorinfo{\email{foo@bar.com}}
\affiliation[a]{Vrije Universiteit Brussel, Brussels, Belgium}

\keywords{stream processing, functional programming, extensibility, meta-programming, library design}

%% These data are provided by the editors. May be left out on submission.
\paperdetails{
    submitted=2020-10-01,
    published=2021-07-15,
    year=2022,
    volume=6,
    issue=1,
    articlenumber=2
}

%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%

%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
\begin{CCSXML}
    <ccs2012>
    <concept>
    <concept_id>10011007.10011006.10011072</concept_id>
    <concept_desc>Software and its engineering~Software libraries and repositories</concept_desc>
    <concept_significance>500</concept_significance>
    </concept>
    <concept>
    <concept_id>10011007.10011006.10011008.10011009.10011012</concept_id>
    <concept_desc>Software and its engineering~Functional languages</concept_desc>
    <concept_significance>300</concept_significance>
    </concept>
    <concept>
    <concept_id>10003752.10010124.10010125.10010127</concept_id>
    <concept_desc>Theory of computation~Functional constructs</concept_desc>
    <concept_significance>300</concept_significance>
    </concept>
    </ccs2012>
\end{CCSXML}

\ccsdesc[500]{Software and its engineering~Software libraries and repositories}
\ccsdesc[300]{Software and its engineering~Functional languages}
\ccsdesc[300]{Theory of computation~Functional constructs}

% To HERE
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%

\maketitle

\begin{abstract}
    Super Abstract
\end{abstract}

\section{Intro}

\begin{listing}[H]
    \caption{Error handling in Akka Streams using Decider. All IllegalArgumentExceptions cause a restart, and other exceptions stop the stream execution.}
    \label{figure:error}
    \begin{minted}{scala}
val decider: Supervision.Decider = {
  case _: IllegalArgumentException => Supervision.Restart
  case _                           => Supervision.Stop
}
val flow = Flow[Int]
  .scan(0) { (acc, elem) =>
    if (elem < 0) throw new IllegalArgumentException("negative not allowed")
    else acc + elem
  }
  .withAttributes(ActorAttributes.supervisionStrategy(decider))
val source = Source(List(1, 3, -1, 5, 7)).via(flow)
val result = source.runWith(Sink.seq)
    \end{minted}
\end{listing}

\cref{figure:error} spills over into the margin with its line numbers. \cref{figure:good} doesn't, but the background of the line numbers is gray instead of white.

\begin{listing}[H]
    \caption{Error handling in Akka Streams using Decider. All IllegalArgumentExceptions cause a restart, and other exceptions stop the stream execution.}
    \label{figure:good}
    \begin{minted}[xleftmargin=\parindent]{scala}
val decider: Supervision.Decider = {
  case _: IllegalArgumentException => Supervision.Restart
  case _                           => Supervision.Stop
}
val flow = Flow[Int]
  .scan(0) { (acc, elem) =>
    if (elem < 0) throw new IllegalArgumentException("negative not allowed")
    else acc + elem
  }
  .withAttributes(ActorAttributes.supervisionStrategy(decider))
val source = Source(List(1, 3, -1, 5, 7)).via(flow)
val result = source.runWith(Sink.seq)
    \end{minted}
\end{listing}

\end{document}
krono commented 3 years ago

Hi,

Line numbers in the margin is intended behavior.

@dbeyer please don't flag line numbers in the maring :)

m1dnight commented 3 years ago

Ah, there must have been a misunderstanding! I will link back to this issue in the e-mail correspondence. Thanks for the prompt answer.

krono commented 3 years ago

I think we're done here :)