abenori / jlreq

Other
125 stars 18 forks source link

jlreq

What is this?

This package provides the class file and JFM (Japanese font metric) files for LuaTeX-ja / pLaTeX / upLaTeX. This aims to implement Requirements for Japanese Text Layout.

Installation

Run make to generate JFM files. Move the files as follows:

The other way to install is just to run make install. It will install all files in $TEXMFHOME.

Usage

To use, simply write

\documentclass{jlreq}

This will set up a document class equivalent to an article in horizontal writing. The engine is automatically determined, but if you want to specify it, pass one of platex/uplatex/lualatex as a class option. To switch to vertical writing, pass the tate option. Additionally, to make the document class equivalent to report or book, pass the report or book option respectively. For example, to create a vertical book, write \documentclass[tate,book]{jlreq}.

Other common options accepted are oneside/twoside/onecolumn/twocolumn/titlepage/notitlepage/draft/final/landscape/openright/openany/leqno/fleqn. Also, passing the disablejfam option will not register Japanese fonts for use in mathematics.

You can write the content as you would in a standard document class, but the following commands have been added or extended. Note that this document uses terms from Requirements for Japanese Text Layout without explanation.

\jlreqsetup

This is a command for settings. It can only be used in the preamble. Settings for the document are made either as class options or through \jlreqsetup, depending on the setting item.

\section

The \section command is extended to accept subtitles in addition to the usual format, as in \section*[running head]{Heading}[Subtitle]. Other commands such as \part (only in article), \chapter (only in book/report), \subsection, and \subsubsection also accept subtitles.

abstract environment

You can place it in the preamble, and it will be output with \maketitle. In the case of two columns, it allows you to output the abstract without columnization. However, this method is now deprecated. By specifying abstract_with_maketitle=true in \jlreqsetup and writing it before \maketitle, you can achieve the same effect.

\sidenote

This command is only defined when the width of the sidenote is positive. In the default basic layout, this width is set to 0. Therefore, \sidenote is not defined. Please refer to the later basic layout settings. \sidenote outputs a sidenote (or footnote in vertical writing). Internally, it uses \marginpar. By default, it has the same format as \footnote, but if sidenote_type=symbol is specified in \jlreqsetup, the format becomes \sidenote{relevant item}{note}. For example, you would write:

capable of publishing \sidenote{manuscript}{by methods such as printing…}

Please refer to the later explanation as well.

\endnote

Specifies an endnote. It has the same format as \footnote. By default, the note itself is output just before the heading. This behavior can be controlled by passing endnote_position to \jlreqsetup. For more details, please see the later explanation of notes. Also, executing \theendnotes will output it on the spot.

\warichu

Outputs a warichu (split annotation). The line division positions are calculated automatically (multiple compilations are required). With \warichu*, you can manually specify these positions. The format is \warichu*{(before first line) & (after first line)\\ (before second line) & (after second line)...}. If & is omitted, it will be adjusted automatically.

\tatechuyoko

Outputs horizontal-in-vertical text. You use it as \tatechuyoko{<content>}. \tatechuyoko will result in an error if used in a non-vertical writing place, but \tatechuyoko* will be output as is in a non-vertical writing place.

\jidori

By using \jidori{<dimension>}{<content>}, you can output the content justified to the length of the dimension.

\akigumi

By using \akigumi{<dimension>}{<content>}, you can output the result of spacing the characters of the content by the length of the dimension. However, the correct output result is not obtained except when using LuaLaTeX.

\jafontsize

Specifies the Japanese font size, similar to \fontsize. If jafontscale=0.9 is specified as a class option, specifying \fontsize{9pt}{15pt} will result in a Japanese font size of 8.1pt, but \jafontsize{9pt}{15pt} will result in 9pt (with the European font size being 10pt). The second argument is exactly the same as the second argument of \fontsize.

\ 

A macro consisting of a single full-width space (U+3000). It inserts a Japanese character space. In LuaLaTeX, you can also input a Japanese character space with   alone.

Others

Design options

The design is specified in keyval format via class options or \jlreqsetup. However, due to LaTeX’s implementation, cases where input that should be possible is not accepted may occur with class options. In many cases, this can be resolved by removing spaces.

In the following, the following usage will be used:

Kihon-hanmen

Class option.

class option

Reverse pagination

class option.

Note related

Specified by \jlreqsetup.

Caption

You can change the captions for figures and tables using \jlreqsetup. All settings allow for environment-specific customization. For example, caption_font=\normalsize,table=\Large means that within the table environment, \Large will be applied, while \normalsize will be applied in other environments. Other settings follow the same pattern.

Quotation

Itemization

Front matter etc.

You can specify the behavior of \frontmatter / \mainmatter / \backmatter / \appendix with \jlreqsetup.

There are also settings that change frontmatter to mainmatter, backmatter, or appendix. However, there are some differences as follows.

Abstract

Headings

You can create new headings with commands like \New***Heading ( is a string that corresponds to the type of heading). The format is always \New***Heading{<command name>}{<level>}{<settings>}. Also, \Renew***Heading, \Provide***Heading, and \Declare***Heading are available at the same time. They are respectively

Tobira headings

You can create it with \NewTobiraHeading. It creates a command with the same format as the usual class file’s \section and so on. The settings are as follows. .

Block headings

You can create it with \NewBlockHeading. It creates a command with the format \<command name>*[running head]{heading text}[subtitle]. The settings are as follows.

Format related

Indent related

Others

Gyo-dori

You can specify gyo-dori setting in one of the following ways.

Gyo-dori for consecutive headings

You can set the gyo-dori settings for block headings that are placed consecutively with \SetBlockHeadingSpaces. \SetBlockHeadingSpaces is used as follows:

\SetBlockHeadingSpaces { {_part{lines=3,before_lines=1},_section{lines=2},_subsection{lines=2}} [lines=5]{_section,23pt,_subsection,16pt} }

This means the following.

The individual settings are as follows.

Note that whether the headings are consecutive or not is determined simply by whether the block heading commands are written in succession. Therefore, even if there are commands that are not related to the output between the heading commands, they are not considered to be consecutive headings. However, if only spaces, line breaks, or \label[<option>]{<argument>}…{<argument>} are inserted between the heading commands, they are considered to be consecutive headings.

Run-in headings

Run-in headings are created with \NewRuninHeading. The command creates a heading with the same format as the standard document class's \section, i.e. \<command name>*[running head]{heading text}. The settings are as follows:

Cut-in headings

You can create cut-in headings with \NewCutinHeading. The command has the format \<command name>{heading text}. The settings are as follows:

\ModifyHeading

\ModifyHeading is a command that changes the settings of a heading command that has already been defined (using one of the above commands). For example,

\ModifyHeading{section}{lines=10}

changes only the line spacing of \section to 10 lines, while keeping the font and other settings the same. You cannot change the type of heading with this command.

\SaveHeading

\SaveHeading saves the definition of a heading command. For example, you can use it like this:

\SaveHeading{section}{\restoresection} % Save the contents of \section to \restoresection.
\RenewBlockHeading{section}{1}{font=…} % Redefine \section with a new font.
…
\restoresection % Restore the contents of \section.

Page Style

You can define a page style using

\NewPageStyle{<page style name>}{<settings>}

<settings> is in keyval format. You can apply the defined page style with \pagestyle. The settings are as follows:

\RenewPageStyle, \ProvidePageStyle, \DeclarePageStyle are also available1.

You can modify an existing page style with \ModifyPageStyle.

JFM

We use the following custom JFMs. Some packages may reset the settings to use their own JFMs or the standard JFMs. In that case, you need to set the appropriate package options to use the JFMs of this class file.

For pLaTeX/upLaTeX

The names of the JFMs are as follows. The characters enclosed in [] may or may not be included depending on the settings.

[u][b][z]jlreq[g][-v]

Each character is included in the following cases.

For example, if you process a source without using hanging punctuation and specifying open_bracket_pos=zenkakunibu_nibu as a class option with pLaTeX, the JFM named zjlreq will be used for horizontal writing mincho font.

For LuaLaTeX

The same JFM is used for gothic fonts. This class file changes the JFM of LuaTeX-ja standard to these.

Others

If the class option jlreq_notes is passed, a notification will be given when a setting that contradicts the description of Japanese typesetting processing is made.

jlreq-complements

jlreq-complements is a package that customizes the environments that are typically provided by LaTeX document classes. You can use it as follows. It accepts the following options:

In jlreq, it is loaded as \usepackage[<engine recognized in jlreq>,setupname=jlreqsetup]{jlreq-complements}, so you can customize the environments with the usual \jlreqsetup. To make this work well with an existing name, the original command and the new one need to be compatible. It is usually better to avoid this.

thebibliography environment

theindex environment

Theorem environment

When the amsthm package is loaded, a new theorem style jlreq is defined and the current style is changed to jlreq. In this case, the above settings function as settings for this jlreq style.

LICENSE

This package is distributed under the BSD 2-Clause License. See LICENSE.

CHANGELOG


Noriyuki Abe https://github.com/abenori/jlreq