質問用フォーラムです。ご質問の前に質問のしかたをご覧ください。

\pagestyle{} がうまく機能しない

- 佐藤 友彰 の投稿

すみません、昨日に引き続き申し訳ありませんが教えてください。

修士論文の執筆のために、TeXを久しぶりに使い始めました。

以下の様に記述したのですが、

\pagestyle{} がうまく機能せず、何をやってもページ番号が右上に出てしまいます。

\pagestyle{plain} にしてもフッターのセンターにページ番号でません。

どうしたら修正できるのでしょうか
使用している環境は、Mac OS Sonoma 14.5, エディタVSCode、LuaLaTeXを使用。

\documentclass[a4paper,12pt]{ltjsbook}
\usepackage{fancyhdr} % fancyhdrパッケージを読み込み
%用紙設定======================================
\usepackage{geometry}
\geometry{left=30truemm,right=30truemm,top=30truemm,bottom=30truemm}

\begin{document}
\pagestyle{fancy}
\lhead{}
\chead{Headerの真ん中}
\cfoot{\thepage}
\chapter{はじめに}
\section{はじめに2}
\subsection{はじめに3}
ここに章の内容を記述します。

\end{document}

jlreqで、直後に改行がある場合の句点のぶら下げについて

- 道光 の投稿

元のソースはもっと長いものですが、下に簡略化したものを書きます。

\documentclass[paper={72mm,178mm},tate,jafontsize=19pt,hanging_punctuation]{jlreq}
\usepackage[top=22mm,bottom=21mm,left=5mm,right=5mm]{geometry}
\begin{document}
\begin{flushleft}
仏告須菩提。諸菩薩摩訶薩。応如是降伏其心。%1行目
仏告須菩提。諸菩薩摩訶薩。応如是降伏其心。%2行目
\par
仏告須菩提。諸菩薩摩訶薩。応如是降伏其心。 %3行目
\par
\end{flushleft}
\end{document}

1行目は句点がぶら下げになっています。
2行目のように直後に改行がある場合でもぶら下げになってほしいのですが、そうなりません。
3行目のように、行末に全角スペースを入れればぶら下げにはなります(が、次の行の行頭に全角スペースが来る)

2行目のようなケースで、ぶら下げにするにはどうしたらいいのでしょう。
(kanjiskipや余白を調整すれば、一応その場の回避はできますが…)

正規表現で任意文字を残して置換したい

- ueki ichiro の投稿

Windows11の富士通ノートパソコンで texworksで論文を書いています。

古い論文のなかで \textbf{...} を使って太字で書いた数字を普通の数字に直すため、 ... で表した数字を残して ... の前後の \textbf{} を消去したいのです。

このため正規表現で検索文字を (textbf{[0-9]+}) 、置換文字を $1 としましたが失敗しました。正しい方法をご教示ください。また検索文字をを (\textbf{[0-9]+}) とすると検索もエラーになりました。\  を含む上のような文字列の検索法も教えて頂ければ幸いです。

  植木

表のセル内の単語間の空白の制御

- matushiro 97 の投稿

英語論文の表の中に文章があります.単語間の空白が広めになる所があり見た目が悪いです.
単語間の空白が半角サイズ,一つの単語が2行にまたがる場合は,単語を次行に送るか,または"-"で分割という処理はできないでしょうか.

\usepackage{animate}でエラーが出る

- gbb 60166 の投稿

ご無沙汰しています。gbb60166です。
以前コンパイルできていたファイルが、コンパイルできなくなったので質問です。

https://unilab.gbb60166.jp/prekou/tex/nageage.tex
を自宅のWindows7,TeXLive2024最新版のuplatexでコンパイルするとエラーが出ます。

しかし職場のWindows10,TeXLive2024少し古い版のuplatexでコンパイルするとコンパイルできてdvipdfmxでPDFに変換できました。しかし職場のTeXLive2024も最新版に更新するとコンパイルエラーが出るようになってしまいました。

2つのログを比較するとpdfbase.styとocgx2.styのバージョンが違います。pdfbase.sty 2022/08/04 v0.55だとコンパイルできるが、2024/09/02 v0.57だと! Missing number, treated as zero.エラーが出ます。

さらに調べると、nageage.tex だけの問題では無くて\usepackage{animate}を使った\begin{animateinline}を使用した他のファイルも全部エラーが出るようになっていました。

media9パッケージの変更が原因のような気がするのですが、どなたか確認していただけないでしょうか?(私ももう少し調べてみます。ソースコードを工夫することでエラーが出ないように出来るのでしょうか?)

schlmath.styで共通テストのような箱が作れない

- Yoshikawa Kaoru の投稿

初めて質問させていただきます。sclmath.sty を用いて、共通テスト(センター試験)のような解答欄を作成したいのですが、作成できずに困っております。

\documentclass[a4, 11pt]{jarticle}

\usepackage{amsmath,amssymb,ascmac,schlmath,emathPp,epic,eepic}

\usepackage[margin=10mm]{geometry}

\usepackage{layout}

\newcounter{kadainum}

\setcounter{kadainum}{0}

\newcommand{\kadai}{%

\refstepcounter{kadainum}%

\thekadainum

}

\newcounter{toi} \newcounter{subtoi}[toi]

\newcounter{subsubtoi}[subtoi]

\newcounter{test}

\setcounter{test}{0}

\newcommand{\test}[1][]{\refstepcounter{test}}

\def\toi{\refstepcounter{toi}

\makebox[2zw][r]{\fbox{\Large\arabic{toi}}\hspace{1zw}}\hangindent=1zw}

\def\subtoi{\refstepcounter{subtoi}

\def\subsubtoi{\refstepcounter{subsubtoi}}

%\def\test{\refstepcounter{test}}

\pagestyle{empty}

\def\LabelNo{\KANA\theLocalNumber}

\makebox[3.4zw][r]{(\arabic{subtoi})\hspace{1zw}}\hangindent=2.4zw}

\def\arraystretch{2.05}

\pagestyle{empty}

\textwidth=18cm

\textheight=25cm

\oddsidemargin=-1.2cm

\topmargin=-1.2cm

\everymath{\displaystyle}

\begin{document}

\lineskiplimit=2.0ex

\normallineskiplimit=\lineskiplimit

\lineskip=\lineskiplimit

\normallineskip=\lineskiplimit

{\LARGE 日々の演習 No.\thepage}

\hskip2zw\\

\hfill

\underline{\hskip1zw 3年 \hskip2zw 6組 \hskip4zw 番 \hskip1zw 氏名 \hskip30ex}

\ResetNo

\Toi $a = \frac{1 + \sqrt{3}}{1 + \sqrt{2}}$, $b = \frac{1 - \sqrt{3}}{1 - \sqrt{2}}$ とおく。

\SubToi $ab=\NO$

\end{document}

コンパイル結果

This is ptex2pdf[.lua] version 20200520.0.

Processing rnsyu.tex

This is e-upTeX, Version 3.141592653-p4.1.1-u1.30-230214-2.6 (utf8.sjis) (TeX Live 2024) (preloaded format=platex)

restricted \write18 enabled.

entering extended mode

(./rnsyu.tex

pLaTeX2e <2023-02-14>+1, based on

LaTeX2e <2023-11-01> patch level 1

L3 programming layer <2024-03-14>

(c:/texlive/2024/texmf-dist/tex/platex/base/jarticle.cls

Document Class: jarticle 2020/09/30 v1.8f Standard pLaTeX class

(c:/texlive/2024/texmf-dist/tex/platex/base/jsize11.clo))

(c:/texlive/2024/texmf-dist/tex/latex/amsmath/amsmath.sty

For additional information on amsmath, use the `?' option.

(c:/texlive/2024/texmf-dist/tex/latex/amsmath/amstext.sty

(c:/texlive/2024/texmf-dist/tex/latex/amsmath/amsgen.sty))

(c:/texlive/2024/texmf-dist/tex/latex/amsmath/amsbsy.sty)

(c:/texlive/2024/texmf-dist/tex/latex/amsmath/amsopn.sty))

(c:/texlive/2024/texmf-dist/tex/latex/amsfonts/amssymb.sty

(c:/texlive/2024/texmf-dist/tex/latex/amsfonts/amsfonts.sty))

(c:/texlive/2024/texmf-dist/tex/latex/ascmac/ascmac.sty

(c:/texlive/2024/texmf-dist/tex/latex/ascmac/tascmac.sty))

(c:/texlive/2024/texmf-dist/tex/latex/schlmath/Schlmath.sty

UTF-8/高等学校数学用 pLaTeX2e 用マクロ集 Ver4.09.05 2018.01.13 金沢光則

) (c:/texlive/texmf-local/tex/platex/misc/emath/emathPp.sty

(c:/texlive/texmf-local/tex/platex/misc/emath/emathPh.sty

(c:/texlive/2024/texmf-dist/tex/latex/eepic/epic.sty

Enhancements to Picture Environment. Version 1.2 - Released June 1, 1986

) (c:/texlive/2024/texmf-dist/tex/latex/eepic/eepic.sty

Extension to Epic and LaTeX. Version 1.1e - Released Dec 21, 1999

) (c:/texlive/2024/texmf-dist/tex/latex/eclarith/eclarith.sty

eclarith.sty 1.1 --- July 1, 1992

) (c:/texlive/texmf-local/tex/platex/misc/emath/emath.sty

(c:/texlive/texmf-local/tex/platex/misc/emath/emath2e.sty

(c:/texlive/texmf-local/tex/platex/misc/emath/emathE.sty

(c:/texlive/2024/texmf-dist/tex/latex/tools/enumerate.sty)

(c:/texlive/texmf-local/tex/platex/misc/emath/emathEc.sty

(c:/texlive/texmf-local/tex/platex/misc/emath/emathC.sty

(c:/texlive/2024/texmf-dist/tex/latex/tools/calc.sty)

(c:/texlive/2024/texmf-dist/tex/latex/base/ifthen.sty))

(c:/texlive/2024/texmf-dist/tex/latex/graphics/keyval.sty))

(c:/texlive/texmf-local/tex/platex/misc/emath/jquote.sty)

(c:/texlive/texmf-local/tex/platex/misc/emath/emathK.sty))))

(c:/texlive/2024/texmf-dist/tex/latex/graphics/graphicx.sty

(c:/texlive/2024/texmf-dist/tex/latex/graphics/graphics.sty

(c:/texlive/2024/texmf-dist/tex/latex/graphics/trig.sty)

(c:/texlive/2024/texmf-dist/tex/latex/graphics-cfg/graphics.cfg)

(c:/texlive/2024/texmf-dist/tex/latex/graphics-def/dvips.def)))

(c:/texlive/2024/texmf-dist/tex/latex/graphics/color.sty

(c:/texlive/2024/texmf-dist/tex/latex/graphics-cfg/color.cfg)

(c:/texlive/2024/texmf-dist/tex/latex/graphics/dvipsnam.def)

(c:/texlive/2024/texmf-dist/tex/latex/graphics/mathcolor.ltx))))

(c:/texlive/2024/texmf-dist/tex/latex/geometry/geometry.sty

(c:/texlive/2024/texmf-dist/tex/generic/iftex/ifvtex.sty

(c:/texlive/2024/texmf-dist/tex/generic/iftex/iftex.sty)))

(c:/texlive/2024/texmf-dist/tex/latex/tools/layout.sty)

(c:/texlive/2024/texmf-dist/tex/latex/l3backend/l3backend-dvips.def)

LaTeX Warning: Unused global option(s):

[a4].

(./rnsyu.aux)

*geometry* driver: auto-detecting

*geometry* detected driver: dvips

(c:/texlive/2024/texmf-dist/tex/latex/amsfonts/umsa.fd)

(c:/texlive/2024/texmf-dist/tex/latex/amsfonts/umsb.fd)

! Missing number, treated as zero.

<to be read again>

=

l.49 \SubToi $ab=\NO$

?

様々なページを当たってみましたが、解決策がわかりません。どなたかご教示願えないでしょうか。

ヘッダーのみ文字化け

- M K の投稿

はじめまして。TeX LIVE 2024を使用しています。某サイトのサンプルとして使用されている下記のコードで、PDF化すると「先生と私」というヘッダーの文字だけが化けしてしまいます。日本語の場合のみ文字化けして、アルファベットの場合は文字化けしません。解決策をご存知の方はいらっしゃいますでしょうか。よろしくお願い致します。

\RequirePackage{plautopatch}
\documentclass[uplatex,
  tate, % 'yoko' で通常の横書き文書
  book,
  onecolumn, % 'twocolumn' で2段組
  paper=a6,  % 紙面サイズを指定
  twoside,
  openany,
  fontsize=9pt,       % 文字サイズ
  jafontsize=9pt,     % 和文字サイズ
  number_of_lines=14, % 行数
  line_length=35zh,   % 一行の文字数
  baselineskip=16pt,  % 行間
  hanging_punctuation,
]{jlreq}
%%% ルビ生成のためのパッケージ
\usepackage{pxrubrica}
%%% 背景色指定のパッケージ
\usepackage{color}
\definecolor{background}{cmyk}{0, 0, 0, 0} % 白
%%% ページの書式を指定
\ModifyPageStyle{plain}{%
running_head_position=top-left,
nombre_position=bottom-left,
odd_running_head={_chapter},
even_running_head={},
mark_format={_chapter={#1}}
}
\pagestyle{plain}
%%% 章・節の書式を指定
\ModifyHeading{chapter}{format={\large\sffamily #2},indent=2zw,lines=4}
\ModifyHeading{section}{format={\normalsize #2},indent=4zw,lines=2}
 
%%% ここから本文
\begin{document}
\pagecolor{background}
 
\chapter{先生と私}
\section{一}
 
\ruby[<>]{私}{わたくし}はその人を常に先生と呼んでいた。 % \ruby[<>] ルビを前後に進入
だからここでもただ先生と書くだけで本名は打ち明けない。
これは世間を\ruby{憚}{はば}かる遠慮というよりも、その方が私にとって自然だからである。
私はその人の記憶を呼び起すごとに、すぐ「先生」といいたくなる。
筆を\ruby{執}{と}っても心持は同じ事である。
よそよそしい\ruby[g]{頭文字}{かしらもじ} などはとても使う気にならない。
 
\end{document}

Excelで作成したグラフをpdfcropしたものを印刷すると線情報が無視される?

- M. I. の投稿

TeXそのものの質問ではないのですが、pdfcropについてご存じでしたらご教示いただけますと幸いです。

Excelで作成したグラフをExcelの標準機能でPDF化し、pdfcropで余白を削除したものをプリンタで印刷すると、グラフの線情報が無視される?現象が起きています。詳細は以下のとおりです。

Windows 11、Excel 2019で作成した折れ線グラフを、グラフのみ選択しExcelの標準機能でPDFとしてエクスポートしました。エクスポート時のオプションは以下のとおりです。

  • 最適化:標準
  • ページ範囲:すべて
  • 発行対象:選択したグラフ
  • 印刷対象外の情報を含める
    • ドキュメントのプロパティはチェック有りでグレーアウト
    • アクセシビリティ用のドキュメント構造タグはチェック無し
  • PDF/A準拠はチェック有り

pdfcropのバージョンは1.42で、オプションは付けず入力ファイル名のみを引数として実行しました。

Excelで生成したPDF、pdfcropで出力されたPDFそれぞれをAcrobat Readerで表示すると同じようなグラフに見えるのですが、プリンタで印刷すると前者は見た目どおり印刷され、後者は線情報が無視されたかのように印刷されます。

添付ファイルをご覧いただければ幸いです。
よろしくお願いいたします。

  • graph.pdf:Excelからエクスポートしたファイル
  • graph-crop.pdf:pdfcropで出力したファイル
  • graph_scan.pdf:graph.pdfを印刷し、スキャンしたもの
  • graph-crop_scan.pdf:graph-crop.pdfを印刷し、スキャンしたもの

漢文訓点用のマクロと前処理システムについて

- yasu oka の投稿
漢文訓点用のマクロと白文と書き下し文からそのマクロにはめ込む(白文に送り仮名を割り振って、返点を付与する)前処理システムを作ってみました。(一式、添付ファイルにつけてあります)
Windows用、macOS用のインターフェイスも作ってありますので、ご覧になって、ご感想などお聞かせねがえれば改良を進めていきたいと思います。

ところで、マクロはLuaLaTeXの使用を前提に作っているのですが、ヘッダーに
\usepackage{luatexja-fontspec}
\setmainjfont[
BoldFont = HaranoAjiGothic-Medium.otf
]{HanaMinA}
を入れて、花園明朝を使おうとすると、句読点があらぬ位置にはまってしまいます。(これは、A4縦の書式を選んで前処理をさせるとこのヘッダーが使われています)前処理システムが5桁ユニコード(utf-8で4バイト)の漢字が処理できるように作ってあるので、できれば花園明朝のようなフォントが使いたいのです。領域を指定して、
\usepackage{luatexja-fontspec}
\setmainjfont[AltFont={
{Range="20000-"2FFFF, Font=HanaMinB},
{Range="0080-"FFFF, Font=IPAexMincho},
}]{HanaMinA}
といったことをすれば、使えるのですが、処理に時間がかかってしまいます。良い知恵をお持ちの方がおられましたら、是非お教えください。

アップデートを元に戻す方法

- 山下 山下 の投稿

Windows 10 で TexLive 2024 を使っています。先ほど TLShell TeX Live Manager を起動してアップデート可能なものを全てアップデートしたところ,以下のエラーが出るようになりました。

(前略)
(c:/texlive/2024/texmf-dist/tex/luatex/luatexja/patches/lltjcore.sty
(c:/texlive/2024/texmf-dist/tex/latex/l3kernel/expl3.sty

! LaTeX Error: Mismatched LaTeX support files detected.
(LaTeX)        Loading 'expl3.sty' aborted!
(LaTeX)        
(LaTeX)        The L3 programming layer in the LaTeX format
(LaTeX)        is dated 2024-07-20, but in your TeX tree the files require
(LaTeX)        at least 2024-08-16.

For immediate help type H <return>.
 ...                                              
                                                  
l.78      \ExplLoaderFileDate{expl3.sty}}
                                       %


直前には問題なかったため,アップデートが原因だろうと思われます。

そのためアップデート前の状態に戻したいのですが,例えば「2024年9月4日の状態に戻す」などの処理は可能なのでしょうか。

https://qiita.com/m20027/items/bb55ea93163456ecfca3

などを見ますと不具合のあるスタイルファイルを戻せばよいありますが,どれが不具合のあるファイルか分かりません。結局,

C:\texlive\2024\tlpkg\backups

の更新日時が新しいファイルを全て,1つずつ戻すしかないのでしょうか。

ご存じの方,ご教示いただければ幸いです。よろしくお願い致します。

山下