Graphics, Figures & TablesIs there a minimum line length in picture elements

Information and discussion about graphics, figures & tables in LaTeX documents.
Post Reply
carcophan
Posts: 3
Joined: Thu Mar 10, 2011 1:11 pm

Is there a minimum line length in picture elements

Post by carcophan »

Hello all,

I'm using a picture element to display a simple diagram and I can't get some lines to appear. The following code shows the problem:

Code: Select all

\documentclass[a4paper,12pt]{article}
\begin{document}

\setlength{\unitlength}{0.8cm}
\begin{picture}(4,4)
  \put(0,0){\line(1,1){0.44}} %% Displays OK
  \put(1,1){\line(1,1){0.43}} %% Doesn't display
\end{picture}
\end{document}
I wonder if it might be related to the fact that only certain line directions are possible but I can't quite convince myself it is. The reason I need such short lines is that in the full code I'm using multiput to draw a dotted line which seems to work fine with vertical and horizontal lines but not lines at an angle.

What do I need to do to get the lines to appear?

Thanks in advance

Phil
Last edited by carcophan on Fri Mar 11, 2011 11:31 am, edited 1 time in total.

Recommended reading 2024:

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

Learn LaTeX easily with newest books:

The LaTeX Beginner's Guide: 2nd edition and perfect for students writing a thesis

The LaTeX Cookbook: 2nd edition full of practical examples for mathematics, physics, chemistry, and more

LaTeX Graphics with TikZ: the first book about TikZ for perfect drawings in your LaTeX thesis

west.logan
Posts: 87
Joined: Tue Sep 14, 2010 6:58 pm

Re: Is there a minimum line length in picture elements

Post by west.logan »

The lower limit for the "length" is about 3.5mm in LaTeX. If you multiply 0.8 times your length of 0.43, you get just under that mark. There are other packages, like the "eepic" package, which remove this limitation.
carcophan
Posts: 3
Joined: Thu Mar 10, 2011 1:11 pm

Is there a minimum line length in picture elements

Post by carcophan »

> The lower limit for the "length" is about 3.5mm in LaTeX

This doesn't seem to be the issue I'm seeing as the following code demonstrates:

Code: Select all

\documentclass[a4paper,12pt]{article}
\begin{document}

\setlength{\unitlength}{0.8cm}
\begin{picture}(4,4)
  \put(0,0){\line(1,1){0.44}} %% Displays OK
  \put(1,1){\line(1,1){0.43}} %% Doesn't display

  \put(2, 0){\line(0,1){0.3}} %% Does Display len = 0.24
  \put(2.25, 0){\line(0,1){0.25}} %% Does Display len = 0.2
  \put(2.5, 0){\line(0,1){0.2}} %% Does Display len = 0.16
  \put(2.75, 0){\line(0,1){0.15}} %% Does Display len = 0.12
  \put(3, 0){\line(0,1){0.1}} %% Does Display len = 0.08

  \put(0, 2){\line(1,0){0.3}} %% Does Display len = 0.24
  \put(0, 2.25){\line(1,0){0.25}} %% Does Display len = 0.2
  \put(0, 2.5){\line(1,0){0.2}} %% Does Display len = 0.16
  \put(0, 2.75){\line(1,0){0.15}} %% Does Display len = 0.12
  \put(0, 3){\line(1,0){0.1}} %% Does Display len = 0.08

\end{picture}
\end{document}

On my system (Linux, Fedora 12) this shows vertical and horizontal lines down to a length of 0.08mm but the line at an angle can't be shorter than 0.35mm.

Phil
User avatar
localghost
Site Moderator
Posts: 9202
Joined: Fri Feb 02, 2007 12:06 pm

Is there a minimum line length in picture elements

Post by localghost »

There are more sophisticated packages like pgf/tikZ or PSTricks for such drawings. For the picture environment you should at least use the pict2e package for some enhancements. Your problems then might vanish.


Best regards and welcome to the board
Thorsten
carcophan
Posts: 3
Joined: Thu Mar 10, 2011 1:11 pm

Is there a minimum line length in picture elements

Post by carcophan »

> For the picture environment you should at least use the pict2e package for some enhancements.

Brilliant. That did the trick (and it still displays in PDF which is what I needed).

Thanks Thorsten. Below is a modified version of the code which displayed the problem that now works fine.

Thanks again,

Phil

Code: Select all

\documentclass[a4paper,12pt]{article}

\usepackage[pdftex]{pict2e}

\begin{document}

\setlength{\unitlength}{0.8cm}
\begin{picture}(4,4)
  \put(2,1){\line(1,1){0.44}} %% Displays OK

  %% without using the pict2e the next two lines don't display
  \put(3,2){\line(1,1){0.43}} %% Does display
  \multiput(0,0)(0.4, 0.4){10}{\line(1,1){0.3}} %% Does display

  \put(2, 0){\line(0,1){0.3}} %% Does Display len = 0.24
  \put(2.25, 0){\line(0,1){0.25}} %% Does Display len = 0.2
  \put(2.5, 0){\line(0,1){0.2}} %% Does Display len = 0.16
  \put(2.75, 0){\line(0,1){0.15}} %% Does Display len = 0.12
  \put(3, 0){\line(0,1){0.1}} %% Does Display len = 0.08

  \put(0, 2){\line(1,0){0.3}} %% Does Display len = 0.24
  \put(0, 2.25){\line(1,0){0.25}} %% Does Display len = 0.2
  \put(0, 2.5){\line(1,0){0.2}} %% Does Display len = 0.16
  \put(0, 2.75){\line(1,0){0.15}} %% Does Display len = 0.12
  \put(0, 3){\line(1,0){0.1}} %% Does Display len = 0.08

\end{picture}
\end{document}
west.logan
Posts: 87
Joined: Tue Sep 14, 2010 6:58 pm

Is there a minimum line length in picture elements

Post by west.logan »

carcophan wrote:
On my system (Linux, Fedora 12) this shows vertical and horizontal lines down to a length of 0.08mm but the line at an angle can't be shorter than 0.35mm.

Phil
That's correct, vertical and horizontal lines can be small, but angled cannot be smaller than 0.35cm, according to the LaTeX companion.
Post Reply