
編集 1: 画像は「4 行ではなく 3 行」である必要があります。
編集 2: コンパイル可能なコードが更新されました。
私は Latex の初心者ですが、論文のタイトルを提供する次のようなテンプレート コードがあります。
\documentclass[headsepline,footsepline,footinclude=false,oneside,fontsize=11pt,paper=a4,listof=totoc,bibliography=totoc]{scrbook} % one-sided
\usepackage{graphicx}
\usepackage[ngerman,american]{babel}
\newcommand*{\getUniversity}{University of Earth}
\newcommand*{\getFaculty}{Engineering Department}
\newcommand*{\getDegree}{Computer Science}
\newcommand*{\getSchool}{School of Public Science}
\newcommand*{\getTitle}{This is a Long title that I want to stretch the Margin so that instead of 4 lines, it should only be 3 lines, and the logo at the end won't break}
\newcommand*{\getTitleGer}{This is a Long title that I want to stretch the Margin so that instead of 4 lines, it should only be 3 lines, and the logo at the end won't break}
\newcommand*{\getAuthor}{Author}
\newcommand*{\getDoctype}{Thesis}
\newcommand*{\getSupervisor}{Faculty Professor}
\newcommand*{\getAdvisor}{Faculty Advisr}
\newcommand*{\getSubmissionDate}{\today}
\newcommand*{\getSubmissionLocation}{Somewhere In between}
\begin{document}
\begin{titlepage}
\centering
\includegraphics[height=20mm]{example-image-a}
\vspace{5mm}
{\huge\MakeUppercase{School of \getSchool{} --- \getFaculty{}} \par}
\vspace{5mm}
{\large\MakeUppercase{\getUniversity{}} \par}
\vspace{20mm}
% \vspace{6mm}
{\Large \getDoctype{} in \getDegree{} \par}
\vspace{15mm}
% \vspace{4mm}
{\huge\bfseries \getTitle{} \par}
\vspace{5mm}
{\huge\bfseries \foreignlanguage{ngerman}{\getTitleGer{}} \par}
\vspace{10mm}
\begin{tabular}{l l}
Author: & \getAuthor{} \\
Supervisor: & \getSupervisor{} \\
Advisors: & \getAdvisor{} \\
Submission Date: & \getSubmissionDate{} \\
\end{tabular}
\vfill{}
\includegraphics[height=15mm]{example-image-b}
\end{titlepage}
\end{document}
質問が2つあります。
\getTitle{} 部分の行の余白を増やす方法はありますか? フォント サイズと vspace{} の指定は維持したいです。タイトルが長くなると、すぐに 3 行から 4 行に分割される傾向があります。2 行から 3 行程度になるように伸ばしたいです。
タイトルが長すぎる場合、著者部分と最後
faculty_logo
(コード スニペットの画像例 B) が次のページに分割されます。次のページに移動せずに、これらの 2 つのコンポーネントを常にページの下部に固定する方法はありますか?
全体として、コード スニペットで定義された同じテキスト長の 3 行のタイトルを 2 つ作成し、すべてを同じページに配置する必要があります。
答え1
\parbox
おそらく、余白に突き出る を生成するマクロで十分でしょう。
\documentclass[headsepline,footsepline,footinclude=false,oneside,fontsize=11pt,paper=a4,listof=totoc,bibliography=totoc]{scrbook} % one-sided
%---------------------------------------------------------
\newsavebox\scratchbox
\newcommand\boxIntoMargins[4]{%
\savebox\scratchbox{%
\mbox{%
\kern-\dimexpr(#1)\relax
\parbox[b]{\dimexpr((#1)+(#2)+(#3))\relax}{#4}%
}%
}%
\wd\scratchbox=\linewidth
\usebox\scratchbox
}%
%---------------------------------------------------------
\usepackage{graphicx}
\usepackage[ngerman,american]{babel}
\newcommand*{\getUniversity}{University of Earth}
\newcommand*{\getFaculty}{Engineering Department}
\newcommand*{\getDegree}{Computer Science}
\newcommand*{\getSchool}{School of Public Science}
\newcommand*{\getTitle}{%
\boxIntoMargins{1.5cm}{\linewidth}{1.5cm}{%
\centering
This is a Long title that I want to stretch the Margin so that instead of 4 lines, it should only be 3 lines, and the logo at the end won't break%
}%
}
\newcommand*{\getTitleGer}{%
\boxIntoMargins{1.5cm}{\linewidth}{1.5cm}{%
\centering
This is a Long title that I want to stretch the Margin so that instead of 4 lines, it should only be 3 lines, and the logo at the end won't break%
}%
}
\newcommand*{\getAuthor}{Author}
\newcommand*{\getDoctype}{Thesis}
\newcommand*{\getSupervisor}{Faculty Professor}
\newcommand*{\getAdvisor}{Faculty Advisr}
\newcommand*{\getSubmissionDate}{\today}
\newcommand*{\getSubmissionLocation}{Somewhere In between}
\begin{document}
\begin{titlepage}
\centering
\includegraphics[height=20mm]{example-image-a}
\vspace{5mm}
{\huge\MakeUppercase{School of \getSchool{} --- \getFaculty{}} \par}
\vspace{5mm}
{\large\MakeUppercase{\getUniversity{}} \par}
\vspace{20mm}
% \vspace{6mm}
{\Large \getDoctype{} in \getDegree{} \par}
\vspace{15mm}
% \vspace{4mm}
{\huge\bfseries \getTitle{} \par}
\vspace{5mm}
{\huge\bfseries \foreignlanguage{ngerman}{\getTitleGer{}} \par}
\vspace{10mm}
\begin{tabular}{l l}
Author: & \getAuthor{} \\
Supervisor: & \getSupervisor{} \\
Advisors: & \getAdvisor{} \\
Submission Date: & \getSubmissionDate{} \\
\end{tabular}
\vfill{}
\includegraphics[height=15mm]{example-image-b}
\end{titlepage}
\end{document}
Overleaf を使用してコンパイルしたスクリーンショット:
テンプレートのデフォルト値を調整するのをまた忘れてしまいました。画像 b の高さは 20 mm のはずですが、それでも 2 ページ目に分割されます。常に 1 ページに収める方法はありますか?
この回答の最初のリリースの作成者は、テキストが多すぎて 1 ページに収まらないという条件は、単にテキストを増やすだけで常に満たされるため、常に 1 ページに収まる方法はないと考えています。 ;-) また、1 ページに収まる可能性を高めるために調整を自動化しようとするのは、労力に見合わないのではないかと考えています。
おそらく、タイトルページの内容を、用紙の寸法を超える可能性がある別の場所に配置し、パッケージ graphicxs の\newsavebox
コマンドと、用紙に収まるようにボックスを縮小するコマンドの使用を組み合わせることができます。\scalebox
\usebox
または、タイトル ページを別の .tex ドキュメントに用意し、そこから別の .pdf ファイルを作成し、それを を介してメイン ドキュメントに組み込むことで、\includegraphics
メイン ドキュメントの用紙サイズに合わせて縮小することができます。別の .tex ドキュメント内では、ドキュメントの用紙の寸法を超えるタイトル ページを収めたボックスが、 と を調整した後に出荷されます\(pdf)pagewidth
。\(pdf)pageheight
次に
、この方法で問題に対処する方法の概要を示します。
\documentclass{article}
\newbox\BoxWithTitlepage
\newcommand\ShipoutAsPage[1]{%
\begingroup
\setbox\BoxWithTitlepage=\vbox{%
\hrule height 0pt
#1\ifvmode\else\expandafter\endgraf\fi
\hrule height 0pt
}%
\csname @ifundefined\endcsname{pagewidth}{}{\pagewidth=\wd\BoxWithTitlepage}%
\csname @ifundefined\endcsname{pdfpagewidth}{}{\pdfpagewidth=\wd\BoxWithTitlepage}%
\csname @ifundefined\endcsname{pageheight}{}{\pageheight=\ht\BoxWithTitlepage
\advance\pageheight\dp\BoxWithTitlepage}%
\csname @ifundefined\endcsname{pdfpageheight}{}{\pdfpageheight=\ht\BoxWithTitlepage
\advance\pdfpageheight\dp\BoxWithTitlepage}%
\shipout\vbox{\kern-1truein\hbox{\kern-1truein\box\BoxWithTitlepage}}%
\endgroup
}%
\begin{document}
\ShipoutAsPage{%
% Content of your titlepage
% Content of your titlepage
% Content of your titlepage
% Content of your titlepage
}%
\end{document}
しかし、これを実際に推奨できないのには十分な理由があります。
- この方法では、タイトルページからドキュメントの他の場所へのハイパーリンクを簡単に作成することはできません。
- フォントが自然なサイズではなくなるため、スケーリングしても見栄えが悪くなります。
- たとえば、表や環境で作成された画像などの罫線や線は
tikzpicture
、サイズを小さくすると細くなりすぎて、印刷できなくなる可能性があります。
したがって、おそらく「手作業」で調整する方がよいでしょう。たとえば、タイトルページのタイプエリアを紙の下部に向かって少し拡大し、文字を少し上向きにカーニングします。以下は「手っ取り早い」解決策ですが、おそらく目的を達成できるでしょう。
\documentclass[headsepline,footsepline,footinclude=false,oneside,fontsize=11pt,paper=a4,listof=totoc,bibliography=totoc]{scrbook} % one-sided
%---------------------------------------------------------
\newsavebox\scratchbox
\newcommand\boxIntoMargins[4]{%
\savebox\scratchbox{%
\mbox{%
\kern-\dimexpr(#1)\relax
\parbox[b]{\dimexpr((#1)+(#2)+(#3))\relax}{#4}%
}%
}%
\wd\scratchbox=\linewidth
\usebox\scratchbox
}%
%---------------------------------------------------------
\usepackage{graphicx}
\usepackage[ngerman,american]{babel}
\newcommand*{\getUniversity}{University of Earth}
\newcommand*{\getFaculty}{Engineering Department}
\newcommand*{\getDegree}{Computer Science}
\newcommand*{\getSchool}{School of Public Science}
\newcommand*{\getTitle}{%
\boxIntoMargins{1.5cm}{\linewidth}{1.5cm}{%
\centering
This is a Long title that I want to stretch the Margin so that instead of 4 lines, it should only be 3 lines, and the logo at the end won't break%
}%
}
\newcommand*{\getTitleGer}{%
\boxIntoMargins{1.5cm}{\linewidth}{1.5cm}{%
\centering
This is a Long title that I want to stretch the Margin so that instead of 4 lines, it should only be 3 lines, and the logo at the end won't break%
}%
}
\newcommand*{\getAuthor}{Author}
\newcommand*{\getDoctype}{Thesis}
\newcommand*{\getSupervisor}{Faculty Professor}
\newcommand*{\getAdvisor}{Faculty Advisr}
\newcommand*{\getSubmissionDate}{\today}
\newcommand*{\getSubmissionLocation}{Somewhere In between}
\begin{document}
\begin{titlepage}
\enlargethispage{1cm}%
\hrule height 0mm
\kern-.5cm
\centering
\includegraphics[height=20mm]{example-image-a}
\vspace{5mm}
{\huge\MakeUppercase{School of \getSchool{} --- \getFaculty{}} \par}
\vspace{5mm}
{\large\MakeUppercase{\getUniversity{}} \par}
\vspace{20mm}
% \vspace{6mm}
{\Large \getDoctype{} in \getDegree{} \par}
\vspace{15mm}
% \vspace{4mm}
{\huge\bfseries \getTitle{} \par}
\vspace{5mm}
{\huge\bfseries \foreignlanguage{ngerman}{\getTitleGer{}} \par}
\vspace{10mm}
\begin{tabular}{l l}
Author: & \getAuthor{} \\
Supervisor: & \getSupervisor{} \\
Advisors: & \getAdvisor{} \\
Submission Date: & \getSubmissionDate{} \\
\end{tabular}
\vfill{}
\includegraphics[height=20mm]{example-image-b}
\end{titlepage}
\end{document}
⟨上余白の高さ⟩:⟨下余白の高さ⟩ の比率が 1:1 でない場合は、垂直方向に上向きにカーニングしながらタイプ領域を下向きに拡大しても比率が維持されるように、もう少し計算を行う必要があるかもしれません。
⟨左余白の幅⟩:⟨右余白の幅⟩の比率が1:1でない場合は、次の式で計算する必要があるかもしれません。
\boxIntoMargins{<amount of horizontal space that sticks into left margin>}%
{\linewidth}%
{<amount of horizontal space that sticks into right margin>}%
{...}%
その比率は維持されます。
おそらく、
{\huge\MakeUppercase{School of \getSchool{} --- \getFaculty{}} \par}
行の配置が、最初の em ダッシュの直前で改行が発生し、学部を示す文字列全体が 1 行に収まるようにすると、見栄えが良くなるでしょう。学部の文字\getFaculty{}
列が 2 つの em ダッシュの間にネストされるように、後ろに em ダッシュが追加されます。 ;-)
ところで、あなたの例のコードは私に思い出させます表紙とタイトル ページ、タイトル ページの後に不要な空白ページがあるスクラップブックおそらく、そこには役立つ洞察が見つかるでしょう。