如何删除 tex 中的草稿和空白页

如何删除 tex 中的草稿和空白页

使用 book 类编写了以下代码(保持简短以突出问题)。此代码面临两个问题(Windows10 上的“texstudio”和“led”都出现同样的问题):

  1. 每页上都打印有“草稿”。我该如何删除它?
  2. 在下面显示的两页之间,我看到一个空白页,上面写着“草稿”。如何删除空白页?
\documentclass[12pt]{book}

\usepackage{graphicx}
\usepackage{background}

\begin{document}

\frontmatter
  \begin{titlepage} 
     \begin{center}
        {\Huge\bf book title}\\[5mm]
        {\Large\bf By author-name}
     \end{center}   
  \end{titlepage}   

\mainmatter 
\backgroundsetup{
    scale=1,
    angle=0,
    opacity=0.1,  %% adjust
    contents={\includegraphics[width=\paperwidth,height=\paperheight]{a.jpg}}
}
  \begin{enumerate}
  \begin{LARGE}
    \item line-1    
    \item line-2
  \end{LARGE}   
  \end{enumerate}   

\end{document}  

在此处输入图片描述

在此处输入图片描述

答案1

要删除单词,draft请删除background包。也不要使用\bf,这已经过时了

\documentclass[12pt]{book}

\usepackage{graphicx}
%\usepackage{background}

\begin{document}

\frontmatter
  \begin{titlepage} 
     \begin{center}
        {\Huge\bfseries book title}\\[5mm]
        {\Large\bfseries By author-name}
     \end{center}   
  \end{titlepage}   

\mainmatter 
  \begin{enumerate}
  \LARGE
  \item line-1    
  \item line-2 
  \end{enumerate}   

\end{document}  

要保留背景包:

\documentclass[12pt]{book}

\usepackage{graphicx}
\usepackage[contents={}]{background}

\begin{document}

\frontmatter
  \begin{titlepage} 
     \begin{center}
        {\Huge\bfseries book title}\\[5mm]
        {\Large\bfseries By author-name}
     \end{center}   
  \end{titlepage}   
\mainmatter 
\backgroundsetup{%
    scale=1,
    angle=0,
    opacity=0.1,  %% adjust
    contents={\includegraphics[width=\paperwidth,height=\paperheight]{example-image}}
}
  \begin{enumerate}
    \LARGE
    \item line-1    
    \item line-2
  \end{enumerate}   

\end{document}  

与包不同的方法eso-pic

\documentclass[12pt]{book}

\usepackage{graphicx}
\usepackage{eso-pic}

\begin{document}

\frontmatter
  \begin{titlepage} 
     \begin{center}
        {\Huge\bfseries book title}\\[5mm]
        {\Large\bfseries By author-name}
     \end{center}   
  \end{titlepage}   
\mainmatter 
\AddToShipoutPictureBG{\includegraphics[width=\paperwidth,height=\paperheight]{example-image}}
  \begin{enumerate}
    \LARGE
    \item line-1    
    \item line-2
  \end{enumerate}   

\end{document}  

或者使用 tiks:

\documentclass[12pt]{book}

\usepackage{graphicx}
\usepackage{tikz}

\begin{document}

\frontmatter
  \begin{titlepage} 
     \begin{center}
        {\Huge\bfseries book title}\\[5mm]
        {\Large\bfseries By author-name}
     \end{center}   
  \end{titlepage}   
\mainmatter 

\begin{tikzpicture}[remember picture, overlay]
\pgfsetfillopacity{0.1}
\node at (current page.center) {\includegraphics[width=\paperwidth,height=\paperheight]{example-image}};
\pgfsetfillopacity{1}
\end{tikzpicture}
  \begin{enumerate}
    \LARGE
    \item line-1    
    \item line-2
  \end{enumerate}   

\end{document}  

相关内容