TeX file is compiled to dvi by dvipdfm. I've been using such technique about 20 years. Everything was Ok until I need paragraph level. Table of contents is correct, hyperref s are working, but bookmarks in pdf-file for paragraphs are incorrect: each paragraph bookmark contains the next one as sublevel. The source code (file test.tex) is following:
\documentclass[12pt,a4paper,sumlimits,intlimits,namelimits,openany,twoside]{book}
\usepackage[T2A]{fontenc}
\usepackage[utf8]{inputenc}
\usepackage[greek,english]{babel}
\usepackage{makeidx,multicol,ifthen,verbatim,layout}
\selectlanguage{english}
\usepackage[hyperindex,bookmarksnumbered,%colorlinks,
dvipdfmx,bookmarks]{hyperref}
\usepackage{amsmath,amsthm,amsfonts,amssymb}
\numberwithin{paragraph}{chapter}
\begin{document}
\setcounter{secnumdepth}4%\setcounter{tocdepth}{4}
\setcounter{tocdepth}4
\tableofcontents
\newpage
\chapter{The Lebesgue theory}
\section{Set functions}
\paragraph{Definition (ring)}
\paragraph{Definition (additive set function)}
\paragraph{Theorem (continuity of additive set function)}
\section{Construction of the Lebesgue measure}
\paragraph{Definition (ring of elementary sets)}
\paragraph{Definition (regular set function)}
\end{document}
File test.toc (generated automatically by LaTeX) is following:
\babel@toc {english}{}
\babel@toc {english}{}
\contentsline {chapter}{\numberline {1}The Lebesgue theory}{2}{chapter.1}
\contentsline {section}{\numberline {1.1}Set functions}{2}{section.1.1}
\contentsline {paragraph}{\numberline {1.1}Definition (ring)}{2}{paragraph.1.1}
\contentsline {paragraph}{\numberline {1.2}Definition (additive set function)}{2}{paragraph.1.2}
\contentsline {paragraph}{\numberline {1.3}Theorem (continuity of additive set function)}{2}{paragraph.1.3}
\contentsline {section}{\numberline {1.2}Construction of the Lebesgue measure}{2}{section.1.2}
\contentsline {paragraph}{\numberline {1.1}Definition (ring of elementary sets)}{2}{paragraph.1.1}
\contentsline {paragraph}{\numberline {1.2}Definition (regular set function)}{2}{paragraph.1.2}
File test.out (generated automatically by LaTeX) is following:
\BOOKMARK [0][-]{chapter.1}{1 The Lebesgue theory}{}% 1
\BOOKMARK [1][-]{section.1.1}{1.1 Set functions}{chapter.1}% 2
\BOOKMARK [2][-]{paragraph.1.1}{1.1 Definition \(ring\)}{section.1.1}% 3
\BOOKMARK [3][-]{paragraph.1.2}{1.2 Definition \(additive set function\)}{paragraph.1.1}% 4
\BOOKMARK [4][-]{paragraph.1.3}{1.3 Theorem \(continuity of additive set function\)}{paragraph.1.2}% 5
\BOOKMARK [1][-]{section.1.2}{1.2 Construction of the Lebesgue measure}{chapter.1}% 6
\BOOKMARK [2][-]{paragraph.1.1}{1.1 Definition \(ring of elementary sets\)}{section.1.2}% 7
\BOOKMARK [3][-]{paragraph.1.2}{1.2 Definition \(regular set function\)}{paragraph.1.1}% 8
Thanks in advance for any idea.