Take the 2-minute tour ×
TeX - LaTeX Stack Exchange is a question and answer site for users of TeX, LaTeX, ConTeXt, and related typesetting systems. It's 100% free, no registration required.

I got a bad problem with the width of my table. I can't get the point why its so wide.

I'm using latexmk.

Here's my code:

\documentclass[final,12pt,abstracton,oneside,a4paper,
bibliography=totocnumbered,
listof=totoc]{scrreprt}


% my imports
\usepackage[utf8]{inputenc}
\usepackage[T1]{fontenc}
\usepackage[ngerman]{babel}
\usepackage[babel,german=quotes]{csquotes}
\usepackage{graphicx}
\usepackage{fancyhdr}
\usepackage{geometry}
\usepackage{lastpage}
\usepackage[usenames,dvipsnames]{color}
\usepackage[ngerman, num]{isodate}
\usepackage{amsmath}
\usepackage{amssymb}
\usepackage{amsthm}
\usepackage{pdfsync}
\usepackage{enumerate}
\usepackage{listings}
\usepackage[square]{natbib}
\usepackage{setspace}
\usepackage{rotating}

% import from used template
\usepackage{amsfonts}
\usepackage{tabularx}
\usepackage[right]{eurosym}
\usepackage[printonlyused]{acronym}
\usepackage{paralist}
\usepackage{parskip}
\usepackage[titles]{tocloft}
\usepackage[pdfpagelabels=true]{hyperref}

% define paper geometry
\geometry{a4paper, left=20mm, top=27mm, right=20mm, bottom=27mm, headsep=10mm,bindingoffset=10mm}

\fancypagestyle{plain}{
  \lhead{}
   \renewcommand{\headrulewidth}{0.4pt}
  }

\pagestyle{fancy}
\lhead{\leftmark}
\chead{}
\rhead{\thepage}
\cfoot{}

\begin{document}
% titlepage toc tof and so on...
\begin{table}[h]
  \begin{tabularx}{\textwidth}{lX}
  \hline
    Event & Description \\
  \hline
    \texttt{SomeOfMyEvents} & Description of the events goes here...
    large large texts should be here line 1
    large large texts should be here line 2
    large large texts should be here line 3
    large large texts should be here line 4
    large large texts should be here line 5
    large large texts should be here line 6
    large large texts should be here line 7
    large large texts should be here line 8
    large large texts should be here line 9
    large large texts should be here line 10
    large large texts should be here \\
  \hline
  \end{tabularx}
  \caption{caption}
  \label{tab:cap}
\end{table}
% ...
\end{document}

and my result looks like this: enter image description here

The rule wit the romic II is my textwidth. How you can see this table is much wider than textwidh. If I try to set the width to 0.5\textwidth only the hline's of the table will be as half as long, the columns stay the same.

I even tried wit package tabulary, tabu, and tabular* with p{4cm}p{4cm} didn't work either. I'm running out of ideas. I hope some one has a better idea on this purpose.

EDIT:

I added more real code. Now only the name of the events and the content of my description varies.

EDIT #2:

Due to comments i added the complete preamble of my document. The picture i show is the output of my code shown above.

share|improve this question
    
this table ist just an example. What I really needing is lX because the X should held long lines of text. But it is generating the table wrong too. According to the documentation of tabularx|y the table should have the width of my text and the X should be automatically set. Specifying two XX doesn't work properly either. –  Marschal Jun 28 at 15:41
    
I edited my code to provide a more realistic example. However this has no impact on my table. –  Marschal Jun 28 at 15:56
2  
Clearly the code you posted does not produce the image you show of the problem. Please edit the question so your code is a complete example from \documentclass to \end{document} and show the image of the output from that code –  David Carlisle Jun 28 at 16:03
    
The new example generates an error ! LaTeX Error: \l@subfigure undefined. Once latex generates an error you should not be surprised about any typeset result, tex's recovery actions try to let it continue they do not try to make a sensible typeset result –  David Carlisle Jun 28 at 16:16
    
Your right, i don't using subfigure. That was a peace from a template I used. Anyway this has no impact on my result. I edited my code above. –  Marschal Jun 28 at 16:20

1 Answer 1

up vote 4 down vote accepted

Thanks for posting a full MWE. The culprit turns out to be the pdfsync package. I can't tell which of the many other packages you also load it interacts with badly, but the upshot of its presence is the terrible look of the table.

The user guide of the pdfsync package suggests that

in case of severe conflicts with another package, try instead

\usepackage[novbox]{pdfsync}

Sure enough, adding the novbox option solves the immediate problem.

I honestly don't know enough about the pdfsync package to tell you if there's a better solution. Quoting from the "Bugs" section of the package's user guide:

pdfsync uses extremely [sensitive] code. You should not use pdfsync on final documents because it can change the layout rather significantly (different page/line breaks are the most obvious changes).

This isn't the most confidence-inspiring statement, is it?

share|improve this answer
    
Oh thanks a lot! That's the snag! This solved my problem. –  Marschal Jun 28 at 16:24
    
I'm using pdfsync during the creation of my documents because it simply easier in combination of Vim. However i'll comment out pdfsync in my final version! –  Marschal Jun 28 at 16:34
    
As noted in the pdfsync docs, this functionality has been built-in to pdflatex for some time. It's called synctex, and you might find this question helpful in setting it up with vim: tex.stackexchange.com/questions/2941/… –  Paul Gessler Jun 29 at 0:23

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

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