如何使不包含连字符的文本居中?

如何使不包含连字符的文本居中?

书脊上的书名需要居中。书名包含连字符 - 根据捷克标准,连字符也应放在第二个单词(冰岛-捷克语中的 fe)前面。我正在寻求建议,如何在不包含重复连字符的情况下将文本居中,如果可能的话,如何缩小看起来不好看的连字符。

注意:只有冰岛语-捷克语和 Íslensk-tékknesk 之间的连字符需要重复(不是 stúdenta-orðabók)

\documentclass[8pt,
    marklength=20mm,
    coverwidth=162mm,
    coverheight=229mm,
    bleedwidth=30mm,spinewidth=65mm]{bookcover}

\usepackage[icelandic, latin, czech]{babel}
\usepackage[utf8]{inputenc}
\usepackage[T1]{fontenc}

\usepackage{tgpagella}
% #################################################################### COLORS #

\usepackage{color}
\definecolor {title}              {RGB} {  16,   13,   32}

% #################################################################### LAYOUT #

% \normalsize should be {8pt}{9.6pt}
\def\HUGE {\fontsize{23.887872pt}{3\baselineskip}\selectfont}
\def\Huge {\fontsize{19.906560pt}{3\baselineskip}\selectfont}
\def\huge {\fontsize{16.588800pt}{3\baselineskip}\selectfont}
\def\LARGE{\fontsize{13.824000pt}{2\baselineskip}\selectfont}
\def\Large{\fontsize{11.520000pt}{2\baselineskip}\selectfont}
\def\large{\fontsize{ 9.600000pt}{2\baselineskip}\selectfont}

% Two columns layout ruler
\setlength\columnsep    {2\baselineskip}
\setlength\columnseprule{0.4pt}

% Necessary for baseline alignment
\topskip=\baselineskip
\raggedbottom
\setlength\parskip{0pt} % it's better to avoid glue

% Temporarily suppress warnings
\hbadness=5000
\vbadness=5000

\setlength\emergencystretch{17pt}

% Allow smaller emergencystretch in several cases
\newenvironment{xtolerant}[2]{%
  \par
  \ifx\empty#1\empty\else\tolerance=#1\relax\fi
  \ifx\empty#2\empty\else\emergencystretch=#2\relax\fi
}{%
  \par
}

 \renewcommand{\baselinestretch}{0.7}

\def\dictnameCZ{islandsko-český studijní slovník}
\def\dictnameIS{íslensk-tékknesk stúdentaorðabók}

\begin{document}

%back cover
\setbookcover{bgcolor}{back}{%
color=title,
}

\setbookcover{fgfirst}{back}{%
\vspace{2cm}
\centering
}

%front cover
\setbookcover{bgcolor}{front}{%
color=title,
}

\setbookcover{fgfirst}{front}{%
\centering
\vspace{2cm}
{\Huge\scshape\color{white}%
   \dictnameCZ\\\dictnameIS}
}

%spine
\setbookcover{bgcolor}{spine}{%
color=title,
}

\setbookcover{fgfirst}{spine}{
\vspace{4cm}

\begin{center}\Huge\scshape\color{white}%
   islandsko-\\
   -český\\
   studijní\\
   slovník
  \end{center}
  \vspace*{0.1cm}%{\fill}

   \begin{center}\Huge\scshape\color{white}%
   íslensk-\\
   -tékknesk\\
   stúdenta-\\
   orðabók
   \end{center}

   \vspace*{10cm}%{\fill}

\begin{center}
{\color{white}www.hvalur.org}
\end{center}

\vfill}

\makebookcover
\end{document}

答案1

您可以隐藏连字符的宽度,但我不确定它是否看起来更好。

\documentclass[8pt,
    marklength=20mm,
    coverwidth=162mm,
    coverheight=229mm,
bleedwidth=30mm,spinewidth=65mm]{bookcover}

\usepackage[icelandic, latin, czech]{babel}
\usepackage[utf8]{inputenc}
\usepackage[T1]{fontenc}

\usepackage{tgpagella}
            % #################################################################### COLORS #

\usepackage{color}
\definecolor {title}              {RGB} {  16,   13,   32}

            % #################################################################### LAYOUT #

            % \normalsize should be {8pt}{9.6pt}
\def\HUGE {\fontsize{23.887872pt}{3\baselineskip}\selectfont}
\def\Huge {\fontsize{19.906560pt}{3\baselineskip}\selectfont}
\def\huge {\fontsize{16.588800pt}{3\baselineskip}\selectfont}
\def\LARGE{\fontsize{13.824000pt}{2\baselineskip}\selectfont}
\def\Large{\fontsize{11.520000pt}{2\baselineskip}\selectfont}
\def\large{\fontsize{ 9.600000pt}{2\baselineskip}\selectfont}

            % Two columns layout ruler
\setlength\columnsep    {2\baselineskip}
\setlength\columnseprule{0.4pt}

            % Necessary for baseline alignment
\topskip=\baselineskip
\raggedbottom
\setlength\parskip{0pt} % it's better to avoid glue

            % Temporarily suppress warnings
\hbadness=5000
\vbadness=5000

\setlength\emergencystretch{17pt}

            % Allow smaller emergencystretch in several cases
\newenvironment{xtolerant}[2]{%
    \par
    \ifx\empty#1\empty\else\tolerance=#1\relax\fi
    \ifx\empty#2\empty\else\emergencystretch=#2\relax\fi
}{%
    \par
}

\renewcommand{\baselinestretch}{0.7}

\def\dictnameCZ{islandsko-český studijní slovník}
\def\dictnameIS{íslensk-tékknesk stúdentaorðabók}

\begin{document}

                 %back cover
\setbookcover{bgcolor}{back}{%
    color=title,
}

\setbookcover{fgfirst}{back}{%
    \vspace{2cm}
    \centering
}

                 %front cover
\setbookcover{bgcolor}{front}{%
    color=title,
}

\setbookcover{fgfirst}{front}{%
    \centering
    \vspace{2cm}
    {\Huge\scshape\color{white}%
\dictnameCZ\\\dictnameIS}
                    }

                    %spine
                    \setbookcover{bgcolor}{spine}{%
                        color=title,
                    }

                    \setbookcover{fgfirst}{spine}{
                        \vspace{4cm}

                        \begin{center}\Huge\scshape\color{white}%
                            islandsko\rlap{-}\\
                            -český\\
                            studijní\\
                            slovník

                        \vspace*{1cm}%{\fill}

                            íslensk\rlap{-}\\
                            \mbox{}\llap{-}tékknesk\\
                            stúdenta-\\
                            orðabók

                        \vspace*{10cm}%{\fill}

                            {\color{white}www.hvalur.org}
                        \end{center}

                    \vfill}

                    \makebookcover
                    \end{document}

你的代码的某些部分有点奇怪。

相关内容