-
Notifications
You must be signed in to change notification settings - Fork 84
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
Substitution cannot proceed if "this" field, "that" field, and the text all contain "\cite" #503
Comments
Sorry for the delay, everything is a bit slow at the moment but I hope to get to this soon. |
Take your time, there's no rush. I appreciate your attention to this issue and I'll be patiently waiting for your further updates. |
Thanks for this. Yes, at present, your example highlights a known issue. workaroundThe workaround is to use replacements:
-
substitution: s/\\cite/ref \\cite/sg for futureAs of 27a5bdd there's no need for the workaround. This will be part of the next release, which I hope to get released soon. |
Released at https://github.com/cmhughes/latexindent.pl/releases/tag/V3.23.5, uploaded to ctan. Thanks again. |
Updating to latexindent 3.23.5, I found a new problem. The details are as follows. original .tex code
yaml settings
actual/given output
desired or expected output
|
I'm unable to produce your given output; I receive the desired output: YYYaaa
YaYaYYY |
My operating system is Win10, the system language is Chinese. I recorded a video and the problem I was talking about actually happened. 2024-01-02.mp4 |
Your local settings are not being loaded, as detailed in your log file.
This means you are not calling latexindent correctly.
…On Tue, 2 Jan 2024, 02:57 fengzyf, ***@***.***> wrote:
I'm unable to produce your given output; I receive the desired output:
YYYaaa
YaYaYYY
My operating system is Win10, the system language is Chinese. I recorded a
video and the problem I was talking about actually happened.
https://github.com/cmhughes/latexindent.pl/assets/154897680/82806c86-4f9e-4eec-827c-9eee4da58779
—
Reply to this email directly, view it on GitHub
<#503 (comment)>,
or unsubscribe
<https://github.com/notifications/unsubscribe-auth/AAQ7CYF7Y2G4MALXKXRR5X3YMNZRNAVCNFSM6AAAAABA226DXKVHI2DSMVQWIX3LMV43OSLTON2WKQ3PNVWWK3TUHMYTQNZTGU4DGNJSHA>
.
You are receiving this because you modified the open/close state.Message
ID: ***@***.***>
|
My apologies, please ignore my previous message, I was incorrect. |
Can you post your log file here please? |
|
How are you calling latexindent? |
Run the following command in cmd. |
Can you run
and post the log file? |
|
Can you try replacements:
-
this: X
that: Y |
The actual output is still
|
I believe this may be a windows line break issue.
Try adding any character at the end of your file and run again.
…On Wed, 3 Jan 2024, 14:13 fengzyf, ***@***.***> wrote:
The actual output is still
YYYaaa
YaYa
—
Reply to this email directly, view it on GitHub
<#503 (comment)>,
or unsubscribe
<https://github.com/notifications/unsubscribe-auth/AAQ7CYH54RNNIAC552JT53LYMVRPFAVCNFSM6AAAAABA226DXKVHI2DSMVQWIX3LMV43OSLTON2WKQ3PNVWWK3TUHMYTQNZVGQZTKNRZHA>
.
You are receiving this because you modified the open/close state.Message
ID: ***@***.***>
|
Yes, that's true. After adding a space at the end of my file, the output is
|
I found the cause of the problem from the introduction of split in the official documentation split /PATTERN/,EXPR,LIMITIf LIMIT is negative, it is treated as if it were instead arbitrarily large; as many fields as possible are produced. If LIMIT is omitted (or, equivalently, zero), then it is usually treated as if it were instead negative but with the exception that trailing empty fields are stripped (empty leading fields are always preserved); if all fields are empty, then all fields are considered to be trailing (and are thus stripped in this case). Thus, the following:
produces only a three element list.
produces a six element list. As another special case, split emulates the default behavior of the command line tool awk when the PATTERN is either omitted or a string composed of a single space character (such as ' ' or "\x20", but not e.g. / /). In this case, any leading whitespace in EXPR is removed before splitting occurs, and the PATTERN is instead treated as if it were /\s+/; in particular, this means that any contiguous whitespace (not just a single space character) is used as a separator.
Therefore, on line 74 of Replacement.pm
should be replaced with
|
Thanks, that's helpful. I've implemented your change as of eaed6db I'll get it released soon. thanks again |
I appreciate it. Glad I could help. |
released at https://github.com/cmhughes/latexindent.pl/releases/tag/V3.23.6, thanks again |
44.tex code
\cite
localSettings.yaml
replacements:
-
this: \cite
that: ref \cite
actual/given output
E:\Personal\Desktop\rr>latexindent -w -r -sl -o=++ -l=localSettings.yaml 44.tex
INFO: latexindent.pl version 3.23.4, 2023-11-19, a script to indent .tex files
latexindent.pl lives here: C:/CTEX/MiKTeX/scripts/latexindent/
Tue Dec 19 17:08:09 2023
Filename: 44.tex
INFO: Processing switches:
-sl|--screenlog: log file will also be output to the screen
-w|--overwrite: Overwrite mode active, will make a back up before overwriting
-l|--localSettings: Read localSettings YAML file
-o|--outputfile: output to file
-r|--replacement: replacement mode
INFO: Options check: -w and -o specified
You have called latexindent.pl with both -o and -w
The -o switch will take priority, and -w (overwrite) will be ignored
INFO: Directory for backup files and indent.log:
.
INFO: Perl modules are being loaded from the following directories:
E:/program/Strawberry/perl/lib/FindBin.pm
E:/program/Strawberry/perl/vendor/lib/YAML/Tiny.pm
E:/program/Strawberry/perl/lib/File/Copy.pm
E:/program/Strawberry/perl/lib/File/Basename.pm
E:/program/Strawberry/perl/lib/Getopt/Long.pm
E:/program/Strawberry/perl/vendor/lib/File/HomeDir.pm
INFO: LatexIndent perl modules are being loaded from, for example:
C:/CTEX/MiKTeX/scripts/latexindent/LatexIndent/Document.pm
INFO: YAML settings read: defaultSettings.yaml
Reading defaultSettings.yaml from C:/CTEX/MiKTeX/scripts/latexindent/defaultSettings.yaml
INFO: YAML reading settings
Home directory is C:\Users\lenovo
latexindent.pl didn't find indentconfig.yaml or .indentconfig.yaml
see all possible locations: https://latexindentpl.readthedocs.io/en/latest/sec-appendices.html#indentconfig-options)
INFO: YAML settings read: -l switch
Adding ./localSettings.yaml to YAML read paths
INFO: YAML settings, reading from the following files:
Reading USER settings from ./localSettings.yaml
---
replacements:
-
that: 'ref \cite'
this: \cite
INFO: -o switch active: output file check
-o switch called with file name without extension: ++
Updated to ++.tex as the file extension of the input file is tex
-o switch called with file name ending with ++: ++.tex
will search for existence and increment counter, starting with 440.tex
440.tex exists, incrementing counter
441.tex exists, incrementing counter
442.tex exists, incrementing counter
443.tex exists, incrementing counter
444.tex does not exist, and will be the output file
desired or expected output
ref \cite
The text was updated successfully, but these errors were encountered: