LaTeX forum ⇒ Page LayoutPage Number in top right Corner Topic is solved

Information and discussion about page layout specific issues (e.g. header and footer lines, page formats, page numbers).
fabioled
Posts: 14
Joined: Sat Sep 15, 2012 2:51 am

Page Number in top right Corner

Postby fabioled » Mon Sep 23, 2013 4:58 pm

Hi everyone,

I have a problem with the page in my document. How do I put the page number in top right corner of the page in case I need to use the option twoside in the docment class report?

Here is my minimal example (my apologies for that because until now I can't do a good example, but hope that you understand).

  1. \documentclass[
  2. 12pt,
  3. a4paper,
  4. % twoside
  5. ]{report}
  6.  
  7. %%%%%Preambule
  8. \usepackage[T1]{fontenc} %encoding
  9. \usepackage{times} %font
  10. \usepackage{setspace}
  11. \usepackage[utf8]{inputenc} %encoding
  12. \usepackage{graphicx}
  13.  
  14. \usepackage{fancyhdr} % draw header and foot
  15.  
  16. % Pacote para divisão silábica do portugues
  17. \usepackage[english, brazilian]{babel}
  18. \usepackage[titles]{tocloft} %% formatar a lista de figuras e tabelas.
  19.  
  20. \usepackage{geometry}
  21. \geometry{tmargin=20mm,bmargin=20mm,lmargin=30mm,rmargin=20mm}
  22.  
  23. % change indent of table of content
  24. \usepackage[titles]{tocloft}
  25. \cftsetindents{chapter}{0cm}{.3cm}
  26. \cftsetindents{section}{0cm}{.6cm}
  27. \cftsetindents{subsection}{0cm}{.9cm}
  28. \cftsetindents{subsubsection}{0cm}{1.2cm}
  29. \cftsetindents{paragraph}{0cm}{1.5cm}
  30.  
  31. %%%%%%%%%%% CONFIG ABOUT HEADER E AND FOOT %%%%%%%%%%%%%%%%%%
  32. \pagestyle{fancy}
  33. \fancyhf{}
  34. %para margem do cabeçalho ficar do tamanho da margem do texto
  35. \fancyheadoffset{0cm}
  36.  
  37. \rhead{\thepage} %% PUT THE PAGE ON TOP RIGHT BUT NOT WORK
  38.  
  39. \setlength\parindent{0pt}
  40. \renewcommand{\headrulewidth}{0pt} % remove lines as well
  41. \renewcommand{\footrulewidth}{0pt}
  42. % \fancyhead[R]{\thepage}
  43. \lfoot{}
  44.  
  45. %%%%%%%%%%%% Begin Docment %%%%%%%%%%%%%%%%%%
  46.  
  47. \begin{document}
  48.  
  49. % \listafiguras % list of figures
  50. % \listatabelas % list of tables
  51. % \listadesiglas % list abrevy
  52. \tableofcontents
  53. % \sumario %My custon tableofcontents
  54.  
  55.  
  56. %%%%%%%%%%%%%%% Textos %%%%%%%%%%%%%%%%%%
  57. \chapter{\uppercase{Introdução}}
  58.  
  59. A introdução deverá conter a natureza do trabalho, justificativa.
  60.  
  61. \section{Problema}
  62.  
  63. a lek lek lek lelek lekyyyy girando girando girando prum lado
  64. girando girando pro outro kkk.
  65.  
  66. \section{Justificativa}
  67.  
  68. Esta seção foi inserida para ilustrar uma seção
  69.  
  70. \chapter{\uppercase{Desenvolvimento}}
  71.  
  72. Eu não sei falar ingles, ela não entende uma palavra em portugues.
  73.  
  74. I saw you saying that you say that you saw I saw you saying that you say that you
  75.  
  76. \chapter{\uppercase{Conclusão}}
  77.  
  78. I feel good because you put your butt on me
  79. I feel good because you put your butt on...
  80.  
  81. \bibliography{bibliografia} %my bib file
  82. \end{document}
Last edited by localghost on Mon Sep 23, 2013 6:58 pm, edited 1 time in total.
Reason: Longer passages of source code are tagged as code block, not as in-line code.

Tags:

User avatar
Johannes_B
Site Moderator
Posts: 4104
Joined: Thu Nov 01, 2012 4:08 pm

Postby Johannes_B » Mon Sep 23, 2013 6:31 pm

Hi,

the pages where a chapter begins are typeset differently. Please have a look at section 7 of the fancyhdr manual to learn how to change the plain style.

By the way, getting rid of the \parindent isn't a good idea. You should use the parskip package instead.

  1. \documentclass[12pt,a4paper,twoside]{report}
  2. \usepackage{fancyhdr}
  3.  
  4. \pagestyle{fancy}
  5. \fancyhf{}
  6. \fancyheadoffset{0cm}
  7. \renewcommand{\headrulewidth}{0pt}
  8. \renewcommand{\footrulewidth}{0pt}
  9. \fancyhead[R]{\thepage}
  10. \fancypagestyle{plain}{%
  11. \fancyhf{}%
  12. \fancyhead[R]{\thepage}%
  13. }
  14.  
  15. \usepackage{blindtext}
  16. \usepackage{parskip}
  17.  
  18. \begin{document}
  19. \Blinddocument
  20. \end{document}



Best regards
Johannes
The smart way: Calm down and take a deep breath, read posts and provided links attentively, try to understand and ask if necessary.

fabioled
Posts: 14
Joined: Sat Sep 15, 2012 2:51 am

Postby fabioled » Mon Sep 23, 2013 8:49 pm

Hi,

Work perfectly, very thanks for you help.
Is the persons how you that make the diference.


Return to “Page Layout”

Who is online

Users browsing this forum: No registered users and 5 guests