Horizontal baseline after chapter number, stretched to right margin, above chapter title

The question may look lengthy, but it is what I need.

I want horizontal line beside chapter number and the vertical position of the line should be on lower. It should be like this

1___


In this link, the vertical position is on middle (1---)

Then, the horizontal line should be stretched to right margin. The previous link shows it.

Then, the chapter title should be below the chapter number, like this

1___
Chapter title


The most important, I want the format of the chapter number and chapter title follow previous (origin) definition. On this link, the code introduces a lot of changes to the chapter number and chapter title. I just want the line.

The line thickness should be standard (1pt).

\documentclass[twoside]{book}

\usepackage[paperheight=9.72in,paperwidth=6.85in]{geometry}

\usepackage{amsmath}
\usepackage{amsthm,mathpazo}

\makeatletter
\vspace*{10\p@}%
{\parindent \z@ \raggedright \normalfont
\ifnum \c@secnumdepth >\m@ne
\if@mainmatter
\huge\bfseries \@chapapp\space \thechapter
\par\nobreak
\vskip 20\p@
\fi
\fi
\interlinepenalty\@M
\Huge \bfseries #1\par\nobreak
\vskip 40\p@
}}
\vspace*{10\p@}%
{\parindent \z@ \raggedright
\normalfont
\interlinepenalty\@M
\Huge \bfseries  #1\par\nobreak
\vskip 40\p@
}}
\makeatother

\usepackage[utf8]{inputenc}
\usepackage[T1]{fontenc}
\usepackage[symbolmax,defaultmathsizes]{mathastext}

\begin{document}

\chapter{Chapter title}

\end{document}


For the MWE, I tried change and combine the codes on the links but I am not familiar on TikZ and the codes introduce changes that I do not want.

• Welcome to TeX SX! Did you try with titlesec? You don't need a hammersledge like TikZ to draw a rule. Nov 6, 2019 at 14:10
• @Bernard Yeah, but it doesn't make any line when I tried to delete some parts of the titlesec on the example. Nov 6, 2019 at 14:19
• Could you post what you tried? Nov 6, 2019 at 14:50

Do you want something like this?

\documentclass[twoside]{book}
\usepackage[paperheight=9.72in, paperwidth=6.85in]{geometry}
\usepackage[utf8]{inputenc}
\usepackage[T1]{fontenc}
\usepackage[symbolmax,defaultmathsizes]{mathastext}

\usepackage{amsmath}
\usepackage{amsthm,mathpazo}
\usepackage{titlesec, linegoal}
\usepackage{lipsum}

\titleformat{\chapter}[display]{\Huge\bfseries}{\huge\chaptername~\thechapter \rule[-0.5ex]{\linegoal}{1pt}}{2ex}{\filcenter}
\titlespacing*{\chapter}{0pt}{2ex}{8ex}

\begin{document}

\chapter{Chapter title}

\lipsum[1]

\end{document}


• This is perfect to me. Is there a way to hide "Chapter" from "Chapter 1"? Nov 6, 2019 at 16:11
• I removed \chaptername~ to get chapter number only. Thank you so much. Nov 6, 2019 at 16:19
• Yes: in the second mandatory argument of \titleformat, remove \chaptername~. Note that perhaps you'll to redefine \titleformat a bit differently for unnumbered chapters (table of contents, bibliography, &c.) This is done through the numberless key (§ 3.8, Extended Settings` in the documentation). Nov 6, 2019 at 16:21