Skip to content
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

[Bug] Fail to wrap some code in the preamble part #74

Open
cnkjw opened this issue Dec 19, 2024 · 2 comments
Open

[Bug] Fail to wrap some code in the preamble part #74

cnkjw opened this issue Dec 19, 2024 · 2 comments

Comments

@cnkjw
Copy link

cnkjw commented Dec 19, 2024

I have the following code:

\documentclass[10pt,a4paper]{article}
\usepackage[breaklinks,colorlinks,urlcolor=blue,citecolor=blue,linkcolor=blue,bookmarks]{hyperref}
\usepackage{caption}
\DeclareCaptionLabelSeparator{pipe}{~\textbf{\textbar}~}
\captionsetup{font=small,margin=2em,labelfont=bf,labelsep=pipe,figurename=Figure,tablename=Table}

\begin{document}
example example example
\end{document}

I expect the default processing result of the tex-fmt to be as follows:

\documentclass[10pt,a4paper]{article}
\usepackage[breaklinks,colorlinks,urlcolor=blue,citecolor=blue,linkcolor=blue,
            bookmarks]{hyperref}
\usepackage{caption}
\DeclareCaptionLabelSeparator{pipe}{~\textbf{\textbar}~}
\captionsetup{font=small,margin=2em,labelfont=bf,labelsep=pipe,
              figurename=Figure,tablename=Table}

\begin{document}
  example example example
\end{document}

But the actual situation is that tex-fmt gives a warning message:

WARN: tex-fmt test.tex: Line 2 (2). Line cannot be wrapped. \usepackage[breaklinks,colorlinks,urlcolor=blue,citecolor=blue,linkcolor=blue,bookmarks]{hyperref}
WARN: tex-fmt test.tex: Line 5 (5). Line cannot be wrapped. \captionsetup{font=small,margin=2em,labelfont=bf,labelsep=pipe,figurename=Figure,tablename=Table}

@cdesaintguilhem
Copy link
Contributor

Hi @cnkjw, currently tex-fmt doesn't consider commas , to be valid wrapping points, it only searches for spaces.

I see that this could be useful in the preamble, but tex-fmt isn't yet "preamble-aware". I'm working on this for a re-wrapping feature (#64) so maybe I can look into enabling wrapping at commas when in the preamble as part of that.

@cnkjw
Copy link
Author

cnkjw commented Dec 19, 2024

OK, thank you very much for your timely reply.

For LaTeX code, automatic wrapping may indeed be a challenge. I have found that the wrap feature often fails when using latexindent, so I am currently trying out the great new project, tex-fmt. I look forward to the early realization of this feature.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants