\NeedsTeXFormat{LaTeX2e}
\ProvidesClass{thesis}[2017/11/20 v0.1 ]

\newif\if@B
\@Bfalse

\newif\if@M
\@Mfalse

\DeclareOption{B}{\@Btrue}

\DeclareOption{M}{\@Mtrue}

\ProcessOptions\relax

\renewenvironment{abstract}{%
  \titlepage
  \null\vfil
  \@beginparpenalty\@lowpenalty
  \begin{center}%
    {\bfseries\abstractname}%
    \vspace{5mm}
    \@endparpenalty\@M
  \end{center}}%
  {\par\vfil\null\endtitlepage}

\if@B
\renewcommand{\abstractname}{要\hspace{2\Cwd}旨}
\fi

\if@M
\renewcommand{\abstractname}{概要}
\fi

\renewcommand{\and}{\hspace*{2\Cwd}}

\renewcommand{\rmdefault}{ptm}
\renewcommand{\sfdefault}{ptm}


% from bxjsreport

\def\@makechapterhead#1{%
  \vspace*{2\Cvs}% 欧文は50pt
  {\parindent \z@ \raggedright \normalfont
    \ifnum \c@secnumdepth >\m@ne
    \setlength\@tempdima{\linewidth}%
      \if@mainmatter
        \huge\headfont \@chapapp\thechapter\@chappos\hskip1\Cvs
        \addtolength\@tempdima{-\wd\z@}%
        \unhbox\z@\nobreak
        \vtop{\hsize\@tempdima}
%        \par\nobreak
%        \vskip \Cvs % 欧文は20pt
      \fi
    \fi
%    \interlinepenalty\@M
    \huge \headfont #1\par\nobreak
    \vskip 3\Cvs}} % 欧文は40pt

\def\@makeschapterhead#1{%
  \vspace*{2\Cvs}% 欧文は50pt
  {\parindent \z@ \raggedright
    \normalfont
    \interlinepenalty\@M
    \huge \headfont #1\par\nobreak
    \vskip 3\Cvs}} % 欧文は40pt

% end from bxjsreport.cls

% from jrepost.cls
                  
\setlength\bibindent{1.5em}
\renewcommand{\newblock}{\hskip .11em\@plus.33em\@minus.07em}
\renewenvironment{thebibliography}[1]
{\chapter*{\bibname}\@mkboth{\bibname}{\bibname}%
   \list{\@biblabel{\@arabic\c@enumiv}}%
        {\settowidth\labelwidth{\@biblabel{#1}}%
         \leftmargin\labelwidth
         \advance\leftmargin\labelsep
         \@openbib@code
         \usecounter{enumiv}%
         \let\p@enumiv\@empty
         \renewcommand\theenumiv{\@arabic\c@enumiv}}%
   \sloppy
   \clubpenalty4000
   \@clubpenalty\clubpenalty
   \widowpenalty4000%
   \sfcode`\.\@m}
  {\def\@noitemerr
    {\@latex@warning{Empty `thebibliography' environment}}%
   \endlist}
\let\@openbib@code\@empty

% end from jrepost.cls