会計T勘定スキーム

会計T勘定スキーム

この画像に示されているような T 勘定を作成したいと思います。

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

私はテーブル環境を使用してこれを実行しようとしましたが、良い結果は得られませんでした (たとえば、アカウントの片側 (左側) にのみ単語や数字がある場合、反対側 (右側) のスペースはすべて削除されます)。

おそらく実行可能な解決策は、minipage内部に 2 つの列がある環境を使用することでしょうか?

アドバイスをいただければ幸いです。

\documentclass{article}

\begin{document}

\begin{table}[]
\centering
%\caption{My caption}
\label{my-label}
\begin{tabular}{|l|l|}
\hline
\multicolumn{2}{|c|}{Statement of Income 2015} \\ \hline
Debit                     & Credit             \\ \hline
Increase                  & Decrease           \\ \hline
Normal Balance            &                    \\ \hline
\end{tabular}
\end{table}

\end{document}

答え1

(T 勘定のデフォルトの幅を上書きできるようにしたいという OP の希望を考慮して編集されました)

以下は、 と呼ばれるマクロを定義する回答です\taccount。このマクロは 4 つの引数を取り、最初の引数はオプションです。

  • 各t列の幅。この引数はオプションです。指定しない場合は、デフォルトで になります\tcolumnwidth1.75cm以下のコードでは に設定されています)。
  • アカウント ヘッダー (中央揃え、自動行折り返しが有効)
  • 左側の列(「アセット」)の素材(右寄せ、行折り返し有効、ハイフネーション可)
  • 右側の列(「責任」)の資料(これも右寄せ、行折り返しが有効、ハイフネーションが許可されている)

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

\documentclass{article}
\usepackage{array,ragged2e}
\newlength\tcolumnwidth
\setlength\tcolumnwidth{1.75cm} % default width of t-column
\newlength\taccountwidth

%% The macro "\taccount" takes 4 arguments. The first
%% arg. is optional; its default value is \tcolumnwidth.
\newcommand\taccount[4][\tcolumnwidth]{% 
  \renewcommand\arraystretch{1.333} % default value: 1
  \setlength\tabcolsep{3pt}         % default value: 6pt
  \setlength\taccountwidth{\dimexpr#1+#1+2\tabcolsep+1\arrayrulewidth\relax}
  \begin{tabular}[t]{@{}l|l@{}}
  \multicolumn{2}{>{\Centering}p{\taccountwidth}}{#2}\\
  \hline
  \begin{tabular}[t]{@{}>{\RaggedRight\hspace{0pt}}p{#1}} 
  #3 \end{tabular} 
  &
  \begin{tabular}[t]{>{\RaggedRight\hspace{0pt}}p{#1}@{}} 
  #4 \end{tabular}
  \end{tabular}}

\begin{document}
% First instance of \taccount uses the default width;
% the second instance uses a non-default width.
\taccount{A basic T-account}
  {Asset 1\\Asset 2\\Asset 3\\Asset 4}
  {Liability 1\\Liability 2\\ Equity}
\qquad     
\taccount[2.75cm]{A slightly more complicated T-account}
  {Basic Asset 1\\Complicated Asset 2\\Asset 3\\Asset 4}
  {Liability 1\\Complicated Liability 2\\Preferred Stock\\Common Equity}

\end{document}

答え2

以下の定義はマクロを導入する

\Taccount[column width]{headline}{table contents}

最初の引数はオプションで、デフォルトは です1.5cm

\newcommand\Taccount[3][1.5cm]%
   {{\renewcommand\arraystretch{1.3}%
    \begin{tabular}[t]{@{}p{#1}|p{#1}@{}}
    \multicolumn{2}{@{}c@{}}{#2}\\
    \hline
    #3
    \end{tabular}%
   }}

行間の間隔は によって制御され\arraystretch、ここでは に増加されます1.3

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

\documentclass{article}
\newcommand\Taccount[3][1.5cm]%
   {{\renewcommand\arraystretch{1.3}%
    \begin{tabular}[t]{@{}p{#1}|p{#1}@{}}
    \multicolumn{2}{@{}c@{}}{#2}\\
    \hline
    #3
    \end{tabular}%
   }}
\begin{document}
\Taccount{Assets}{Debits&Credits\\Increase&Decrease\\Normal Balance}\quad
\Taccount{Expenses}{Debits&Credits\\Increase&Decrease\\Normal Balance}\quad
\Taccount{Owner's Drawing}{Debits&Credits\\Increase&Decrease\\Normal Balance}
\bigskip

\Taccount{Liabilities}{Debits&Credits\\Decrease&Increase\\&Normal Balance}\quad
\Taccount{Revenues}{Debits&Credits\\Decrease&Increase\\&Normal Balance}\quad
\Taccount{Owner's Capital}{Debits&Credits\\Decrease&Increase\\&Normal Balance}
\end{document}

関連情報