3

In my answers here, on TeX.SS many times I like to show tables with width of \textwidth together with page layout. Since both lines are black, it is not simple distinguish table vertical border lines and table top line from page layout. If the page layout lines be in for example blue, this would become more easier.

An example:

enter image description here

Above image is done by

\documentclass{article}
\usepackage{showframe}
\usepackage{array, booktabs}

\begin{document}
    \scriptsize
    \centering
\setlength\tabcolsep{0pt}
    \begin{tabular*}{\textwidth}{@{\,}m{2cm}@{\extracolsep{\fill}}*{18}{c}@{\,}}
    \toprule
        & \multicolumn{17}{c}{APE Thresholds (\%)} &   
                            \\  \cmidrule(lr){2-18}
\centering  Model   
        & 0.01 & 0.05 & 0.1 & 0.25 & 0.5 &  1 &  2 & 5 
        & 7.5  & 10   & 15  & 30   & 40  & 50 & 75 & 100 
        & None & Best       \\  \midrule
Closed
        & 25   & 50   & 35  & 40   & 45  &    &    &  
        &      &      &     &      &     &    &    & 
        &      &            \\ \bottomrule
\end{tabular*}
\end{document}

1 Answer 1

6

Redeclare \ShowFrameColor.

Example:

\documentclass{article}
\usepackage{showframe}
\usepackage{array, booktabs}

\renewcommand*\ShowFrameColor{\color{red}}
\begin{document}
    \scriptsize
    \centering
\setlength\tabcolsep{0pt}
    \begin{tabular*}{\textwidth}{@{\,}m{2cm}@{\extracolsep{\fill}}*{18}{c}@{\,}}
    \toprule
        & \multicolumn{17}{c}{APE Thresholds (\%)} &
                            \\  \cmidrule(lr){2-18}
\centering  Model
        & 0.01 & 0.05 & 0.1 & 0.25 & 0.5 &  1 &  2 & 5
        & 7.5  & 10   & 15  & 30   & 40  & 50 & 75 & 100
        & None & Best       \\  \midrule
Closed
        & 25   & 50   & 35  & 40   & 45  &    &    &
        &      &      &     &      &     &    &    &
        &      &            \\ \bottomrule
\end{tabular*}
\end{document}

enter image description here


It is also possible to change the thickness of the lines with \renewcommand*\ShowFrameLinethickness{5pt}

enter image description here


References

http://mirror.physik-pool.tu-berlin.de/tex-archive/macros/latex/contrib/eso-pic/showframe.sty

5
  • Thank you very much! I wonder, does exist similar solution for showframe option in geometry package?
    – Zarko
    Sep 8, 2016 at 20:14
  • I do not know of any, and looking at the relevant code in geometry makes me believe that it won't be easy to implement. Do you assume that \usepackage[showframe]{geometry} creates more accurate frames than \usepackage{showframe}? Sep 8, 2016 at 20:23
  • No, I'm just curious. In case, that I use geometry packages, the option showframe become handy. But instead this option have one more package in preamble, is not so big deal. Because the name of option and package are the same, I hope, that they have some common parts of code.
    – Zarko
    Sep 8, 2016 at 21:53
  • 1
    See tex.stackexchange.com/q/164521 for the showframe option of geometry.
    – Thérèse
    Oct 9, 2016 at 13:37
  • The same exact code gives me an error ! LaTeX Error: Command \ShowFrameColor undefined., showframe results installed. Dec 16, 2022 at 8:37

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .