2

I may have change something before at the macro level by accident with some code I got online. How could I set it back?

Now I am facing this problem where when I put: \setlength\heavyrulewidth{0.14em} \setlength\lightrulewidth{0.14em}

to get same thickness on all lines,

I got the bottom like thicker than the top line???

Code:

\documentclass{article}
\usepackage[letterpaper,margin=1in]{geometry}
\setlength{\pdfpagewidth}{8.5in} 
\setlength{\pdfpageheight}{11in}
\usepackage[english]{babel}
\usepackage{colortbl} 
\usepackage{array}

\usepackage{amssymb,amsmath,array}
\usepackage{siunitx} % don't use 'detect-all' switch unless you know what you're doing
\usepackage{booktabs}
\usepackage{rotating} % for 'sidewaystable' env.

\setlength\heavyrulewidth{0.14em}
\setlength\lightrulewidth{0.14em}

\begin{document}
\begin{sidewaystable}
\sisetup{
  input-symbols         = (),
  table-format          = -1.3,
  table-space-text-post = ***,
  table-align-text-post = false,
  group-digits          = false
}
\noindent
\begin{tabular}{@{}l *{8}{S} @{}} 
\arrayrulecolor{blue} 
\toprule
          & {(1)} & {(2)} & {(3)} & {(4)} & {(5)} & {(6)} & {(7)} & {(8)} \\
Variables & {FullD} & {FullD} & {FullD} & {FullD} & {FullD} & {FullD} & {FullD} & {FullD} \\ 
\midrule
STI\_30   & 0.301*** & 0.179** & 0.152* & 0.159 & -0.000 & 0.107 & 0.097 & 0.115 \\
          & (0.087) & (0.085) & (0.085) & (0.097) & (0.003) & (0.084) & (0.094) & (0.105) \\
Produce\_Full\_SR &  & 0.349*** & 0.321*** & 0.303* & 0.318*** & 0.270*** & 0.244*** & 0.257*** \\
          &  & (0.071) & (0.074) & (0.170) & (0.074) & (0.074) & (0.078) & (0.090) \\
Has\_Sus\_Efforts &  &  & 0.078*** & 0.077*** & 0.245*** & 0.001 & 0.046** & 0.129*** \\
          &  &  & (0.020) & (0.020) & (0.094) & (0.013) & (0.019) & (0.041) \\
1o.STI\_30\#1o.Produce\_Full\_SR &  &  &  & 0.000 &  &  &  &  \\
          &  &  &  & (0.000) &  &  &  &  \\
1o.STI\_30\#1o.Has\_Sus\_Efforts &  &  &  &  & 0.000 &  &  &  \\
          &  &  &  &  & (0.000) &  &  &  \\
Water\_Efforts &  &  &  &  &  & 0.168*** &  &  \\
          &  &  &  &  &  & (0.039) &  &  \\
C\_or\_S  &  &  &  &  &  &  & 0.202*** &  \\
          &  &  &  &  &  &  & (0.066) &  \\
C\_or\_S1 &  &  &  &  &  &  &  & 0.221** \\
          &  &  &  &  &  &  &  & (0.100) \\
Constant  & 0.054*** & 0.029*** & -0.001 & -0.002 & 0.000 & -0.001 & 0.000 & 0.000 \\
          & (0.010) & (0.008) & (0.003) & (0.003) & (0.003) & (0.003) & (0.000) & (0.000) \\
\midrule
Observations & {566} & {555} & {552} & {552} & {552} & {552} & {252} & {140} \\
Year FE      & {No} & {No} & {No} & {No} & {No} & {No} & {No} & {No} \\
No.\ of obs  & {566} & {555} & {552} & {552} & {552} & {552} & {252} & {140} \\
Adjusted\ R\textsuperscript{2} & {0.0696} & {0.211} & {0.233} & {0.232} & {0.234} & {0.275} & {0.199} & {0.133} \\ 
\bottomrule
\addlinespace
\multicolumn{9}{c}{Robust standard errors in parentheses} \\
\multicolumn{9}{c}{$^{***}\ p<0.01$; $^{**}\ p<0.05$; $^{*}\ p<0.1$} \\
\end{tabular}
\end{sidewaystable}
\end{document}

Thx for the help^^

Johnny

  • Please help us help you and add a minimal working example (MWE) that illustrates your problem. Reproducing the problem and finding out what the issue is will be much easier when we see compilable code, starting with \documentclass{...} and ending with \end{document}. – user36296 Jan 3 at 12:18
  • 1
    Thanks for adding the code! I get the same line widths if I test it. – user36296 Jan 3 at 12:21
  • 1
    I think this is probably a problem of the pdf viewer and your latex code works fine. – user36296 Jan 3 at 12:22
  • 1
    I can see some variations depending on zoom level, so I agree with samcarter, this is likely to be rounding issues in the PDF viewer – daleif Jan 3 at 12:23
  • 1
    @Johnny I tested with the build-in viewer of texstudio and mac preview. many pdf viewer have some preferences to switch off options like "enhance thin lines" or similar. Switching these off might help but other things might look less good then. – user36296 Jan 3 at 12:28
1

I found a solution with \patchcmd:

just add the following into the code =) Thanks for the help guys anyway^^

\usepackage{booktabs, etoolbox}

\newlength{\toprulewidth}
\setlength{\toprulewidth}{0.14em}
\patchcmd{\toprule}% <cmd>
  {\heavyrulewidth}{\toprulewidth}% <search><replace>
  {}{}% <success><failure>
\patchcmd{\bottomrule}% <cmd>
  {\heavyrulewidth}{\toprulewidth}% <search><replace>
  {}{}% <success><failure>
  • but it works only if we don't set the lightrulewidth to the same value--when the problem persists =( guess it's something to do with the viewer software – Johnny Jan 3 at 12:45
  • 1
    Your entire answer can be simplified to \setlength\heavyrulewidth{0.14em}. (The default value is 0.08em.) Do check it out for yourself. – Mico Jan 3 at 13:06
  • 1
    Regarding the claim you posted in a comment: Why would you -- or anyone else -- set \heavyrulewidth equal to \lightrulewidth to begin with? That would defeat the whole purpose of creating a professional-looking table... – Mico Jan 3 at 13:08

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.