Path: utzoo!utgpu!jarvis.csri.toronto.edu!mailrus!ames!lll-winken!uunet!yale!leichter From: leichter@cs.yale.edu (Jerry Leichter) Newsgroups: comp.text Subject: Re: TeX cursor positioning Message-ID: <54703@yale-celray.yale.UUCP> Date: 24 Mar 89 15:18:08 GMT Sender: root@yale.UUCP Organization: Yale Computer Science Department, New Haven Lines: 46 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