Graphics, Figures & TablesDiagonal arrows/vectors not working

Information and discussion about graphics, figures & tables in LaTeX documents.
markprosser
Posts: 5
Joined: Mon Mar 05, 2012 12:13 am

Diagonal arrows/vectors not working

Post by markprosser »

For some reason I can't get diagonal arrows/vectors to work. Only the arrowhead shows up - the line is missing. For example, in the following, the first vector is fine (horizontal) but the second just gives a floating arrowhead.

Code: Select all

    \setlength{\unitlength}{1mm}
    \begin{picture}(60, 40)
      \put(30, 20){\vector(1, 0){30}}
      \put(30, 20){\vector(4, 1){20}}
    \end{picture}
I've tried using \thicklines, \thinlines, doesn't make a difference.

I'm using MiKTeX 2.9 with TeXnicCenter. Thanks.

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

User avatar
Stefan Kottwitz
Site Admin
Posts: 10350
Joined: Mon Mar 10, 2008 9:44 pm

Diagonal arrows/vectors not working

Post by Stefan Kottwitz »

Hi Mark,

welcome to the board!

Do you really want to work with the basic picture environment? I would use TikZ for diagrams with arrows, have a look at diagram examples in the TikZ example gallery.

Stefan
LaTeX.org admin
User avatar
Stefan Kottwitz
Site Admin
Posts: 10350
Joined: Mon Mar 10, 2008 9:44 pm

Diagonal arrows/vectors not working

Post by Stefan Kottwitz »

I tried your code now. It works in a simple document:

Code: Select all

\documentclass{article}
\begin{document}
\setlength{\unitlength}{1mm}
\begin{picture}(60, 40)
  \put(30, 20){\vector(1, 0){30}}
  \put(30, 20){\vector(4, 1){20}}
\end{picture}  
\end{document}
picture.png
picture.png (1.18 KiB) Viewed 7658 times
So, perhaps provide a complete compilable document which doesn't work for you - the error may be in code which you did not show.

Stefan
LaTeX.org admin
markprosser
Posts: 5
Joined: Mon Mar 05, 2012 12:13 am

Re: Diagonal arrows/vectors not working

Post by markprosser »

Thanks for the quick reply. After reading your post I realized there were some lines in the log that said "non-PDF special ignored". I've realized the problem is that I am using pdflatex instead of latex to build. The vectors work when I use latex, except then I get a whole bunch of "Cannot determine size of graphic" errors. My preference is to keep using pdflatex, and standard vectors/lines, if possible. Any idea what I can do?

Thanks
-Mark
User avatar
Stefan Kottwitz
Site Admin
Posts: 10350
Joined: Mon Mar 10, 2008 9:44 pm

Diagonal arrows/vectors not working

Post by Stefan Kottwitz »

I used pdfLaTeX and it worked. Here's my .log file, no errors and no warnings:

Code: Select all

This is pdfTeX, Version 3.1415926-2.3-1.40.12 (TeX Live 2011) (format=pdflatex 2011.10.7)  5 MAR 2012 01:00
entering extended mode
 restricted \write18 enabled.
 %&-line parsing enabled.
**vector.tex
(./vector.tex
LaTeX2e <2009/09/24>
Babel <v3.8l> and hyphenation patterns for english, dumylang, nohyphenation, ge
rman-x-2009-06-19, ngerman-x-2009-06-19, afrikaans, ancientgreek, ibycus, arabi
c, armenian, basque, bulgarian, catalan, pinyin, coptic, croatian, czech, danis
h, dutch, ukenglish, usenglishmax, esperanto, estonian, ethiopic, farsi, finnis
h, french, galician, german, ngerman, swissgerman, monogreek, greek, hungarian,
 icelandic, assamese, bengali, gujarati, hindi, kannada, malayalam, marathi, or
iya, panjabi, tamil, telugu, indonesian, interlingua, irish, italian, kurmanji,
 lao, latin, latvian, lithuanian, mongolian, mongolianlmc, bokmal, nynorsk, pol
ish, portuguese, romanian, russian, sanskrit, serbian, serbianc, slovak, sloven
ian, spanish, swedish, turkish, turkmen, ukrainian, uppersorbian, welsh, loaded
.
(/usr/local/texlive/2011/texmf-dist/tex/latex/base/article.cls
Document Class: article 2007/10/19 v1.4h Standard LaTeX document class
(/usr/local/texlive/2011/texmf-dist/tex/latex/base/size10.clo
File: size10.clo 2007/10/19 v1.4h Standard LaTeX file (size option)
)
\c@part=\count79
\c@section=\count80
\c@subsection=\count81
\c@subsubsection=\count82
\c@paragraph=\count83
\c@subparagraph=\count84
\c@figure=\count85
\c@table=\count86
\abovecaptionskip=\skip41
\belowcaptionskip=\skip42
\bibindent=\dimen102
) (./vector.aux)
\openout1 = `vector.aux'.

LaTeX Font Info:    Checking defaults for OML/cmm/m/it on input line 2.
LaTeX Font Info:    ... okay on input line 2.
LaTeX Font Info:    Checking defaults for T1/cmr/m/n on input line 2.
LaTeX Font Info:    ... okay on input line 2.
LaTeX Font Info:    Checking defaults for OT1/cmr/m/n on input line 2.
LaTeX Font Info:    ... okay on input line 2.
LaTeX Font Info:    Checking defaults for OMS/cmsy/m/n on input line 2.
LaTeX Font Info:    ... okay on input line 2.
LaTeX Font Info:    Checking defaults for OMX/cmex/m/n on input line 2.
LaTeX Font Info:    ... okay on input line 2.
LaTeX Font Info:    Checking defaults for U/cmr/m/n on input line 2.
LaTeX Font Info:    ... okay on input line 2.

[1

{/usr/local/texlive/2011/texmf-var/fonts/map/pdftex/updmap/pdftex.map}]
(./vector.aux) ) 
Here is how much of TeX's memory you used:
 200 strings out of 493633
 2152 string characters out of 3143398
 49245 words of memory out of 3000000
 3587 multiletter control sequences out of 15000+200000
 3640 words of font info for 14 fonts, out of 3000000 for 9000
 831 hyphenation exceptions out of 8191
 23i,4n,17p,153b,107s stack positions out of 5000i,500n,10000p,200000b,50000s
</usr/local/texlive/2011/texmf-dist/fonts/type1/public/amsfonts
/cm/cmr10.pfb></usr/local/texlive/2011/texmf-dist/fonts/type1/public/amsfonts/l
atxfont/line10.pfb>
Output written on vector.pdf (1 page, 10550 bytes).
PDF statistics:
 16 PDF objects out of 1000 (max. 8388607)
 10 compressed objects within 1 object stream
 0 named destinations out of 1000 (max. 500000)
 1 words of extra memory for PDF output out of 10000 (max. 10000000)
The PDF output is attached. Perhaps have a look. If you cannot see lines there too, it's a problem of your PDF viewer program. In any case, I suggest try another viewer to compare your output in different software. Sometimes a PDF reader just doesn't display all. Usually the Adobe Reader is a good reference.

Perhaps show a diagram you created, I could show you how to draw them with TikZ. The LaTeX standard picture environment is in my opinion not the best choice, even for simple graphics. Here, for example, regarding lines and vectors, a drawback is that the slopes of line segments can just have a few certain values, so you may see not perfect or broken lines. With TikZ we don't have such problems.

Stefan
Attachments
vector.pdf
(10.3 KiB) Downloaded 187 times
LaTeX.org admin
User avatar
Stefan Kottwitz
Site Admin
Posts: 10350
Joined: Mon Mar 10, 2008 9:44 pm

Diagonal arrows/vectors not working

Post by Stefan Kottwitz »

Here's another approach, which could fix your problems if you want to stay with the LaTeX picture environment - load the pict2e package:

Code: Select all

\usepackage{pict2e}
It extends the existing LaTeX picture environment using driver files.

Stefan
LaTeX.org admin
markprosser
Posts: 5
Joined: Mon Mar 05, 2012 12:13 am

Diagonal arrows/vectors not working

Post by markprosser »

Thanks for the suggestions. It's definitely not my viewer, and unfortunately pict2e didn't help.

There must be something else going on but I'm not sure what it would be.

When I add the following code:

Code: Select all

\begin{picture}(60, 40)
  \put(30, 20){\vector(4, 1){5}}
\end{picture}
it compiles successfully but only the arrowhead appears, and I get this in the log:

("C:\..\Fourier/algorithm.tex" [86] [87
Non-PDF special ignored!
Non-PDF special ignored!
Non-PDF special ignored!
Non-PDF special ignored!] [88])

When I remove that code, I get this in the log:

("C:\..\Fourier/algorithm.tex" [86] [87]
Underfull \vbox (badness 10000) has occurred while \output is active []
[88])
User avatar
localghost
Site Moderator
Posts: 9202
Joined: Fri Feb 02, 2007 12:06 pm

Diagonal arrows/vectors not working

Post by localghost »

Just for information to other users to be aware of possibly already existing solutions. The question has also been posted to the {TeX} SE.
User avatar
Stefan Kottwitz
Site Admin
Posts: 10350
Joined: Mon Mar 10, 2008 9:44 pm

Diagonal arrows/vectors not working

Post by Stefan Kottwitz »

markprosser wrote:There must be something else going on but I'm not sure what it would be.
I suggest post such a compilable example where you got the warnings and no error. You could see, just those lines work fine on my TeX system. For completeness and to not spend more time on guessing, I suggest post
  • a compilable Infominimal working example, as mentioned
  • the .log file for this example, as attachment to the post, to see warnings and the way of compilation
  • the PDF output as attachment, so we can see it with our PDF viewers.
Stefan
LaTeX.org admin
markprosser
Posts: 5
Joined: Mon Mar 05, 2012 12:13 am

Diagonal arrows/vectors not working

Post by markprosser »

I think I've isolated the problem: eepic. If I take out this line:

Code: Select all

\usepackage{eepic} 
my minimal example works. Of course, that package is necessary for other parts of the document.

I've attached a minimal example with log and pdf. I appreciate any help.

Mark
Attachments
root.tex
(443 Bytes) Downloaded 279 times
root.pdf
(41.67 KiB) Downloaded 215 times
root.log
(4.27 KiB) Downloaded 280 times
Post Reply