2

I wonder if you can help me why LaTeX can't draw a \hhline in my table?

(I would put a picture but I need at least 10 reputation...)

Here is the code:

\documentclass[12pt,titlepage]{report}

\usepackage[T1]{fontenc}
\usepackage{lmodern}
\usepackage[utf8]{inputenc}
\usepackage[czech]{babel}
\usepackage{fullpage}
\usepackage{listings}
\usepackage{palatino, url, multicol}
\usepackage{graphicx}
\setlength{\parindent}{1cm}
\usepackage{indentfirst}
\setcounter{secnumdepth}{3}
\usepackage{mdframed}
\usepackage[usenames,dvipsnames]{xcolor}
\definecolor{light-gray}{gray}{0.85}
\setcounter{tocdepth}{3}
\usepackage{titlesec}
\titleformat{\chapter}[display]   
{\normalfont\huge\bfseries}{\chaptertitlename\ \thechapter}{20pt}{\Huge}  
\titlespacing*{\chapter}{0pt}{-50pt}{40pt}
\usepackage{multirow}
\usepackage{hhline}
\usepackage{enumerate}
\usepackage{here}
\usepackage{longtable}
\usepackage[bottom]{footmisc}
\usepackage[font={small,it}]{caption}

\begin{document}

 \begin{table}[H]
    \centering
    \begin{tabular}{|c|c|c|}
    \hline
    \multirow{2}{*}{Rok} & \multicolumn{2}{|c|}{$r_f$}\\
    \hhline{~--}
      & ARAD & INFA\\
    \hline
      2000         & 7,38 \%  & \\
    \hline
      2001    & 5,43 \% & \\
    \hline
      2002         & 4,15 \%  &  \\
    \hline
      2003    & 4,82 \% & \\
    \hline
      2004         & 4,04 \% & \\
    \hline
      2005         & 3,61 \% &\\
    \hline
      2006         & 3,68 \% & \\
    \hline
      2007         & 4,65 \%  &  4,28 \%\\
    \hline
      2008    & 4,09 \% & 4,55 \%\\
    \hline
      2009         & 3,68 \% & 4,67 \%\\
    \hline
      2010         & 3,75 \% & 3,71 \%\\
    \hline
      2011         & 3,43 \% & 3,51 \%\\
    \hline
      2012         & 1,45 \% & \\
    \hline
    \end{tabular}
    \caption{Hrubý výnos českého desetiletého dluhopisu v letech 2000 - 2012, zdroj: ČNB a MPO}\label{dluhopisy}
    \end{table}
\end{document}

Result of code

3
  • 2
    Welcome to TeX.sx! Please add a minimal working example (MWE) that illustrates your problem. It will be much easier for us to reproduce your situation and find out what the issue is when we see compilable code, starting with \documentclass{...} and ending with \end{document}. It's important to know what packages are needed, in order to avoid having to guess.
    – egreg
    Mar 29, 2013 at 11:13
  • Welcome to TeX.SX. Usually, we don't put a greeting or a "thank you" in our posts. While this might seem strange at first, it is not a sign of lack of politeness, but rather part of our trying to keep everything very concise. Accepting and upvoting answers is the preferred way here to say "thank you" to users who helped you. Mar 29, 2013 at 11:32
  • 2
    As new user without image posting privileges simply include the image as normal and remove the ! in front of it to turn it into a link. A moderator or another user with edit privileges can then reinsert the ! to turn it into an image again.
    – Tobi
    Mar 29, 2013 at 11:42

2 Answers 2

3

The czech option to babel is giving a different meaning to -, so you need to turn this shorthand off before using the \hhline command:

Sample output

\documentclass[12pt,titlepage]{report}

\usepackage[T1]{fontenc}
\usepackage{lmodern}
\usepackage[utf8]{inputenc}
\usepackage[czech]{babel}
\usepackage{multirow}
\usepackage{hhline}
\usepackage{enumerate}
\usepackage{here}

\begin{document}

 \begin{table}[H]
    \centering\shorthandoff{-}
    \begin{tabular}{|c|c|c|}
    \hline
    \multirow{2}{*}{Rok} & \multicolumn{2}{|c|}{$r_f$}\\
    \hhline{~--}
      & ARAD & INFA\\
    \hline
      2000         & 7,38 \%  & \\
    \hline
    \end{tabular}
    \caption{Hrubý výnos českého desetiletého dluhopisu v letech 2000 - 2012, zdroj: ČNB a MPO}\label{dluhopisy}
    \end{table}
\end{document}
1

It works for me (please always post complete documents). Note you should avoid using [H] as much as possible as it defeats the point of the LaTeX table float mechanism.

\documentclass{article}
\usepackage[utf8]{inputenc}
\usepackage{hhline,multirow,float}
\begin{document}
\begin{table}[H]
    \centering
    \begin{tabular}{|c|c|c|}
    \hline
    \multirow{2}{*}{Rok} & \multicolumn{2}{|c|}{$r_f$}\\
    \hhline{~--}
      & ARAD & INFA\\
    \hline
      2000         & 7,38 \%  & \\
    \hline
      2001    & 5,43 \% & \\
    \hline
      2002         & 4,15 \%  &  \\
    \hline
      2003    & 4,82 \% & \\
    \hline
      2004         & 4,04 \% & \\
    \hline
      2005         & 3,61 \% &\\
    \hline
      2006         & 3,68 \% & \\
    \hline
      2007         & 4,65 \%  &  4,28 \%\\
    \hline
      2008    & 4,09 \% & 4,55 \%\\
    \hline
      2009         & 3,68 \% & 4,67 \%\\
    \hline
      2010         & 3,75 \% & 3,71 \%\\
    \hline
      2011         & 3,43 \% & 3,51 \%\\
    \hline
      2012         & 1,45 \% & \\
    \hline
    \end{tabular}
    \caption{Hrubý výnos českého desetiletého dluhopisu v letech 2000 - 2012, zdroj: ČNB a MPO}\label{dluhopisy}
    \end{table}
\end{document}

You must log in to answer this question.

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