How to find the type of a list using Novacode DocX? - novacode-docx

I'm parsing a .docx document using Novacode DocX, and so far I can detect if a paragraph is part of a list with Paragraph.IsListItem. However, I want to distinguish between lists numbered with Arabic numbers (1. 2. 3.), Roman numbers (I. II. III.) or letters (a. b. c.).
I can't find any property in Paragraph that gives me this information. Is there any way to get it?

Related

text.replace in python-docx deletes all footnotes in document regardless of whether they contain replaced text

I am trying to write a Python script that replaces certain target words in .docx files with predefined text. My script replaces the target words but, if it finds a match anywhere in the document, the script deletes all of the footnotes. This is true regardless of whether there are any matches in the footnotes. If the target word does not appear in the document at all, the footnotes are unaffected.
I am at a complete loss to understand this behavior. This issue can be replicated with just six lines of code:
from docx import Document
doc = Document("./Test Input.docx")
for p in doc.paragraphs:
if p.text.find("target") >= 0:
p.text = p.text.replace("target", "replacement")
doc.save("./Test Output.docx")
I know I am pushing the boundaries of what python-docx can handle, but I am hoping somebody can help me figure out what is going on here.

Lyx. Space between letters of some words in program listing

When I create a pdf document that I'm writing in Lyx, there are spaces between letters in some words when I use code programs to insert some pieces of programming.
In the Lyx program listing configuration I added the option "showstringspaces = false" but I do not get anything.
Can you tell me how I can remove these annoying spaces so that all the letters of each word in the code lists appear together?
I get ---> fmt. P r i n t
I expect ---> fmt.Print
I answer to myself. Putting the option columns = fullflexible or columns = flexible in the configuration of the code lists is solved

how to put y axis greek letters in Veusz plot?

I want to put Capitalomega with index DE and k label:
and then ı want to show on the y axis label? How to do them?
Generally you can use tex symbols in Veusz. Therefore, you can write \Omega_{DE} and \Omega_{k} for your request. See details here (Sec. 2.4 Text).
Veusz understands a limited set of LaTeX-like formatting for text. There are some differences (for example, "10^23" puts the 2 and 3 into superscript), but it is fairly similar. You should also leave out the dollar signs. Veusz supports superscripts ("^"), subscripts ("_"), brackets for grouping attributes are "{" and "}".
Supported LaTeX symbols include: \AA, \Alpha, \Beta, \Chi, \Delta, \Epsilon, \Eta, \Gamma, \Iota, \Kappa, \Lambda, \Mu, \Nu, \Omega, \Omicron, \Phi, \Pi, \Psi, \Rho, \Sigma, \Tau, \Theta, \Upsilon, \Xi, \Zeta, \alpha, \approx, \ast, \asymp, \beta, \bowtie, \bullet, \cap, \chi, \circ, \cup, \dagger, \dashv, \ddagger, \deg, \delta, \diamond, \divide, \doteq, \downarrow, \epsilon, \equiv, \eta, \gamma, \ge, \gg, \in, \infty, \int, \iota, \kappa, \lambda, \le, \leftarrow, \lhd, \ll, \models, \mp, \mu, \neq, \ni, \nu, \odot, \omega, \omicron, \ominus, \oplus, \oslash, \otimes, \parallel, \perp, \phi, \pi, \pm, \prec, \preceq, \propto, \psi, \rhd, \rho, \rightarrow, \sigma, \sim, \simeq, \sqrt, \sqsubset, \sqsubseteq, \sqsupset, \sqsupseteq, \star, \stigma, \subset, \subseteq, \succ, \succeq, \supset, \supseteq, \tau, \theta, \times, \umid, \unlhd, \unrhd, \uparrow, \uplus, \upsilon, \vdash, \vee, \wedge, \xi, \zeta. Please request additional characters if they are required (and exist in the unicode character set). Special symbols can be included directly from a character map.
Other LaTeX commands are supported. "\" breaks a line. This can be used for simple tables. For example "{a\b} {c\d}" shows "a c" over "b d". The command "\frac{a}{b}" shows a vertical fraction a/b.
Also supported are commands to change font. The command "\font{name}{text}" changes the font text is written in to name. This may be useful if a symbol is missing from the current font, e.g. "\font{symbol}{g}" should produce a gamma. You can increase, decrease, or set the size of the font with "\size{+2}{text}", "\size{-2}{text}", or "\size{20}{text}". Numbers are in points.
Various font attributes can be changed: for example, "\italic{some italic text}" (or use "\textit" or "\emph"), "\bold{some bold text}" (or use "\textbf") and "\underline{some underlined text}".
Example text could include "Area / \pi (10^{-23} cm^{-2})", or "\pi\bold{g}".
Veusz plots these symbols with Qt's unicode support. You can also include special characters directly, by copying and pasting from a character map application. If your current font does not contain these symbols then you may get a box character.
In addition to the answer OmG posted, you can also directly enter the character (via a character map application or copy and paste), as Veusz supports unicode characters.

Why does InDesign put "c_" before literal text?

I'm working with the old interchange format of Adobe InDesign (.inx files).
This XML file has text contents like the following:
<pcnt>c_Stackoverflow

</pcnt>
Which results in
Stackoverflow<CR><CR>
Question: Why does it put c_ before the actual value and not simply use CDATA in doubt?
Adobe has been encoding everything.
The reason they prefix the payload is because you can have several values in a single field, hence, CDATA would not be working.
c_ indicates a string
x_ represents a list (enum)
x_a represents a list with 0x0a items (a = 10 hexadecimal)
l_ represents a long
See a full list of all prefixes in the PDF:
http://partners.adobe.com/public/developer/en/indesign/sdk/working_with_inx_file_format.pdf

IDML : What are Kinsoku/Mojikumi tables?

I am new to the world of Adobe InDesign and IDML file format. I am trying to understand the IDML file format so that I can create IDML files dynamically through code!
I am going through the IDML File format specification and have found references to "Mojikumi Tables" and "Kinsoku Tables" and "Aki". Though the documentation defines various attributes for these elements, there's no clear explanation what these elements actually are.
Any pointers or links to relevant articles would be really helpful.
Thanks.
These are all additional typography settings used in laying out Japanese text.
Kinsoku: A rule set in the Japanese language that is used to determine characters that are not permitted at the beginning or end of a line. Reference.
Mojikumi: Determines spacing between punctuation, symbols, numbers, and other character classes in Japanese type. Reference.
Aki: Means space in Japanese:
"When the glyphs that correspond to characters of different character
classes come together in a run of text, there is spacing behaviour. In
other words, extra space, measured using a fraction of an em, is
introduced depending on which two character classes are in proximity*.
Typical values are one-fourth and one-half of an em"
(Footnote: * 'In Japanese this space is referred to as aki, which simply means
"space"')
Reference and source for this quote.
Here's a link to a book that should provide more information: CJKV Information Processing, 2nd Edition

Resources