rxiv-maker 1.18.0__py3-none-any.whl → 1.18.2__py3-none-any.whl

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
rxiv_maker/__version__.py CHANGED
@@ -1,3 +1,3 @@
1
1
  """Version information."""
2
2
 
3
- __version__ = "1.18.0"
3
+ __version__ = "1.18.2"
@@ -139,9 +139,9 @@ def convert_tables_to_latex(
139
139
  result_lines.pop() # Remove caption line
140
140
 
141
141
  # Check for new format table caption after the table
142
- new_format_caption, table_id, rotation_angle = _parse_table_caption(lines, i)
143
- if new_format_caption:
144
- i += 2 # Skip blank line and caption line
142
+ new_format_caption, table_id, rotation_angle, lines_to_skip = _parse_table_caption(lines, i)
143
+ if new_format_caption and lines_to_skip:
144
+ i += lines_to_skip # Skip blank lines, comments, and caption line
145
145
 
146
146
  # Generate LaTeX table with the processed caption
147
147
  latex_table = generate_latex_table(
@@ -844,39 +844,68 @@ def _is_table_row(line: str) -> bool:
844
844
  return "|" in line and line.startswith("|") and line.endswith("|")
845
845
 
846
846
 
847
- def _parse_table_caption(lines: list[str], i: int) -> tuple[str | None, str | None, int | None]:
848
- """Parse table caption in new format after table."""
847
+ def _parse_table_caption(lines: list[str], i: int) -> tuple[str | None, str | None, int | None, int | None]:
848
+ """Parse table caption in new format after table.
849
+
850
+ Returns:
851
+ tuple of (caption, table_id, rotation_angle, lines_to_skip)
852
+ lines_to_skip indicates how many lines after position i should be skipped
853
+ """
849
854
  new_format_caption = None
850
855
  table_id = None
851
856
  rotation_angle = None
857
+ lines_to_skip = None
852
858
 
853
- if (
854
- i < len(lines)
855
- and lines[i].strip() == ""
856
- and i + 1 < len(lines)
857
- and re.match(r"^\{#[a-zA-Z0-9_:-]+.*\}\s*\*\*.*\*\*", lines[i + 1].strip())
858
- ):
859
- # Found new format caption, parse it
860
- caption_line = lines[i + 1].strip()
861
-
862
- # Parse caption with optional attributes like rotate=90
863
- caption_match = re.match(r"^\{#([a-zA-Z0-9_:-]+)([^}]*)\}\s*(.+)$", caption_line)
864
- if caption_match:
865
- table_id = caption_match.group(1)
866
- attributes_str = caption_match.group(2).strip()
867
- caption_text = caption_match.group(3)
868
-
869
- # Extract rotation attribute if present
870
- if attributes_str:
871
- rotation_match = re.search(r"rotate=(\d+)", attributes_str)
872
- if rotation_match:
873
- rotation_angle = int(rotation_match.group(1))
874
-
875
- # Process caption text to handle markdown formatting
876
- new_format_caption = re.sub(r"\*\*([^*]+)\*\*", r"\\textbf{\1}", caption_text)
877
- new_format_caption = re.sub(r"\*([^*]+)\*", r"\\textit{\1}", new_format_caption)
878
-
879
- return new_format_caption, table_id, rotation_angle
859
+ # Look ahead for caption, skipping blank lines and HTML comments
860
+ # Search up to 5 lines ahead to be flexible
861
+ search_limit = min(i + 5, len(lines))
862
+
863
+ for offset in range(search_limit - i):
864
+ check_line = lines[i + offset].strip()
865
+
866
+ # Skip blank lines and HTML comments
867
+ if check_line == "" or (check_line.startswith("<!--") and check_line.endswith("-->")):
868
+ continue
869
+
870
+ # Check if this is a new-format caption
871
+ if re.match(r"^\{#[a-zA-Z0-9_:-]+.*\}\s*\*\*.*\*\*", check_line):
872
+ caption_line = check_line
873
+
874
+ # Parse caption with optional attributes like rotate=90
875
+ caption_match = re.match(r"^\{#([a-zA-Z0-9_:-]+)([^}]*)\}\s*(.+)$", caption_line)
876
+ if caption_match:
877
+ table_id = caption_match.group(1)
878
+ attributes_str = caption_match.group(2).strip()
879
+ caption_text = caption_match.group(3)
880
+
881
+ # Extract rotation attribute if present
882
+ if attributes_str:
883
+ rotation_match = re.search(r"rotate=(\d+)", attributes_str)
884
+ if rotation_match:
885
+ rotation_angle = int(rotation_match.group(1))
886
+
887
+ # Process caption text to handle markdown formatting
888
+ new_format_caption = re.sub(r"\*\*([^*]+)\*\*", r"\\textbf{\1}", caption_text)
889
+ new_format_caption = re.sub(r"\*([^*]+)\*", r"\\textit{\1}", new_format_caption)
890
+
891
+ # Convert cross-references (figures, tables, equations) in caption
892
+ from .figure_processor import (
893
+ convert_equation_references_to_latex,
894
+ convert_figure_references_to_latex,
895
+ )
896
+
897
+ new_format_caption = convert_figure_references_to_latex(new_format_caption)
898
+ new_format_caption = convert_table_references_to_latex(new_format_caption)
899
+ new_format_caption = convert_equation_references_to_latex(new_format_caption)
900
+
901
+ # Return how many lines to skip (all lines from i to caption, inclusive)
902
+ lines_to_skip = offset + 1
903
+ break
904
+ else:
905
+ # Found a non-blank, non-comment, non-caption line - stop searching
906
+ break
907
+
908
+ return new_format_caption, table_id, rotation_angle, lines_to_skip
880
909
 
881
910
 
882
911
  def _split_table_row_respecting_backticks(row: str) -> list[str]:
@@ -12,7 +12,7 @@ from docx import Document
12
12
  from docx.enum.text import WD_ALIGN_PARAGRAPH, WD_COLOR_INDEX
13
13
  from docx.oxml import OxmlElement
14
14
  from docx.oxml.ns import qn
15
- from docx.shared import Inches, Pt, RGBColor
15
+ from docx.shared import Pt, RGBColor
16
16
  from latex2mathml.converter import convert as latex_to_mathml
17
17
  from lxml import etree
18
18
 
@@ -689,9 +689,22 @@ class DocxWriter:
689
689
  img_width, img_height = img.size
690
690
  aspect_ratio = img_width / img_height
691
691
 
692
- # Page dimensions with margins (Letter size: 8.5 x 11 inches, 1 inch margins)
693
- max_width = Inches(6.5) # 8.5 - 2*1
694
- max_height = Inches(9) # 11 - 2*1
692
+ # Calculate available width from document section settings
693
+ # Get the current section to read actual page dimensions and margins
694
+ section = doc.sections[-1] # Use the most recent section
695
+
696
+ # Page width minus left and right margins
697
+ available_width = section.page_width - section.left_margin - section.right_margin
698
+
699
+ # Page height minus top and bottom margins
700
+ available_height = section.page_height - section.top_margin - section.bottom_margin
701
+
702
+ # Convert available width to Inches for comparison
703
+ max_width = available_width
704
+ max_height = available_height
705
+
706
+ # Calculate aspect ratio thresholds
707
+ page_aspect_ratio = available_width / available_height
695
708
 
696
709
  # Add figure centered
697
710
  # Note: add_picture() creates a paragraph automatically, but we need to add it explicitly
@@ -700,7 +713,7 @@ class DocxWriter:
700
713
  fig_para.alignment = WD_ALIGN_PARAGRAPH.CENTER
701
714
 
702
715
  # Calculate optimal size maintaining aspect ratio
703
- if aspect_ratio > (6.5 / 9): # Wide image - constrain by width
716
+ if aspect_ratio > page_aspect_ratio: # Wide image - constrain by width
704
717
  run = fig_para.add_run()
705
718
  run.add_picture(img_source, width=max_width)
706
719
  else: # Tall image - constrain by height
@@ -639,6 +639,16 @@ def process_template_replacements(template_content, yaml_metadata, article_md, o
639
639
  acknowledgements_block = ""
640
640
  template_content = template_content.replace("<PY-RPL:ACKNOWLEDGEMENTS-BLOCK>", acknowledgements_block)
641
641
 
642
+ # Funding
643
+ funding = content_sections.get("funding", "").strip()
644
+ if funding:
645
+ funding_block = f"""\\begin{{funding}}
646
+ {funding}
647
+ \\end{{funding}}"""
648
+ else:
649
+ funding_block = ""
650
+ template_content = template_content.replace("<PY-RPL:FUNDING-BLOCK>", funding_block)
651
+
642
652
  # Competing Interests
643
653
  competing_interests = content_sections.get("competing_interests", "").strip()
644
654
  if competing_interests:
@@ -190,9 +190,29 @@ Interpret your results in the context of existing literature and theory. Discuss
190
190
 
191
191
  Summarize your key findings and their significance. Reinforce the main contributions of your work and their broader impact on the field. Keep this section concise but impactful, leaving readers with a clear understanding of what your research has accomplished and why it matters.
192
192
 
193
- ## References
193
+ ## Data Availability
194
194
 
195
- Citations are automatically formatted from 03_REFERENCES.bib. Reference works using citation keys like [@smith2023] for single citations or [@smith2023; @johnson2022] for multiple citations.
195
+ Describe where the data supporting the findings of this study are available. Include repository names, accession numbers, DOIs, or URLs. If data are available upon request, state this clearly with contact information.
196
+
197
+ ## Code Availability
198
+
199
+ Provide information about the availability of code, software, or algorithms used in this study. Include repository URLs (e.g., GitHub), software package names with version numbers, and any licensing information.
200
+
201
+ ## Author Contributions
202
+
203
+ Describe the specific contributions of each author to the work. Use initials to identify authors and describe their roles (e.g., "A.B. and C.D. designed the study. A.B. performed experiments. C.D. analyzed data. All authors contributed to writing the manuscript.").
204
+
205
+ ## Acknowledgements
206
+
207
+ Acknowledge individuals, groups, or organizations that contributed to the work but do not meet authorship criteria. This may include technical assistance, discussions, or provision of materials.
208
+
209
+ ## Funding
210
+
211
+ Provide information about funding sources, grant numbers, and supporting organizations. If no external funding was received, state "This research received no external funding."
212
+
213
+ ## Competing Interests
214
+
215
+ The authors declare no competing interests.
196
216
  """
197
217
 
198
218
  def _get_default_supplementary_template(self) -> str:
@@ -353,10 +373,6 @@ Organize your content with additional sections as needed.
353
373
  ## Conclusions
354
374
 
355
375
  Summarize your conclusions.
356
-
357
- ## References
358
-
359
- Add citations using [@ref_key].
360
376
  """
361
377
 
362
378
  def _get_minimal_supplementary_template(self) -> str:
@@ -436,9 +452,29 @@ Suggest future research directions.
436
452
 
437
453
  Summarize key conclusions.
438
454
 
439
- ## References
455
+ ## Data Availability
456
+
457
+ Describe where the data supporting the findings of this study are available. Include repository names, accession numbers, DOIs, or URLs. If data are available upon request, state this clearly with contact information.
458
+
459
+ ## Code Availability
440
460
 
441
- [@ref]
461
+ Provide information about the availability of code, software, or algorithms used in this study. Include repository URLs (e.g., GitHub), software package names with version numbers, and any licensing information.
462
+
463
+ ## Author Contributions
464
+
465
+ Describe the specific contributions of each author to the work. Use initials to identify authors and describe their roles (e.g., "A.B. and C.D. designed the study. A.B. performed experiments. C.D. analyzed data. All authors contributed to writing the manuscript.").
466
+
467
+ ## Acknowledgements
468
+
469
+ Acknowledge individuals, groups, or organizations that contributed to the work but do not meet authorship criteria. This may include technical assistance, discussions, or provision of materials.
470
+
471
+ ## Funding
472
+
473
+ Provide information about funding sources, grant numbers, and supporting organizations. If no external funding was received, state "This research received no external funding."
474
+
475
+ ## Competing Interests
476
+
477
+ The authors declare no competing interests.
442
478
  """
443
479
 
444
480
  # Preprint template methods
@@ -485,13 +521,17 @@ Links to data repositories, code, and protocols for reproducibility.
485
521
 
486
522
  Detailed author contribution statements.
487
523
 
488
- ## Competing Interests
524
+ ## Acknowledgements
489
525
 
490
- Declaration of competing interests.
526
+ Acknowledge individuals, groups, or organizations that contributed to the work but do not meet authorship criteria. This may include technical assistance, discussions, or provision of materials.
491
527
 
492
- ## References
528
+ ## Funding
493
529
 
494
- [@ref]
530
+ Provide information about funding sources, grant numbers, and supporting organizations. If no external funding was received, state "This research received no external funding."
531
+
532
+ ## Competing Interests
533
+
534
+ Declaration of competing interests.
495
535
  """
496
536
 
497
537
 
@@ -48,6 +48,8 @@
48
48
 
49
49
  <PY-RPL:ACKNOWLEDGEMENTS-BLOCK>
50
50
 
51
+ <PY-RPL:FUNDING-BLOCK>
52
+
51
53
  <PY-RPL:COMPETING-INTERESTS-BLOCK>
52
54
 
53
55
  \begin{exauthor}
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: rxiv-maker
3
- Version: 1.18.0
3
+ Version: 1.18.2
4
4
  Summary: Write scientific preprints in Markdown. Generate publication-ready PDFs efficiently.
5
5
  Project-URL: Homepage, https://github.com/HenriquesLab/rxiv-maker
6
6
  Project-URL: Documentation, https://github.com/HenriquesLab/rxiv-maker#readme
@@ -1,5 +1,5 @@
1
1
  rxiv_maker/__init__.py,sha256=p04JYC5ZhP6dLXkoWVlKNyiRvsDE1a4C88f9q4xO3tA,3268
2
- rxiv_maker/__version__.py,sha256=MVd3J-jKwgAFkETITQ9sUCvhAdXfezvIvUmYNFYviSc,51
2
+ rxiv_maker/__version__.py,sha256=r1DNB3JWDHXSSJtFwhx61DHqp-syX6loJLs-YmN6FEQ,51
3
3
  rxiv_maker/rxiv_maker_cli.py,sha256=9Lu_mhFPXwx5jzAR6StCNxwCm_fkmP5qiOYdNuh_AwI,120
4
4
  rxiv_maker/validate.py,sha256=AIzgP59KbCQJqC9WIGfUdVv0xI6ud9g1fFznQkaGz5Q,9373
5
5
  rxiv_maker/cli/__init__.py,sha256=Jw0DTFUSofN-02xpVrt1UUzRcgH5NNd-GPNidhmNwpU,77
@@ -55,7 +55,7 @@ rxiv_maker/converters/md2tex.py,sha256=eO0gMjINrFmefJZARCEQO0ACmLgVE5mAccR_Fqz8z
55
55
  rxiv_maker/converters/python_executor.py,sha256=YMJO7A-re8EOCQjy-PKryFFBoxddK3g9R1VuaH2MfYY,37369
56
56
  rxiv_maker/converters/section_processor.py,sha256=7znzb_FYH2sCYH336l5J1ZdRaQv-ycdCN79RpI3Tc-w,5706
57
57
  rxiv_maker/converters/supplementary_note_processor.py,sha256=8wzQw2kN0Afg0iB7hPFdeWiDlDsFhhTkcRTvwCXIvjc,6689
58
- rxiv_maker/converters/table_processor.py,sha256=chicOshkX20NleRTgdOkx8cuwCBITcrsFXHOByUKXAU,38431
58
+ rxiv_maker/converters/table_processor.py,sha256=0sCtDVlQwLcAC8_dJMijgVb7DCmtannCyDgWNJ35-KE,39869
59
59
  rxiv_maker/converters/text_formatters.py,sha256=pa2kVAqyPkGh5LViL5Iqqjjqw1ixB0GKBZJloaVBVi0,42816
60
60
  rxiv_maker/converters/types.py,sha256=mTLXVTBGfEi2dp_U2maSE7kZQFz_lfmLDQjlMAeU9lE,885
61
61
  rxiv_maker/converters/url_processor.py,sha256=xoZrgz7kgRtMzSay_14ZpYEwK9uXj3YloQW9K-G8LAc,6586
@@ -107,7 +107,7 @@ rxiv_maker/exporters/__init__.py,sha256=NcTD1SDb8tTgsHhCS1A7TVEZncyWbDRTa6sJIdLq
107
107
  rxiv_maker/exporters/docx_citation_mapper.py,sha256=oSy1LglLvxlmhO18bzl3EInA2PleE8nXqEgQIIRVzwE,5170
108
108
  rxiv_maker/exporters/docx_content_processor.py,sha256=FoOaF9BoEpZEF3HG3pzFZFgYbYKwbgRNwkOyURZ8XtI,27895
109
109
  rxiv_maker/exporters/docx_exporter.py,sha256=7HYgQSGE_7xl3PTMSPKXIW6yHg-b3MU9ASXG-rKVSXo,21456
110
- rxiv_maker/exporters/docx_writer.py,sha256=252nqO1_ItJzCiuvsrpVdlU4VbLVMSh5FvFpo4k2GtI,56510
110
+ rxiv_maker/exporters/docx_writer.py,sha256=JvNVprMqdvvDGf65ESsEqf7-A33G1D9Kd0Zi2Q4gmbw,57145
111
111
  rxiv_maker/install/__init__.py,sha256=kAB6P-12IKg_K1MQ-uzeC5IR11O2cNxj0t_2JMhooZs,590
112
112
  rxiv_maker/install/dependency_handlers/__init__.py,sha256=NN9dP1usXpYgLpSw0uEnJ6ugX2zefihVjdyDdm1k-cE,231
113
113
  rxiv_maker/install/dependency_handlers/latex.py,sha256=xopSJxYkg3D63rH7RoVLN-Ykl87AZqhlUrrG3m6LoWo,3304
@@ -127,7 +127,7 @@ rxiv_maker/manuscript_utils/figure_utils.py,sha256=FsNtMiA1IOHeA6gQsENmAWLZSAvPp
127
127
  rxiv_maker/processors/__init__.py,sha256=8UmaeFkbPfcwAL5MnhN2DcOA2k8iuJu0B5dDA6_pmnA,720
128
128
  rxiv_maker/processors/author_processor.py,sha256=jC4qZ9M_GADelkp1v8pk46ESUf4DNraXLfMYGhn_7ZM,10016
129
129
  rxiv_maker/processors/markdown_preprocessor.py,sha256=Ez_2lhSFEdJY0CS2SKJJESRfnmSdMq4s0jP2nlFSKN8,11228
130
- rxiv_maker/processors/template_processor.py,sha256=mX8L19Evo9c8DvcdvSdtFHGaGGrQseVsF1CKfj_WYow,30024
130
+ rxiv_maker/processors/template_processor.py,sha256=V47kh5zyiZDPNXBfNkQeyU5r-3MBHM3UMWAjcfgs11s,30316
131
131
  rxiv_maker/processors/yaml_processor.py,sha256=SSXHpwY1Cw81IDN4x40UFtosz-T9l29oh-CZpusmlYo,11499
132
132
  rxiv_maker/scripts/__init__.py,sha256=nKsDmj6UAc90uC6sKd-V6O80OMYjAl4Uha9zF_6ayX0,154
133
133
  rxiv_maker/scripts/custom_doc_generator.py,sha256=pMkdTI8a4qG8Z3gFUJtPwRuu2i0ioW3pKfs22es0KCk,6311
@@ -141,7 +141,7 @@ rxiv_maker/services/publication_service.py,sha256=0p8yQ1jrY3RHwCkzTEl_sAbWYTafRk
141
141
  rxiv_maker/services/validation_service.py,sha256=eWg14NqJu6LzyJBgeXkTaVZAlX4wYFX8ZEvSR5hMx7U,14619
142
142
  rxiv_maker/templates/__init__.py,sha256=UTet1pYPkPdgvrLw-wwaY-PAgdjGJasAi_hdyIh0J8s,562
143
143
  rxiv_maker/templates/manager.py,sha256=HlI7Qb52866Okf4k1aRh0fUy9heOSNGjMQJtrCdL3Xk,6131
144
- rxiv_maker/templates/registry.py,sha256=XHO3sQBRulsTsYUmP9R3K6RxnYMAehqrY-MoPgGaexE,16206
144
+ rxiv_maker/templates/registry.py,sha256=GikYKBBUSzzT0yeI8W8EZYVo40B9wtseNVGTLsAJGKY,18800
145
145
  rxiv_maker/tex/python_execution_section.tex,sha256=pHz6NGfZN4ViBo6rInUO5FAuk81sV_Ppqszrvl00w_4,2218
146
146
  rxiv_maker/utils/__init__.py,sha256=4ya5VR8jqRqUChlnUeMeeetOuWV-gIvjPwcE1u_1OnI,1540
147
147
  rxiv_maker/utils/accent_character_map.py,sha256=L8BDiUH3IPCZ_pQzfsnlY0KkJpbyNpf3nQy4DBUdczE,3484
@@ -191,11 +191,11 @@ rxiv_maker/validators/syntax_validator.py,sha256=hHpKVKky3UiA1ZylA6jJVP3DN47LgaS
191
191
  rxiv_maker/validators/doi/__init__.py,sha256=NqATXseuS0zVNns56RvFe8TdqgvueY0Rbw2Pjozlajc,494
192
192
  rxiv_maker/validators/doi/api_clients.py,sha256=tqdYUq8LFgRIO0tWfcenwmy2uO-IB1-GMvBfF3lP7-0,21763
193
193
  rxiv_maker/validators/doi/metadata_comparator.py,sha256=euqHhKP5sHQAdZbdoAahUn6YqJqOfXIOobNgAqFHlN8,11533
194
- rxiv_maker/tex/template.tex,sha256=zrJ3aFfu8j9zkg1l375eE9w-j42P3rz16wMD3dSgi1I,1354
194
+ rxiv_maker/tex/template.tex,sha256=_tPtxrurn3sKTt9Kfa44lPdPyT44vHbDUOGqldU9r2s,1378
195
195
  rxiv_maker/tex/style/rxiv_maker_style.bst,sha256=jbVqrJgAm6F88cow5vtZuPBwwmlcYykclTm8RvZIo6Y,24281
196
196
  rxiv_maker/tex/style/rxiv_maker_style.cls,sha256=6VDmZE0uvYWog6rcYi2K_NIM9-Pgjx9AFdRg_sTheK0,24374
197
- rxiv_maker-1.18.0.dist-info/METADATA,sha256=uJSb2e2tMW1eUvob2E8iKM5kJAVZsILejVNbG_Uitto,18222
198
- rxiv_maker-1.18.0.dist-info/WHEEL,sha256=WLgqFyCfm_KASv4WHyYy0P3pM_m7J5L9k2skdKLirC8,87
199
- rxiv_maker-1.18.0.dist-info/entry_points.txt,sha256=ghCN0hI9A1GlG7QY5F6E-xYPflA8CyS4B6bTQ1YLop0,97
200
- rxiv_maker-1.18.0.dist-info/licenses/LICENSE,sha256=GSZFoPIhWDNJEtSHTQ5dnELN38zFwRiQO2antBezGQk,1093
201
- rxiv_maker-1.18.0.dist-info/RECORD,,
197
+ rxiv_maker-1.18.2.dist-info/METADATA,sha256=OqROaCqeuMSX45OfafGdLjR5Q_Y-XxaC__NboFz_z54,18222
198
+ rxiv_maker-1.18.2.dist-info/WHEEL,sha256=WLgqFyCfm_KASv4WHyYy0P3pM_m7J5L9k2skdKLirC8,87
199
+ rxiv_maker-1.18.2.dist-info/entry_points.txt,sha256=ghCN0hI9A1GlG7QY5F6E-xYPflA8CyS4B6bTQ1YLop0,97
200
+ rxiv_maker-1.18.2.dist-info/licenses/LICENSE,sha256=GSZFoPIhWDNJEtSHTQ5dnELN38zFwRiQO2antBezGQk,1093
201
+ rxiv_maker-1.18.2.dist-info/RECORD,,