0

I am trying align the text "Chapter" before the section title.

I've tried

\documentclass[chapterprefix=false]{scrreprt}
\makeatletter
\renewcommand*{\chapterformat}{%
\mbox{\chapapp~\thechapter\autodot:\enskip}%
}

And much more got from another answers but it's not working for my issue.

\documentclass[12pt,a4paper]{article}
\usepackage[latin2]{inputenc}
\usepackage{graphicx}
\usepackage{ulem}
\usepackage{amsmath}
\usepackage{xcolor}
\usepackage[utf8]{inputenc}
\usepackage{graphicx}
\graphicspath{ {figures/} }
\usepackage{array}

This is what I want Text "Chapter before section title name" I am very new to latex. Please help me to solve this problem. Thank you in advance.

6
  • 1
    Welcome to TeX SX! What you want is not very clear. Could you post a small compilable example showing what your problem is?
    – Bernard
    Apr 14, 2018 at 18:42
  • @Bernard i have edited my question. Sorry for not showing the expected output before editing Apr 14, 2018 at 18:45
  • Do you use the scrreprt class? B.t.w. in the last code why do you load inputenc with option latin2, then utf8? This is inconsistent!
    – Bernard
    Apr 14, 2018 at 18:53
  • @Bernard actually I'm also not sure why i used it. I copied it for something. Can you please tell me what is the efficient way to have the output i want Apr 15, 2018 at 9:34
  • The vertical line in the image is a visualisation of the left margin?
    – Bernard
    Apr 15, 2018 at 9:45

1 Answer 1

0

You can load titlesec and use this code in your preamble:

\usepackage{titlesec}

\titleformat{\chapter}[block]{\LARGE\bfseries\filright}{\chaptertitlename~\thechapter:}{0.5em}{}

Some explanations:

  • The first mandatory argument of \titleformat} is the section level.
  • The (first) optional argument is the shape used for this level (there are 9 shapes, the default is hang).
  • The second mandatory argument is the format to be applied to the whole title.
  • The third argument defines the label.
  • the fourth argument defines the spacing between label and title.
  • The fifth argument is code the title body.The very last command can take an argument, which is the title text.
  • A second optional argument (not used here), which can be used with some shapes, is for code following the title body.
1

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .