How to insert plain text? - latex

I have some xml text to be inserted in the document as plain text. I directly inserted but it gives weird symbols. How can I avoid that?
XML I want to add:
\begin{tabular}{|c|}
<table>
<tr>
<td> Title and Logo</td>
</tr>
<tr>
<td> left Column </td>
<td> main table </td>
</tr>
</table>
\end{tabular}
And the output is like :
¡table¿ ¡tr¿ ¡td¿ Title and Logo¡/td¿ ¡/tr¿ ¡tr¿ ¡td¿ left Column ¡/td¿ ¡td¿ main table ¡/td¿ ¡/tr¿ ¡/table
Basically I want to add the HTML code in a tabular. How can I do that?

Have you tried the verbatim environment?
\begin{verbatim}
Your text here.
\end{verbatim}
Without knowing what your "weird symbols" are, it's difficult to suggest a solution to your problem.
Update: In order to embed a verbatim environment in a table cell, you need to change the column to a paragraph column (using either p, m, or b as the column specifier); e.g.
\begin{tabular}{|p{10cm}|}
\begin{verbatim}
Your text here.
\end{verbatim}
\end{tabular}
See Wikibooks for more information.

Related

Sticky columns for dynamic colum definition

I am trying to define an Angular Material table with approx 24 columns and they are not uniform in behavior. Some columns just display text, others may have controls. I want to try and keep it as dynamic as possible and not have them all defined in the HTML file.
I have created an object to define a column object and create the columns dynamically:
<ng-container *ngFor="let column of columnDefinitions" [matColumnDef]="column.columnName">
<th mat-header-cell
*matHeaderCellDef
mat-sort-header
[disabled]="!column.sortable"> {{ column.label }} </th>
<td mat-cell *matCellDef="let row"
[ngClass]="getClasses(row, column)"> {{ getColumnContentFor(row, column.columnPath) }} </td>
</ng-container>
Some of the questions I have are around how to best add functionality based on the type of column I need:
I want to add a sticky column just to the first couple of columns
Ideally even the [ngClass] would like it only for certain columns so it doesn't have to evaluate this function for every column.
If some columns have a custom control how can I add a custom template
Any examples you may suggest would be extremely helpful.
You can do this by adding the index to ngFor, like this: *ngFor="let column of columnDefinitions; let i = index". Then, you can conditionally add the sticky position by adding this to the th cell: [style.position]="i < 2 ? 'sticky' : null" (null value means that the style won't be added).
EDIT: You also need to change the matHeaderRowDef to *matHeaderRowDef="columnsToDisplay; sticky: true"
While you can use something like ngSwitch for that, I don't think it's worth the effort. You can, however, make sure you return null as early as possible for classes that don't need it.
Inside the td element, you can use ngSwitch, as described here. You can use the column index, for example.

Remove section number but display the number in table of contents in LaTeX

I am new to LateX. I know how to remove the section number by using \section*{heading} instead of \section{heading}.
But when I display the section heading in the Table of Contents , it does not print the section number. I want the section number to be displayed before "Introduction to Project" and "Introduction to company" in the Table of Contents shown below.
The titlesec package is very useful to modify your chapter and section titles. An important command is \titleformat, which is described on page 4 of the manual. The command looks like this:
\titleformat{⟨command⟩}[⟨shape⟩]{⟨format⟩}{⟨label⟩}{⟨sep⟩}{⟨before-code⟩}[⟨after-code⟩]
here, we want to change the \section command, i.e. <command> is \section.
The <shape> setting is optional - we'll just leave the default value. In <format>, we define how the title shall be formatted. The default for \section is \normalfont\Large\bfseries, so we'll set it to that. If you want to change the appearance, you can do that here. Now, the interesting part: the <label> is the section number - we don't want to print it, so we'll lave that field empty. The <sep> is the separation between label and title, which should be zero if we don't have a label. Finally, with <before-code> and <after-code> we can add any code which should be run before or after printing the title. We don't need that either. So, our command is:
\titleformat{\section}{\normalfont\Large\bfseries}{}{0pt}{}
Here, a demonstration of that:
\documentclass{article}
\usepackage{titlesec}
\titleformat{\section}{\normalfont\Large\bfseries}{}{0pt}{}
\begin{document}
\tableofcontents
\section{Introduction to Company}
This is the company.
\section{Introduction to Project}
My project is very nice.
\end{document}

tablesorter child row searching

I am using tablesorter with child rows. My table has many many child rows per parent row. All child rows have same number of columns as that of parent.
I have filters implemented, with which I can search both parent and child. When I do a search in the filter box for a column, I notice that all filter matches from all columns a child row are also reported. The intend in my application is to report matches for a specific column (same column of filter box) regardless of whether it is a parent or a child.
Has anybody came across this before ?
For example, look at this site
http://mottie.github.io/tablesorter/docs/example-child-rows-filtered.html
If we search for "Colorado" in the "Date" column filter box, one entry will still show up, which has the string "Colorado" in some some unrelated column in the child row.
I have the same problem. The way we overcame was basically to make childrow have its own specific columns and then add external filters only on those columns. Then we had to hide the filters in the header for columns with child column data. Not sure if this has been fixed.
<tr class="tablesorter-childRow">
<td></td>
<td></td>
<td></td>
<td></td>
<td></td>
<td>child column filter 1</td>
<td class="filter-match">Child column fiter 2</td>
<td class="filter-match">child column filter 3</td>
</tr>

Parsing text content in ColdFusion

I am attempting to parse text from a <cfoutput query="...">. I am interested in finding the number of times every word in the text is displayed. For example:
"My name is Bob and I like to Bob".
should result in
Bob - 2
Name - 1
etc, etc, etc.
I take my <cfoutput> from a twitter RSS feed. Here is my code:
<blink>
<cfset feedurl="http://twitter.com/statuses/user_timeline/47847839.rss" />
<cftry>
<cffeed source="#feedurl#" properties="feedmeta" query="feeditems" />
<cfcatch></cfcatch>
</cftry>
<ol>
<cfoutput query="feeditems">
#content# #id# <br><br>
</cfoutput>
</ol>
</blink>
I output a pretty great ordered list, but I can't figure out for the life of me how to parse the content and list how many times each word is used.
Thanks for any help you can provide, I am new to these forums!
You can find a solution here:
http://www.coldfusionjedi.com/index.cfm/2007/8/2/Counting-Word-Instances-in-a-String
Basically, split the string up using regex and then loop over the results. There are some darn good comments here as well.

Markdown: How to reference an item in a numbered list, by number (like LaTeX's \ref / \label)?

Is there any way in markdown to do the equivalent of the cross-referencing in this LaTeX snippet? (Taken from here.)
\begin{enumerate}
\item \label{itm:first} This is a numbered item
\item Another numbered item \label{itm:second}
\item \label{itm:third} Same as \ref{itm:first}
\end{enumerate}
Cross-referencing items \ref{itm:second} and \ref{itm:third}.
This LaTeX produces
1. This is a numbered item
2. This is another numbered item
3. Same as 1
Cross-referencing items 2 and 3.
That is, I would like to be able to refer to items in a markdown list without explicitly numbering them, so that I could change the above list to the following without having to manually update the cross references:
1. This is the very first item
2. This is a numbered item
3. This is another numbered item
4. Same as 2
Cross-referencing items 3 and 4.
HTML can't even do that and Markdown is a subset of HTML, so the answer is no.
For example, your list would be represented like so (when rendered by Markdown):
<ol>
<li>This is a numbered item</li>
<li>This is another numbered item</li>
<li>Same as 1</li>
</ol>
Notice that there is no indication of which item is which as far as the numbering goes. That is all inferred at render time by the browser. However, the number values are not stored within the document and are not referenceable or linkable. They are for display only and serve no other purpose.
Now you could write some custom HTML to uniquely identify each list item and make them referenceable:
<ol>
<li id="item1">This is a numbered item</li>
<li id="item2">This is another numbered item</li>
<li id="item3">Same as <a href="#item1>1</a></li>
</ol>
However, those IDs are hardcoded and have no relation to the numbers used to display the items. Although, I suppose that's what you want. To make your updated changes:
<ol>
<li id="item0">This is the very first item</li>
<li id="item1">This is a numbered item</li>
<li id="item2">This is another numbered item</li>
<li id="item3">Same as 2</li>
</ol>
The IDs stay with the item as intended. However, lets move on to the links to those list items. Note that in the first iteration we had:
1
And with the update we had:
2
The only difference being the link's label (changed from "1" to "2"). That is actually changing the document text through some sort of macro magic stuff. Not something HTML can do, at least not without JavaScript and/or CSS to help.
In other words, the text of every reference to the item would need to be manually updated throughout the document every time the list is updated. And that is for HTML. What about Markdown? As the rules state:
Markdown is not a replacement for HTML, or even close to it. Its syntax is very small, corresponding only to a very small subset of HTML tags.
Therefore in standard Markdown there is not even any way to assign IDs to the list items.
Seems to me you either need to use something other than lists or use something other than Markdown/HTML.
Maybe you need to use the H1.. H6 and then Markdown generates an anchor that you can link to:
# H1
## H2
### H3
#### H4
##### H5
###### H6
Something like:
###### 1. This is a numbered item
###### 2. This is another numbered item
###### 3. Same as 1
Generates:
<h6 id="1-this-is-a-numbered-item">1. This is a numbered item</h6>
<h6 id="2-this-is-another-numbered-item">2. This is another numbered item</h6>
<h6 id="3-same-as-1">3. Same as 1</h6>
Pandoc allows you to use labels in example lists:
Numbered example lists
Extension: example_lists
The special list marker # can be used for sequentially numbered examples. The first list item with a # marker will be numbered '1', the next '2', and so on,
throughout the document. The numbered examples need not occur in a single list; each new list using # will take up where the last stopped. So, for example:
(#) My first example will be numbered (1).
(#) My second example will be numbered (2).
Explanation of examples.
(#) My third example will be numbered (3).
Numbered examples can be labeled and referred to elsewhere in the document:
(#good) This is a good example.
As (#good) illustrates, ...
The label can be any string of alphanumeric characters, underscores, or hyphens.

Resources