正如标题所说,singlespace 不使用定义的字体大小。
我能做些什么让它发挥作用吗?
参见 mwe:
\documentclass{article}
\usepackage{parskip} % vertical space between paragraphs
\usepackage{xcolor} % foreground (text, rules, etc.) and background colour management
\usepackage{soul} % hyphenatable letterspacing, underlining, overstriking, highlighting
\usepackage{geometry} % customize page layout
\usepackage{enumitem} % enumerate, itemize and description lists
\usepackage{hyperref} % hypertext links
\usepackage{fancyhdr} % headers and footers
\usepackage{graphicx} % support for graphics
\usepackage{tabularx} % tables with adjustable width columns
\usepackage{scalerel} % vertically scaling and stretching objects
\usepackage{amssymb} % symbols found in the AMS symbol font msam and msbm
\usepackage{multicol} % define a multicols environment which typesets text in multiple columns
\usepackage{qrcode} % printing of qr codes
\usepackage{scrextend} % required to left indent address block
\usepackage{marvosym} % includes euro symbol
\usepackage{colortbl} % background color for row, columns or individual cells in a table
\usepackage[absolute]{textpos} % absolute positioning of text on the page
\usepackage{tikz} % package for creating graphics
\usepackage{setspace} % set spacing between lines
\usepackage{wallpaper} % use pdf as background image (letterhead)
\usepackage[dutch]{babel} % use dutch hyphenation conventions
%\usepackage[default,scale=0.90]{opensans} % Use font opensans (supported by pdflatex)
\usepackage{paratype} % Use font Paratype (identical to Calibri)
\renewcommand{\familydefault}{\sfdefault} % select sans serif font
\usepackage[explicit]{titlesec} % various title styles
\usepackage[most]{tcolorbox} % coloured and framed text boxes
\usepackage{tabto} % moves the typesetting position
\usepackage{pdfpages} % Include PDF as annex
\usepackage{etoolbox} % Check if an argument is optional in a newcommand
\usepackage{xparse,l3regex}
\usepackage{xstring}
\usepackage[utf8]{inputenc} % Use accented letters
\usepackage[T1]{fontenc} % Use accented letters
\usepackage{eso-pic}
\usepackage{rotating}
\usepackage{graphicx}
\usepackage{scrextend}
\usepackage{lastpage}
\usepackage{refcount}
\usepackage{dashrule} % dashed and dotted lines
\newcommand{\signer}[2]{
\ifthenelse{\not{\equal{#2}{}}} {
\begin{minipage}[t][4.5cm]{8.5cm}
\includegraphics[width=5.008cm, height=2.432cm]{#1} \newline
\begin{singlespace}
#2
\end{singlespace}
\end{minipage}
}
{}
}
\geometry{
a4paper,
left=30mm,
right=25mm,
top=4.5cm,
bottom=4.5cm
}
\linespread{0.8} % change the line spacing for entire document
\newcommand{\signerI}{Ben Maes \\ test}
\newcommand{\signerISignature}{{SIGNATURE}.png}
\begin{document}
\fontsize{9}{10}
\selectfont
testtesttesttest \\
\signer{\signerISignature}{\signerI} \\
testtesttesttest \\
\signer{\signerISignature}{\fontsize{9}{10}\selectfont\signerI} \\
testtesttest
\end{document}
底部是我想要的,但我不想给出我的字体大小。
提前致谢
答案1
首先,您确实应该更好地修剪示例代码。您的问题已经出现在以下内容中(暂时忽略\makeatletter
和之间的部分\makeatother
):
\documentclass{article}
\usepackage{setspace} % set spacing between lines
\linespread{0.8} % change the line spacing for entire document
\begin{document}
\makeatletter
\f@size
\makeatother
\fontsize{9}{10}
\selectfont
\makeatletter
\f@size
\makeatother
TEST
\begin{singlespace}
\makeatletter
\f@size
\makeatother
TEST
\end{singlespace}
TEST
\end{document}
调用\f@size
显示当前字体大小,您会看到最初使用的是 10 点字体。调用命令后,\fontsize
它会按照您的意愿正确设置为 9 点字体。但是当您调用环境时,singlespace
它现在又设置回 10 点。
原因是包singlespace
中的方法在设置行距后调用,以确保我们当时获得正确的(相对)当前字体大小。您的文档类默认设置为 10 pts,并且您没有对当前相对字体大小进行任何更改,因此调用时会将大小设置为 10 pts。setspace
\@currsize
\normalsize
singlespace
\@currsize
\normalsize
解决此问题的几种方法:
\baselineskip
如果您只是需要暂时更改字体大小,并且对11pts 而不是 10pts感到满意,那么您可以直接调用\small
而不是\fontsize{9}{11}\selectfont
。这样,当singlespace
调用时\@currsize
它将获得\small
而不是\normalsize
。- 如果你希望整个文档都基于 9 号字体,你可以考虑使用扩展尺寸文檔類別。
- 如果您已经愿意并希望手动微观管理行距,那么您不妨不要使用该
setspace
包,只需调用\fontsize{}{}
自己并调整第二个参数来调整行距量。