rpaka-farmSupport

Writing rules

How to write company regulations or club rules in the same format as Japanese laws (Japanese Standard Law XML).

A minimal example

Rules are written in Japanese Standard Law XML, the format e-Gov uses for Japanese laws. MyCodex reads them the same way as laws from e-Gov, so rules in this format are typeset just like laws.

This alone is enough to be read as rules with a title and Article 1.

<?xml version="1.0" encoding="UTF-8"?>
<Law Era="Reiwa" Year="8" Num="1" LawType="Rule" Lang="en">
  <LawNum>Rules No. 1 of 2026</LawNum>
  <LawBody>
    <LawTitle>Sales Department Rules</LawTitle>
    <MainProvision>
      <Article Num="1">
        <ArticleCaption>(Purpose)</ArticleCaption>
        <ArticleTitle>Article 1</ArticleTitle>
        <Paragraph Num="1">
          <ParagraphNum/>
          <ParagraphSentence>
            <Sentence>These Rules set out how the Sales Department is run.</Sentence>
          </ParagraphSentence>
        </Paragraph>
      </Article>
    </MainProvision>
  </LawBody>
</Law>

About the rules

The attributes of <Law> describe the number and type of the rules. All of them are optional. If you leave one out, the rules still display; that item is just empty.

AttributeMeaning
EraJapanese era: Meiji, Taisho, Showa, Heisei or Reiwa
YearYear
NumNumber
LawTypeType. For rules of your own, use Rule or Misc (other)
LangLanguage: ja or en. See Rules in English

<LawNum> holds how the number is written, such as "Rules No. 1 of 2026". It is also optional.

Always write the title in <LawTitle>. The title appears on the cover in your library, and MyCodex uses it to recognize a revision of rules you already have.

Articles, paragraphs and items

Inside <MainProvision>, nest articles (<Article>), paragraphs (<Paragraph>) and items (<Item>) in that order.

<Article Num="2">
  <ArticleCaption>(Members)</ArticleCaption>
  <ArticleTitle>Article 2</ArticleTitle>
  <Paragraph Num="1">
    <ParagraphNum/>
    <ParagraphSentence>
      <Sentence>A member is a person who meets both of the following:</Sentence>
    </ParagraphSentence>
    <Item Num="1">
      <ItemTitle>(i)</ItemTitle>
      <ItemSentence>
        <Sentence>a person who supports the purpose of the Club; and</Sentence>
      </ItemSentence>
    </Item>
  </Paragraph>
  <Paragraph Num="2">
    <ParagraphNum>(2)</ParagraphNum>
    <ParagraphSentence>
      <Sentence Function="main">A member may leave the Club at any time.</Sentence>
      <Sentence Function="proviso">However, a member who has unpaid fees must pay them before leaving.</Sentence>
    </ParagraphSentence>
  </Paragraph>
</Article>

Chapters and sections

To group articles into chapters or sections, put containers between <MainProvision> and the articles. From largest to smallest, they are part (<Part>), chapter (<Chapter>), section (<Section>), subsection (<Subsection>) and division (<Division>). Write the name of each in the element with Title added to its name, such as <PartTitle> or <ChapterTitle>.

<MainProvision>
  <Chapter Num="1">
    <ChapterTitle>Chapter I General Provisions</ChapterTitle>
    <Article Num="1"> … </Article>
    <Article Num="2"> … </Article>
  </Chapter>
</MainProvision>

The table of contents is built from the chapters and articles. You do not need to write one in the XML.

Enacting statement and preamble

You can put an enacting statement (<EnactStatement>) and a preamble (<Preamble>) between the title and the main provisions. Write both inside <LawBody>, after <LawTitle>.

<LawTitle>Sales Department Rules</LawTitle>
<EnactStatement>The Sales Department Rules are established as follows.</EnactStatement>
<Preamble>
  <Paragraph Num="1">
    <ParagraphNum/>
    <ParagraphSentence>
      <Sentence>The Sales Department …</Sentence>
    </ParagraphSentence>
  </Paragraph>
</Preamble>
<MainProvision> … </MainProvision>

Supplementary provisions

Write supplementary provisions in <SupplProvision> after <MainProvision>. Put a label such as "Supplementary Provisions" in <SupplProvisionLabel>, and add articles or paragraphs inside just as in the main provisions.

<SupplProvision>
  <SupplProvisionLabel>Supplementary Provisions</SupplProvisionLabel>
  <Paragraph Num="1">
    <ParagraphNum/>
    <ParagraphSentence>
      <Sentence>These Rules come into effect on April 1, 2026.</Sentence>
    </ParagraphSentence>
  </Paragraph>
</SupplProvision>

Articles in supplementary provisions can start again from Article 1 without being confused with Article 1 of the main provisions. You can add as many supplementary provisions as you like, for example one for each amendment.

Tables and appended tables

You can put a table inside a paragraph or an item. Wrap the table in <TableStruct>, and write rows with <TableRow> and cells with <TableColumn>. Write a header row with <TableHeaderRow> and <TableHeaderColumn>. To span columns, add colspan; to span rows, add rowspan.

<Paragraph Num="1">
  <ParagraphNum/>
  <ParagraphSentence>
    <Sentence>The membership fees are as shown in the following table.</Sentence>
  </ParagraphSentence>
  <TableStruct>
    <Table>
      <TableHeaderRow>
        <TableHeaderColumn>Category</TableHeaderColumn>
        <TableHeaderColumn>Annual fee</TableHeaderColumn>
      </TableHeaderRow>
      <TableRow>
        <TableColumn><Sentence>Full member</Sentence></TableColumn>
        <TableColumn><Sentence>6,000 yen</Sentence></TableColumn>
      </TableRow>
    </Table>
  </TableStruct>
</Paragraph>

Cells show plain text only. Decorations such as ruby are not applied.

After the main and supplementary provisions, you can add appended tables. Inside <AppdxTable>, write the title in <AppdxTableTitle> followed by a <TableStruct>.

Text decorations

You can use these decorations in sentences.

MarkupDisplay
<Ruby>瑕疵<Rt>かし</Rt></Ruby>Ruby (reading aid)
<Sup>2</Sup> / <Sub>2</Sub>Superscript / subscript
<Line>text</Line>Side line. Style takes solid (default), dotted, double or none

For any other element, the tags are ignored and the text inside is shown. <Em> and <Ref>, which dictionaries use, are plain text in rules.

Rules in English

Write <Law Lang="en"> to typeset the rules in English. As in Japanese, article and item names are shown exactly as written in the XML. To follow the English translations of Japanese laws, write articles as Article 1, chapters as Chapter I, paragraphs as (2) and items as (i). A space separates numbers from the text, and an empty <ParagraphNum> from the second paragraph on is filled in as (2) and so on.

What is not read

The following are not read. Files containing them still import, but they are not used for display.

Back to support home