I am trying to create a title page and I want to include some list like this:
\begin{document}
\centering
{\Large \textbf{Entity 1:} \quad Some entity 1 \protect\\
\textbf{Entity 2:} \quad Some entity 2 \protect\\
\textbf{Slightly longer entity:} \quad Some slightly longer entity \protect\\
\textbf{The last entity:} \quad Some entity 3 \par}
\end{document}
However this produces
entire lines center-aligned.
Whereas I aim to make it look like
titles right-aligned and text left-aligned. I could not figure out how to do it. Any help is appreciated.
Use a tabular:
\documentclass{article}
\begin{document}
\centering\Large
\begin{tabular}{rl}
\textbf{Entity 1:} & Some entity 1\\
\textbf{Entity 2:} & Some entity 2 \\
\textbf{Slightly longer entity:} & Some slightly longer entity\\
\textbf{The last entity:} & Some entity 3\\
\end{tabular}
\end{document}
Related
I'm trying to obtain the text in only the title#lang=en-US elements in an XML file.
This code obtains all the title text for all languages.
entries = root.xpath('//prefix:new-item', namespaces={'prefix': 'http://mynamespace'})
for entry in entries:
all_titles = entry.xpath('./prefix:title', namespaces={'prefix': 'http://mynamespace'})
for title in all_titles:
print (title.text)
I tried this code to get the title#lang=en-US text, but it does not work.
all_titles = entry.xpath('./prefix:title', namespaces={'prefix': 'http://mynamespace'})
for title in all_titles:
test = title.xpath("#lang='en-US'")
print (test)
How do I obtain the text for only the english language items?
The expression
//prefix:title[lang('en')]
will select all the English-language titles. Specifically:
title elements that have an xml:lang attribute identifying the title as English, for example <title xml:lang="en-US"> or <title xml:lang="en-GB">
title elements within some container that identifies all the contents as English, for example <section xml:lang="en-US"><title/></section>.
If you specifically want only US English titles, excluding other forms of English, then you can use the predicate [lang('en-US')].
My first stackoverflow question. I take the easy way out and directly ask the following. How is it possible to produce an output in LaTeX, like the one pictured below?
More holistic, what are the best ways to encapsulate text in an amsmath eg. equation, align, block?
You should use a tabular environment. This code:
\documentclass{article}
\begin{document}
\begin{tabular}{ll}
$ID_V$ & = identifier of $V$\\
$P_C$ & = password of user on $C$\\
$AD_C$ & = network address of $C$\\
$K_V$ & = secret encryption key shared by $AS$ and $V$
\end{tabular}
\end{document}
produces:
Then you can indent or align the tabular as you prefer.
Only a hint about the second part of your question. Keep in mind which environments, like tabular, have text as default content (hence math must be included in $...$) and which ones, like array, align, equation, etc., have math as default (so that text must be included in a box or in \text{...}).
You can use the \text{} command to write text in amsmath blocks:
\documentclass[11pt]{article}
\usepackage{amsmath}
\begin{document}
\begin{align}
ID_V &= \text{identifier of $V$} \\
P_C &= \text{password of user on $C$}
\end{align}
\begin{alignat}{2}
&ID_V &&= \text{identifier of $V$} \\
&P_C &&= \text{password of user on $C$}
\end{alignat}
\end{document}
I have some code in a computed field where I want to embed some spaces between two values:
var rtn:String = doc.getItemValue("RefNo")[0] + " " + doc.getItemValue("Company")[0];
the computed field Display Type = text and the content type is String but the display strips out all the extra spaces. Is there a function like insertSpaces(5) that would insert 5 hard spaces?
Figured it out insert " " + " " and display as HTML. fairly simple but really ackward.
It will print them out as whitespace in HTML output. It will not be rendered.
You can add instead (5 times in your case).
An alternative way is to set style="white-space: pre;" (works IE8+ and other browsers)
I need to import text from txt file with some variables. I use BufferedReader and File Reader. In code I have :
String car = "vw golf";
String color = "nice sunny blue color";
And in my txt file:
I have nice " +car+ " which has "+color+".
My expected output :
I have nice vw golf which has nice sunny blue color.
My actual output is :
I have nice " +car+ " which has "+color+".
If I've understood correctly, what you want to do is replace " + car + " with the value of your car string and likewise for colour. You've tried to do this by writing your text file as if it were a command to be evaluated. However, that won't happen - it will just be outputted as is. I'm going to assume you are using c#. What you need to do is, prior to outputting your string, parse it to replace the markers with the variables. I would recommend you get rid of the double quotes in your text file. You could then do something like this:
string text = this.ReadTextFromFile();
string ammended = text.Replace("+car+", car);
As mentioned, this is assuming you remove the double quotes from your text file so it reads:
I have nice +car+ which has +color+.
Also, you don't need to use the + symbols, but I suppose they are a good way of designating a unique token to be replaced. You could use {car} in the file and then likewise in the Replace startment, for example.
I may not have properly understood what you wanted to do, of course!
Edit: Incase of confustion,
this.ReadTextFile();
was just a short hand way of saying that the text variable contains the contents as read from your text file.
I'd like to know how to replace parts of a string in latex. Specifically I'm given a measurement (like 3pt, 10mm, etc) and I'd like to remove the units of that measurement (so 3pt-->3, 10mm-->10, etc).
The reason why I'd like a command to do this is in the following piece of code:
\newsavebox{\mybox}
\sbox{\mybox}{Hello World!}
\newlength{\myboxw}
\newlength{\myboxh}
\settowidth{\myboxw}{\usebox{\mybox}}
\settoheight{\myboxh}{\usebox{\mybox}}
\begin{picture}(\myboxw,\myboxh)
\end{picture}
Basically I create a savebox called mybox. I insert the words "Hello World" into mybox. I create a new length/width, called myboxw/h. I then get the width/height of mybox, and store this in myboxw/h. Then I set up a picture environment whose dimensions correspond to myboxw/h. The trouble is that myboxw is returning something of the form "132.56pt", while the input to the picture environment has to be dimensionless: "\begin{picture}{132.56, 132.56}".
So, I need a command which will strip the units of measurement from a string.
Thanks.
Use the following trick:
{
\catcode`p=12 \catcode`t=12
\gdef\removedim#1pt{#1}
}
Then write:
\edef\myboxwnopt{\expandafter\removedim\the\myboxw}
\edef\myboxhnopt{\expandafter\removedim\the\myboxh}
\begin{picture}(\myboxwnopt,\myboxhnopt)
\end{picture}
Consider the xstring package at https://www.ctan.org/pkg/xstring.
The LaTeX kernel - latex.ltx - already provides \strip#pt, which you can use to strip away any reference to a length. Additionally, there's no need to create a length for the width and/or height of a box; \wd<box> returns the width, while \ht<box> returns the height:
\documentclass{article}
\makeatletter
\let\stripdim\strip#pt % User interface for \strip#pt
\makeatother
\begin{document}
\newsavebox{\mybox}
\savebox{\mybox}{Hello World!}
\begin{picture}(\stripdim\wd\mybox,\stripdim\ht\mybox)
\put(0,0){Hello world}
\end{picture}
\end{document}