我想制作一个模板文档(带有自定义边距、字体大小、页眉、页脚等...)。
我只指定了第一页的页脚和所有其他页面的页眉、边距、文本宽度、文本高度、页眉高度、页面边框......这就是我想要的。
我在下图中用数字标记了我想要更改的内容。
我想要如图所示的多行文本,但我想减少行距。代码:
%%begin page borders \SetBgOpacity{100.0} %% Select opacity \SetBgScale{1} %% Select scale factor of logo \SetBgAngle{0} %% Select rotation of logo \SetBgColor{black} %% Select color \SetBgContents{ \begin{tikzpicture}[overlay,remember picture] \node[anchor=north] at ($(current page.north west)+(1.5cm,-1cm)$) {\rotatebox{90}{\makecell[r]{\scriptsize\selectfont Reproduction or any use not conformity with the intended\\ \scriptsize\selectfont application is not permissible.}}}; \node[anchor=south] at ($(current page.south west)+(1.5cm,1cm)$) {\rotatebox{90}{\makecell[l]{\scriptsize\selectfont Nachdruck oder Verwendung, die nicht der beabsichtigten\\ \scriptsize\selectfont Anwendung entspricht, ist nicht zulässig.}}}; \end{tikzpicture} } %%end page borders
我没有完成左边的表格,但我知道如何添加更多行,这不是问题。我的问题是如何固定行高或如何删除或减少单元格内的额外文本间距?我不想调整表格大小,因为我希望宽度保持不变。
如何将图形垂直和水平居中放置在单元格内?是否有类似 [anchor=center] 的选项?
在第一页页脚和所有其他页面的页眉上,我在页眉和页脚中具有相同的属性,例如 Project。我可以在序言中定义例如:project=My first project in LaTeX;然后在特定单元格中的页眉和页脚中写入 project 时,我的输出将是 My first project in LaTeX。
我应该实施 KOMA 脚本吗?对我而言有什么好处吗?使用 KOMA 脚本,我可以准确指定要使用的字体大小吗?例如 \fontsize{5} 一些随机文本。我问这个问题是因为可以更轻松地更改表格内的字体大小。:)
我的完整代码:
%%begin preamble
\documentclass[a4paper,12pt]{article}
\usepackage[utf8]{inputenc}
\usepackage[demo]{graphicx}
\usepackage{hyperref}
\usepackage{array}
\usepackage{lastpage}
\usepackage{xcolor}
\usepackage{fancyhdr}
\usepackage{tikz}
\usepackage{background}
\usepackage{url}
%%\usepackage{showframe}
\usepackage{lipsum}
\usepackage{makecell}
\usepackage[export]{adjustbox}
\usepackage{graphbox}
\usepackage{booktabs}
\usepackage{multirow}
\usepackage{bigstrut}
\usetikzlibrary{calc}
\usetikzlibrary{positioning}
\usepackage{geometry}
\geometry{paper=a4paper}
%%odabir veličine papira
\geometry{bindingoffset=1.5cm,hmargin={1.5cm,1.5cm},vmargin={1cm,1cm}}
%%podešavanje margina
\geometry{includehead=true,headheight=3.5cm,headsep=1cm}
%%podešavanje headinga
\geometry{includefoot=false}
%%podešavanje footinga
\setlength{\parindent}{0.95cm} %%paragraf uvodni razmak
\pagestyle{fancy}
\renewcommand{\headrulewidth}{0pt} %%delete default header line
\newcommand{\thenextpage}{\number\numexpr\thepage+1\relax}
%%begin page borders
\SetBgOpacity{100.0} %% Select opacity
\SetBgScale{1} %% Select scale factor of logo
\SetBgAngle{0} %% Select rotation of logo
\SetBgColor{black} %% Select color
\SetBgContents{
\begin{tikzpicture}[overlay,remember picture]
\draw [line width=1pt,rounded corners=0pt]
($ (current page.north west) + (2.5cm,-1cm) $)
rectangle
($ (current page.south east) + (-1cm,1cm) $);
\draw [line width=1.5pt]
($ (current page.north west) + (2.5cm,-14.85cm) $) -- ($ (current page.north
west) + (1cm,-14.85cm) $);
\node[anchor=north] at ($(current page.north west)+(1.5cm,-1cm)$)
{\rotatebox{90}{\makecell[r]{\scriptsize\selectfont Reproduction or any use
not conformity with the intended\\
\scriptsize\selectfont application is not permissible.}}};
\node[anchor=north] at ($(current page.south west)+(1.5cm,1cm)$)
{\rotatebox{90}{\makecell[l]{\scriptsize\selectfont Nachdruck oder
Verwendung, die nicht der beabsichtigten\\
\scriptsize\selectfont Anwendung entspricht, ist nicht zulässig.}}};
\end{tikzpicture}
}
%%end page borders
%%begin firstpage footer
\fancypagestyle{firstpage}{%
\fancyhead[CE,CO,LE,LO,RE,RO]{} %% clear out all headers
\fancyfoot[CE,CO,LE,LO,RE,RO]{} %% clear out all footers
\fancyhf{} %% clear default for head and foot
\fancyfoot[C]{%
\begin{tikzpicture}[remember picture,overlay]
\node[anchor=south west,inner sep=0pt] at ($(current page.south west)+ (2.5cm,1cm)$) {
\begin{tabular}{@{}p{5.45cm}@{}|@{}p{3.5cm}@{}|@{}p{6cm}@{}|@{}p{1.5cm}@{}@{}p{1cm}@{}}
\hline
\scriptsize Projekt: & \scriptsize Vertrag Nr.: & \scriptsize Dokument Nr.: & \scriptsize Seite: & \textbf{\thepage} \bigstrut\\
\cline{4-5} \centering\textbf{\footnotesize Project} & & \centering\textbf{\footnotesize Document number} & \scriptsize Nächste Seite: & \textbf{\footnotesize \thenextpage} \bigstrut\\
\hline
\scriptsize Titel: & \scriptsize Format: & \scriptsize Rahmen: & \scriptsize Gesamte Seite: & \textbf{\footnotesize \pageref*{LastPage}} \bigstrut[t]\\
\centering\textbf{\footnotesize Title} & \centering\textbf{\footnotesize Format} & \centering\textbf{\footnotesize 1:1} & & \bigstrut[b]\\
\end{tabular}%
};
\end{tikzpicture}
}
}
%%end firstpage footer
%%begin default header for all pages; except first page style
\fancyhead[CE,CO,LE,LO,RE,RO]{} %% clear out all headers
\fancyfoot[CE,CO,LE,LO,RE,RO]{} %% clear out all footers
\fancyhf{} %% clear default for head and foot
\fancyhead[C]{%
\begin{tikzpicture}[remember picture,overlay]
\node[anchor=north west,inner sep=0pt] at ($(current page.north west)+(2.5cm,-1cm)$) {
\begin{tabular}{@{}p{4cm}@{}|@{}p{6.45cm}@{}|@{}p{6cm}@{}@{}p{1cm}@{}}
\multirow{4}[6]{*}{\includegraphics[valign=m,scale=0.25]{\cenlogo.png}} & \scriptsize Projekt: & \multicolumn{1}{l|}{\scriptsize Dokument Nr.:} & \scriptsize Rev.: \bigstrut[t]\\
& \centering\textbf{\footnotesize Project} & \multicolumn{1}{l|}{\textbf{\footnotesize Document number}} & \textbf{\footnotesize A} \bigstrut[b]\\
\cline{2-4} & \scriptsize Titel: & \scriptsize Seite: & \textbf{\footnotesize \thepage} \bigstrut\\
\cline{3-4} & \centering\textbf{\footnotesize Title} & \scriptsize Seitenzahl: & \textbf{\footnotesize \pageref*{LastPage}} \bigstrut\\
\hline
\end{tabular}%
};
\end{tikzpicture}
}
%%end default header for all pages; except first page style
%%end preamble
\begin{document}
%%titlepage begin
\thispagestyle{firstpage} %%\fancypagestyle{firstpage}
%%begin podešavanje margina, headinga i footinga za početnu stranicu
\newgeometry{bindingoffset=1.5cm,hmargin={1.5cm,1.5cm},vmargin={1cm,1cm},
includehead=false,
includefoot=true,footskip=2cm
}
%%end podešavanje margina, headinga i footinga za početnu stranicu
\vspace*{6cm} %%6cm vertical offset
\begin{center}
\Huge Some random text\\
\large Some random text\\~\\
\Huge Some random text\\
\large Some random text
\end{center}
\vspace*{\fill} %%fill page with empty space
%%titlepage end
\newpage
\restoregeometry %%restore to default header for all pages; except first page style
\section{Section title}
\lipsum[1-8]
\newpage
\section{Section title}
\lipsum[1-8]
\newpage
\section{Section title}
\lipsum[1-8]
\end{document}
提前谢谢您!谨致问候