ドキュメント形式の複製

ドキュメント形式の複製

下のリンクのような文書を作成する方法をご存知ですか? 文書に書かれている内容は無視してかまいません。

サンプルドキュメントへのリンク

ここに画像の説明を入力してください

答え1

すべて、ライトブルーの面に書かれているもの(そしておそらくダークブルーの面にも)は、セクションなどの機能を持っているようです。つまり、それは変わらない一定のテキストであるように思えます。

空白部分のテキストは可変テキストのようです。

私の仮定が正しい場合、もちろん、変化するテキストの部分を入力する LaTeX 変数をいくつか定義できます。次に、テーブルを生成し、以前に定義した変数の内容を入力するコマンドまたは環境を定義する必要があります。

簡単なはずです。

とりあえず、私の MWE はこちらです。

通常、定義は独自のスタイルファイルに置きます。その場合、 および は必要ありませ\makeatletter\makeatother

いくつかの内部変数を定義しました。たとえば、 です\course@title。により@、通常のドキュメントでは使用できなくなります。@ファイル名に を使用すると、変数名が安全になります。 ドキュメント内で偶然に 2 番目の変数を定義することはありません。

変数の内容を操作するために、ユーザー空間コマンドも定義しました。

また、変更されないテキスト部分の名前、つまりセクション名として使用される定数テキストの変数も定義しました。このセクション名を変更する必要がないことが確実な場合は、変数でこれらの名前を定義する必要はありません。コマンドでセクション名を直接使用してください。ただし、これらのセクション名の一部またはすべてが変更される可能性がわずかにある場合は、安全です。

最後に、タイプセットを実行するコマンドを定義しました\coursetable(これがマクロに本当に適切な名前であるかどうかは確信が持てません。警告しておきます)。

すべてのコンテンツを 1 つのマクロにまとめることで、変数を好きな順序で自由に入力できます。順序は問題ではありません。

\documentclass{article}
\usepackage{graphicx}
\usepackage{tabularx}


%% Some new column declarations
\newcolumntype{C}{>{\centering\arraybackslash}X}
\newcolumntype{L}{>{\raggedright\arraybackslash}X}

%% Dont use indent here!
\setlength{\parindent}{0pt}

%% maybe we need a uniqe skip:
\newlength{\myskip}\setlength{\myskip}{4ex}

%% Define some variables
\makeatletter
\def\course@title{}
\def\course@institute{Institute for Typography}
\def\course@teacher{}
%% This time with a default
\def\course@term{Summer2017}
\def\course@content{The course will explain the content of the course}
%% Define also the section names
\def\course@institutename{Institute}
\def\course@titlename{Course}
\def\course@teachername{Professor}
\def\course@termname{Semester}
\def\course@contentname{Contents}

%% Define the command, which will create the table right now.
\newcommand{\coursetable}{%
  % start a new page
  \clearpage%
  \thispagestyle{empty}%
  % Put in the Logos
  \includegraphics[width=2cm]{example-image-a}%
  \hfill%
  \includegraphics[width=2cm]{example-image-b}%
  \vspace{\myskip}
  \begin{tabularx}{\linewidth}{|C|C|}
    \hline
    \textbf{\course@titlename} & \textbf{\course@termname} \\
    \hline
    \course@title & \course@term \\
    \hline
    \textbf{\course@teachername} & \textbf{\course@institutename} \\
    \hline
    \course@teacher & \course@institute\\
    \hline
  \end{tabularx}

  \vspace*{\myskip}
  \begin{tabularx}{\linewidth}{|L|}
    \hline
    \multicolumn{1}{|C|}{\textbf{\course@contentname}}\\
    \hline
    \course@content\\
    \hline
  \end{tabularx}
  \vfill
  Signature: \hrulefill

}

%% Define user space commands to manipulate the internal variables 
\newcommand{\courseterm}[1]{\def\course@term{#1}}%
\newcommand{\coursetitle}[1]{\def\course@title{#1}}%
\newcommand{\courseinstitute}[1]{\def\course@institute{#1}}
\newcommand{\courseteacher}[1]{\def\course@teacher{#1}}
\newcommand{\coursecontent}[1]{\def\course@content{#1}}

%% Reserve the @-sign.
\makeatother

\begin{document}

%% The order, in which you define the variables, does not matter.
\coursetitle{Beautiful Concepts}
\courseteacher{Prof. Dr. Drofnats}
\coursecontent{We will discuss in deep, if good typography will enhace
every document of the world.  Therefore we will study two or three
examples} 

%% Now, build this table.    
\coursetable
\end{document}

これが結果です。もちろん、あなたの例とは異なりますが、これがあなたのドキュメントの進め方を示してくれることを願っています。

編集: 言及し忘れたことが 1 つあります。xcolor青いテーブル行を取得するには、-package を確認してください。

ここに画像の説明を入力してください

関連情報