How to use if-then-else structure in LaTeX? I need a example of odd and even page.
if odd then
command 1
else
command 2
|
How to use if-then-else structure in LaTeX? I need a example of odd and even page.
|
|||||||||||||||||
|
|
Use the
|
|||||
|
|
Use the
If you use the memoir class, then this feature is built in automatically. |
||||
|
|
|
As Harald has pointed out already, the use of
You will read `Odd' on every page. Instead, it is safer to use a
|
|||||
|
|
For the sake of completeness: KOMA-Script offers the command
|
|||||
|
|
|
If you want an environment, which automatically right or left justifies depending on page odd/evenness, I use something like the below. For example, I have boxes for my equations or key derivations, done with tikzpicture, and wrapping that inside the below environment does the expected. I wouldn't, however, use it around regions that can page-break mid way, like paragraphs of text, since a variable is stored (def\mylr{...}) at the start of the environment, that variable remains as is.
|
||||