I'm writing a script to handle some layout and I've come across some odd behaviour when creating footnotes.
Whenever I create the footnotes with the script, they appear before the next paragraph which is of a different style to the paragraph containing the footnote. Unless it reaches the end of the story in which case they will appear at the bottom of the page.
I would like for it to behave the same way as when you insert a footnote via the menu, I.E. placing the footnotes together at the bottom of the page.
Here's a before and after:
Here's the relevant code which creates the footnotes. references is an array containing the superscript references in the text (as a character or range of character objects). footnotes is an array containing the footnotes between the #FootnoteB and #FootnoteE tags as paragraph objects.
for (var i = 0; i < references.length; i++) {
// Create footnote
newFootnote = textPara.parentStory.footnotes.add(LocationOptions.BEFORE, references[i].insertionPoints[0]);
// Move footnote text into the footnote
footnotes[i].move(LocationOptions.AFTER, newFootnote.insertionPoints[-1]);
// Remove \r at the end of the footnote
newFootnote.characters.item(-1).remove();
// Delete the leftover superscript reference
references[i].remove();
}
It seems to make no difference where I add the footnotes, whether I add them to the paragraph, story or text frame, the result is the same.
I would check the paragraph styles that appear after the footnotes for their ParagraphStyle.spanColumnType value. I'm not sure if it's a bug or a feature, but if your paragraph spans columns the footnote will appear above it (as if it were the beginning of a new column).
Through the UI, you can check this by editing the paragraph style and checking its Span Columns tab.
ETA: the values you would want in order to avoid the footnote placement you have now are SpanColumnTypeOptions.SINGLE_COLUMN or, via the UI, just Single Column.
Related
I found some instructions on how to show/hide differences in comments using beyond compare. However most of the answers show how to set comment as important text or not. That is, if a portion of code is commented on both sides then check if the comment are different or not.
I would like to ignore when only one side of the comparison is commented. In other words if I have
# # line1
# line2
on one side and
# line1
line2
I would like both lines to be marked as "unimportant differences" (if indeed the text is the same, otherwise to be marked as differences).
Beyond Compare will only compare text if it is of the same grammar element type. If one side is regular code and the other side is a comment, it will always mark it as an important difference.
To make regular text on one side and the same text commented on the other side show as a match, you'll need to edit the definition of a comment in the file format.
To edit a format, open Tools > File Formats.
Select the format that matches your files.
Go to the Grammar tab.
Select the Comment grammar element, which might be defined as # to end of line.
Click the Edit (gear) button.
Set the Category radio button to Basic.
Text matching: ^#\s
Check Regular expression.
Click OK, then Save.
The updated file format will treat # followed by a whitespace character as an unimportant comment, the remaining text in the line will be treated as regular text and compared to the other side.
I am creating a big table with MigraDoc.
I have two issues I don't know how to solve exactly:
If the content (Paragraph) of a cell is too long it breaks and I got 2 lines in my cell. I don't want this behavior. I want that the text which does not fit in the first line of the cell is hidden.
If a word is too long I want also that the characters which are outside of the cell are hidden. Now they are displayed in the next cell :/ and are overlapping with the content of the next cell...
Do you know how to fix this issues?
This behavior is by design.
Use MeasureString to measure your text before you add it and truncate at the correct place (maybe adding "..." if you want).
See also:
http://forum.pdfsharp.net/viewtopic.php?p=6158#p6158
I have a NSTextView subclass. It displays normal text (which should wrap, ideally around the 80-char line) and ascii style tables (which should not be wrapped).
Mockup:
As you see the text on top is wrapped, while the table extends.
I have code that figures out if a line is a table, but I need some ideas on how to go with the selective (non)wrapping.
Use multiple text containers with your layout manager.
"This one is the width of the text view (it wraps); the next one is as wide as it needs to be (doesn't wrap); etc."
This question and the comments and answers prompted this question. How do I effectively use Cells and CellGroups in mathematica? I've always only programmed systematically inside the input cells, entering the next line in a new cell after evaluating the previous. Looking around at the different options available, this seemed inefficient.
How do I use these more effectively? I tried organizing my code into sections using command-5 and into subsections, etc. But then when I try to get back to input cell with command-9, it doesn't evaluate it. I'm sure I'm doing something wrong, so help is appreciated.
Cell groups are just that, a way to group cells together. These groups can be easily selected, executed as one, and opened/closed (collapsed). By default these groups are indicated by a series of blue brackets to the right of the cells:
As seen above, output cells are automatically grouped with the input cell that created them. Also, the Section cell automatically groups the Text, Input, and Output cells below it. Finally the Title cell groups all cells below it, including the Section cell.
The different classes of cells that are available, such as Title, Section, etc., are determined by the active Stylesheet. The way they group is controlled by the option CellGroupingRules. This is a more advanced area, and details are probably better addressed in a different question.
Cell Grouping can be done either automatically, the default, or manually, or to a limited extent by a combination thereof. This is all handled by the menu commands in Cell > Grouping > ... or the keyboard shortcuts listed there.
If using Automatic Grouping, then styling a cell in a style that groups (as controlled by CellGroupingRules) will automatically group "lesser" cells and cell groups beneath it.
To style a cell, select the entire cell, not just the cell contents, by either:
clicking on the blue cell bracket (or the area where it would be if it is hidden)
clicking within the cell and using Alt+. until the entire cell is selected
clicking and dragging from above the cell, where the cursor is horizontal, to below the cell
Then, use menu Format > Style > ..., or the corresponding key combinations.
The same methods can be used to select cell groups, rather than individual cells.
To create a new cell of a particular style:
click outside of existing cells where the cursor is horizontal
this should create a horizontal rule as shown in earlier illustration
specify a style, again with Format > Style > ... or keyboard shortcuts
start typing (or paste) the contents of the new cell
To create a new Input cell, the default style, simply do step (1) and then type or paste the input.
It depends on your stylesheet. Input is not the nineth numbered style in every stylesheet. Also, you have to select the cell bracket to change a cell's style.
I use sections particularly to be able to use folding, i.e. the double clicking on the cell group bracket to hide the lower ranking cells. That makes for a clean document. It doesn't do anything with the Input cells (except for the context option).
I've been playing around with NSTextView and have applied some paragraph styles to certain lines. However, when I type enter and get a new line, the attributes that I applied to one line are bleeding into the next.
I want to be able to apply a paragraph style to one line and have the next line be formatted in the default way. You can see what I mean from the screenshots.
When I add some spacing between paragraphs via NSParagraphStyle, the same spacing applies to the newline, which makes the whole thing look pretty shotty. Basically, I am looking for a way to reset the paragraph style for an empty line.
I have tried [MyTextView resetTypingAttributes:theAttributes] to no avail, since you first have to start typing for the new attributes to apply. Just to be clear, the line below the text in the screenshot is the cursor, which is really far down there as a result of the paragraph spacing.
Screenshot:
It seems that you have to use setTypingAttributes on the textview.