如何将列表标题放在右边距?

如何将列表标题放在右边距?

我目前正在使用该包floatrow将我的图形的标题放在右边距。如何为listing环境(由 提供\usepackage[newfloat]{minted})内的标题实现相同的效果?

这是一个最小工作示例(MWE):

%!TEX program = xelatex
\documentclass[
    draft=false,     % final mode 
    paper=portrait,
    twoside=false,
    open=right,
    parskip=full,
    headings=big,
    version=last, %
    italian, % language (passed to babel and other packages)
            % (ngerman, english, french, ...)
]{scrbook} % Classes: scrartcl, scrreprt, scrbook

% ----------------------
% DIMENSIONI PAGINA
% ----------------------
\setlength{\oddsidemargin}{0.3cm}
\setlength{\textwidth}{0.7\textwidth}
\setlength{\marginparwidth}{2\marginparwidth}


\usepackage{lmodern}
\usepackage{amsmath}  % advanced math symbols pkg
\usepackage{amsthm, amsthm}
\usepackage[utf8]{inputenc} % utf8 encoding
\usepackage{graphicx} % pictures support
\usepackage{longtable} % table on multiple pages support
\usepackage[italian]{babel} % language support
\usepackage{enumitem} % custom enumeration support
\usepackage{rotating} % Rotating pictures support
\usepackage{floatrow} % Support for floated images
\usepackage{hyperref} % Support for href in toc
\usepackage{marvosym} % Currency symbols
\usepackage{fancyhdr} % Fancy headers
\usepackage{array}
\usepackage{footnote}
\usepackage{setspace}
\usepackage{afterpage} % Permette di mettere i numeri di pagina nel footer se si usa il package Fancyhdr
\usepackage{textcomp} % Package for copyright glyph
\usepackage[newfloat]{minted} % Package for highlight code
\usepackage{appendix} %Package for appendices
\usepackage{chngcntr} %Package for list of figures numeration
\usepackage{csquotes}
\usepackage{fontspec}
\usepackage[protrusion=true]{microtype}
\usepackage{mwe}


% ----------------------
% CUSTOMIZATION CAPITOLI
% ----------------------
\usepackage{xcolor}
\usepackage{graphicx}
\usepackage{etoolbox}
\usepackage{blindtext}

\renewcommand*{\sectionformat}{%
  \llap{\thesection\enskip}%
}

\renewcommand*{\subsectionformat}{%
  \llap{\thesubsection\enskip}%
}

% ----------------------
% FOOTNOTE AL MARGINE
% ----------------------
\usepackage{marginfix} % --> gestisce correttamente il posizionamento ai margini
\usepackage[%
   bottom,      % Footnotes appear always on bottom. This is necessary
   stable,      % Make footnotes stable in section titles
   perpage,     % Reset on each page
   side,       % Place footnotes in the margin
   ragged,      % Use RaggedRight
   marginal,
   norule,     % suppress rule above footnotes
   multiple,    % rearrange multiple footnotes intelligent in the text.
]{footmisc}
\setlength{\footnotemargin}{0.1mm} % --> distanza numero di nota a pie di pagine e testo
\definecolor{footnotecolor}{RGB}{78, 78, 78}
\def\footnotelayout{\raggedright\color{footnotecolor}} % --> raggedright coincide con text-align:left


% ----------------------
% CAPTION CUSTOMIZATION
% ----------------------
\usepackage[
    format=plain, 
    justification=raggedright,
    singlelinecheck=false
]{caption}
\captionsetup{figurename=FIGURE, labelsep=colon}
\captionsetup[figure]{font={color=footnotecolor,it,footnotesize},labelfont={color=black,bf,it,scriptsize}}
\captionsetup[listing]{font={color=footnotecolor,it,footnotesize},labelfont={color=black,bf,it,scriptsize}}
\renewcommand*{\figureformat}{ % --> elimina un punto di troppo sulla numerazione delle figure
    \figurename~\thefigure
       %  \autodot% DELETED
}

% ----------------------
% FLOATING
% ----------------------
\floatsetup{
    margins=hangright,
    capposition=beside,
    capbesideposition={bottom,right},
    floatwidth=\textwidth
}

\begin{document}
  \setminted{linenos,autogobble, frame=lines, framesep=3mm, tabsize=2, fontsize=\footnotesize,baselinestretch=1} %IMPOSTAZIONI 
  \chapter{Chapter}
  \blindtext\footnote{Lorem ipsum dolor sit amet, consectetur adipiscing elit. Cras accumsan rutrum dictum. Nunc volutpat egestas ante non efficitur. Sed pellentesque vulputate scelerisque.}
  \begin{figure}
    \includegraphics[width=\textwidth]{example-image-a}
    \caption{MWE to demonstrate how to place to images side-by-side}
  \end{figure}
  \blindtext
  \blindtext
  \begin{listing}
    \begin{minted}{objective-c}
        @interface XYZShoutingPerson : XYZPerson
        @end

        @implementation XYZShoutingPerson
          - (void)saySomething:(NSString *)greeting {
              NSString *uppercaseGreeting = [greeting uppercaseString];
              NSLog(@"%@", uppercaseGreeting);
          }
        @end
      \end{minted}
    \caption{Objective-c interface}
  \end{listing}
\end{document}

实际上这是我的图表(以及脚注,尽管并不重要)的结果

实际结果

这是我用来呈现代码列表的代码:

\begin{listing}[H]
        \inputminted{javascript}{code/reactive/simple_sum.js}
        \caption{Pseudocodice per la somma di due variabili}
        \label{code:somma_variabili_pseudocodice}
\end{listing}

结果如下: 代码清单示例

floatrow包中我期望即使对于列表的标题也会有相同的结果,但看来我错了......

相关内容