该部分显示正确,但子部分没有(我希望文本从标题右侧开始。这是我的代码:
\documentclass[10pt]{article}
\usepackage[left=2.5cm,right=2.5cm,top=2.5cm,bottom=2.5cm]{geometry}
\usepackage[utf8]{inputenc}
\usepackage[T1]{fontenc}% Use 8-bit encoding that has 256 glyphs
\usepackage{titlesec}
\setlength{\parindent}{0pt}
%=====SECTION====
\titleformat{\section}% command
[hang] % shape
{\bfseries\Large\raggedright}%format
{\thesection.} %label
{0em}%sep
{
\rule{\textwidth}{1pt}
\vspace{1ex}
\centering
}% before-code
[
\vspace{-0.5ex}%
\rule{\textwidth}{0.3pt}
] % after-code
\titlespacing{\section}%command
{0pc}%left
{0pc}%vertical space before title
{0pc}%separation between title and non-sectioning text
%=====SUB-SECTION====
\titleformat{\subsection}% command
[leftmargin] % shape
{\bfseries\Large}%format
{\\} %label
{0em}%sep
{
}% before-code
[
] % after-code
\titlespacing{\subsection}%command
{0pc}%left
{0pc}%vertical space before title
{0pc}%separation between title and non-sectioning text
\begin{document}
\section{Sectio1} % (fold)
\label{sec:sectio1}
Lorem ipsum dolor sit amet, consectetur adipiscing elit. Etiam laoreet tempor viverra. Etiam semper tristique magna, ut tempor nunc aliquet sit amet.
\subsection{subsectio2} % (fold)
\label{sub:subsectio2}
Lorem ipsum dolor sit amet, consectetur adipiscing elit. Etiam laoreet tempor viverra. Etiam semper tristique magna, ut tempor nunc aliquet sit amet.
\end{document}
我注释了不同的行来帮助我,但我没有找到我的谜题。有人能帮助我吗?谢谢