framextopmargin 不起作用 listings.sty

framextopmargin 不起作用 listings.sty

尝试过

\documentclass{article}
\usepackage{xcolor,listings}

\usepackage{showframe}
\begin{document}

\lstset{%
    frame=leftline,%
    framerule=3pt,%
framextopmargin=20pt,
    rulecolor=\color{black!60},%
        extendedchars=true,%
    columns=fixed,%
    basicstyle=\tt\footnotesize,%
    keywordstyle=\tt\bfseries,%
        showstringspaces=false,%
        showspaces=false,%
        tabsize=2,%
    breaklines,
breakatwhitespace,%
        showtabs=false,%
        captionpos=b,
    backgroundcolor=\color{black!10},%
}

\noindent
\begin{lstlisting}[framextopmargin=120pt,language=python,caption={Example of a textual specification for a traditional software function as common in software projects, describing what the function does and how to compute the results (pointing to another document for details in this case). A developer can implement this function according to the specification, without needing to understand the rest of the system. Another developer working on another part of the system can rely on this function without having access to its implementation.}]
def compute_deductions(agi, expenses):
    """
    Compute deductions based on provided adjusted gross income
    and expenses in customer data.

    See tax code 26 U.S. Code A.1.B, PART VI.

    Adjusted gross income must be a positive value.
    Returns computed deduction value.
    """
\end{lstlisting}

\end{document}

在这个例子中,framextopmargin=20pt,工作不正常。

相关内容