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

USER settings have no effect #362

Closed
andy941 opened this issue May 10, 2022 · 7 comments
Closed

USER settings have no effect #362

andy941 opened this issue May 10, 2022 · 7 comments
Labels
answered question has been answered question user-centred question about behaviour of latexindent.pl text-wrap text wrapping; documented at https://latexindentpl.readthedocs.io/en/latest/sec-the-m-switch.html

Comments

@andy941
Copy link

andy941 commented May 10, 2022

original .tex code

\documentclass{report}
\begin{document}
This is a line of more than 50 characters that should be broken up in two lines.
\end{document}

--
/Users/andrea/.latexindent_settings.yaml:

modifyLineBreaks:
         textWrapOptions:
           columns: 80

--
Issue:
In the output the text is not wrapped, I would expect the line to be broken up in 80 char chunks.

--
It seems that the USER settings are correctly read (`latexindent -sl'):

INFO:  latexindent version 3.16, 2022-03-13, a script to indent .tex files
       latexindent lives here: /usr/local/texlive/2022/texmf-dist/scripts/latexindent/
       Tue May 10 12:19:16 2022
       Filename: tmp/tmp.tex
INFO:  Processing switches:
       -sl|--screenlog: log file will also be output to the screen
INFO:  Directory for backup files and indent.log: tmp
INFO:  YAML settings read: defaultSettings.yaml
       Reading defaultSettings.yaml from /usr/local/texlive/2022/texmf-dist/scripts/latexindent/defaultSettings.yaml
INFO:  YAML settings read: indentconfig.yaml or .indentconfig.yaml
       Reading path information from /Users/andrea/.indentconfig.yaml
       (Alternatively /Users/andrea/indentconfig.yaml can be used)
       ---
       paths:
         - /Users/andrea/.latexindent_settings.yaml

INFO:  YAML settings, reading from the following files:
       Reading USER settings from /Users/andrea/.latexindent_settings.yaml
       ---
       modifyLineBreaks:
         textWrapOptions:
           columns: '80'

INFO:  Phase 1: searching for objects
INFO:  Phase 2: finding surrounding indentation
INFO:  Phase 3: indenting objects
INFO:  Phase 4: final indentation check
INFO:  Output routine:
       Not outputting to file; see -w and -o switches for more options.
       --------------
INFO:  Please direct all communication/issues to:
        https://github.com/cmhughes/latexindent.pl 

--

Sorry to bother you with such a simple issue but i have been banging my head against the wall for an hour. I can't understand why the user settings are read but not applied. I am on MacOS if that might be a problem. Latexindent comes with TexLive (see output with -sl).

Thank you,
Andrea

@cmhughes
Copy link
Owner

Thanks for this, no trouble at all :)

Have you tried using the m switch, as in

latexindent.pl -m tmp/tmp.tex

See also https://latexindentpl.readthedocs.io/en/latest/sec-the-m-switch.html#lst-tw-bf-myenv1

@cmhughes cmhughes added question user-centred question about behaviour of latexindent.pl answered question has been answered text-wrap text wrapping; documented at https://latexindentpl.readthedocs.io/en/latest/sec-the-m-switch.html labels May 10, 2022
@andy941
Copy link
Author

andy941 commented May 10, 2022

Thanks for the quick answer!

I confirm that it works with the -m flag on the minimal example I gave. For some reason it doesn't work when I do the same on a longer, more complicated file. There are special cases.
This is a good example from the thesis I'm writing:

\textit{AP1}'s expression pattern follows \textit{LFY}, but with a slightly
delayed timing~\cite{AlejandraMandel1992}. The loss of function mutant \textit{ap1} forms
a high number of ectopic flowers resulting in an increased inflorescence branching.
Sepals are rarely seen in \textit{ap1} mutants and petals are homeotically
transformed into sepal-like organs, from which, at the axels, new \textit{ap1}
flowers develop displaying the same phenotype~\cite{Mandel1995}. Constitutive expression of
\textit{AP1} under the \textit{CaMV 35S} promoter causes early flowering
shoots, a phenotype that resembles a \textit{tfl1} mutant~\cite{Mandel1995}.

AP1 and LFY act in concert to
promote the floral transition
but interestingly, LFY
promotes TFL1 expression when
AP1 is not present, revealing
another layer of complexity
that is still largely
unfathomed~\cite{Goslin2017}.

In this case I used the command latexindent -m -y="modifyLineBreaks:textWrapOptions:columns:30" nanopore_rnaseq.tex to get rid of any prblems that may arise from the settings in the yaml config.
The problem seems to be something else, maybe \textit{} is messing up with latexindent? It might recognize the whole block (between the blank lines) as a function and skip indentation?
Should I change something like blocksBeginWith?

@cmhughes
Copy link
Owner

cmhughes commented May 10, 2022 via email

@andy941
Copy link
Author

andy941 commented May 10, 2022

Yes I was thinking about that option, just wanted to make sure there wasn't anything easier I was missing. It works well now thanks, it's surprisingly helpful to work with well formatted text (I am a latex newbie).
Thanks for the help!

@andy941 andy941 closed this as completed May 10, 2022
@cmhughes
Copy link
Owner

cmhughes commented May 10, 2022 via email

@andy941
Copy link
Author

andy941 commented May 10, 2022

Sure, I was just worried that this would be a very inelegant regex (it has not been "tested"):

modifyLineBreaks:
    textWrapOptions:
        columns: 79
        blocksBeginWith:
            other: '\\text[a-z]*\{.*\}'

I wanted to handle all the \text* like \textbf for example, however the * could be substituted with something more specific. There is still the problem that \textit{aaa ... aaa} gets a hard indent (tab) no matter what when the break is inside the {}. I can live with that anyway, it's just nitpicking at that point.

Thanks again, hopefully this can help others in the future.

@cmhughes
Copy link
Owner

cmhughes commented May 10, 2022 via email

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
answered question has been answered question user-centred question about behaviour of latexindent.pl text-wrap text wrapping; documented at https://latexindentpl.readthedocs.io/en/latest/sec-the-m-switch.html
Projects
None yet
Development

No branches or pull requests

2 participants