Google Groups no longer supports new Usenet posts or subscriptions. Historical content remains viewable.
Dismiss

pdfmark command directly in LaTeX

286 views
Skip to first unread message

jeffdod

unread,
Feb 28, 2010, 2:32:03 PM2/28/10
to
I was wondering if it is possible to include pdfmark commands directly
in LaTeX code, such as the following:

[ /Count 0 /Action << /S /GoTo /D (section.2) >> /Title
(Introduction) /OUT pdfmark end

I have tried using the hyperref package, but for some reason it will
not work with the combination of packages I am already using. In any
case, I was wondering if there is a native method in LaTeX of passing
a command like the one above through to the final PDF file.

Thanks,
Jeff Dodson

Jeffrey Goldberg

unread,
Feb 28, 2010, 2:39:33 PM2/28/10
to

It should be doable with the TeX \special command. I'm not certain of
the precise syntax.

-j

--
Jeffrey Goldberg http://goldmark.org/jeff/
I rarely read HTML or poorly quoting posts
Reply-To address is valid

Dan

unread,
Feb 28, 2010, 5:42:07 PM2/28/10
to

I assume you are following the latex+dvips+ps2pdf path. So you
need the dvips \special for including raw postscript code:

\special{ps:<your text here>}

You are responsible for making sure it is valid code, and
properly positioned. See the dvips documentation. On my
system there is a file dvips.pdf and this is page 31.

If you use pdflatex, then there are a lot of commands \pdf...
that perform similarly. See the pdftex documentation
(pdftex-a.pdf on my system).


Dan

jeffdod

unread,
Feb 28, 2010, 6:26:57 PM2/28/10
to
Thanks for the responses.

I am using xelatex and XeTeX, with these version numbers:

Version 3.1415926-2.2-0.999.3 (Web2C 7.5.7)

Would it be correct to say then that the xelatex compiler uses pdftex?

Jeff Dodson

Ulrike Fischer

unread,
Mar 1, 2010, 4:58:31 AM3/1/10
to

No, the xelatex compiler use xetex and normally the end driver
xdvipdfmx. So you need specials for xdvipdfmx. Look into the driver
of hyperref (hxetex.def). The needed special seems to be
\special{pdf:....}:

\def\@pdfm@mark#1{\special{pdf:#1}}

--
Ulrike Fischer

Heiko Oberdiek

unread,
Mar 1, 2010, 5:30:38 AM3/1/10
to
jeffdod <jef...@gmail.com> wrote:

> I was wondering if it is possible to include pdfmark commands directly
> in LaTeX code, such as the following:
>
> [ /Count 0 /Action << /S /GoTo /D (section.2) >> /Title
> (Introduction) /OUT pdfmark end
>
> I have tried using the hyperref package, but for some reason it will
> not work with the combination of packages I am already using.

It's probably easier to fix the incompatibility problems than
rewriting the whole bookmark stuff. Make a minimal example
that shows the problem.

> In any
> case, I was wondering if there is a native method in LaTeX of passing
> a command like the one above through to the final PDF file.

pdfmark is a operator at PostScript level. Therefore you would need
a PostScript file first. Look at hyperref's code, it contains all the
low level stuff for different drivers.
--
Heiko Oberdiek

jeffdod

unread,
Mar 4, 2010, 4:31:32 PM3/4/10
to
> It's probably easier to fix the incompatibility problems than
> rewriting the whole bookmark stuff. Make a minimal example
> that shows the problem.

I made a minimal example to demonstrate the problem, and in the
process figured out what the issue was. I was using a year-old version
of XeTeX and W32TeX. This version apparently has an incompatibility
between the "amsmath" package and the "hyperref" package. Once I
updated my XeTeX/W32TeX installation to the latest, the
incompatibility went away, even without modifying my minimal example.

Also, there were a number of things I was doing in my original code
that produced warnings from hyperref, although the project would
ultimately compile. Specifically, I was using package "fontspec" in
XeTeX and defining new fonts with the "newfontinstance" command. When
using "hyperref" and calling addtocontents, I was sometimes passing
commands like "\mynewfont{Some Text}" through in the addtocontents
command. This would produce warning messages from hyperref. To get rid
of the warning messages, I pass only raw text through to most calls
that hyperref overrides, and control the font formatting using other
package commands.

Jeff Dodson

Heiko Oberdiek

unread,
Mar 4, 2010, 5:43:55 PM3/4/10
to
jeffdod <jef...@gmail.com> wrote:

> > It's probably easier to fix the incompatibility problems than
> > rewriting the whole bookmark stuff. Make a minimal example
> > that shows the problem.
>
> I made a minimal example to demonstrate the problem, and in the
> process figured out what the issue was. I was using a year-old version
> of XeTeX and W32TeX. This version apparently has an incompatibility
> between the "amsmath" package and the "hyperref" package. Once I
> updated my XeTeX/W32TeX installation to the latest, the
> incompatibility went away, even without modifying my minimal example.

Very good practice to test the latest versions before making a
bug report.

> Also, there were a number of things I was doing in my original code
> that produced warnings from hyperref, although the project would
> ultimately compile. Specifically, I was using package "fontspec" in
> XeTeX and defining new fonts with the "newfontinstance" command. When
> using "hyperref" and calling addtocontents, I was sometimes passing
> commands like "\mynewfont{Some Text}" through in the addtocontents
> command. This would produce warning messages from hyperref.

Probably because this stuff is also used to generate bookmark strings.
Because a PDF viewer usually does not support TeX code in strings,
the TeX code should be converted to strings. Therefore hyperref
(\pdfstringdef) expands the string and tries to fix many stuff
automatically. But it cannot call TeX stomach commands (assignments,
definitions, ...), thus it tries to remove them, because the would
cause `garbage' in the string otherwise.

> To get rid
> of the warning messages, I pass only raw text through to most calls
> that hyperref overrides, and control the font formatting using other
> package commands.

There are \texorpdfstring and \pdfstringdefDisableCommands.

Example:
\pdfstringdefDisableCommands{%
\let\mynewfont\relax
% or
\def\mynewfont{}%
}

And the warnings caused by \mynewfonts are gone.

Also try hyperref 6.80k, where I have disabled further
generic font commands (\selectfont, \usefont, \fontencoding, ...)

--
Heiko Oberdiek

Pluto

unread,
Mar 10, 2010, 12:16:32 PM3/10/10
to
On Mar 4, 10:43 pm, Heiko Oberdiek <heiko.oberd...@googlemail.com>
wrote:

The hyperref manual briefly describes the command
\pdfstringdefDisableCommands and gives an example as follows:

\pdfstringdefDisableCommands{%
\let~\textasciitilde
\def\url{\pdfstringdefWarn\url}%
\let\textcolor\@gobble
}

Does this mean that these commands will be disabled in the arguments
of, say, \section?

Dan Luecking

unread,
Mar 10, 2010, 2:42:02 PM3/10/10
to
On Wed, 10 Mar 2010 09:16:32 -0800 (PST), Pluto
<a.m...@rocketmail.com> wrote:

>The hyperref manual briefly describes the command
>\pdfstringdefDisableCommands and gives an example as follows:
>
>\pdfstringdefDisableCommands{%
>\let~\textasciitilde
>\def\url{\pdfstringdefWarn\url}%
>\let\textcolor\@gobble
>}
>
>Does this mean that these commands will be disabled in the arguments
>of, say, \section?

\pdfstringdefDisableCommands provides commands that
\pdfstringdef (previously described) uses when it is
generating "PDF strings" for bookmarks, etc. This has
nothing to do with what is printed in the document.

The above code will permit the use of the commands "~",
"\url", and "\textcolor" in the argument of \section,
only preventing problems with the automatic conversion
of these commands into PDF bookmark text, etc.

This is what the previous posters have been explaining
to tell the OP.


Dan
To reply by email, change LookInSig to luecking

0 new messages