如何将此小页面向右移动0.2厘米?

如何将此小页面向右移动0.2厘米?

我找到了一些方法来对齐垂直对齐,但不是水平对齐。代码

\documentclass{article}  
\usepackage{xparse}
\usepackage{graphicx}   

% http://tex.stackexchange.com/a/88624/13173
\newsavebox{\fminipagebox}
\NewDocumentEnvironment{fminipage}{m O{\fboxsep}}
 {\par\kern#2\noindent\begin{lrbox}{\fminipagebox}
  \begin{minipage}{#1}\ignorespaces}
 {\end{minipage}\end{lrbox}%
  \makebox[#1]{%
    \kern\dimexpr-\fboxsep-\fboxrule\relax
    \fbox{\usebox{\fminipagebox}}%
    \kern\dimexpr-\fboxsep-\fboxrule\relax
  }\par\kern#2
 }

\begin{document}       
\begin{fminipage}{16em}%\textwidth}
{\small
Seller: \textbf{Student A. Masi} \\
\\
Date: 30.9.2016 \\
Local food store 
}
\end{fminipage}
\end{document}

方法测试失败

  • 拥有raiseboxhfill

    % http://tex.stackexchange.com/q/16937/13173
    % these not working when applied with \width etc:
    %\raisebox{-.5\height}
    %\hfill
    

操作系统:Debian 8.5 64 位
Texlive:2016
硬件:Asus Zenbook UX303UA

答案1

一个简单的修改(您所引用的答案中的代码是为了使框的边框粘在边缘):

\documentclass{article}  
\usepackage{xparse}

% load showframe just to show where the box borders are
\usepackage{showframe}

\newsavebox{\fminipagebox}
\NewDocumentEnvironment{fminipage}{m O{\fboxsep}}
 {\par\kern#2\noindent\begin{lrbox}{\fminipagebox}
  \begin{minipage}{\dimexpr#1-2\fboxsep-2\fboxrule}\ignorespaces}
 {\end{minipage}\end{lrbox}%
  \fbox{\usebox{\fminipagebox}}%
  \par\kern#2 }

\begin{document}       
\begin{fminipage}{16em}
\small
Seller: \textbf{Student A. Masi}

\bigskip

Date: 30.9.2016 \\
Local food store 
\end{fminipage}

\begin{fminipage}{\textwidth}
\small
Seller: \textbf{Student A. Masi}

\bigskip

Date: 30.9.2016 \\
Local food store 
\end{fminipage}

\end{document}

输出showframe

在此处输入图片描述

输出无showframe

在此处输入图片描述

答案2

虽然不漂亮,但是确实有效......

\documentclass{article}   
\usepackage{graphicx}   
\usepackage{xparse}
% http://tex.stackexchange.com/a/88624/13173
\newsavebox{\fminipagebox}
\NewDocumentEnvironment{fminipage}{m O{\fboxsep}}
 {\par\kern#2\noindent\begin{lrbox}{\fminipagebox}
  \begin{minipage}{#1}\ignorespaces}
 {\end{minipage}\end{lrbox}%
  \makebox[#1]{%
    \kern\dimexpr-\fboxsep-\fboxrule\relax
    \fbox{\usebox{\fminipagebox}}%
    \kern\dimexpr-\fboxsep-\fboxrule\relax
  }\par\kern#2
 }
\newsavebox{\ugh}


\begin{document}       
\begin{fminipage}{16em}%\textwidth}
{\small
Seller: \textbf{Student A. Masi} \\
\\
Date: 30.9.2016 \\
Local food store 
}
\end{fminipage}

\savebox{\ugh}{%
\begin{fminipage}{16em}%\textwidth}
    {\small
        Seller: \textbf{Student A. Masi} \\
        \\
        Date: 30.9.2016 \\
        Local food store 
    }
\end{fminipage}}

\noindent\hspace*{0mm}\usebox{\ugh}

\begin{minipage}{16em}
    {\small
        Seller: \textbf{Student A. Masi} \\
        \\
        Date: 30.9.2016 \\
        Local food store 
    }
\end{minipage}

\hspace{2mm}\begin{minipage}{16em}
    {\small
        Seller: \textbf{Student A. Masi} \\
        \\
        Date: 30.9.2016 \\
        Local food store 
    }
\end{minipage}
\end{document}

相关内容