Solidity 程式碼後出現巨大的空白問題:Package xcolor warning: Incomplete colorDefinition on input line 73. 無限膠水收縮

Solidity 程式碼後出現巨大的空白問題:Package xcolor warning: Incomplete colorDefinition on input line 73. 無限膠水收縮

我在我的乳膠文件中使用了 Xcolor 包,但後來我評論了甚至刪除了它,但我仍然遇到 Xcolor 問題。我認為它存儲在我的文檔的二進製版本中。現在我建立了一個新文件進行測試,但仍然遇到 xcolor 問題。問題出現在我的 Solidity 清單中。我的測試文檔中的程式碼是:

\documentclass{ieeeaccess}
\usepackage{cite}
\usepackage{bbding}
\usepackage{pifont}
\usepackage{wasysym}
\usepackage{amssymb}
\usepackage{amsmath,amssymb,amsfonts}
\usepackage{algorithmic}
\usepackage{graphicx}
\usepackage{textcomp}
\def\BibTeX{{\rm B\kern-.05em{\sc i\kern-.025em b}\kern-.08em
    T\kern-.1667em\lower.7ex\hbox{E}\kern-.125emX}}
\input{solidity-highlighting.tex}
\def\timesfont{ptm}
\begin{document}
\history{Date of publication xxxx 00, 0000, date of current version xxxx 00, 0000.}
\doi{10.1109/ACCESS.2017.DOI}
\title{Testing Involuntary }
\author{\uppercase{a A a, }
\IEEEmembership{Member, IEEE}}
\address[1]{dos, uuu, o, i, j (e-mail: [email protected])}
\address[2]{dos, iii, m,
, ooo (e-mail: [email protected])}
\tfootnote{This work.}
\markboth
{Author \headeretal: Preparation of Papers for IEEE TRANSACTIONS and JOURNALS}
{Author \headeretal: Preparation of Papers for IEEE TRANSACTIONS and JOURNALS}
\corresp{Corresponding author: ooo (e-mail: [email protected]).}
\begin{abstract}
Smart Contracts (SCs)  
\end{abstract}
\begin{keywords}
Attacker types, 
\end{keywords}
\titlepgskip=-21pt
\maketitle
\section{Introduction}
\PARstart{E}{thereum}
\cite{Ghost9} \cite{Ghost10} 
\cite{Ghost12}
\cite{Ghost13} \cite{Ghost14} \cite{Ghost16}, \cite{Ghost17}
\cite{114}, \cite{117}
\cite{IMP1053}
\subsection{Related Work}\label{ss:relatedwork}
\begin{lstlisting}[language=Solidity, label={lst:NREVicSCl1}, caption={tx.origin-based non-reentrant involuntary transfer: faulty 'tx.origin' condition does not protect Solidity's 'transfer', hence we call it involuntary transfer.}]
contract Victim{
    address owner;
    constructor() public {
       owner = msg.sender;}
    function transferTo(address payable receiver, uint amount) public {
       require(tx.origin == owner);
       receiver.transfer(amount);
       }
    function() external payable{}
    }
\end{lstlisting}
\subsection{Methodology}\label{ss:Methodology}
\section{Background}
\section{Conclusion}
\bibliographystyle{IEEEtran}
\bibliography{sourcefile-bib}
\begin{IEEEbiography}[{\includegraphics[width=1in,height=1.25in,clip,keepaspectratio]{a2.png}}]{} 
\end{IEEEbiography}
\begin{IEEEbiography}[{\includegraphics[width=1in,height=1.25in,clip,keepaspectratio]{a2.png}}]{Aaa, Ph.D.} Aaaa is an Associate education.
\end{IEEEbiography}
\EOD
\end{document}

有人請指導我。

在此輸入影像描述

祖爾菲。

答案1

錯誤有不同的原因。

(1)solidity-highlighting.tex檔案載入與類別載入的xcolor套件衝突的套件。colorieeeaccess

(2)ieeeaccess不提供產生格式化清單標題的設施。

這個答案提供了solidity-highlighting-ieeeaccess.tex要載入的文件,而不是solidity-highlighting.tex使用該類別時載入的文件ieeeaccess

現在,清單caption已使用 package 產生並格式化caption

d

% !TeX TS-program = pdflatex

\documentclass{ieeeaccess}
\usepackage{cite}
\usepackage{bbding}
\usepackage{pifont}
%%\usepackage{wasysym}
\usepackage{amsmath,amssymb,amsfonts}
\usepackage{algorithmic}
\usepackage{graphicx}
\usepackage{textcomp}
\usepackage{algorithmic}
\def\BibTeX{{\rm B\kern-.05em{\sc i\kern-.025em b}\kern-.08em
        T\kern-.1667em\lower.7ex\hbox{E}\kern-.125emX}}
    
\input{solidity-highlighting-ieeeaccess.tex} % changed <<<<<<<<<<<<<<<<<<

\def\timesfont{ptm}

\begin{document}
    \history{Date of publication xxxx 00, 0000, date of current version xxxx 00, 0000.}
    \doi{10.1109/ACCESS.2017.DOI}
    \title{Testing Involuntary }
    \author{\uppercase{a A a, }
        \IEEEmembership{Member, IEEE}}
    \address[1]{dos, uuu, o, i, j (e-mail: [email protected])}
    \address[2]{dos, iii, m,
        , ooo (e-mail: [email protected])}
    \tfootnote{This work.}
    \markboth
    {Author \headeretal: Preparation of Papers for IEEE TRANSACTIONS and JOURNALS}
    {Author \headeretal: Preparation of Papers for IEEE TRANSACTIONS and JOURNALS}
    \corresp{Corresponding author: ooo (e-mail: [email protected]).}
    \begin{abstract}
        Smart Contracts (SCs)  
    \end{abstract}
    \begin{keywords}
        Attacker types, 
    \end{keywords}
    \titlepgskip=-21pt
    \maketitle
    \section{Introduction}
    \PARstart{E}{thereum}
    \cite{Ghost9} \cite{Ghost10} 
    \cite{Ghost12}
    \cite{Ghost13} \cite{Ghost14} \cite{Ghost16}, \cite{Ghost17}
    \cite{114}, \cite{117}
    \cite{IMP1053}
    \subsection{Related Work}\label{ss:relatedwork}
    \begin{lstlisting}[language=Solidity, label={lst:NREVicSCl1}, caption={tx.origin-based non-reentrant involuntary transfer: faulty 'tx.origin' condition does not protect Solidity's 'transfer', hence we call it involuntary transfer.}]
        contract Victim{
            address owner;
            constructor() public {
                owner = msg.sender;}
            function transferTo(address payable receiver, uint amount) public {
                require(tx.origin == owner);
                receiver.transfer(amount);
            }
            function() external payable{}
        }
    \end{lstlisting}
    \subsection{Methodology}\label{ss:Methodology}
    \section{Background}
    \section{Conclusion}    
    \EOD
\end{document}

這是文件solidity-highlighting-ieeeaccess.tex

% Copyright 2017 Sergei Tikhomirov, MIT License

%% File solidity-highlighting-ieeeaccess.tex
%% To work with  ieeeaccess

\usepackage{listings}
%\usepackage{xcolor} % <<<<<<<<<<DO NOT USE together with ieeeaccess <<<<<<<<<<<<<

%%********************************************** added <<<<<<<<<<<<
\usepackage{caption} % added
\DeclareCaptionFormat{listing}{{\color{accessblue}#1.}#2#3}
\captionsetup[lstlisting]{format=listing,singlelinecheck=false, margin=0pt, font={sf},labelsep=space,labelfont=bf, font={footnotesize,sf}}
\renewcommand\lstlistingname{LISTING}
\definecolor{violet}{rgb}{0.56,0.0,1.0} %
\definecolor{teal}{rgb}{0.0,0.5,0.5}  % 
%%********************************************** 

\definecolor{verylightgray}{rgb}{.97,.97,.97}

\lstdefinelanguage{Solidity}{
    keywords=[1]{anonymous, assembly, assert, balance, break, call, callcode, case, catch, class, constant, continue, constructor, contract, debugger, default, delegatecall, delete, do, else, emit, event, experimental, export, external, false, finally, for, function, gas, if, implements, import, in, indexed, instanceof, interface, internal, is, length, library, log0, log1, log2, log3, log4, memory, modifier, new, payable, pragma, private, protected, public, pure, push, require, return, returns, revert, selfdestruct, send, solidity, storage, struct, suicide, super, switch, then, this, throw, transfer, true, try, typeof, using, value, view, while, with, addmod, ecrecover, keccak256, mulmod, ripemd160, sha256, sha3}, % generic keywords including crypto operations
    keywordstyle=[1]\color{blue}\bfseries,
    keywords=[2]{address, bool, byte, bytes, bytes1, bytes2, bytes3, bytes4, bytes5, bytes6, bytes7, bytes8, bytes9, bytes10, bytes11, bytes12, bytes13, bytes14, bytes15, bytes16, bytes17, bytes18, bytes19, bytes20, bytes21, bytes22, bytes23, bytes24, bytes25, bytes26, bytes27, bytes28, bytes29, bytes30, bytes31, bytes32, enum, int, int8, int16, int24, int32, int40, int48, int56, int64, int72, int80, int88, int96, int104, int112, int120, int128, int136, int144, int152, int160, int168, int176, int184, int192, int200, int208, int216, int224, int232, int240, int248, int256, mapping, string, uint, uint8, uint16, uint24, uint32, uint40, uint48, uint56, uint64, uint72, uint80, uint88, uint96, uint104, uint112, uint120, uint128, uint136, uint144, uint152, uint160, uint168, uint176, uint184, uint192, uint200, uint208, uint216, uint224, uint232, uint240, uint248, uint256, var, void, ether, finney, szabo, wei, days, hours, minutes, seconds, weeks, years}, % types; money and time units
    keywordstyle=[2]\color{teal}\bfseries,
    keywords=[3]{block, blockhash, coinbase, difficulty, gaslimit, number, timestamp, msg, data, gas, sender, sig, value, now, tx, gasprice, origin},   % environment variables
    keywordstyle=[3]\color{violet}\bfseries,
    identifierstyle=\color{black},
    sensitive=false,
    comment=[l]{//},
    morecomment=[s]{/*}{*/},
    commentstyle=\color{gray}\ttfamily,
    stringstyle=\color{red}\ttfamily,
    morestring=[b]',
    morestring=[b]"
}

\lstset{
    language=Solidity,
    backgroundcolor=\color{verylightgray},
    extendedchars=true,
    basicstyle=\footnotesize\ttfamily,
    showstringspaces=false,
    showspaces=false,
    numbers=left,
    numberstyle=\footnotesize,
    numbersep=9pt,
    tabsize=2,
    breaklines=true,
    showtabs=false,
    captionpos=b,
}
%************************************** end solidity-highlighting-ieeeaccess.tex

相關內容