问题描述

问题描述

问题描述

软件包文档第 30-31 页中的以下代码bookcover只能按照pdflatex其中一条注释所建议的运行:

\documentclass[
coverwidth=150mm,
coverheight=220mm,
spinewidth=25mm,
bleedwidth=20mm,
markcolor=black,
foldingmargin,
12pt,
% trimmed % Show only trimmed part!
]{bookcover}
%\bookcovertrimmedpart{front} % Trimmed part is the front cover
%\bookcovertrimmedpart{back} % Trimmed part is the back cover
%\bookcovertrimmedpart{spine} % Trimmed part is the spine
\letnamebookcoverpart{front with margin}{front}[5mm,5mm,5mm,5mm]
\letnamebookcoverpart{front upper third}{front with margin}[,2\partheight/3,,]
\letnamebookcoverpart{front lower third}{front with margin}[,,,2\partheight/3]
\letnamebookcoverpart{back with margin}{back}[5mm,5mm,5mm,5mm]
\letnamebookcoverpart{back text area}{back}[27mm,,22mm,27mm]
\letnamebookcoverpart{bg spine bottom}{bg spine}[,,,\partheight-\bleedwidth-\spinewidth]
\newbookcovercomponenttype{center rotate}{
\vfill\centering\rotatebox[origin=c]{-90}{#1}\vfill}
\usepackage[english]{babel}
\usepackage{kantlipsum,microtype}
\usepackage{transparent} % It works only with pdflatex
\begin{document}

\begin{bookcover}
\bookcovercomponent{color}{bg whole}{orange}
\bookcovercomponent{color}{front upper third}{red!60!black}
\bookcovercomponent{color}{front lower third}{red!60!black}
\bookcovercomponent{color}{back with margin}{red!60!black}
\bookcovercomponent{tikz}{front with margin}{
\draw[opacity=0.4,red,line width=10mm] (\partwidth-15mm,0) -- +(0,\partheight);}
\bookcovercomponent{tikz}{back with margin}{
\draw[opacity=0.4,red,line width=10mm] (15mm,0) -- +(0,\partheight);}
\bookcovercomponent{tikz}{whole}[5mm,,5mm,]{
\draw[opacity=0.4,red,line width=10mm] (0,\partheight-20mm) -- +(\partwidth,0);}
\bookcovercomponent{color}{bg spine bottom}{black}
\bookcovercomponent{center}{front upper third}{
\resizebox*{\partwidth-5mm}{\partheight-5mm}{%
\color{white}\transparent{0.1}\bfseries\LaTeX}}
\bookcovercomponent{center}{front lower third}{
\resizebox*{\partwidth-5mm}{\partheight-5mm}{%
\color{white}\transparent{0.1}\bfseries\LaTeX}}
\bookcovercomponent{center}{front}{
\resizebox{90mm}{!}{\bfseries\color{white}\LaTeX}}
\bookcovercomponent{normal}{back text area}{\color{white}\kant[1-2]}
\bookcovercomponent{center rotate}{spine}{
\resizebox{50mm}{!}{\bfseries\color{white}\LaTeX}}
\end{bookcover}
\end{document}

geometry但是,当我加载和包时,我需要帮助使代码可执行,fontspec如以下 MWE 中所述:

% !TeX TS-program = xelatex

\documentclass[
coverwidth=150mm,
coverheight=220mm,
spinewidth=25mm,
bleedwidth=20mm,
markcolor=black,
foldingmargin,
12pt,
% trimmed % Show only trimmed part!
]{bookcover}
\usepackage[
a4paper,
left=1in,
right=1in, 
top=1in, 
bottom=1in
]{geometry}
%\bookcovertrimmedpart{front} % Trimmed part is the front cover
%\bookcovertrimmedpart{back} % Trimmed part is the back cover
%\bookcovertrimmedpart{spine} % Trimmed part is the spine
\letnamebookcoverpart{front with margin}{front}[5mm,5mm,5mm,5mm]
\letnamebookcoverpart{front upper third}{front with margin}[,2\partheight/3,,]
\letnamebookcoverpart{front lower third}{front with margin}[,,,2\partheight/3]
\letnamebookcoverpart{back with margin}{back}[5mm,5mm,5mm,5mm]
\letnamebookcoverpart{back text area}{back}[27mm,,22mm,27mm]
\letnamebookcoverpart{bg spine bottom}{bg spine}[,,,\partheight-\bleedwidth-\spinewidth]
\newbookcovercomponenttype{center rotate}{
\vfill\centering\rotatebox[origin=c]{-90}{#1}\vfill}
\usepackage[english]{babel}
\usepackage{kantlipsum,microtype}
\usepackage{transparent} % It works only with pdflatex
\usepackage{fontspec}
\begin{document}

\begin{bookcover}
\bookcovercomponent{color}{bg whole}{orange}
\bookcovercomponent{color}{front upper third}{red!60!black}
\bookcovercomponent{color}{front lower third}{red!60!black}
\bookcovercomponent{color}{back with margin}{red!60!black}
\bookcovercomponent{tikz}{front with margin}{
\draw[opacity=0.4,red,line width=10mm] (\partwidth-15mm,0) -- +(0,\partheight);}
\bookcovercomponent{tikz}{back with margin}{
\draw[opacity=0.4,red,line width=10mm] (15mm,0) -- +(0,\partheight);}
\bookcovercomponent{tikz}{whole}[5mm,,5mm,]{
\draw[opacity=0.4,red,line width=10mm] (0,\partheight-20mm) -- +(\partwidth,0);}
\bookcovercomponent{color}{bg spine bottom}{black}
\bookcovercomponent{center}{front upper third}{
\resizebox*{\partwidth-5mm}{\partheight-5mm}{%
\color{white}\transparent{0.1}\bfseries\LaTeX}}
\bookcovercomponent{center}{front lower third}{
\resizebox*{\partwidth-5mm}{\partheight-5mm}{%
\color{white}\transparent{0.1}\bfseries\LaTeX}}
\bookcovercomponent{center}{front}{
\resizebox{90mm}{!}{\bfseries\color{white}\LaTeX}}
\bookcovercomponent{normal}{back text area}{\color{white}\kant[1-2]}
\bookcovercomponent{center rotate}{spine}{
\resizebox{50mm}{!}{\bfseries\color{white}\LaTeX}}
\end{bookcover}
\end{document}

补充信息

根据@S. Venkataraman的评论,我被引导到透明文字:透明包装有什么替代品?。我尝试了提供的两个解决方案,目的是transparent在 下寻找包替代品xelatex。但是,两次尝试都出现了此错误:File ended while scanning use of \bookcovercomponent。我的两次尝试的 MWE 如下所示:

1. 试用\tikz\node[]{}命令

以下是我的 MWE:

% !TeX TS-program = xelatex

\documentclass[
coverwidth=150mm,
coverheight=220mm,
spinewidth=25mm,
bleedwidth=20mm,
markcolor=black,
foldingmargin,
12pt,
% trimmed % Show only trimmed part!
]{bookcover}
%\usepackage{transparent} % It works only with pdflatex
%\usepackage[
%a4paper,
%left=1in,
%right=1in, 
%top1in, 
%bottom=1in
%]{geometry}
\bookcoverdescgeometry{a4paper,
    left=1in,
    right=1in, 
    top=1in, 
    bottom=1in}%<- Use this instead of using the geometry package.
%\bookcovertrimmedpart{front} % Trimmed part is the front cover
%\bookcovertrimmedpart{back} % Trimmed part is the back cover
%\bookcovertrimmedpart{spine} % Trimmed part is the spine
\letnamebookcoverpart{front with margin}{front}[5mm,5mm,5mm,5mm]
\letnamebookcoverpart{front upper third}{front with margin}[,2\partheight/3,,]
\letnamebookcoverpart{front lower third}{front with margin}[,,,2\partheight/3]
\letnamebookcoverpart{back with margin}{back}[5mm,5mm,5mm,5mm]
\letnamebookcoverpart{back text area}{back}[27mm,,22mm,27mm]
\letnamebookcoverpart{bg spine bottom}{bg spine}[,,,\partheight-\bleedwidth-\spinewidth]
\newbookcovercomponenttype{center rotate}{
    \vfill\centering\rotatebox[origin=c]{-90}{#1}\vfill}
\usepackage[english]{babel}
\usepackage{kantlipsum,microtype}
\usepackage{fontspec}
\begin{document}
    
    \begin{bookcover}
        \bookcovercomponent{color}{bg whole}{orange}
        \bookcovercomponent{color}{front upper third}{red!60!black}
        \bookcovercomponent{color}{front lower third}{red!60!black}
        \bookcovercomponent{color}{back with margin}{red!60!black}
        \bookcovercomponent{tikz}{front with margin}{
            \draw[opacity=0.4,red,line width=10mm] (\partwidth-15mm,0) -- +(0,\partheight);}
        \bookcovercomponent{tikz}{back with margin}{
            \draw[opacity=0.4,red,line width=10mm] (15mm,0) -- +(0,\partheight);}
        \bookcovercomponent{tikz}{whole}[5mm,,5mm,]{
            \draw[opacity=0.4,red,line width=10mm] (0,\partheight-20mm) -- +(\partwidth,0);}
        \bookcovercomponent{color}{bg spine bottom}{black}
        \bookcovercomponent{center}{front upper third}{
            \resizebox*{\partwidth-5mm}{\partheight-5mm}{%
            \tikz\node[inner sep=0pt, opacity=0.1]{\bfseries\LaTeX}}
        \bookcovercomponent{center}{front lower third}{
            \resizebox*{\partwidth-5mm}{\partheight-5mm}{%
                \tikz\node[inner sep=0pt, opacity=0.1]{\bfseries\LaTeX}}
        \bookcovercomponent{center}{front}{
            \resizebox{90mm}{!}{\bfseries\color{white}\LaTeX}}
        \bookcovercomponent{normal}{back text area}{\color{white}\kant[1-2]}
        \bookcovercomponent{center rotate}{spine}{
            \resizebox{50mm}{!}{\bfseries\color{white}\LaTeX}}
    \end{bookcover}
\end{document}

2. 试用tcolorbox套餐

以下是我的 MWE:

% !TeX TS-program = xelatex

\documentclass[
coverwidth=150mm,
coverheight=220mm,
spinewidth=25mm,
bleedwidth=20mm,
markcolor=black,
foldingmargin,
12pt,
% trimmed % Show only trimmed part!
]{bookcover}
%\usepackage{transparent} % It works only with pdflatex
%\usepackage[
%a4paper,
%left=1in,
%right=1in, 
%top1in, 
%bottom=1in
%]{geometry}
\bookcoverdescgeometry{a4paper,
    left=1in,
    right=1in, 
    top1in, 
    bottom=1in}%<- Use this instead of using the geometry package.
%\bookcovertrimmedpart{front} % Trimmed part is the front cover
%\bookcovertrimmedpart{back} % Trimmed part is the back cover
%\bookcovertrimmedpart{spine} % Trimmed part is the spine
\letnamebookcoverpart{front with margin}{front}[5mm,5mm,5mm,5mm]
\letnamebookcoverpart{front upper third}{front with margin}[,2\partheight/3,,]
\letnamebookcoverpart{front lower third}{front with margin}[,,,2\partheight/3]
\letnamebookcoverpart{back with margin}{back}[5mm,5mm,5mm,5mm]
\letnamebookcoverpart{back text area}{back}[27mm,,22mm,27mm]
\letnamebookcoverpart{bg spine bottom}{bg spine}[,,,\partheight-\bleedwidth-\spinewidth]
\newbookcovercomponenttype{center rotate}{
    \vfill\centering\rotatebox[origin=c]{-90}{#1}\vfill}
\usepackage[english]{babel}
\usepackage{kantlipsum,microtype}
\usepackage{fontspec}
\usepackage[most]{tcolorbox}
\newtcbox{\mybox}{blank, on line, opacitytext=0.1}
\begin{document}
    
    \begin{bookcover}
        \bookcovercomponent{color}{bg whole}{orange}
        \bookcovercomponent{color}{front upper third}{red!60!black}
        \bookcovercomponent{color}{front lower third}{red!60!black}
        \bookcovercomponent{color}{back with margin}{red!60!black}
        \bookcovercomponent{tikz}{front with margin}{
            \draw[opacity=0.4,red,line width=10mm] (\partwidth-15mm,0) -- +(0,\partheight);}
        \bookcovercomponent{tikz}{back with margin}{
            \draw[opacity=0.4,red,line width=10mm] (15mm,0) -- +(0,\partheight);}
        \bookcovercomponent{tikz}{whole}[5mm,,5mm,]{
            \draw[opacity=0.4,red,line width=10mm] (0,\partheight-20mm) -- +(\partwidth,0);}
        \bookcovercomponent{color}{bg spine bottom}{black}
        \bookcovercomponent{center}{front upper third}{
            \resizebox*{\partwidth-5mm}{\partheight-5mm}{%
            \begin{tabular}{c}                   
            \mybox\bfseries\LaTeX
            \end{tabular}}
            \bookcovercomponent{center}{front lower third}{
                \resizebox*{\partwidth-5mm}{\partheight-5mm}{%
                \begin{tabular}{c}                   
                \mybox\bfseries\LaTeX
                \end{tabular}}
                \bookcovercomponent{center}{front}{
                    \resizebox{90mm}{!}{\bfseries\color{white}\LaTeX}}
                \bookcovercomponent{normal}{back text area}{\color{white}\kant[1-2]}
                \bookcovercomponent{center rotate}{spine}{
                    \resizebox{50mm}{!}{\bfseries\color{white}\LaTeX}}
            \end{bookcover}
        \end{document}

如果可能的话,我需要帮助以使这两项试验都能顺利进行。

答案1

以下修改后的代码版本在 lualatex 中编译良好。为避免选项与 geometry 发生冲突,请使用 bookcover 包中提供的接口。使用\bookcoverdescgeometry{⟨geometry parameteres⟩}第 4 页中 bookcover 包中提供的命令。transparency 包在 xelatex 中仍然会出现问题。除非您使用的是 Indic 或其他一些奇特的字体,否则 Lualatex 就是您所需要的。

\documentclass[
coverwidth=150mm,
coverheight=220mm,
spinewidth=25mm,
bleedwidth=20mm,
markcolor=black,
foldingmargin,
12pt,
% trimmed % Show only trimmed part!
]{bookcover}
\usepackage{transparent} % It works only with pdflatex
%\usepackage[
%a4paper,
%left=1in,
%right=1in, 
%top1in, 
%bottom=1in
%]{geometry}
\bookcoverdescgeometry{a4paper,
    left=1in,
    right=1in, 
    top1in, 
    bottom=1in}%<- Use this instead of using the geometry package.
%\bookcovertrimmedpart{front} % Trimmed part is the front cover
%\bookcovertrimmedpart{back} % Trimmed part is the back cover
%\bookcovertrimmedpart{spine} % Trimmed part is the spine
\letnamebookcoverpart{front with margin}{front}[5mm,5mm,5mm,5mm]
\letnamebookcoverpart{front upper third}{front with margin}[,2\partheight/3,,]
\letnamebookcoverpart{front lower third}{front with margin}[,,,2\partheight/3]
\letnamebookcoverpart{back with margin}{back}[5mm,5mm,5mm,5mm]
\letnamebookcoverpart{back text area}{back}[27mm,,22mm,27mm]
\letnamebookcoverpart{bg spine bottom}{bg spine}[,,,\partheight-\bleedwidth-\spinewidth]
\newbookcovercomponenttype{center rotate}{
    \vfill\centering\rotatebox[origin=c]{-90}{#1}\vfill}
\usepackage[english]{babel}
\usepackage{kantlipsum,microtype}
\usepackage{fontspec}
\begin{document}
    
    \begin{bookcover}
        \bookcovercomponent{color}{bg whole}{orange}
        \bookcovercomponent{color}{front upper third}{red!60!black}
        \bookcovercomponent{color}{front lower third}{red!60!black}
        \bookcovercomponent{color}{back with margin}{red!60!black}
        \bookcovercomponent{tikz}{front with margin}{
            \draw[opacity=0.4,red,line width=10mm] (\partwidth-15mm,0) -- +(0,\partheight);}
        \bookcovercomponent{tikz}{back with margin}{
            \draw[opacity=0.4,red,line width=10mm] (15mm,0) -- +(0,\partheight);}
        \bookcovercomponent{tikz}{whole}[5mm,,5mm,]{
            \draw[opacity=0.4,red,line width=10mm] (0,\partheight-20mm) -- +(\partwidth,0);}
        \bookcovercomponent{color}{bg spine bottom}{black}
        \bookcovercomponent{center}{front upper third}{
            \resizebox*{\partwidth-5mm}{\partheight-5mm}{%
                \color{white}\transparent{0.1}\bfseries\LaTeX}}
        \bookcovercomponent{center}{front lower third}{
            \resizebox*{\partwidth-5mm}{\partheight-5mm}{%
                \color{white}\transparent{0.1}\bfseries\LaTeX}}
        \bookcovercomponent{center}{front}{
            \resizebox{90mm}{!}{\bfseries\color{white}\LaTeX}}
        \bookcovercomponent{normal}{back text area}{\color{white}\kant[1-2]}
        \bookcovercomponent{center rotate}{spine}{
            \resizebox{50mm}{!}{\bfseries\color{white}\LaTeX}}
    \end{bookcover}
\end{document}

编辑我查看了软件包文档。软件包作者没有明确加载geometry软件包。他确实提到geometry需要该软件包。因此,该bookcover软件包可能正在使用不同的选项加载几何图形,这与您使用的选项发生冲突。因此,最好使用软件包作者提供的界面。

相关内容