mcdonald@uxe.cso.uiuc.edu (03/23/89)
I have a question about TeX/LaTex. I want to put bitmap graphics into LAtex output using a \special. That is no problem, I hacked the dvijep source. What is a problem, a big one, is getting it positioned properly. Say I want to position it at the left margin at some vertical location. I can't find a way to force TeX to tell the dvi file to send a position command to the dvi file short of putting a character there. Is there a way to do this? I don't want to have something actually printed there. What I have done to kludge a solution is to manufacture a font with Metafont, containing a copy of the smallest dot from circle10. I then used a debugger to remove all the one bits from the list of bits in the .pxl file. Printing this character leaves the cursor at the point of the character without printing anything. But I get sick every time I do this. Is there a legal way to do it? Doug McDonald
leichter@cs.yale.edu (Jerry Leichter) (03/24/89)
In article <47700049@uxe.cso.uiuc.edu>, mcdonald@uxe.cso.uiuc.edu writes... > >I have a question about TeX/LaTex. I want to put bitmap graphics into >LAtex output using a \special. That is no problem, I hacked the >dvijep source. Gee, you too? I did this quite some time ago (or more accurately, Steve Gutfreund did it for an older version of dvijep and I updated it). Nelson Beebe has had a copy of our stuff for many months, and will give it to anyone who asks. Take this as a word of advice before deciding to hack at Beebe's stuff: Ask him what is available first. You may save yourself some effort! > What is a problem, a big one, is getting it positioned >properly. Say I want to position it at the left margin at some >vertical location. I can't find a way to force TeX to tell the dvi file >to send a position command to the dvi file short of putting a character >there. Is there a way to do this? I don't want to have something >actually printed there.... Here's the macro I use. It's more or less as Steve originally wrote it. There is no direct way to force TeX to re-position "the cursor" - in fact, there is really no notion within TeX of "the cursor" in this sense, it's purely an implementation issue. TeX optimizes its output by discarding "irrelevent" cursor moves. So you have to force it to think there is some reason why the cursor move "matters". The tiny, invisible rule used here does the trick. (If you think a .01mm x .01mm rule is visible, you can always make it smaller!) % % \insertfile{file-spec}(x,y) - insert a picture from file-spec, reserving a % box x true inches wide and y true inches high. In hmode or math mode, % produces an hbox; in vmode, produces a vbox. In all cases, the reference % point for the box is at its upper left-hand corner. % \def\insertfile{\ifvmode\let\next=\v@insert\else\let\next=\h@insert\fi\next} \def\h@insert#1(#2,#3){\hbox to #2truein{% \vrule height.01mm width.01mm depth\z@ \vtop to #3truein{\special{include #1}\vss}\hss}} \def\v@insert#1(#2,#3){\vtop to #3truein{% \hrule height.01mm width.01mm depth\z@ \hbox to #2truein{\special{include #1}\hss}\vss}} -- Jerry
rokicki@polya.Stanford.EDU (Tomas G. Rokicki) (03/25/89)
(In reference to discussions about forcing specials to occur at current positions on the page by sending bogus characters or infinitesimal rules . . .) TeX most certainly does position specials correctly, sending out the correct positioning commands before each special. It's the dvi drivers that don't. Fix the driver, don't kludge in unnecessary dummy fonts or small rules. If you don't believe me, run the following file through TeX and then dvitype: Test\vskip10pt \special{A}\vskip10pt \line{\special{B}\hfil \special{C}}\vskip 10pt That's all!\bye -tom
mcdonald@uxe.cso.uiuc.edu (03/26/89)
>TeX most certainly does position specials correctly, sending >out the correct positioning commands before each special. >It's the dvi drivers that don't. This was the correct answer.