如何刪除清單產生的白線?

如何刪除清單產生的白線?

我遇到了完全相同的問題,但是 texstudio 的 pdf 檢視器不會顯示該錯誤,所以我直到文件讀到 32 頁時才注意到。他的解決方案實際上有效(mdframed 的解決方案,其他方案在我的情況下沒有任何效果),但我無法手動遍歷文件中的 32 頁,手動格式化我擁有的每個程式碼片段。所以我需要一個能夠在整個文件中傳播的解決方案(很可能涉及調整序言中的清單環境)。

我手頭緊,所以我在 5 分鐘內完成了 MWE,抱歉。

\documentclass{book}

\usepackage{listings}
\usepackage{color}

\lstset{
    frame=lines,
    rulecolor=\color{deepblue},
    framesep = 5pt,
    language=C,
    aboveskip=3mm,
    belowskip=3mm,
    showstringspaces=false,
    columns=flexible,
    basicstyle={\small\ttfamily\color{cyan}},
    numbers=none,
    %numberstyle=\small\color{green},
    keywordstyle=\color{orange},
    commentstyle=\color{grey},
    stringstyle=\color{mauve},
    breaklines=true,
    breakatwhitespace=true,
    backgroundcolor=\color{deepblue},
    tabsize=3,
    morekeywords={uint32_t},
    keywordsprefix=#
}

\lstdefinestyle{C-small}
{
    language=C,
    morekeywords={uint32_t},
    basicstyle={\fontsize{12}{12}\ttfamily\color{cyan}},
    commentstyle=\color{grey},
    keywordstyle=\color{orange},
}

\lstdefinestyle{C}
{
    language=C,
    morekeywords={uint32_t},
    keywordstyle=\color{orange},
}

\definecolor{orange}{rgb}{1,0.5,0}
\definecolor{deepblue}{rgb}{0, 0, 0.15}
\definecolor{grey}{rgb}{0.5,0.5,0.5}

\begin{document}

\begin{lstlisting}[style =C]
    uint32_t mailbox_message[22] __attribute__ ((aligned (16)));
    uint32_t index;

    void set_init_display_message()
    {
        index = 1;
        mailbox_message[index++] = 0;//request code

        mailbox_message[index++] = (uint32_t) SET_PHYSICAL_WIDTH_HEIGHT; //tag
        mailbox_message[index++] = 8;   //request size
        mailbox_message[index++] = 8;   //response size
        mailbox_message[index++] = physical_width;  //horizontal resolution of the monitor
        mailbox_message[index++] = physical_height; //vertical resolution of the monitor

        mailbox_message[index++] = (uint32_t) SET_VIRTUAL_WIDTH_HEIGHT; //tag
        mailbox_message[index++] = 8;   //rquest size
        mailbox_message[index++] = 8;   // response size
        mailbox_message[index++] = virtual_width;   //horizontal resolution of virtual screen
        mailbox_message[index++] = virtual_height;  //vertical resolution of virtual screen

        mailbox_message[index++] = (uint32_t) SET_DEPTH;    //tag
        mailbox_message[index++] = 4;   //request size
        mailbox_message[index++] = 4;   //response size
        mailbox_message[index++] = color_depth; //color depth of the frame buffer

        mailbox_message[index++] = (uint32_t) ALLOCATE; //tag
        mailbox_message[index++] = 8;   //request size
        mailbox_message[index++] = 8;   //response size
        mailbox_message[index++] = 16;  //alignment fb ptr returned here
        mailbox_message[index++] = 0;   //fb size returned here

        mailbox_message[index++] = END;//end tag

        mailbox_message[0] = index*sizeof(uint32_t);    //size of message
    }
\end{lstlisting}
\end{document}

在此輸入影像描述

相關內容