![如何才能放松粗体页眉中的字母间距?](https://linux22.com/image/320411/%E5%A6%82%E4%BD%95%E6%89%8D%E8%83%BD%E6%94%BE%E6%9D%BE%E7%B2%97%E4%BD%93%E9%A1%B5%E7%9C%89%E4%B8%AD%E7%9A%84%E5%AD%97%E6%AF%8D%E9%97%B4%E8%B7%9D%EF%BC%9F.png)
当标题设置为粗体时,它们会显得太紧,请参阅 MWE。
%
%---------------------------------------------------------------------------------------------------------- %
\documentclass{book} %
%---------------------------------------------------------------------------------------------------------- %
%
\usepackage[fleqn]{amsmath} %
\usepackage{amsthm,amssymb} %
\usepackage[explicit]{titlesec} %
\usepackage{titletoc} %
\usepackage[nottoc]{tocbibind}
\usepackage[T1]{fontenc} % no apparent effect
\usepackage[utf8,latin1]{inputenx} %
\usepackage{txfonts} % needed for cross but when placed last, S is wrong
\usepackage{xcolor,colortbl} %
\usepackage[margin=10pt,font=normalsize,labelfont=bf,labelsep=space,position=below]{caption} %
\usepackage[position=below,textfont=normal,labelfont=bf]{caption,subfig} %
\usepackage[dvips=true,pdftex=true,verbose]{geometry}
\usepackage[a4,frame,center]{crop} % a4=210mm x 297mm
\usepackage{tikz} % tikz - essential
\usepackage{tcolorbox}
%
\setlength{\unitlength}{1mm}
%
\definecolor{ThemeColour}{rgb}{0.45,0.00,0.45} %
\definecolor{ThemeGrey}{rgb}{0.92,0.92,0.92}
\newtcolorbox{sectionbox}[2][]{nobeforeafter, boxsep=4.4pt,boxrule=1.2pt,arc=3pt,outer arc=3.2pt,width=\linewidth, %
coltitle=white,colbacktitle=ThemeColour,after=\hfill,colframe=black,colback=ThemeGrey,title={#2},fonttitle=\bfseries,#1} %
\titleformat{\section} %
{\normalfont\bfseries\itshape\fontsize{12}{16}\selectfont} %
{}{0pt}
{\begin{sectionbox}
{\fontsize{14}{16}\selectfont{Section\hspace{5.6pt}\thetitle}}{{#1}\vspace{-2.4pt}} %
\end{sectionbox}}
\titlespacing{\section}{0pt}{10pt}{5.4pt}[0pt] %
\renewcommand{\thesection}{\arabic{section}} %
\begin{document}
\vspace{6pt}
\section{The bolding of the header appears to tighten the kerning - especially words like: lining; \hspace{1.2pt}I just want it about 2pc looser}
\end{document}
答案1
使用microtype
,您可以通过在序言中添加以下内容来自动调整所有粗体字体的跟踪:
\usepackage[tracking]{microtype}
\DeclareMicrotypeSet*[tracking]{bold}
{ encoding = *, series = bf* }
\SetTracking
[ unit = 1pc ]
{ encoding = *, series = bf* }
{ 20 }
如果您只想调整分段字体,请从上面删除\DeclareMicrotypeSet
命令和选项,然后在需要的地方添加,例如:tracking
\lsstyle
\titleformat{\section} %
{\normalfont\bfseries\itshape\fontsize{12}{16}\lsstyle\selectfont} % <--
{}{0pt}
{\begin{sectionbox}
{\fontsize{14}{16}\selectfont{Section\hspace{5.6pt}\thetitle}}{{#1}\vspace{-2.4pt}}%
\end{sectionbox}}
更新
根据要求,以下是您的示例,并附有我建议的补充:
(microtype
在 dvi 模式下, 的字母间距不起作用,因此soul
包中也提供了替代解决方案。请注意, 无法对所有粗体字体进行自动跟踪调整soul
。)
%
%---------------------------------------------------------------------------------------------------------- %
\documentclass{book} %
%---------------------------------------------------------------------------------------------------------- %
%
\usepackage[fleqn]{amsmath} %
\usepackage{amsthm,amssymb} %
\usepackage[explicit,pagestyles]{titlesec} % <-- added option `pagestyles'
\usepackage{titletoc} %
\usepackage[nottoc]{tocbibind}
\usepackage[T1]{fontenc} % no apparent effect
\usepackage[utf8,latin1]{inputenx} %
\usepackage{txfonts} % needed for cross but when placed last, S is wrong
\usepackage{xcolor,colortbl} %
\usepackage[margin=10pt,font=normalsize,labelfont=bf,labelsep=space,position=below]{caption} %
\usepackage[position=below,textfont=normal,labelfont=bf]{caption,subfig} %
\usepackage[dvips=true,pdftex=true,verbose]{geometry}
\usepackage[a4,frame,center]{crop} % a4=210mm x 297mm
\usepackage{tikz} % tikz - essential
\usepackage{tcolorbox}
%
\setlength{\unitlength}{1mm}
%
\definecolor{ThemeColour}{rgb}{0.45,0.00,0.45} %
\definecolor{ThemeGrey}{rgb}{0.92,0.92,0.92}
\newtcolorbox{sectionbox}[2][]{nobeforeafter, boxsep=4.4pt,boxrule=1.2pt,arc=3pt,outer arc=3.2pt,width=\linewidth, %
coltitle=white,colbacktitle=ThemeColour,after=\hfill,colframe=black,colback=ThemeGrey,title={#2},fonttitle=\bfseries,#1} %
\titleformat{\section} %
{\normalfont\bfseries\itshape\fontsize{12}{16}\selectfont} %
{}{0pt}
{\begin{sectionbox}
{\fontsize{14}{16}\selectfont{Section\hspace{5.6pt}\thetitle}}{{#1}\vspace{-2.4pt}} %
\end{sectionbox}}
% ------ additions -------
\usepackage{microtype}
\usepackage{ifpdf}
\ifpdf % <-- enable tracking in pdf mode
\microtypesetup{tracking=true}
\DeclareMicrotypeSet*[tracking]{bold}
{ encoding = *, series = bf* }
\SetTracking
[ unit = 1pc ]
{ encoding = *, series = bf* }
{ 20 }
\newcommand\lscaps[2][80]{\textls[#1]{#2}}
\else % <-- alternative with soul
\usepackage{soul}
\soulregister\hspace7
\sodef\lscaps{}{.1em} {.4em plus.08em minus.06em}{.4em plus.15em minus.83em}%
\sodef\lsbold{}{.02em}{.3em plus.08em minus.06em}{.3em plus.15em minus.83em}%
\titleformat{\section} % <-- change title format, adding letterspacing
{\normalfont\bfseries\itshape\fontsize{12}{16}\selectfont} %
{}{0pt}
{\begin{sectionbox}
{\fontsize{14}{16}\selectfont\lsbold{Section\hspace{5.6pt}\thetitle}}{\lsbold{#1}\vspace{-2.4pt}} %
\end{sectionbox}}
\fi
\newpagestyle{main}{% <-- change header definitions to accommodate letterspacing
\sethead[\thepage][][\slshape \MakeUppercase{\lscaps{\chaptername\ \thechapter. \ \chaptertitle}}] % even
{\slshape \thesection. \ \MakeUppercase{\lscaps{\sectiontitle}}}{}{\thepage}} % odd
\pagestyle{main}
% ------ end additions -------
\titlespacing{\section}{0pt}{10pt}{5.4pt}[0pt] %
\renewcommand{\thesection}{\arabic{section}} %
\begin{document}
\vspace{6pt}
\section[Bolding of the header -- lining]{The bolding of the header appears to tighten the kerning -- especially words like: lining; \hspace{1.2pt}I just want it about 2pc looser}
\end{document}
以下是输出——针对粗体文本和全大写的标题调整了跟踪: