Skip to content

The removal of full-width spaces #581

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
bananadium opened this issue Mar 15, 2025 · 2 comments
Open

The removal of full-width spaces #581

bananadium opened this issue Mar 15, 2025 · 2 comments
Labels
align-at-ampersand-routine the align at ampersand; documented in lookForAlignDelims answered question has been answered cjk Chinese/Japanese/Korean question user-centred question about behaviour of latexindent.pl

Comments

@bananadium
Copy link

(This post is written by a human, but AI was used to compose the text.) Thank you for creating such a wonderful tool. In my team, full-width spaces are sometimes used for indenting the typeset output (not ideally, but due to historical reasons). However, when using latexindent—as shown in the example below—full-width spaces are removed regardless of whether the GCString switch is enabled or not (using a font that visualizes whitespace might make this more apparent). It appears that full-width spaces at the beginning of lines and around the characters “&” and “//” in tabular environments are being removed. Since LaTeX treats full-width spaces as characters (unlike other whitespace symbols), would it be possible to handle full-width spaces differently (i.e., not remove them)? Please consider this request.

original .tex code

\documentclass{article}
\usepackage[utf8]{inputenc}
\begin{document}

   これは  テスト文です。  全角スペースが ランダムに配置されており、  
   文章全体に独特のリズムを与えています。  
   下記の表は、和文のみで構成され、セルごとにスペースの数が異なります。

\bigskip

\begin{tabular}{|l|l|l|l|}
\hline
 初期設定  &  運用開始   & 監視中  & 終了確認 \\
\hline
設定完了  & 動作中    &  点検実施  & 停止 \\
\hline
  準備完了  & 起動準備中  & 実施中   & 完了報告 \\
\hline
再試行   & 作業中    & 点検中  &  終了   \\
\hline
\end{tabular}

\bigskip

   表の後の文章も、  あえてスペースを乱雑に挿入しています。  
   このように、外側の文章と表内の文章で  全角スペースの不規則性を表現できます。

\end{document}

yaml settings

(default)

actual output

\documentclass{article}
\usepackage[utf8]{inputenc}
\begin{document}

これは  テスト文です。  全角スペースが ランダムに配置されており、  
文章全体に独特のリズムを与えています。  
下記の表は、和文のみで構成され、セルごとにスペースの数が異なります。

\bigskip

\begin{tabular}{|l|l|l|l|}
  \hline
  初期設定 & 運用開始   & 監視中   & 終了確認 \\
  \hline
  設定完了 & 動作中     & 点検実施 & 停止     \\
  \hline
  準備完了 & 起動準備中 & 実施中   & 完了報告 \\
  \hline
  再試行   & 作業中     & 点検中   & 終了     \\
  \hline
\end{tabular}

\bigskip

表の後の文章も、  あえてスペースを乱雑に挿入しています。  
このように、外側の文章と表内の文章で  全角スペースの不規則性を表現できます。

\end{document}

desired output

\documentclass{article}
\usepackage[utf8]{inputenc}
\begin{document}

   これは  テスト文です。  全角スペースが ランダムに配置されており、  
   文章全体に独特のリズムを与えています。  
   下記の表は、和文のみで構成され、セルごとにスペースの数が異なります。

\bigskip

\begin{tabular}{|l|l|l|l|}
  \hline
   初期設定     &   運用開始    &  監視中       &  終了確認    \\
  \hline
  設定完了       &  動作中       &   点検実施   &  停止        \\
  \hline
    準備完了   &  起動準備中     &  実施中      &  完了報告    \\
  \hline
  再試行        &  作業中       &  点検中       &   終了    \\
  \hline
\end{tabular}

\bigskip

   表の後の文章も、  あえてスペースを乱雑に挿入しています。  
   このように、外側の文章と表内の文章で  全角スペースの不規則性を表現できます。

\end{document}
@cmhughes cmhughes added the align-at-ampersand-routine the align at ampersand; documented in lookForAlignDelims label Mar 16, 2025
@cmhughes
Copy link
Owner

Thanks for this.

I think this is an editor/viewing issue.

output on vim (desired)

Image

output on gedit (desired)

Image

output on github (not desired)

\documentclass{article}
\usepackage[utf8]{inputenc}
\begin{document}

これは  テスト文です。  全角スペースが ランダムに配置されており、
文章全体に独特のリズムを与えています。
下記の表は、和文のみで構成され、セルごとにスペースの数が異なります。

\bigskip

\begin{tabular}{|l|l|l|l|}
	\hline
	初期設定 & 運用開始   & 監視中   & 終了確認 \\
	\hline
	設定完了 & 動作中     & 点検実施 & 停止     \\
	\hline
	準備完了 & 起動準備中 & 実施中   & 完了報告 \\
	\hline
	再試行   & 作業中     & 点検中   & 終了     \\
	\hline
\end{tabular}

\bigskip

表の後の文章も、  あえてスペースを乱雑に挿入しています。
このように、外側の文章と表内の文章で  全角スペースの不規則性を表現できます。

\end{document}

@cmhughes cmhughes added cjk Chinese/Japanese/Korean question user-centred question about behaviour of latexindent.pl answered question has been answered labels Mar 16, 2025
@bananadium
Copy link
Author

Thank you. What I would like to focus on here is not the appearance of the source code, but rather the difference in the typeset results. Could you please typeset each of the three examples I provided? The 'original' and 'desired' examples should produce the same typeset result, while the 'actual' one should yield a different result. I'm not sure whether it is preferable to attach the files, but just in case, I have attached a cropped screenshot of the typeset output.

original
Image
actual
Image
desired
Image

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
align-at-ampersand-routine the align at ampersand; documented in lookForAlignDelims answered question has been answered cjk Chinese/Japanese/Korean question user-centred question about behaviour of latexindent.pl
Projects
None yet
Development

No branches or pull requests

2 participants