I want to write the name of my chapter above this horizontal line, I'm using LyX.

enter image description here

  • Hi, welcome. How did you add that line in the first place? If it's made by Insert -> Formatting -> Horizontal line for example, just delete it, and insert a new line where you want it to be. Jun 13 at 8:17
  • Do you mean writing the chapter title in the header, per chance?
    – Bernard
    Jun 13 at 11:20
  • yes I mean the chapter title in the header @Bernard
    – Imene Yd
    Jun 13 at 13:52
  • I don't use Lyx, but there's latex code behing. Usually this is done with the fancyhdr package, with (a bit easier) the titleps, a companion package of titlesec.
    – Bernard
    Jun 13 at 14:32
  • Similar to your last question [tex.stackexchange.com/questions/601023/adding-horizental-lines], you can have a look at the fancyhdr package. The code in the provided answer shows \leftmark and \rightmark which is probably what you are looking for. Jun 13 at 14:59


  1. Document Class → Select Book (Standard Class)

  2. Page LayoutPage style → Select fancy

Note that this will make a header (with the rule, that should not be in them main screen) in the second and following pages, but not in the chapter page, because a header just above of a huge title is really useless, but if you have some problem with this, you can go under the chapeter title and type Ctrl+L and \thispagestyle{fancy} in the evil red box.

If you wnat something more complex with header, go to DocumentSettingsLaTeX preamble to set fancyhdr headers manually.

  • thank you so much for your answer @Fran the first method worked and I got the hearders ,but I dont know how to write above it
    – Imene Yd
    Jun 13 at 17:25
  • @ImeneYd In ViewCode Preview PaneComplete Source you can see that the above just insert \usepackage{fancyhdr}\pagestyle{fancy} in the LaTeX preamble,, but as said above, you can edit directly the preamble to add manually \usepackage{fancyhdr} ..., where ... is the commands of the package that you want. See the fancyhdr manual or the examples of the questions about fancyhdr in this site.
    – Fran
    Jun 13 at 23:05
  • +1: I did not know about the <kbd>Document</kbd> syntax, cool! Jun 14 at 2:21
  • Thank you so much
    – Imene Yd
    Jun 14 at 5:39

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.