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

\textbf instead of \section #106

Closed
garyritchie opened this issue Jul 8, 2024 · 3 comments
Closed

\textbf instead of \section #106

garyritchie opened this issue Jul 8, 2024 · 3 comments
Assignees

Comments

@garyritchie
Copy link

garyritchie commented Jul 8, 2024

Until now I've just been using docx2tex to set some MathType free (thank you!) but now I;ve got another project and I've noticed that headings aren't translating to sections. I was expecting \chapter, \section and \subsection but I'm getting \textbf instead. Here's a minimal test output:

d2t test_d2t.docx gives:

% docx2tex 1.9 --- ``How I learned to stop worrying and love DOCX'' 
% 
% docx2tex is Open Source and  
% you can download it on GitHub: 
% https://github.com/transpect/docx2tex 
%  
\documentclass{scrbook} 
\usepackage[T1]{fontenc} 
\usepackage[utf8]{inputenc} 
\usepackage{hyperref} 
\usepackage{multirow} 
\usepackage{tabularx} 
\usepackage{color} 
\usepackage{textcomp} 
\usepackage{tipa}
\usepackage{amsmath} 
\usepackage{amssymb} 
\usepackage{amsfonts} 
\usepackage{amsxtra} 
\usepackage{wasysym} 
\usepackage{isomath} 
\usepackage{mathtools} 
\usepackage{txfonts} 
\usepackage{upgreek} 
\usepackage{enumerate} 
\usepackage{tensor} 
\usepackage{pifont} 
\usepackage{ulem} 
\usepackage{xfrac} 
\usepackage{arydshln} 
\usepackage[english]{babel}

\begin{document}
\textbf{Test Document Heading 1}

Some paragraph text

\textbf{A Heading Level 2}

More paragraph text
\end{document}

The minimal LibreOffice-created docx is attached.

test_d2t.docx

There are two errors in the log (attached below):

...
[main] ERROR com.xmlcalabash.runtime.XAtomicStep - file:/docx2tex/xproc-util/load/xpl/load.xpl:0:load-error:Could not load file:https:///docx2tex/conf/conf.csv (file:/docx2tex/xproc-util/load/xpl/load.xpl) dtd-validate=false
[main] ERROR com.xmlcalabash.runtime.XAtomicStep - file:/docx2tex/xproc-util/load/xpl/load.xpl:0:load-error:Could not load file:https:///docx2tex/conf/conf.csv (file:/docx2tex/xproc-util/load/xpl/load.xpl) dtd-validate=false
...

I did edit conf.csv with VSCodium to match the style names:

Heading 1	; \chapter{	; }
Quotations 	; \begin{quote}	; end{quote}
Heading 2	; \section{	; }
Heading 3	; \subsection{	; }

test_d2t.d2t.log (paths shortened)

EDIT: Added error log; command used.

@mkraetke mkraetke self-assigned this Jul 8, 2024
mkraetke added a commit that referenced this issue Jul 8, 2024
@mkraetke
Copy link
Member

mkraetke commented Jul 8, 2024

Thank you for the report! There were two problems:

  1. The README.md did not state that the style names must apply to the role attributes in the generated XML file. I specified this more precisely.
  2. The XSLT that converts the CSV internally to the XML configuration format replaced underscores and did not normalized it before. This issue is now resolved, too.

If you pull my latest fixes and change the configuration as specified below, it should work:

Heading_1 ; \chapter{ ; }
Quotations ; \begin{quote} ; end{quote}
Heading_2 ; \section{ ; }
Heading_3 ; \subsection{  ; }

@garyritchie
Copy link
Author

Fixed, thank you!

@mkraetke
Copy link
Member

mkraetke commented Jul 9, 2024

Addendum: Should work with regular MS word style names with whitespace such as Heading 1, too.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants