• Global community
    • Language:
      • Deutsch
      • English
      • Español
      • Français
      • Português
  • 日本語コミュニティ
    Dedicated community for Japanese speakers
  • 한국 커뮤니티
    Dedicated community for Korean speakers
Exit
0

variables for /bop-hook

New Here ,
Nov 19, 2018 Nov 19, 2018

Copy link to clipboard

Copied

Hi,

I'm trying  to write a PS special to include "Proof"  on every page within latex. I used to do it via userdict and /bop-hook

Everything was fine  but now I need to prepend a few DVI pages before the original documents but they has to be without "Proof" mark.

And I have a problem because after making PS from that concatenated DVI I see "Proof" in every page. So now I want to write

a condition with "/showproof where {} if" to assigning it from the page where "Proof" needs to start. Here how my code looks:

  \special{ps: /showproof true def}

  \special{%

    !userdict

    begin

      /bop-hook{

        /showproof where

        {

          gsave

          % ... some code for positioning this text

          (Proof) show

          grestore

        }

        if

      } def

    end}

I don't get any "Proof" and if I change "\special{ps:..}" to "\special{!...}" I get to every page.

Could anybody explain how to set some variables in middle of document that I could check them inside /bop-hook 

TOPICS
Programming

Views

344

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines

correct answers 1 Correct answer

LEGEND , Nov 21, 2018 Nov 21, 2018

in your procedure start with initgraphics.

Votes

Translate

Translate
LEGEND ,
Nov 19, 2018 Nov 19, 2018

Copy link to clipboard

Copied

Probably, the subsequent files redefine this bop-hook, whatever it is. You'd need to change each file.

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
New Here ,
Nov 19, 2018 Nov 19, 2018

Copy link to clipboard

Copied

Like I said. File with few pages is prepended at the top and it has no /bop-hook. Other file has it so from DVI view this hook is added at the page 3  but postscript adds contents of this hook for every page (including first 2).

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
LEGEND ,
Nov 20, 2018 Nov 20, 2018

Copy link to clipboard

Copied

Have you looked at the generated PostScript to see if the code you insert is where you expect it to be in the PostScript file?

If not, this is a TeX issue. If so, you have a PostScript programming issue. Sorry, I find this confusing because you seem to be asking about both and I only know PostScript.

If the code is present but has no effect, then your positioning code is probably wrong. Since you haven't told us what it is, it's hard to say.

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
New Here ,
Nov 20, 2018 Nov 20, 2018

Copy link to clipboard

Copied

I can't tell that my code gets in the right position because I don't know PS.  But it works if I add "/showproof true def"  in the userdict and it doesn't  if that line is somewhere in the page.

Strange thing is that when I print some text within userdict /bop-hook I see it as expected but when I add it just at the beginning of the page I see it upside down mirrored and points are scale points not PS points.

Here how it looks at the start of thepage:

%%Page: 2 2

TeXDict begin 2 1 bop 0 TeXcolorgray -3528 -1395 a @beginspecial

@endspecial @beginspecial @endspecial @beginspecial @endspecial

@beginspecial @endspecial @beginspecial @endspecial -3528

-1395 a

[ /Label (2) /PAGELABEL pdfmark

-3528 -1395 a -3528 -1395 a

gsave 0 0 translate 0 500 moveto /HelveticaNeue-Roman findfont 2000 scalefont

setfont 0.9 setgray(UNCORRECTED PROOF) show grestore

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
New Here ,
Nov 21, 2018 Nov 21, 2018

Copy link to clipboard

Copied

I got the text in right way with but it is still at the top of the page:

/HelveticaNeue-Roman findfont

[12 0 0 -12 0 0] makefont

200 scalefont

Now would be good to set coordinates system to Tex (to start from LL corner) and set dimensions to points.

How to do it?

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
LEGEND ,
Nov 20, 2018 Nov 20, 2018

Copy link to clipboard

Copied

Also: you must set a font before using show unless you are certain the code has done it. You might get an error, or 1 point courier.

Also: if you want to see for sure if your code is executed, just add a PostScript error like

force_an_error

If there is no error, your code is not executed.

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
LEGEND ,
Nov 21, 2018 Nov 21, 2018

Copy link to clipboard

Copied

LATEST

in your procedure start with initgraphics.

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines