Vertically center text and image in two lines - graphics

I need to place a text of two lines next to a centered image.
I have already tried the code provided in https://tex.stackexchange.com/questions/433/vertically-center-text-and-image-in-one-line/17101, which works great for a single line, but cannot get it to work for for than one.
\newcommand{\vcenteredinclude}[1]{\begingroup
\setbox0=\hbox{\includegraphics[scale=0.3]{#1}}%
\parbox{\wd0}{\box0}\endgroup}
\par{\hspace{3cm}\LARGE \centering
{text}{\\more text under text} \hspace{2cm}\smallskip \vcenteredinclude{myimage}\par}
can you please help?

The simpler is to use an array IMHO. The array package extends tabular by adding several extra column specifier and one, m is like p (paragraph), but the paragraph is centered in the cell. So, just put you text in a 'm' paragraph and the image in another.
The resulting code is straightforward.
\documentclass{article}
\usepackage{graphicx}
\usepackage{array}
\begin{document}
\begin{tabular}{m{5cm}m{5cm}}
mona lisa mona lisa mona lisa mona lisa mona lisa mona lisa
&\includegraphics[width=\linewidth]{monalisa}
\end{tabular}
\end{document}
One can adjust the width between the image and the text with
\setlength{\tabcolsep}{2cm}

Related

Combining two lines into 1 in Powershell

An elderly family member recorded a memoir over the past few years, using Windows Notepad, so each file (by year) is simple text. I am tasked with normalizing the documents as much as possible, for a later print run. The problem I'm struggling with is how to handle each chapter title. Within a single text file could be multiple chapter entries. some chapter titles are very simple to get, for example:
Chapter 1
text
text
text.
chapter two
text
text
But she wasn't always so neat. Some of her documents contain lines like
" chapter
three
"
with leading and trailing spaces and even a CarriageReturn/LineFeed between.
I cannot get the syntax to manage the "chapter three" situation. Here's what I have done so far:
$charstr = ' chapter
three
text here
more text
'
#remove leading spaces
$charstr2 = $charstr.trim()
#find and replace chapter to all caps and start on a new line
$charstr2.Replace("chapter ",''nCHAPTER ')
I'd sure appreciate some assistance how to normalize that multi-line text string into a format like "CHAPTER three" (ideally, I will UPPER() the chapter
number as well, like "CHAPTER THREE").
I've tried using \s, as in
$charstr2 = $charstr.trim() -replace '\s+',
but I'm obviously doing something wrong.
Thanks!
read

Pulling name and title from strings in Python 3.5

I'm working through a list of legal notices and need to pull the name and title from the strings.
"NO. 17-1354 (1) THOMAS A. GOLDBERG ADMINISTRATOR"
"NO. 17-1355 (1) ASHLEY MARIE BAKER EXECUTOR"
"CAUSE NO. _________ TIMOTHY WIMBERLY PETITIONER"
"ERIC SMITH, PETITIONER NO. 17-1048 MLF"
I've been trying various combinations using .split(), but can't seem to find one combo to fit them all.
For each one I want to identify the name and title, so it would look like:
['THOMAS A. GOLDBERG', 'ADMINISTRATOR']
['ASHLEY MARIE BAKER', 'EXECUTOR']
etc.

How do I remove duplicates AND the originals from a list in Sublime Text 3?

Edit > Permute Lines > Unique is great for removing duplicate from a list in Sublime Text. But what if I wanted to remove all matching results instead? For example:
james
james
bobby
mary
ann
ann
The above list of names would become:
bobby
mary
Because bobby and mary are the only names that only appear once.
If you don't mind your lines being sorted, you could do it like this:
Edit > Sort Lines
Find > Replace...
Ensure RegEx mode is on
Find What: (^.*$\n)\1+
Replace With: (blank)
Although, sorting wouldn't be necessary if all the duplicates are next to each other, as per your example. e.g. it would even work with the following:
james
james
bobby
mary
ann
ann
james
james
james
Note that this regex requires the last line to have a trailing newline character, if it is a duplicate, otherwise it won't find it.

How do I change the color of each letter in a sentence in LaTeX?

I've been struggling in find the solution for the following problem.
If I want to change the color of each letter in a sentence in latex, how can I do it? Let's say that I want to write "Merry Christmas" using the colors red and green and alternating between them.
I want to define a command and use a forloop to change the color of each letter, but I don't know:
How can I find the number of letters in a sentence (excluding spaces) to give the upper limit for the forloop?
How can I define a string with the two colors to use in the forloop?
So far my silly "solution" is to do it manually, like:
\documentclass[a4paper,12pt]{article}
\usepackage[utf8x]{inputenc}
\usepackage{xcolor}
\begin{document}
\textcolor{red}{M}\textcolor{green}{e}\textcolor{red}{r}
\textcolor{green}{r}\textcolor{red}{y}\textcolor{green}{C}
\textcolor{red}{h}\textcolor{green}{r}\textcolor{red}{i}
\textcolor{green}{s}\textcolor{red}{t}\textcolor{green}{m}
\textcolor{red}{a}\textcolor{green}{s}\textcolor{red}{!}
\end{document}
From what I saw I can define an environment and use a loop to alternate between the colors, I don't have a sensilble solution, but it would be something like:
\newenvironment{redgreen}{
\forloop{WORDNUMBER}{1}{\VALUE{WORDNUMBER} < \LENGHT{WORDNUMBER}}{
\textcolor{red}{WORDNUMBER}
\textcolor{green}{WORDNUMBER + 1}
WORDNUMBER = WORDNUMBER + 2
}
}
The parts with capital letters I know won't work, I just want to give an example of what I'm willing to do. I want to find a way to get the number of letters in the sentence that I would put inside the redgreen block and somehow use the forloop to change the color of each letter in the sentence alternating between red and green. I'm not sure how the forloop works in latex, so everything in the example above may be trash.

Piping rectangle region of text from vim to an external program?

I am editing a large text array in vim, and I want to compute on one sub-column of it.
Simplified example of edited file:
name value name saturation
red 5 green 2
blue 7 yellow 7
other text
I want to pipe column 4 through an external program calc.pl,
calc.pl replaces numbers with new numbers in the input, for example:
name value name saturation
red 5 green 2.4
blue 7 yellow 7.14
other text
When I select rectangle in column 4, using v.motion, and !perl calc.pl
the whole lines gets piped to calc.pl, not just the rectangle.
A work around would be to: cut rectangle to temp file,
run calc.pl on temp file, and then read output as rectangle.
Is there a straight forward solution in vim, without having
to cut/shell/paste?
You might try the vis plugin by Charles Campbell
Use ctrl-v to select a column, then apply an external filter to that column. ctrl-v ..move.. :B !sort
Another plugin that might work for you is NrrwRgn by Christian Brabandt.
Use :NarrowRegion to narrow a line based selection or alternatively visually select a range and press nr
In the scratch buffer simply save it and the changes will be copied into the original file.
This is only a very simple help. You should probably read the help, that is provided with the plugin. See :h NarrowRegion

Resources