When I reference an equation, I like to have the page number in the reference as follows: (1.2)(34) would mean equation (1.2) on page 34. This is easy to do using \pageref. The problem is, I only want the page number to show if it is on a page other than the current page. Here is what I tried
Unfortunately, it doesn't work. No matter what, the 'not true' clause is alway executed. Something is going wrong with the comparison. I have altered the code to print out \thepage and \pageref{#1}. Even though they are the same, the page number gets printed.
Any ideas?
No solution yet, but a question: did you see that referencing style in any book? I've seen a lot of scientific books, and they have never used such an idea. I would stick to the style of my favorite physics books.
Also, you could do as planned but be consistent, always using the page number, so there's no confusion about what the reference means, as it's always two numbers in parentheses.
I have never seen this in any book, but I highly recommend that authors consider using it. The reason is that equation numbers are not sequential like page numbers are. Have you ever seen a reference to an equation that is many pages away from the page you are reading. If you're like me, you open the book to approximately the place you think it should be. But you don't know if the page you have opened is before or after the page you need to be on. So you look backward and/or forward scanning each page looking for a signpost telling you which direction to move in, but you still won't know how far away your target is. After all, how many pages is it from (9.4) to (12.8)? Once you get your bearings you repeat the process, this time hopefully closer to your target page. I call this the Newton-Raphson method. But if you have the page number in hand, you know as soon as you open the book what page you are on, what direction you need to move in, and approximately how far away, all without having to scan the page for clues. When I encounter a reference I always write a note in my book telling me the page number so at least I only have to search for it once the hard way. But if the referenced equation is on the same page, I don't write a note because the equation is right there in front of my eyes. When I reread the book, (I always reread physics books because I gain insight with each rereading), I have these page numbers to look up instead of equation numbers. I write the same kind of notes for all references such as figures, tables, sections and the like.