0

I starting to make a table which print out all for me relevant document information in one table like

  • actual paper width,
  • count of words,
  • actual font size
  • actual font type
  • ...

Is there maybe a package available for this? Or anyone know where I can find the missing commands (print out count fo words, print out current font, current font size)

\begin{table}[]
\footnotesize
\centering
\begin{tabular}{ll}  
\toprule
Feature & Value\\
\midrule
actual paper width in [cm] &  \printinunitsof{cm}\prntlen{\textwidth}  \\
actual font size & <??> \\   \bottomrule 
\end{tabular}
\end{table}
SRel
  • 1,313
  • 1
    The current font size is stored in \f@size (this is not a length but a macro storing the size in pt you can access it with either \makeatletter\f@size\makeatother or \csname f@size\endcsname.). – Skillmon Aug 21 '18 at 18:03
  • You can also access the paper width, but the word count seems to require additional software. –  Aug 21 '18 at 18:05
  • And (if you didn't know yet), there are the dimensions \textheight, \paperheight, \paperwidth, \marginparwidth, ... The wikibook has a bit of information about all the lengths related to page layout. – Skillmon Aug 21 '18 at 20:16
  • And this question might be of interest: https://tex.stackexchange.com/questions/14377/how-can-i-test-for-the-current-font – Skillmon Aug 21 '18 at 20:17
  • the count of words does not really fit there, all the other things are tex defined lengths, but tex has no idea about the number of words in the docuemnt – David Carlisle Aug 21 '18 at 20:33
  • many thanks @skillmon there are some features i was not thinking about – SRel Aug 21 '18 at 20:53

1 Answers1

1

I made a listing in a tabular environment with some information which are helpful for me. Maybe this can help someone else:

\documentclass {scrbook}
\usepackage[utf8]{inputenc}
\usepackage[ngerman]{babel}
\usepackage[T1]{fontenc}
\usepackage{array} 
\usepackage{tikz} 
\usepackage{xcolor} 
\usepackage{booktabs} 
\usepackage[showframe]{geometry}
\usepackage{layouts}
\usepackage{lmodern}

%//Colour definitions\\%
\newcommand{\fillOne}{green!35!black}
\newcommand{\fillTwo}{black!10}
\newcommand{\fillThree}{red!10!}
\newcommand{\fillFour}{black!10!blue}

\newcolumntype{L}[1]{>{\raggedright\arraybackslash}p{#1}} 

% display some document properties
\edef\defaultfont{\fontname\font}  
\edef\defaultsize{\csname f@size\endcsname}  
\newcommand{\currentfont}{\fontname\font}
\newcommand{\currentsize}{\csname f@size\endcsname}


\begin{document}

\newcommand{\printProperties}
{
\newlength{\freewidth}
\begin{table}[]
\footnotesize
\setlength{\freewidth}{\dimexpr\textwidth-6\tabcolsep}
\begin{tabular}{L{.7\freewidth}L{.2\freewidth}L{.10\freewidth}}   
\toprule
Feature & Value \\
\midrule
PaperWidth in [cm]& \printinunitsof{cm}\prntlen{\paperwidth}\\
PaperHeight in [cm]& \printinunitsof{cm}\prntlen{\paperheight}\\
TextWidth in [cm] &  \printinunitsof{cm}\prntlen{\textwidth}  \\
TextHeight in [cm] & \printinunitsof{cm}\prntlen{\textheight}\\
\midrule
MarginParSep in [cm] & \printinunitsof{cm}\prntlen{\marginparsep}\\
MarginParWidth in [cm] & \printinunitsof{cm}\prntlen{\marginparwidth}\\
FootSkip in [cm]& \printinunitsof{cm}\prntlen{\footskip}\\
\midrule
Default Font &  \defaultfont \\
Default Size   & \defaultsize \\
Current Font &  \currentfont \\
Current Size &  \currentsize \\
\midrule
Colour1 & \fillOne & \begin{tikzpicture} \draw[fill=\fillOne, draw=none] (0,0) rectangle (1,.2); \end{tikzpicture}\\
Colour2 & \fillTwo & \begin{tikzpicture} \draw[fill=\fillTwo, draw=none] (0,0) rectangle (1,.2); \end{tikzpicture}\\
Colour3 & \fillThree & \begin{tikzpicture} \draw[fill=\fillThree, draw=none] (0,0) rectangle (1,.2); \end{tikzpicture}\\
Colour4 & \fillFour & \begin{tikzpicture} \draw[fill=\fillFour, draw=none] (0,0) rectangle (1,.2); \end{tikzpicture}\\
\bottomrule 
\end{tabular}
\end{table}
}

\printProperties

\end{document}

Which results in:

enter image description here

SRel
  • 1,313