封面上的背景图像

封面上的背景图像

我试图在第一页添加封面,但没有成功。哪里出了问题?这是我的问题,我不知道如何解决。标题和页面在不同的页面上,但它们应该在同一页上。封面应该是背景。

图像

 \documentclass[a5paper,pagesize,10pt,bibtotoc,pointlessnumbers,
    normalheadings,DIV=9,twoside=false]{scrbook}
    
    \KOMAoptions{DIV=last}
    
    \usepackage{trajan}
     
    \usepackage[ngerman]{babel}
    \usepackage[utf8]{inputenc}
    \usepackage[T1]{fontenc}
    \usepackage{graphicx}
    
    \usepackage[babel,german=guillemets]{csquotes}
    
    \usepackage[sc]{mathpazo}
    \linespread{1.05} 
    
    \usepackage{verbatim} % for comments
    \usepackage{listings} % for comments
    
    \usepackage{blindtext}
    \newcommand{\q}[1]{>>\textit{#1}<<}
    
    \begin{document}
    
    
    %=========================================
    
    \begin{titlepage}
`\includegraphics[width=\paperwidth,height=\paperheight]{example-image-a}`
            \centering{
                {\fontsize{40}{48}\selectfont 
                A book title}
            }\\
            \vspace{10mm}
            \centering{\Large{AAAA}}\\
            \vspace{\fill}
            \centering \large{BBB}
    
      
    \end{titlepage}
           
    %=========================================
    \newpage{}
    \thispagestyle {empty}
    
    \vspace*{2cm}
    
    \begin{center}
        \Large{\parbox{10cm}{
            \begin{raggedright}
            {\Large 
                \textit{Do what you think is interesting, 
                do something that you think is fun and worthwhile, 
                because otherwise you won’t do it well anyway.}
            }
        
            \vspace{.5cm}\hfill{---Brian W. Kernighan}
            \end{raggedright}
        }
    }
    \end{center}
    
    \newpage
    
    
    \end{document}

我想要这个:

在此处输入图片描述

答案1

您可以通过加载eso-pic包然后将这些行添加到您的titlepage(另请参阅这个答案):

\AddToShipoutPictureBG*{%
    \AtPageLowerLeft{%
        \includegraphics[width=\paperwidth,height=\paperheight]{example-image-a}%
    }%
}

完整代码:

\documentclass[a5paper,pagesize,10pt,bibtotoc,pointlessnumbers,
    normalheadings,DIV=9,twoside=false]{scrbook}
    
    \KOMAoptions{DIV=last}
    
    \usepackage{trajan}
     
    \usepackage{eso-pic}

    \usepackage[ngerman]{babel}
    \usepackage[utf8]{inputenc}
    \usepackage[T1]{fontenc}
    \usepackage{graphicx}
    
    \usepackage[babel,german=guillemets]{csquotes}
    
    \usepackage[sc]{mathpazo}
    \linespread{1.05} 
    
    \usepackage{verbatim} % for comments
    \usepackage{listings} % for comments
    
    \usepackage{blindtext}
    \newcommand{\q}[1]{>>\textit{#1}<<}
    
    \begin{document}
    
    
    %=========================================

    \begin{titlepage}
            \AddToShipoutPictureBG*{%
              \AtPageLowerLeft{%
                \includegraphics[width=\paperwidth,height=\paperheight]{example-image-a}%
              }%
            }
    
            \centering{
                {\fontsize{40}{48}\selectfont 
                A book title}
            }\\
            \vspace{10mm}
            \centering{\Large{AAAA}}\\
            \vspace{\fill}
            \centering \large{BBB}
    \end{titlepage}
           
    %=========================================
    \newpage{}
    \thispagestyle {empty}
    
    \vspace*{2cm}
    
    \begin{center}
        \Large{\parbox{10cm}{
            \begin{raggedright}
            {\Large 
                \textit{Do what you think is interesting, 
                do something that you think is fun and worthwhile, 
                because otherwise you won’t do it well anyway.}
            }
        
            \vspace{.5cm}\hfill{---Brian W. Kernighan}
            \end{raggedright}
        }
    }
    \end{center}
    
    \newpage
    
    \end{document}

在此处输入图片描述

相关内容