Comments (7)
I present two options, both give your desired output.
option 1
Use noIndentBlock
as in https://latexindentpl.readthedocs.io/en/latest/sec-fine-tuning.html?highlight=href#lst-href3
onlyOneBackUp: 1
defaultIndent: ' '
removeTrailingWhitespace: 1
modifyLineBreaks:
commands:
label:
CommandStartsOnOwnLine: 1
noIndentBlock:
subfloat:
begin: \\subfloat\h*\{\h*\\label\{
body: [^}]*?
end: \}\h*\}
option 2
Using the replacement switch as in https://latexindentpl.readthedocs.io/en/latest/sec-replacements.html
onlyOneBackUp: 1
defaultIndent: ' '
removeTrailingWhitespace: 1
modifyLineBreaks:
commands:
label:
CommandStartsOnOwnLine: 1
replacements:
-
when: after
substitution: |-
s/(\\subfloat\{)\s*(\\label)/$1$2/sg
from latexindent.pl.
Thanks for the solution! I agree that it is quite nice, and that it could be used in multiple circumstances.
However, I would still plea that the suggestion that I make here is quite nice too. In particular, it does not warrant the user to figure out a regex for every 'edge'-case it wants to ignore for some (but not all) feature of latexindent. Of course, it could be that the implementation of latexindent
makes this option very hard?
from latexindent.pl.
So you want the user to be able annotate lines in their file using a comment such as % noqa: modifyLineBreaks
?
from latexindent.pl.
That is indeed my suggestion, per similarity with common use in Python e.g. with flake8, see e.g. https://stackoverflow.com/questions/45346575/what-does-noqa-mean-in-python-comments .
It is true that latexindent.pl
is extremely versatile (likely much more than similar tools used e.g. for Python code). So it seems that even weird edge-cases can be treated in .latexindent.yaml
. However, finding the right regular expressions can be more cumbersome than just ignoring a line.
from latexindent.pl.
OK, understood, it's on the list :)
from latexindent.pl.
I'm hoping to get to this soon, apologies for the delay :)
Do you have a sense for what the YAML user interface might look like for this?
from latexindent.pl.
I'm sorry, Tom, but I don't think that this is going to go anywhere.
My experience with the text wrap routine has made me very hesitant to implement a feature that seems simple but actually has a great number of subtleties,and leads to a number of questions, issues, edge cases.
If you, or anyone else, feels like taking this on, then do feel encouraged to submit a pull request. But, for the moment, I'm going to close this.
from latexindent.pl.
Related Issues (20)
- `CommaFinishesWithLineBreaks` in nested environments HOT 4
- Erroneous Indentation at Paragraph Start and Failure to Wrap First Sentence after `\item` HOT 3
- Add linebreak after `\par` HOT 2
- Could latexindent.pl provide appropriate spaces and text wraps before or after math operators? (sounds like many formatters doing for Python or C language) HOT 3
- Indentation in tabular* HOT 3
- Contextual `sentencesBeginWith`, semicolons, lowercase and `\paragraph` HOT 2
- Unknown error "���" HOT 21
- [Feature] More friendly support for CJK words (characters) HOT 18
- [latexindent.exe] -GCString switch cannot run normally HOT 2
- Exclude `table` and `tabular` from indentation HOT 3
- Feature Request: Support spreadtab block HOT 4
- can't run it, neither after `tlmgr` nor as a Perl script HOT 4
- Error "Can't open file" when using `-g` key with nontrivial path HOT 3
- [windows] conda installation fail due to perl version HOT 6
- Format tabular for fullwidth fonts HOT 2
- [Bug] Incorrect indentation amount when have a long config with tabualrray package HOT 4
- Can't find string terminator '"' error - bug? HOT 7
- the future of multirows in _tabularray_ package would let latexindent format the code incorrectly HOT 8
- Indenting of tikz arrow specification HOT 4
- Incorrect encoding (possiblely due to #505) HOT 3
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from latexindent.pl.