I'm working on a LaTeX beamer presentation where I'd like to add a notes section below each \item heading which simply copies its text. For example I have
\begin{frame}{Frame Title}
\begin{itemize}[<+->]
\item Einstein was a clever man.
\item My favorite equation is,
\begin{equation}
E = m c^2.
\end{equation} where
\begin{enumerate}
\item $m$ is the mass,
\item $c$ the velocity of light and,
\item $E$ is the energy.
\end{enumerate}
\end{itemize}
\end{frame}
and I would like to have
\begin{frame}{Frame Title}
\begin{itemize}[<+->]
\item Einstein was a clever man.
\note<.>[item]{
Einstein was a clever man.
}
\item My favorite equation is,
\begin{equation}
E = m c^2.
\end{equation} where
\begin{enumerate}
\item $m$ is the mass,
\item $c$ the velocity of light and,
\item $E$ is the energy.
\end{enumerate}
\note<.>[item] {
My favorite equation is,
\begin{equation}
E = m c^2.
\end{equation where
\begin{enumerate}
\item $m$ is the mass,
\item $c$ the velocity of light and,
\item $E$ is the energy.
\end{enumerate}
}
\end{itemize}
\end{frame}
How can I do this in vim, or using command line tools like awk or sed?
Via vim I'm able to copy-and-append isolated lines starting with the pattern \item via
:g/^\\item/ copy . | s//\\note\{item\}<.>\{/g
but I'm unable to capture the whole block belonging to each top-level \item.
This might work for you (GNU sed):
sed -E '/^\\begin\{itemize\}/{:a;n;/^\\end\{itemize\}/bb
/^( {4}|\t)\\item/{
:b;x;s/^(\s*)\\item(.*)/\1\\note<.*>[item]{\n\1\1\2\n\1}/p;x;h;ba}
H;ba}' file
Focus on lines between \begin{itemize} and \end{itemize}
Make a copy of each \item and append the copy to each \item stanza, replacing the \item command by the desired \note command.
N.B. The solution depends on the whitespace indenting the \item command, currently the indent is set at 4 spaces but tabs may be used (see regexp at the beginning of the second line).
Related
I was wondering how to bring the names of the places of work on the left side in one line with the job titles and the date. E.g. Praktikum Psychologie should be in line with Sonnhalde Grüningen. See compilable code below. I've tried vspace etc. but haven't had much luck. Same issue with Ausbildung (Education) as well.
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% Classicthesis-Styled CV
% LaTeX Template
% Version 1.0 (22/2/13)
%
% This template has been downloaded from:
% http://www.LaTeXTemplates.com
%
% Original author:
% Alessandro Plasmati
%
% License:
% CC BY-NC-SA 3.0 (http://creativecommons.org/licenses/by-nc-sa/3.0/)
%
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%----------------------------------------------------------------------------------------
% PACKAGES AND OTHER DOCUMENT CONFIGURATIONS
%----------------------------------------------------------------------------------------
\documentclass{scrartcl}
\reversemarginpar % Move the margin to the left of the page
\newcommand{\MarginText}[1]{\marginpar{\raggedleft\itshape\small#1}} % New command defining the margin text style
\usepackage[nochapters]{classicthesis} % Use the classicthesis style for the style of the document
\usepackage[LabelsAligned]{currvita} % Use the currvita style for the layout of the document
\usepackage[ngerman]{babel}
\renewcommand{\cvheadingfont}{\LARGE\color{Purple}} % Font color of your name at the top
\usepackage{hyperref} % Required for adding links and customizing them
\hypersetup{colorlinks, breaklinks, urlcolor=Purple, linkcolor=Purple} % Set link colors
\usepackage{enumitem}% Use the enumitem package for lists - http://ctan.org/pkg/enumitem
\setlist{nolistsep}
\newlength{\datebox}\settowidth{\datebox}{Spring 2011} % Set the width of the date box in each block
\newcommand{\NewEntry}[3]{\noindent\hangindent=1em\hangafter=0 \parbox{\datebox}{#1}\hspace{0.1em} #2 #3 % Define a command for each new block - change spacing and font sizes here: #1 is the left margin, #2 is the italic date field and #3 is the position/employer/location field
\vspace{0.5em}} % Add some white space after each new entry
\newcommand{\Description}[1]{\noindent\hangindent=2em\hangafter=0\noindent\footnotesize{#1}\par\normalsize\vspace{1em}} % Define a command for descriptions of each entry - change spacing and font sizes here
\usepackage{adforn}
%----------------------------------------------------------------------------------------
\begin{document}
\thispagestyle{empty} % Stop the page count at the bottom of the first page
%----------------------------------------------------------------------------------------
% NAME AND CONTACT INFORMATION SECTION
%----------------------------------------------------------------------------------------
\begin{cv}{\spacedallcaps{censored}}\vspace{1.5em} % Your name
\spacedlowsmallcaps{Persönliche Daten}\vspace{0.5em} % Personal information heading
\datebox=1in
\NewEntry{\large{*}}{censored}{} % Birthplace and date
\datebox=1in
\NewEntry{e-mail}{\href{mailto:censored}{censored} % Email address
\datebox=1in
\NewEntry{telefon}{censored} % Phone number(s)
\datebox=1in
\NewEntry{adresse}{censored} % Address
\vspace{1em} % Extra white space between the personal information section and goal
%\noindent\spacedlowsmallcaps{Goal}\vspace{1em} % Goal heading, could be used for a quotation or short profile instead
%\Description{Improve my skills in creating and developing cutting edge projects. Find a way to apply scientific approaches in solving practical problems. }\vspace{2em} % Goal text
%----------------------------------------------------------------------------------------
% Experience
%----------------------------------------------------------------------------------------
\spacedlowsmallcaps{Berufserfahrung}\vspace{1em}
\datebox=3.2in
\datebox=3.2in
\NewEntry{Praktikum Psychologie}{\textit{08.2022 -- 02.2023}}
\Description{\MarginText{\textsc{\href{https://www.klinik-sonnhalde.ch/}{Sonnhalde}} \\ Grüningen.} \vspace{-2mm}
\begin{itemize}
\item Pensum 40-60 \%
\item Psychotherapiegespräche im Einzelsetting
\item Co-Leitung Sozialkompetenztraining
\item Leitung Gruppe Achtsamkeit
\item Begleitung Psychiater auf Visiten
\item regelmässige Teilhabe an Supervisionen
\end{itemize}}
\datebox=3.2in
\NewEntry{Praxisassistentin}{\textit{06.2019 -- 06.2022}}
\Description{\MarginText{\textsc{Zentrum für Chiropraktik} \\ Zürich.} \vspace{-2mm}
}
\vspace{2.25em} % Extra space between major sections
\datebox=3.2in
\NewEntry{Praktikum Psychologie}{\textit{10.2020 -- 01.2021}}
\Description{\MarginText{\textsc{\href{https://www.forio.ch/}{forio AG}} \\ Frauenfeld.} \vspace{-4mm}
\begin{itemize}
\item Mitarbeit Begutachtungen und Testberichte
\item selbstständige Durchführung psychodiagnostischer Testverfahren \\(\textsc{WISC-V}, \textsc{WAIS-IV}) mit Jugendlichen und Erwachsenen
\end{itemize}}
\datebox=3.2in
\NewEntry{Mitarbeiterin Hotellerie}{\textit{09.2016 -- 09.2019}}
\Description{\MarginText{\textsc{Privatklinik Hirslanden} \\ Zürich.} \vspace{-4mm}
}
\vspace{2.25em} % Extra space between major sections
\datebox=3.2in
\NewEntry{Diverse Praktika}{\textit{07.2015--08.2016}}
\Description{\MarginText{\textsc{} \\ } \vspace{-4mm}
}
\vspace{0.4em} % Extra space between major sections
------------
\vspace{0.4em} % Extra space between major sections
%----------------------------------------------------------------------------------------
% EDUCATION
%----------------------------------------------------------------------------------------
\spacedlowsmallcaps{Ausbildung}\vspace{1em}
\datebox=3.2in
\NewEntry{MSc Psychologie}{\textit{2020-2022}}
\Description{\MarginText{\textsc{UZH} \\ Zürich.}
\vspace{-4mm}
\begin{itemize}
\item Masterarbeit \\ \textit{Englisch als Lingua Franca und Machine Translation}
\end{itemize}}
\datebox=3.2in
\NewEntry{BSc Psychologie}{\textit{2016-2020}}
\Description{\MarginText{\textsc{UZH} \\ Zürich.}
\vspace{-4mm}
}
\datebox=3.2in
\NewEntry{Gymnasiale Maturität}{\textit{2009-2015}}
\Description{\MarginText{\textsc{Kantonsschule} \\ Wetzikon.}
\vspace{-4mm}
\begin{itemize}
\item Schwerpunktfach Spanisch
\end{itemize}
}
%------------------------------------------------
%------------------------------------------------
%------------------------------------------------
%----------------------------------------------------------------------------------------
% OTHER INFORMATION
%----------------------------------------------------------------------------------------
\vspace{1em} % Extra space between major sections
\spacedlowsmallcaps{Verschiedenes}\vspace{1em}
\Description{seit 2017 \ \ ~ $\cdotp$\ \ Vorstand Samariterverein Grüningen}
\vspace{-0.5em} % Negative vertical space to counteract the vertical space between every \Description command
\Description{~~~~~~~~~~~~~~~ \ \ $\cdotp$\ \ Mitglied Verein \href{https://www.njira.org/}{Njira}}
\vspace{-0.5em} % Negative vertical space to counteract the vertical space between every \Description command
\newpage
%------------------------------------------------
%----------------------------------------------------------------------------------------
% COMPUTER SKILLS
%----------------------------------------------------------------------------------------
\spacedlowsmallcaps{Software}\vspace{1em}
\Description{\MarginText{Ausgezeichnet}Microsoft Office Word \& Excel}
\Description{\MarginText{Fortgeschritten} R, \LaTeX, SDL Trados Studio, Adobe Illustrator \& InDesign}
%------------------------------------------------
\vspace{0.8em}
\spacedlowsmallcaps{Sonstiges}\vspace{1em}
\newlength{\langbox} % Create a new length for the length of languages to keep them equally spaced
\settowidth{\langbox}{Französisch} % Length equals the length of "English" - if you have a longer language in your list put it here
\Description{\MarginText{Sprachen}\parbox{\langbox}{\textsc{Deutsch}}\ \ $\cdotp$\ \ \ Muttersprache}
\vspace{-0.5em} % Negative vertical space to counteract the vertical space between every \Description command
\Description{\parbox{\langbox}{\textsc{Englisch}}\ \ $\cdotp$\ \ \ Muttersprache}
\vspace{-0.5em} % Negative vertical space to counteract the vertical space between every \Description command
\Description{\parbox{\langbox}{\textsc{Französisch}}\ \ $\cdotp$\ \ \ B1}
\vspace{-0.5em} % Negative vertical space to counteract the vertical space between every \Description command
\Description{\parbox{\langbox}{\textsc{Russisch}}\ \ $\cdotp$\ \ \ A2}
\vspace{1em} % Negative vertical space to counteract the vertical space between every \Description command
%------------------------------------------------
\Description{\MarginText{Interessen}Fussball\ \ $\cdotp$\ \ Schwimmen \ \ $\cdotp$\ \ Sprache \& Geschichte \ \ $\cdotp$\ \ Typografie \& Drucksatz}
%----------------------------------------------------------------------------------------
\end{cv}
\end{document}
I have a file with the following data:
25 POSIX shell script, ASCII text executable
25 POSIX shell script, ASCII text executable
3 PostScript document text conforming DSC level 3.0, type EPS, Level 2
2 PostScript document text conforming DSC level 3.0, type EPS, Level 2
23 PostScript document text conforming DSC level 3.0, type EPS, Level 2
4 SVG Scalable Vector Graphics image
4 SVG Scalable Vector Graphics image
and would like to sum first field if all other fields are the same, so the output should be:
50 POSIX shell script, ASCII text executable
28 PostScript document text conforming DSC level 3.0, type EPS, Level 2
8 SVG Scalable Vector Graphics image
I tried this awk command:
awk '{ a[$2]+=$1 }END{ for(i in a) print a[i],i }' inputfile
which prints:
25 POSIX
28 PostScript
8 SVG
but I can't find a way to print the rest of the line
This is one way:
$ awk '{v=$1;$1="";s[$0]+=v}END{for(i in s)print s[i] i}' file
8 SVG Scalable Vector Graphics image
50 POSIX shell script, ASCII text executable
28 PostScript document text conforming DSC level 3.0, type EPS, Level 2
Explained:
$ awk '{
v=$1 # store value in $1
$1="" # empty $1, record gets rebuilt
s[$0]+=v # sum indexing on $1less record
}
END { # in the end
for(i in s) # loop all
print s[i] i # ... and output
}' file
$ awk '{n=$1; sub(/[0-9]+ +/,""); a[$0]+=n} END{ for(i in a) print a[i],i }' file
28 PostScript document text conforming DSC level 3.0, type EPS, Level 2
50 POSIX shell script, ASCII text executable
8 SVG Scalable Vector Graphics image
Another awk with 'sort'
$ sort -k2 sergio.txt | awk ' { t=$1; $1=""; c=$0;if(c==p) { s+=b} else { if(NR>1) print s+b,p; s=0} p=c;b=t} END { print s+b,p } ' sergio.txt
50 POSIX shell script, ASCII text executable
28 PostScript document text conforming DSC level 3.0, type EPS, Level 2
8 SVG Scalable Vector Graphics image
$
Input file:
$ cat sergio.txt
25 POSIX shell script, ASCII text executable
25 POSIX shell script, ASCII text executable
3 PostScript document text conforming DSC level 3.0, type EPS, Level 2
2 PostScript document text conforming DSC level 3.0, type EPS, Level 2
23 PostScript document text conforming DSC level 3.0, type EPS, Level 2
4 SVG Scalable Vector Graphics image
4 SVG Scalable Vector Graphics image
$
I am having a problem in producing a cropped PDF file in LaTeX using the preview package with tightpage option.
I want to put two independently created PDF images into one LaTeX file and produce a singled PDF image. My LaTeX file is
\documentclass{minimal}
\usepackage{graphicx}
\usepackage[active,tightpage,graphics]{preview}
\begin{document}
\begin{centering}
\includegraphics{fig1}\includegraphics{fig2}
\end{centering}
\end{document}
When I run pdflatex, I get an empty PDf file. The log is given below
...
Preview: Fontsize 10pt
Preview: PDFoutput 1
<fig1.pdf, id=1, 297.28665pt x 190.31703pt> <use fig1.pdf> (./fig.aux)
No pages of output.
Transcript written on fig.log.
What is wrong with the code. If I use an equation instead of includegraphics with the extra textmath option, I get the right output.
Any help will be appreciated
Madhur
The minimal documentclass is often too minimal. Instead you could use the standalone class which will automatically produce a cropped pdf:
\documentclass{standalone}
\usepackage{graphicx}
%\usepackage[active,tightpage,graphics]{preview}
\begin{document}
%\begin{centering}
\includegraphics{example-image-duck}\includegraphics[page=2]{example-image-duck}
%\end{centering}
\end{document}
So I have the following LaTex list, and many like it in a paper I'm translating:
\begin{enumerate}
\item If $\mathfrak{E}$ and $\mathfrak{B}$ with the arguments $x, y, z$ a solution of the Maxwell's equations (1), then through the components $\mathfrak{E}_x, \mathfrak{E}_y, \mathfrak{-E}_z, \mathfrak{-B}_x, \mathfrak{-B}_y, \mathfrak{B}_z$, with the arguments $x, y, z$ is given also an electromagnetic field that is a solution to Maxwell's equations.
\item If $\mathfrak{E, B}$ is the electromagnetic field of a planar electromagnetic wave radiation, then $\mathfrak{E}_x, \mathfrak{E}_y, \mathfrak{B}_z$ are symmetrical to the plane of the figure with $\mathfrak{E}_z, \mathfrak{B}_x, \mathfrak{B}_y$, with opposite values.
\item If $\mathfrak{E, B}$ a solution to Maxwell's equations (1), the following field is as well:
$$\mathfrak{E'} = \pm \sqrt{\frac{\mu}{\epsilon}} \mathfrak{B}, \mathfrak{B'} = \mp \sqrt{\frac{\epsilon}{\mu}} \mathfrak{E}$$
\end{enumerate}\par
It compiles to this:
There's a lot of dead space that should be taken up by text. How do I make the text wrap around the numbers?
PS. Also, I'm trying to add space between the equations. Simply putting more spaces didn't do it. Any pointers?
Strange how you want to save space in the enumeration yet add space between equations. I enjoy the current display. However, you can use a custom mylist which looks like an enumerate without alignment:
\documentclass{article}
\usepackage{showframe}% Just for this example
\usepackage{amsfonts}
\newenvironment{mylist}
{\setlength{\parindent}{0pt}% No paragraph indent
\setcounter{enumi}{0}% Restart enumeration at level 1 (i)
\renewcommand{\item}{\par\refstepcounter{enumi}%
\theenumi.~\ignorespaces}%
}{}
\begin{document}
\begin{enumerate}
\item
If~$\mathfrak{E}$ and~$\mathfrak{B}$ with the arguments~$x$, $y$,~$z$ a solution of the Maxwell's equations~(1),
then through the components~$\mathfrak{E}_x$, $\mathfrak{E}_y$, $\mathfrak{-E}_z$, $\mathfrak{-B}_x$,
$\mathfrak{-B}_y$,~$\mathfrak{B}_z$, with the arguments~$x$, $y$,~$z$ is given also an electromagnetic field
that is a solution to Maxwell's equations.
\item
If~$\mathfrak{E}$, $\mathfrak{B}$ is the electromagnetic field of a planar electromagnetic wave radiation,
then~$\mathfrak{E}_x$, $\mathfrak{E}_y$,~$\mathfrak{B}_z$ are symmetrical to the plane of the figure
with~$\mathfrak{E}_z$, $\mathfrak{B}_x$,~$\mathfrak{B}_y$, with opposite values.
\item
If~$\mathfrak{E}$, $\mathfrak{B}$ a solution to Maxwell's equations~(1), the following field is as well:
\[
\mathfrak{E'} = \pm \sqrt{\frac{\mu}{\epsilon}} \mathfrak{B}, \mathfrak{B'} =
\mp \sqrt{\frac{\epsilon}{\mu}} \mathfrak{E}
\]
\end{enumerate}
\begin{mylist}
\item
If~$\mathfrak{E}$ and~$\mathfrak{B}$ with the arguments~$x$, $y$,~$z$ a solution of the Maxwell's equations~(1),
then through the components~$\mathfrak{E}_x$, $\mathfrak{E}_y$, $\mathfrak{-E}_z$, $\mathfrak{-B}_x$,
$\mathfrak{-B}_y$,~$\mathfrak{B}_z$, with the arguments~$x$, $y$,~$z$ is given also an electromagnetic field
that is a solution to Maxwell's equations.
\item
If~$\mathfrak{E}$, $\mathfrak{B}$ is the electromagnetic field of a planar electromagnetic wave radiation,
then~$\mathfrak{E}_x$, $\mathfrak{E}_y$,~$\mathfrak{B}_z$ are symmetrical to the plane of the figure
with~$\mathfrak{E}_z$, $\mathfrak{B}_x$,~$\mathfrak{B}_y$, with opposite values.
\item
If~$\mathfrak{E}$, $\mathfrak{B}$ a solution to Maxwell's equations~(1), the following field is as well:
\[
\mathfrak{E'} = \pm \sqrt{\frac{\mu}{\epsilon}} \mathfrak{B}, \mathfrak{B'} =
\mp \sqrt{\frac{\epsilon}{\mu}} \mathfrak{E}
\]
\end{mylist}
\end{document}
For changing the spacing around display equations, see How can I decrease spaces between equations? Also see Why is \[ … \] preferable to $$ … $$?
How to compile a code using gcc, which performs loop tiling (Blocking) ? The -O3 optimization by default does not do loop tiling. I need to enable loop tiling in this flag and also, find out the tile factor. (E.g. cubic tiling or rectangular tiling) i.e. the internal tiling heuristics .
Thanks
You haven't provided the exact version of gcc, nor example code, nor result code, nor did you look hard enough at the internet, but possibly this already answers your question:
Strip mining is an optimization that has been introduced into gcc with the merge of the graphite branch in version 4.4. See also the manual:
-floop-strip-mine
Perform loop strip mining transformations on loops. Strip mining splits a loop into two nested loops. The outer loop has strides equal to the strip size and the inner loop has strides of the original loop within a strip. The strip length can be changed using the loop-block-tile-size parameter. For example, given a loop like:
DO I = 1, N
A(I) = A(I) + C
ENDDO
loop strip mining will transform the loop as if the user had written:
DO II = 1, N, 51
DO I = II, min (II + 50, N)
A(I) = A(I) + C
ENDDO
ENDDO
This optimization applies to all the languages supported by GCC and is not limited to Fortran. To use this code transformation, GCC has to be configured with --with-ppl and --with-cloog to enable the Graphite loop transformation infrastructure.
You may run man gcc | grep '\-floop\-strip\-mine' to check if that is a supported option. For the exact gcc version, type gcc --version.