-
Notifications
You must be signed in to change notification settings - Fork 112
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
* Add new papers * Mark with * what is still TODO * [pre-commit.ci] auto fixes from pre-commit.com hooks for more information, see https://pre-commit.ci * Add some papers * Update and forward to Claudius * Fix some trailing curly braces linked to issue 183 * testing updating references in pulled branch * Update until September 25th * Update until October 2nd * Update until October 18 * change order of papers. show newest first * Finish update until Nov 4 * Update until Nov 08 * [pre-commit.ci] auto fixes from pre-commit.com hooks for more information, see https://pre-commit.ci * Change update_plot back to False * Add CaloChallenge, run plot and recent * Remove duplicates from histogramming --------- Co-authored-by: pre-commit-ci[bot] <66853113+pre-commit-ci[bot]@users.noreply.github.com> Co-authored-by: Claudius Krause <[email protected]>
- Loading branch information
1 parent
8afa71f
commit 6277ecd
Showing
11 changed files
with
4,963 additions
and
3,660 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,34 @@ | ||
import re | ||
|
||
|
||
def reverse_citations_in_tex(file_path, output_path=None): | ||
r"""Reverse the order of citation keys in all \cite{...} blocks in a .tex file.""" | ||
|
||
# Read the content of the .tex file | ||
with open(file_path) as file: | ||
content = file.read() | ||
|
||
# Regular expression to match \cite{...} blocks | ||
cite_pattern = re.compile(r'\\cite\{([^}]+)\}') | ||
|
||
# Function to reverse the order of keys within each cite block | ||
def reverse_cite_keys(match): | ||
keys = match.group(1).split(',') | ||
reversed_keys = ','.join(keys[::-1]) | ||
return f'\\cite{{{reversed_keys}}}' | ||
|
||
# Replace all \cite{...} blocks with reversed citation order | ||
updated_content = cite_pattern.sub(reverse_cite_keys, content) | ||
|
||
# Write the updated content back to the same file or a new file | ||
output_file = output_path | ||
with open(output_file, 'w') as file: | ||
file.write(updated_content) | ||
|
||
print(f"Updated citations saved to {output_file}") | ||
|
||
if __name__ == "__main__": | ||
# Example usage | ||
input_file = 'HEPML.tex' | ||
output_file = 'HEPML_cite_reverse.tex' | ||
reverse_citations_in_tex(input_file, output_file) |
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Large diffs are not rendered by default.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters