Graphics, Figures & TablesLabel Alignment in ER Diagram

Information and discussion about graphics, figures & tables in LaTeX documents.
Post Reply
c_d_hofer
Posts: 3
Joined: Tue Oct 29, 2013 12:07 pm

Label Alignment in ER Diagram

Post by c_d_hofer »

Hi community!

I want to make an ER diagram using TikZ with its er library. Unfortunately I have a problem with the alignment of the node labels.

The label seems to use a different alignment than the node, i.e. the label is some units right of the place it supposed to be, and even not in the node. Here is my code:

Code: Select all

\documentclass[11pt]{article}
\usepackage[T1]{fontenc}
\usepackage{tikz}
\usetikzlibrary{er}

\begin{document}
  \tikzstyle{every entity} = [draw=blue, fill=blue!20]
  \begin{tikzpicture}
    \node[entity] (person) {Person};
  \end{tikzpicture}
\end{document}
I have already completely reinstalled LaTeX but it didn't work out. Thank you so far and I hope you can help me with this task.
Last edited by c_d_hofer on Tue Oct 29, 2013 12:39 pm, edited 1 time in total.

Recommended reading 2024:

LaTeXguide.org • LaTeX-Cookbook.net • TikZ.org

NEW: TikZ book now 40% off at Amazon.com for a short time.

And: Currently, Packt sells ebooks for $4.99 each if you buy 5 of their over 1000 ebooks. If you choose only a single one, $9.99. How about combining 3 LaTeX books with Python, gnuplot, mathplotlib, Matlab, ChatGPT or other AI books? Epub and PDF. Bundle (3 books, add more for higher discount): https://packt.link/MDH5p

Johannes_B
Site Moderator
Posts: 4182
Joined: Thu Nov 01, 2012 4:08 pm

Re: Label Alignment in ER Diagram

Post by Johannes_B »

Good minimal example, but i am not sure what you are trying to achieve. Please click on "Open in writeLaTeX" just above the code you posted to see the output.

Is your TeX distribution (TeX Live oder MiKTeX) up to date?
The smart way: Calm down and take a deep breath, read posts and provided links attentively, try to understand and ask if necessary.
c_d_hofer
Posts: 3
Joined: Tue Oct 29, 2013 12:07 pm

Re: Label Alignment in ER Diagram

Post by c_d_hofer »

Thank you for the quick response! :)

Okay, that's weird. The "Open in writeLaTeX" compiles the code just fine and shows exactly what I want to have. When I compile it on my machine, the label is moved to the right for some units. But this holds only for the DVI file. When I convert the DVI to PDF the output is just fine again.

Since I will work with the PDF it seems that I have no actual problem at all, although I never have experienced that the DVI is different to the converted PDF.

By the way, I have installed "texlive-full" from the Ubuntu repository.
User avatar
Johannes_B
Site Moderator
Posts: 4182
Joined: Thu Nov 01, 2012 4:08 pm

Label Alignment in ER Diagram

Post by Johannes_B »

The DVI format isn't actually meant to be viewed. Convert to PDF using dvips and ps2pdf or dvipdfmx, or use pdflatex in the first place.
The smart way: Calm down and take a deep breath, read posts and provided links attentively, try to understand and ask if necessary.
c_d_hofer
Posts: 3
Joined: Tue Oct 29, 2013 12:07 pm

Re: Label Alignment in ER Diagram

Post by c_d_hofer »

Thanks for the tip. From now on I will use pdfLaTeX. So far I have only done a lot of mathematical stuff and obviously have misused the DVI format as preview since it is the output format of the "latex" command. Until now I never had problems with this approach. Allright, so I learned something new :) (for the price of shooting down twice my work environment :D )
Post Reply