\DocumentMetadata{lang=en,tagging=on}
\documentclass[12pt,a4paper]{article}
\usepackage[margin=1in]{geometry}
\usepackage{dcolumn}
\usepackage{booktabs}
\usepackage{fcolumn}
\usepackage{longtable}
\usepackage[tableposition=top,aboveskip=0pt]{caption}
% The next lines are a fix to the caption package, as that package is incompatible with tagging.
\RemoveFromHook{begindocument}[latex-lab-testphase-float]
\makeatletter \ExplSyntaxOn
\socket_new_plug:nnn{tagsupport/parbox/before}{caption}
  {\tagpdfparaOn %restart para tagging
   \tl_if_empty:NTF\@current@float@struct{\tag_struct_begin:n{tag=Caption,firstkid}}
    {\tag_struct_begin:n{tag=Caption,parent=\@current@float@struct,firstkid}}}
\socket_new_plug:nnn{tagsupport/parbox/after}{caption}{\tag_struct_end:}
\l@addto@macro\caption@beginex@hook{%
 \tagpdfparaOff %leavevmode in parbox should not start paragraph structure
  \AssignSocketPlug{tagsupport/parbox/before}{caption}
  \AssignSocketPlug{tagsupport/parbox/after}{caption}}
\ExplSyntaxOff \makeatother % End fix
\DeclareCaptionStyle{normal}{labelfont={rm,bf,small},textfont={rm,small},
 indention=0pt,labelsep=colon,justification=raggedright}
\captionsetup[table]{style=normal}
\captionsetup{singlelinecheck=false}
\usepackage{color}
\usepackage[hang,symbol*,perpage]{footmisc}
\ExplSyntaxOn \makeatletter \def\LT@output{%
 \ifnum\outputpenalty <-\@Mi
  \ifnum\outputpenalty > -\LT@end@pen
   \LT@err{floats~ and~ marginpars~ not~ allowed~ in~ a~ longtable}\@ehc
  \else
   \setbox\z@\vbox{\unvbox\@cclv}%
   \ifdim \ht\LT@lastfoot>\ht\LT@foot
    \dimen@\pagegoal
    \advance\dimen@\ht\LT@foot
    \advance\dimen@-\ht\LT@lastfoot
    \ifdim\dimen@<\ht\z@
     \setbox\@cclv\vbox{\unvbox\z@\copy\LT@foot
      % \vss % old line
      \vskip 0pt plus \maxdimen minus \normalbaselineskip 
     }\@makecol
     \@expl@@@mark@update@singlecol@structures@@
     \@outputpage \global\vsize\@colroom
     \setbox\z@\vbox{\box\LT@head}%
    \fi
   \fi
   \unvbox\z@\box\ifvoid\LT@lastfoot\LT@foot\else\LT@lastfoot\fi
   \UseTaggingSocket{tbl/longtable/foot}
  \fi
 \else
  \setbox\@cclv\vbox{\unvbox\@cclv\copy\LT@foot
  % \vss % old line
   \vskip 0pt plus \maxdimen minus \normalbaselineskip 
  }\UseTaggingSocket{tbl/longtable/foot}\@makecol
  \@expl@@@mark@update@singlecol@structures@@
  \@outputpage \global\vsize\@colroom \copy\LT@head\nobreak
 \fi}
\makeatother \ExplSyntaxOff
\def\cs#1{{\tt #1}}
\begin{document}
%\NewHookWithArguments{tbl/init}{2} \NewHook{tbl/row/end}
\noindent
Document showing all tables from \cs{fcolumn.pdf} (except the verbatim
versions) but now without using \cs{\char`\\documentclass\{ltxdoc\}}, 
i.e., in a ``normal'' \LaTeX-file.  It is using \cs{\char`\\DocumentMetadata},
however.  The \cs{caption} package needed to be patched, since without patching
it is incompatible with tagging.

But first a small equation to trigger some math as proof that the math
tagging still takes place.
\begin{equation}
x^n+y^n=z^n
\end{equation}

\floatsep=5pt plus 2pt minus 3pt
\textfloatsep=5pt plus 2pt minus 3pt
\renewcommand{\bottomfraction}{0.9}
\renewcommand{\textfraction}{0.1}
\begin{table}[htb]
\caption{Example Table.} \label{tab:ex1}
\begin{tabular}{@{}lflf@{}}
\multicolumn4{@{}c@{}}{\bfseries Balance sheet}\\
\toprule
properties & \leeg{31 dec 2014} & debts & \leeg{31 dec 2014}\\
\midrule
house        & 200000    & equity capital &  50000    \\
bank account &   -603,23 & mortgage       & 150000    \\
savings      &  28000                                 \\
cash         &    145,85 & profit         &  27542,62 \\
\sumline
\bottomrule
\end{tabular}
\end{table}

\newcolumntype{q}[1]{F.,{3,2}{#1}}
\begin{table}[htb]
\caption{Example Table with column formatting.} \label{tab:fcformat}
\begin{tabular}{@{}lq{\color{blue}\mathsf,\mathbf}lq{\color{magenta}}@{}}
\multicolumn4{@{}c@{}}{\bfseries Balance sheet}\\
\toprule
properties & \leeg{31 dec 2014} & debts & \leeg{31 dec 2014}\\
\midrule
house        & 200000    & equity capital &  50000    \\
bank account &   -603,23 & mortgage       & 150000    \\
savings      &  28000                                 \\
cash         &    145,85 & profit         &  27542,62 \\
\sumline
\bottomrule
\end{tabular}
\end{table}

\vskip45mm
\begin{longtable}[l]{@{}lflf@{}}
\caption{Table showing compatibility of fcolumn and 
  longtable.\label{tab:fclong}}\\
\multicolumn4{@{}c@{}}{\bfseries Balance sheet}\\
\toprule
properties & \leeg{31 dec 2014} & debts & \leeg{31 dec 2014}\\
\midrule
\endfirsthead
\caption[]{\textit{(continued from previous page)\/}}\\
\toprule
properties & \leeg{31 dec 2014} & debts & \leeg{31 dec 2014}\\
\midrule
\endhead
\bottomrule
\multicolumn4{@{}r@{}}{\small\textit{(Table continues on 
  next page)\/}}\\
\endfoot
\bottomrule
\endlastfoot
house        & 200000    & equity capital &  50000    \\
bank account &   -603,23 & mortgage       & 150000    \\
savings 1    &   5600                                 \\
savings 2    &   5600                                 \\
savings 3    &   5600                                 \\
savings 4    &   5600                                 \\
savings 5    &   5600                                 \\
cash         &    145,85 & profit         &  27542,62 \\
\sumline
\end{longtable}


Demonstrating \cs{\char`\\resetsumline}.
\begin{table}[htb]
\caption{Example: multiple projects.} \label{tab:fcmult}
\begin{tabular}{@{}lfflff@{}}
\multicolumn6{@{}c@{}}{\bfseries Project~1}\\
\toprule
expense & \leeg{actual} & \leeg{budget} & 
income  & \leeg{actual} & \leeg{budget} \\
\midrule
food   &  450,20 & 500    & tickets & 1200    & 1000    \\
drinks &  547,5  & 400                                  \\
music  &  180    & 100                                  \\
profit &   22,3                                         \\
\sumline[2pt][10pt]
\resetsumline
\multicolumn6{@{}c@{}}{\bfseries Project~2}\\
\toprule
expense & \leeg{actual} & \leeg{budget} & 
income & \leeg{actual} & \leeg{budget} \\
\midrule
food   &  250    & 300    & tickets &  400    &  450    \\
drinks &  100    &  80                                  \\
music  &   80    &  70    & loss    &   30              \\
\sumline
\bottomrule
\end{tabular}
\end{table}

The contents of Table~\ref{tab:fcoverflow} below will normally generate
errors---that can be ignored here because that's the whole purpose of this 
demonstration table.  In production runs, however, that's annoying, so
a redefinition of \cs{\char`\\PackageError} is included within the table
environment. If you want to see the raw errors generated by the tabular,
remove (or comment) the line redefining it.

\begin{table}[htb]
\def\PackageError#1#2#3{\PackageWarning{#1}{#2: #3}}
\caption{Examples on overflow.}
\label{tab:fcoverflow}
\begin{tabular}{@{}lfff@{}}
\multicolumn4{@{}c@{}}{\bfseries Projects}\\
\toprule
income & \leeg{31 dec 2014} & \leeg{31 dec 2015} & \leeg{31 dec 2016} \\
\midrule
item~1 &  20000000 & 20000000 & 20000000 \\
item~2 &  10000000 &  2000000 & -1500000 \\
item~3 &   5000000 & -1500000 &  2000000 \\
\checkfcolumns23
\sumline
\bottomrule
\end{tabular}
\end{table}

In Table~\ref{tab:fctrunc} more decimals after the decimal mark are given.
\newcolumntype{d}{D,,{-1}}
\begin{table}[htb]
\caption{Truncating excess digits.}
\label{tab:fctrunc}
\begin{tabular}{@{}ldfl@{}}
\toprule
composer & \multicolumn1c{raw entry} & \leeg{debt} & remark \\
\midrule
Berg        & 123,450  & 123,450  & silently ignoring digit ``0''             \\
Eisler      & 234,563  & 234,563  & warning: digit ``3'' ignored              \\
Sch\"onberg & 345,6704 & 345,6704 & warning: digits ``04'' ignored            \\
Webern      &   2,3456 &   2,3456 & warning: digits ``56'' ignored, i.e.,     \\
            &          &          & \quad without rounding this entry to 2,35 \\
\sumline
\bottomrule
\end{tabular}
\end{table}

And to end, copies of Table~\ref{tab:ex1}, now with strict accounting
layout and with red colour for negative numbers, are given in 
Tables~\ref{tab:ex2} and~\ref{tab:ex3} respectively.
\begin{table}[htb]
\makeatletter \strict@ccountingtrue
\caption{Example Table.} \label{tab:ex2}
\begin{tabular}{@{}lflf@{}}
\multicolumn4{@{}c@{}}{\bfseries Balance sheet}\\
\toprule
properties & \leeg{31 dec 2014} & debts & \leeg{31 dec 2014}\\
\midrule
house        & 200000    & equity capital &  50000    \\
bank account &   -603,23 & mortgage       & 150000    \\
savings      &  28000                                 \\
cash         &    145,85 & profit         &  27542,62 \\
\sumline
\bottomrule
\end{tabular}
\end{table}

\begin{table}[htb]
\makeatletter \minusr@dtrue
\caption{Example Table.} \label{tab:ex3}
\begin{tabular}{@{}lflf@{}}
\multicolumn4{@{}c@{}}{\bfseries Balance sheet}\\
\toprule
properties & \leeg{31 dec 2014} & debts & \leeg{31 dec 2014}\\
\midrule
house        & 200000    & equity capital &  50000    \\
bank account &   -603,23 & mortgage       & 150000    \\
savings      &  28000                                 \\
cash         &    145,85 & profit         &  27542,62 \\
\sumline
\bottomrule
\end{tabular}
\end{table}
\end{document}
