This is not an answer. I was able to produce the minimal working example as:
\documentclass{article}
\usepackage{hyperref}
\TeXXeTstate=1
\def\neweverypar{{\setbox0\lastbox\beginR\usebox0}}
\let\origeverypar=\everypar
\def\everypar#1{\origeverypar{\neweverypar#1}}
\begin{document}
This is \href{http://google.com}{Google} and ...
\end{document}
after runing pdflatex
on this, you get exactly the same error message. I have also forwared this to Heiko Oberdiek and if he answers me, then I post his answer here but I think this actually seems to be a limitation of the pdfTeX engine with TeX--XeT algorithm (the algorithm already have many annoying bugs) and it may turn out that this is not even fixable. XeTeX and PDFTeX both uses TeX--XeT but hyperref with PDFTeX uses PDFTeX primitives for hypertext and in XeTeX, it uses \special
.
Edit: This is verbatim response of Heiko Oberdiek:
I don't know. AFAIK there isn't even an easy way to test, whether
\beginR or \beginL is active. A workaround could be to put two labels
with some distance to find out the writing direction, thus that the
order of \pdfstartlink and \pdfendlink could be switched if necessary.
But that kind of workaround does not scale, the hash table size in TeX
is limited, large document with many links will too easily hit the
limit.
In LuaTeX the node lists can be examined and the switches can be done
at Lua level.
I also asked him, why this problem happens with PDFTeX and not with XeTeX. Here is his response:
Perhaps the \specials are resorted automatically in xdvipdfmx.
Odd numbered pages should always be right pages!
So you should always use \cleardoublepage
before changing page numbering, because it makes no sense to change page numbering on the left side of a double sided print:
\documentclass[twoside]{article}% It's better to tell already the class to use twoside!
\usepackage[showframe]{geometry}
\begin{document}
This is the first page; it should be a right page (recto).
\cleardoublepage
\pagenumbering{arabic}
This is the third page; it should be a right page, because changing page numbering should always be done on right pages!
\end{document}
If you simply wanted to suppress page number at the first page of an article, try:
\documentclass[twoside]{article}% It's better to tell already the class to use twoside!
\usepackage[showframe]{geometry}
\begin{document}
\title{Title}
\author{Me}
\maketitle\thispagestyle{empty}
\begin{abstract}A short abstract of the document.\end{abstract}
Some more text, e.g. a table of contents.
\clearpage
This is the second page; it should be a left page and numbered 2!
\end{document}
Note: You may use \cleardoublepage
before \pagenumbering
even at oneside documents, because in this case it would have the same result \clearpage
would have.
But, if you really, really must have odd pages left and even pages right, you may simply switch the margins (and the margin used for \marginpar
):
\documentclass[twoside]{article}% It's better to tell already the class to use twoside!
\usepackage[showframe]{geometry}
\makeatletter
\newcommand*{\flipmargins}{%
\clearpage
\setlength{\@tempdima}{\oddsidemargin}%
\setlength{\oddsidemargin}{\evensidemargin}%
\setlength{\evensidemargin}{\@tempdima}%
\if@reversemargin
\normalmarginpar
\else
\reversemarginpar
\fi
}
\makeatother
\begin{document}
This is the first page; it should be a right page (recto).
\flipmargins
\pagenumbering{roman}
This is the second page; it should be a left page (verso).
\end{document}
Using a page style like headings
you may also need to change the page style, e.g., to print the numbers near the outer margin. You may do this, using either scrpage2 or fancyhrd. Here an example using scrpage2
:
\documentclass[twoside]{article}% It's better to tell already the class to use twoside!
\usepackage[showframe]{geometry}
\usepackage[automark]{scrpage2}
\pagestyle{scrheadings}
\makeatletter
\newcommand*{\flipmargins}{%
\clearpage
\setlength{\@tempdima}{\oddsidemargin}%
\setlength{\oddsidemargin}{\evensidemargin}%
\setlength{\evensidemargin}{\@tempdima}%
\if@reversemargin
\normalmarginpar
\else
\reversemarginpar
\fi
\ifdim \evensidemargin>\oddsidemargin
\ihead{\headmark}%
\ohead[\pagemark]{\pagemark}%
\else
\ihead[\pagemark]{\pagemark}%
\ohead{\headmark}%
\fi
}
\makeatother
\begin{document}
\section{Normal pages}
This is the first page; it should be a right page (recto).
\flipmargins
\pagenumbering{roman}
\section{Inverse margin pages}
This is the second page; it should be a left page (verso).
\end{document}
Alternative:
One completely different alternative would be to fake the page number, given by \thepage
:
\documentclass[twoside]{article}% It's better to tell already the class to use twoside!
\usepackage[showframe]{geometry}
\makeatletter
\newcommand{\@arabicplusone}[1]{\@arabic{\numexpr #1+1\relax}}
\newcommand{\@romanplusone}[1]{\@roman{\numexpr #1+1\relax}}
\newcommand{\@Romanplusone}[1]{\@Roman{\numexpr #1+1\relax}}
\newcommand{\@alphplusone}[1]{\@alph{\numexpr #1+1\relax}}
\newcommand{\@Alphplusone}[1]{\@Alph{\numexpr #1+1\relax}}
\makeatother
\newcommand*{\pagenumberingplusone}[1]{%
\pagenumbering{#1plusone}\setcounter{page}{0}%
}
\begin{document}
This is the first page; it should be a right page (recto). See
page~\pageref{test}.
\clearpage\pagenumberingplusone{roman}
This\label{test} is the second page; it should be a left page (verso).
\end{document}
Disadvantage of this suggestion would be, that if a package uses page counter directly for something else but testing odd or even the result may be unexpected. The advantage of this suggestion would be, that pages with odd value of counter page
shows not only an even page number but will be handled to be a even=left page by LaTeX and every class or package that uses \c@page
or \value{page}
for the test (and vica versa).
Best Answer
I wouldn't necessarily say you need LyX for quick writing of documents/note-taking (it's more to ease the learning curve), but the following method should work well with either plain LaTeX or LyX I believe.
At present there exist the excellent babel and
hebfont
packages. The combination of these two packages is likely the best option for typesetting Hebrew text. The former provides support for Hebrew characters/text encoding, RTL rendering, and switching between Hebrew/Latin/other scripts, while the latter provides a variety of fonts for rendering Hebrew characters.You can turn 'Hebrew mode' on simply with the
\sethebrew
macro, and off again with the\unsethebrew
macro.Boris Lavva has written a very useful guide to typesetting Hebrew in LaTex 2e, which should get you going. It would probably be fairly straightforward to set up a template for Hebrew documents. Apart from a handful of new macros to learn, you should essentially be able to use Hebrew in LaTeX as you would normal LaTeX.
Note: There is even a
hebtech
document class for preparing formal technical documents/theses in Hebrew, if you find the need.