How do I vertically center the (web, email, email, mobile) field right to the QR-code?
\documentclass[11pt,a4paper]{memoir}
\setstocksize{55mm}{85mm} % UK Stock size
\setpagecc{55mm}{85mm}{*}
\settypeblocksize{45mm}{75mm}{*}
\setulmargins{5mm}{*}{*}
\setlrmargins{5mm}{*}{*}
\usepackage{xcolor}
\setheadfoot{0.1pt}{0.1pt}
\setheaderspaces{1pt}{*}{*}
\usepackage{fontspec}
\checkandfixthelayout[fixed]
\pagestyle{empty}
\usepackage{pstricks}
\usepackage{auto-pst-pdf,pst-barcode}
\begin{document}
\begin{Spacing}{0.75}%
\noindent
\textbf{Helena Doe}\\
\tiny subtitle \hfill {\color{gray}Division / Employer}\\
\rule{74mm}{.3mm}\\
\begin{minipage}[t]{33mm}
\vspace{-0mm}%
\begin{pspicture}(25mm,25mm)
% The MECARD format is used to exchange contact information. More information at:
% http://www.nttdocomo.co.jp/english/service/imode/make/content/barcode/function/application/addressbook/index.html
\psbarcode{MECARD:N:Last name, First Name;URL:https://fqdn;EMAIL:helena#univ.edu;NOTE:GPG: ;;}{eclevel=L width=1 height=1}{qrcode}
\end{pspicture}
\end{minipage}
\hspace{1mm}
\begin{minipage}[t]{42mm}
\vspace{-0mm}%
\begin{flushleft}
{\scriptsize
\begin{Spacing}{1}%
% \textbf{Job Title}\\
% \hspace{5mm}Speciality 1\\
% \hspace{5mm}Speciality 2\\
% \hspace{5mm}Speciality 3 \vspace{2mm}\\
\end{Spacing}
}
{\tiny
\begin{tabular}{rl}
{\color{gray}web} & https://fqdn/\\
{\color{gray}email} & helena#univ.edu\\
{\color{gray}email} & hxr42#gmail.com\\
{\color{gray}mobile} & +1 123 456 7890\\
\end{tabular}
\vspace*{2mm}
}
\end{flushleft}
\end{minipage}
\rule{74mm}{0mm}\\
\texttt{\fontsize{2.84mm}{3.55mm}\selectfont 425B 030A B8D2 0316 CA1B 4709 CA83 5DDA EC31 CA56} % GPG KEY ID
\end{Spacing}
\end{document}
I tried
\vapce*{\fill}
but this does not work. And I tried some other things, which failed all.
Has anybody an idea?
For compelation I u xelatex!
Okay, I need some more details, sorry, but I have said everything about this problem, this is really annoying.
complexinfinity
minipage allows to specify the height with an optional argument. If this option is set, the text can be centred with the c key:
% !TeX TS-program = xelatex
\documentclass[11pt,a4paper]{memoir}
\setstocksize{55mm}{85mm} % UK Stock size
\setpagecc{55mm}{85mm}{*}
\settypeblocksize{45mm}{75mm}{*}
\setulmargins{5mm}{*}{*}
\setlrmargins{5mm}{*}{*}
\usepackage{xcolor}
\setheadfoot{0.1pt}{0.1pt}
\setheaderspaces{1pt}{*}{*}
\usepackage{fontspec}
\checkandfixthelayout[fixed]
\pagestyle{empty}
\usepackage{pstricks}
\usepackage{auto-pst-pdf,pst-barcode}
\begin{document}
\begin{Spacing}{0.75}%
\noindent
\textbf{Helena Doe}\\
\tiny subtitle \hfill {\color{gray}Division / Employer}\\
\rule{74mm}{.3mm}\\
\begin{minipage}[t]{33mm}
\vspace{-0mm}%
\begin{pspicture}(25mm,25mm)
% The MECARD format is used to exchange contact information. More information at:
% http://www.nttdocomo.co.jp/english/service/imode/make/content/barcode/function/application/addressbook/index.html
\psbarcode{MECARD:N:Last name, First Name;URL:https://fqdn;EMAIL:helena#univ.edu;NOTE:GPG: ;;}{eclevel=L width=1 height=1}{qrcode}
\end{pspicture}
\end{minipage}
\hspace{1mm}
\begin{minipage}[t][24mm][c]{42mm}
\tiny
\begin{tabular}{rl}
{\color{gray}web} & https://fqdn/\\
{\color{gray}email} & helena#univ.edu\\
{\color{gray}email} & hxr42#gmail.com\\
{\color{gray}mobile} & +1 123 456 7890\\
\end{tabular}
\end{minipage}
\rule{74mm}{0mm}\\
\texttt{\fontsize{2.84mm}{3.55mm}\selectfont 425B 030A B8D2 0316 CA1B 4709 CA83 5DDA EC31 CA56} % GPG KEY ID
\end{Spacing}
\end{document}
Related
This code :
\begin{minipage}{0.4\textwidth}
\begin{flushleft}
\large
\textit{Author}\\
B.J. \textsc{Blazkowicz} % Your name
\end{flushleft}
\end{minipage}
~% THIS IS WHAT I NEED TO KNOW
\begin{minipage}{0.4\textwidth}
\begin{flushright}
\large
\textit{Supervisor}\\
Dr. Caroline \textsc{Becker} % Supervisor's name
\end{flushright}
\end{minipage}
produces
And this code
...
B.J. \textsc{Blazkowicz} % Your name
\end{flushleft}
\end{minipage}
~% THIS IS WHAT I NEED TO KNOW
\begin{minipage}{0.4\textwidth}
\begin{flushright}
\large
...
produces
How does that work? Does it like lock the minipages to the borders?
I am having a problem with an appendix title. I have a main.tex file, and several .tex files (one for each section) that are then included in the main.tex file through \input{namefile.tex} command.
However, the appendix section has a problem: the title of the appendix goes under the first three tables that are inside it (all the table contents are hidden):
The code of the main.tex file is as follows:
\documentclass[a4paper,fleqn]{cas-sc}
\UseRawInputEncoding
\usepackage[authoryear,longnamesfirst]{natbib}
% Needed for subfigures
\usepackage{subcaption}
% Needed for better tables
\usepackage{tabularx}
\newcolumntype{g}{X} % big column
\newcolumntype{s}{>{\hsize=.5\hsize}X} % small column
\newcolumntype{Y}{>{\centering\arraybackslash}X} % centered column in tabularx environment
\usepackage{enumitem}
%%%Author macros
\def\tsc#1{\csdef{#1}{\textsc{\lowercase{#1}}\xspace}}
\tsc{WGM}
\tsc{QE}
%%%
\begin{document}
\let\WriteBookmarks\relax
\def\floatpagepagefraction{1}
\def\textpagefraction{.001}
% Short title
\shorttitle{shorttitle}
% Short author
\shortauthors{anonymous}
% Main title of the paper
\title[mode=title]{maintitle}
% Address/affiliation
\affiliation[aff]{organization={org},
%addressline={},
city={city},
% citysep={}, % Uncomment if no comma needed between city and postcode
postcode={pk},
%state={st},
country={c}
}
% First author
%
% Options: Use if required
%\author[<aff no>]{<author name>}[<options>]
\author[aff]{anonymous}[type=editor]
% Corresponding author indication
\cormark[1]
% Footnote of the first author
%\fnmark[1]
% Email id of the author
\ead{mail}
% Corresponding author text
\cortext[1]{Corresponding author}
\begin{abstract}
Abstract
\end{abstract}
% Keywords
% Each keyword is separated by \sep
\begin{keywords}
kw1 \sep kw2
\end{keywords}
\maketitle
%*************************************************************
% Mainmatter
%*************************************************************
%\input{sections/01}
%\input{sections/02}
%\input{sections/03}
%\input{sections/04}
%% Loading bibliography style file
\bibliographystyle{cas-model2-names}
% Loading bibliography database
\bibliography{bibliography.bib}
\clearpage
%% The Appendices part is started with the command \appendix;
%% appendix sections are then done as normal sections
\appendix
\include{sections/appendix}
\end{document}
While the appendix.tex code is as follows (at the beginning):
\section{Tables and Numerical Results}
\label{app:tables-results}
% Number the appendix tables as A.1, A.2, ...
\setcounter{table}{0}
\renewcommand{\thetable}{A.\arabic{table}}
\begin{table}[ht]
\centering
\renewcommand{\arraystretch}{1.5}
\begin{tabularx}{\columnwidth}{XYY}
\hline
&&\\
\hline
&&\\
&&\\
&&\\
&&\\
&&\\
&&\\
&&\\
&&\\
&&\\
\hline
\end{tabularx}
\caption{caption}
\label{tab}
\end{table}
All the other tables are pretty much the same.
I have already tried in changing the [ht] option of the table, by using both [h] and [h!], but without any result.
The class you are using defines tables and figures in such a way that their default position is only at the top of the page. You can hack the code like this:
\documentclass[a4paper,fleqn,draft]{cas-sc}
\usepackage[authoryear,longnamesfirst]{natbib}
\ExplSyntaxOn
\cs_set:Npn \__reset_tbl:
{
\tl_set:Nx \l_tbl_pos_tl { h }
\tl_set:Nx \l_tbl_cols_tl { 1 }
\tl_set:Nn \l_tbl_align_tl { \centering }
\skip_set:Nn \l_tbl_abovecap_skip { 6pt }
\skip_set:Nn \l_tbl_belowcap_skip { 0pt }
\skip_set:Nn \l_tbl_abovetbl_skip { 6pt }
\skip_set:Nn \l_tbl_belowtbl_skip { 6pt }
}
\ExplSyntaxOff
\begin{document}
\section{Tables and Numerical Results}
\label{app:tables-results}
\begin{table}[htbp]
\caption{caption}
\label{tab}
\end{table}
text
\end{document}
I have a tex-file obtained originally from RStudio with bookdown. The original set of Rmd-files were deleted by accident.
So I need to convert below minimized correct tex-file to Word (docx file extension):
% Options for packages loaded elsewhere
\PassOptionsToPackage{unicode}{hyperref}
\PassOptionsToPackage{hyphens}{url}
%
\documentclass[
]{article}
\usepackage{amsmath,amssymb}
\usepackage{lmodern}
\usepackage{iftex}
\ifPDFTeX
\usepackage[T1]{fontenc}
\usepackage[utf8]{inputenc}
\usepackage{textcomp} % provide euro and other symbols
\else % if luatex or xetex
\usepackage{unicode-math}
\defaultfontfeatures{Scale=MatchLowercase}
\defaultfontfeatures[\rmfamily]{Ligatures=TeX,Scale=1}
\fi
% Use upquote if available, for straight quotes in verbatim environments
\IfFileExists{upquote.sty}{\usepackage{upquote}}{}
\IfFileExists{microtype.sty}{% use microtype if available
\usepackage[]{microtype}
\UseMicrotypeSet[protrusion]{basicmath} % disable protrusion for tt fonts
}{}
\makeatletter
\#ifundefined{KOMAClassName}{% if non-KOMA class
\IfFileExists{parskip.sty}{%
\usepackage{parskip}
}{% else
\setlength{\parindent}{0pt}
\setlength{\parskip}{6pt plus 2pt minus 1pt}}
}{% if KOMA class
\KOMAoptions{parskip=half}}
\makeatother
\usepackage{xcolor}
\IfFileExists{xurl.sty}{\usepackage{xurl}}{} % add URL line breaks if available
\IfFileExists{bookmark.sty}{\usepackage{bookmark}}{\usepackage{hyperref}}
\hypersetup{
pdftitle={Simple document},
hidelinks,
pdfcreator={LaTeX via pandoc}}
\urlstyle{same} % disable monospaced font for URLs
\usepackage[margin=1in]{geometry}
\usepackage{longtable,booktabs,array}
\usepackage{calc} % for calculating minipage widths
% Correct order of tables after \paragraph or \subparagraph
\usepackage{etoolbox}
\makeatletter
\patchcmd\longtable{\par}{\if#noskipsec\mbox{}\fi\par}{}{}
\makeatother
% Allow footnotes in longtable head/foot
\IfFileExists{footnotehyper.sty}{\usepackage{footnotehyper}}{\usepackage{footnote}}
\makesavenoteenv{longtable}
\usepackage{graphicx}
\makeatletter
\def\maxwidth{\ifdim\Gin#nat#width>\linewidth\linewidth\else\Gin#nat#width\fi}
\def\maxheight{\ifdim\Gin#nat#height>\textheight\textheight\else\Gin#nat#height\fi}
\makeatother
% Scale images if necessary, so that they will not overflow the page
% margins by default, and it is still possible to overwrite the defaults
% using explicit options in \includegraphics[width, height, ...]{}
\setkeys{Gin}{width=\maxwidth,height=\maxheight,keepaspectratio}
% Set default figure placement to htbp
\makeatletter
\def\fps#figure{htbp}
\makeatother
\usepackage[normalem]{ulem}
% Avoid problems with \sout in headers with hyperref
\pdfstringdefDisableCommands{\renewcommand{\sout}{}}
\setlength{\emergencystretch}{3em} % prevent overfull lines
\providecommand{\tightlist}{%
\setlength{\itemsep}{0pt}\setlength{\parskip}{0pt}}
\setcounter{secnumdepth}{5}
\ifLuaTeX
\usepackage{selnolig} % disable illegal ligatures
\fi
\usepackage[]{biblatex}
\addbibresource{bibliography.bib}
\title{Simple document}
\author{}
\date{\vspace{-2.5em}}
\usepackage{amsthm}
\newtheorem{theorem}{Theorem}[section]
\newtheorem{lemma}{Lemma}[section]
\newtheorem{corollary}{Corollary}[section]
\newtheorem{proposition}{Proposition}[section]
\newtheorem{conjecture}{Conjecture}[section]
\theoremstyle{definition}
\newtheorem{definition}{Definition}[section]
\theoremstyle{definition}
\newtheorem{example}{Example}[section]
\theoremstyle{definition}
\newtheorem{exercise}{Exercise}[section]
\theoremstyle{remark}
\newtheorem*{remark}{Remark}
\newtheorem*{solution}{Solution}
\begin{document}
\maketitle
{
\setcounter{tocdepth}{2}
\tableofcontents
}
\hypertarget{format}{%
\section{Format}\label{format}}
Read \ref{format} for details.
Or read \protect\hyperlink{format}{format}.
Formatting:
\begin{itemize}
\tightlist
\item
sup-script or power - x\textsuperscript{2} ;
\item
sub-script - y\textsubscript{3} ;
\item
strike through - \sout{strike through} ;
\item
term -- definition ;
\item
long term --- long definition .
\end{itemize}
Here comes \textbf{footnote} \footnote{Footnote text} with its contents.
Image with caption, see \ref{fig:image}.
\begin{figure}
\centering
\includegraphics{image.png}
\caption{\label{fig:image} Image}
\end{figure}
Labeled table is below, see table \ref{tab:table}.
\begin{longtable}[]{#{}ll#{}}
\caption{\label{tab:table}\\
My table}\tabularnewline
\toprule
\textbf{Col 1 header} & \textbf{Col 2 header} \\
\midrule
\endfirsthead
\endhead
r1c1 & r1c2 \\
r2c1 & r2c2 \\
\bottomrule
\end{longtable}
Inline: \(a^2 + b^2 = c^2\).
Block:
\[ E = \frac{mc^2}{\sqrt{1-\frac{v^2}{c^2}}} \]
Labeled, see \eqref{eq:eq}:
\begin{equation}
f\left(k\right) =\binom{n}{k} p^k\left(1-p\right)^{n k}
\label{eq:eq}
\end{equation}
See LaTeX \autocite{latex} site for details.
Code is below, see \ref{exm:code}:
\begin{example}
\protect\hypertarget{exm:code}{}{\label{exm:code} }Hello world
\end{example}
\begin{verbatim}
int main(){
return 0;
}
\end{verbatim}
\hypertarget{references}{%
\section*{References}\label{references}}
\addcontentsline{toc}{section}{References}
\printbibliography
\end{document}
When I try to convert it to docx using pandoc (2.16.1 version) command below:
pandoc simple.tex --to docx+native_numbering --output simple.docx --table-of-contents --toc-depth 5 --number-sections --citeproc --verbose --csl ieee.csl
(In the above command ieee.csl was downloaded from Zotero).
I get
and I see many strange things:
[fig:image] along with Figure with number;
[tab:table] along with Table with number;
[eq:eq] instead of equation number;
[exm:code] instead of example number.
Is it possible to replace (or suppress them for Figure and Table) above strange […] fields by correct numbers and links using Pandoc to get correct docx output?
This is currently not supported by plain pandoc, but you can use filters to get the numbering back. E.g., the resolve-references.lua filter in the OpenJournals "Inara" project does something comparable. You may have to adjust and extend it to fully suit your requirements.
I was trying to reposition my table a bit left to the page, so I try \hskip -2cm or \hspace{-2cm} But non of these can move the table and here is my code:
\documentclass{article}
\usepackage[utf8]{inputenc}
\usepackage{float}
\usepackage{array}
\usepackage{booktabs,caption}
\usepackage[flushleft]{threeparttable}
\usepackage{indentfirst}
\setlength\extrarowheight{2pt}
\title{}
\author{}
\begin{document}
\maketitle
\section{Introduction}
\section{Data Summary}
\begin{table}[H]
\begin{threeparttable}
\small
\def\sym#1{\ifmmode^{#1}\else\(^{#1}\)\fi}
\hskip -2cm
\caption{Summary of numeric variables}
\begin{tabular}{l*{1}{ccccc}}
\hline\hline
&\multicolumn{5}{c}{(1)} \\
&\multicolumn{5}{c}{} \\
& count& mean& sd& min& max\\
\hline
Unemployment Rate & 170& 8.3323& 4.1395& 3.1000& 26.0919\\
log of spending per person for secondary education& 168& 9.0229& 0.4344& 7.6109& 9.9616\\
log of spending per person for teriary education& 165& 9.5241& 0.3967& 8.7797& 10.7478\\
log of exchange rate& 170& 1.0983& 2.0997& -0.4986& 7.0522\\
log of GDP per person& 168& 10.5306& 0.3592& 9.7330& 11.5213\\
log of GDP fixed purchasing power& 165& 27.0045& 1.4905& 23.3668& 30.5051\\
log of GDP growth & 159& 1.2268& 0.7896& -1.7458& 3.0063\\
Long-term interest rate on government bonds& 165& 3.8447& 2.1387& 0.5511& 10.5465\\
Short-term interest rate& 170& 1.7675& 1.9971& 0.0078& 10.3317\\
\hline\hline
\end{tabular}
\begin{tablenotes}
\small
\item Source: OECD (2019), Education at a Glance Database, http://stats.oecd.org
\end{tablenotes}
\end{threeparttable}
\end{table}
\section{Methodology}
\end{document}
and my table looks like this:
and I want to make my table left about a least 1.5cm.
Is there other way to do this?
Having your table project into the margin is not a good style for a layout that is not specifically designed to have additional space in the margins for this. The margin should belong to the reader to easily hold your document, adding notes etc. If there is not enough space things like Fermat's Last Theorem are your fault :)
Instead I suggest to use a tabularx to fit the table into the available space:
\documentclass{article}
\usepackage[utf8]{inputenc}
\usepackage{float}
\usepackage{array}
\usepackage{booktabs,caption}
\usepackage[flushleft]{threeparttable}
\usepackage{indentfirst}
\setlength\extrarowheight{2pt}
\usepackage{tabularx}
\usepackage{siunitx}
\title{}
\author{}
\begin{document}
\maketitle
\section{Introduction}
\section{Data Summary}
\begin{table}[H]
\begin{threeparttable}
\small
\def\sym#1{\ifmmode^{#1}\else\(^{#1}\)\fi}
\hskip -2cm
\caption{Summary of numeric variables}
\begin{tabularx}{\linewidth}{#{}XS[table-format=3.0]S[table-format=2.4]S[table-format=1.4]S[table-format=-1.4]S[table-format=2.4]#{}}
\toprule
&\multicolumn{5}{c}{(1)} \\\addlinespace
& {count}& {mean}& {sd}& {min}& {max}\\
\midrule
Unemployment Rate & 170& 8.3323& 4.1395& 3.1000& 26.0919\\
log of spending per person for secondary education& 168& 9.0229& 0.4344& 7.6109& 9.9616\\
log of spending per person for teriary education& 165& 9.5241& 0.3967& 8.7797& 10.7478\\
log of exchange rate& 170& 1.0983& 2.0997& -0.4986& 7.0522\\
log of GDP per person& 168& 10.5306& 0.3592& 9.7330& 11.5213\\
log of GDP fixed purchasing power& 165& 27.0045& 1.4905& 23.3668& 30.5051\\
log of GDP growth & 159& 1.2268& 0.7896& -1.7458& 3.0063\\
Long-term interest rate on government bonds& 165& 3.8447& 2.1387& 0.5511& 10.5465\\
Short-term interest rate& 170& 1.7675& 1.9971& 0.0078& 10.3317\\
\bottomrule
\end{tabularx}
\begin{tablenotes}
\small
\item Source: OECD (2019), Education at a Glance Database, http://stats.oecd.org
\end{tablenotes}
\end{threeparttable}
\end{table}
\section{Methodology}
\end{document}
Some other comments:
Try to avoid [H], this is usually a guaranty for bad suboptimal placement of floats. I suggest [htbp] instead
*{1}{ccccc} can be shorted to either ccccc or *{5}{c}
You already load the booktabs package, so I suggest to use \toprule, \midrule and \bottomrule instead of \hline because they have much better spacing around them
instead of manually adding empty lines in the table, I suggest the \addlinespace macro from the booktabs package
With the S column from the siunitx package you can align the numbers by their decimal marker and use actual minus signs instead of cheating with hyphens
you should check the significant figures of your values. If your standard deviation is between 0.3 and 4.1, it makes no sense to give the values with 4 decimal places.
I try to define a table as a new environment.
\newenvironment{scaledtable}[1]{%
\begin{table}[h]
\caption{xxx}
\label{tab:xxx}
\begin{center}
\begin{tabular}{rcrrrrrrrrrrrrcc}
}{
\hline
\end{tabular}
\end{center}
\end{table}}
The problem I have is that I can't use scalebox{}. If I put the closing bracket into the end definition of the environment, latex can't assign the brackets anymore. I also can not use PStricks because of pdflatex.
Use \lrbox to temporarily store the table, then scale it
\newsavebox{\scaledtablebox}
\newcommand*{\scaledtablefactor}{1}
\newenvironment{scaledtable}[1]{%
\renewcommand*{\scaledtablefactor}{#1}%
\begin{table}[h]%
\caption{xxx}%
\label{tab:xxx}%
%
\begin{lrbox}{\scaledtablebox}%
\begin{tabular}{ll}%
}{%
\hline%
\end{tabular}%
\end{lrbox}%
%
\begin{center}%
\scalebox{\scaledtablefactor}{\usebox{\scaledtablebox}}%
\end{center}%
\end{table}%
}
Works like this (0.5 is the scale factor):
\begin{scaledtable}{0.5}
Hello & World! \\
\end{scaledtable}