LoginSignup
36

More than 5 years have passed since last update.

LaTeXでセクションとかのデザインを変える

Posted at

こんな感じにした

latex

ソース全部

\documentclass[a4paper]{jreport}

\usepackage{titlesec}
\usepackage{picture}
\usepackage[usenames]{color}
%\usepackage[usenames,divpsnames]{xcolor}                                                                                                                                                                                                                                                                                                                              

% colors                                                                                                                                                                                                                                                                                                                                                               
\definecolor{teal}{RGB}{0,128,128}
\definecolor{powderblue}{RGB}{176,224,230}
\definecolor{darkslateblue}{RGB}{72,61,139}
\definecolor{darkslategray}{RGB}{47,79,79}
\definecolor{lightcyan}{RGB}{224,255,255}

% chapter                                                                                                                                                                                                                                                                                                                                                              
\titleformat{\chapter}[block]
{}{}{0pt}{
  \fontsize{40pt}{40pt}\selectfont\filleft
}[
  \hrule \Large{\filleft\thechapter}
]

% section                                                                                                                                                                                                                                                                                                                                                              
\titleformat{\section}[block]
{}{}{0pt}
{
  \colorbox{teal}{\begin{picture}(0,20)\end{picture}}
  \hspace{0pt}
  \normalfont \Huge\bfseries \thesection
  \hspace{-4pt}
}
[
\begin{picture}(100,0)
  \put(3,30){\color{teal}\line(1,0){400}}
\end{picture}
\\
\vspace{-50pt}
]

% subsection                                                                                                                                                                                                                                                                                                                                                           
\titleformat{\subsection}[block]
{}{}{0pt}
{
  \colorbox{darkslateblue}{\begin{picture}(0,10)\end{picture}}
  \hspace{0pt}
  \normalfont \Large\bfseries \thesubsection
  \hspace{-4pt}
}
[
\begin{picture}(100,0)
  \put(3,18){\color{darkslateblue}\line(1,0){300}}
\end{picture}
\\
\vspace{-30pt}
]

% margin                                                                                                                                                                                                                                                                                                                                                               
\addtolength{\textwidth}{2in}
\addtolength{\oddsidemargin}{-1in}
\addtolength{\textheight}{1in}
\addtolength{\voffset}{-0.5in}
\parindent=0zw

\begin{document}

\chapter{章章章章章}
\section{セクションセクション}
\subsection{サブセクションサブセクション}
\subsubsection{サブサブセクション}

本文本文本文本文本文本文本文本文本文本文本文本文本文本文本文本文本文本文本文本文本文本文本文本文本文本文本文本文本文本文本文本文本文本文本文本文本文本文本文本文本文本文本文本文本文本文本文本文本文本文本文本文本文本文本文本文本文本文本文本文

\end{document}

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
What you can do with signing up
36