环境中的右对齐文本minipage
太靠右;我怎样才能将其对齐到右侧但保持在边界内,以便它不会比下方更靠右\rule
。
代码
% Define document class, font size
\documentclass[9pt]{extarticle}
% Tweak page margins
% Set left and right margin and compute the remaining ones
% https://www.sharelatex.com/learn/Page_size_and_margins#!#Paper_size.2C_orientation_and_margins
\usepackage{geometry}
\geometry{
a4paper,
total={170mm,257mm},
left=20mm,
top=20mm}
% --
% Disable paragraph indentation
\setlength{\parindent}{0pt}
% Multicolumn section
\usepackage{multicol}
% Do not show the section numbers
\setcounter{secnumdepth}{0}
% Load xcolor package and define colours
\usepackage{xcolor}
% \definecolor{darkcerulean}{rgb}{0.03, 0.27, 0.49}
\definecolor{linkcolour}{rgb}{0.0, 0.2, 0.4}
% --
% Define PDF metadata and link colours
\usepackage[pdfauthor={person},
pdfcreator={vim},
colorlinks={true}, % colour hyperlinks according to settings
allcolors={linkcolour}
]{hyperref}
% --
\begin{document}
% Place details side-by-side using minipage placeholder
% https://tex.stackexchange.com/a/157246/123504
% Minipage with
\begin{minipage}{.5\textwidth}
{\Large\textbf{A} \par}
text $\cdot$ text $\cdot$ text $\cdot$ text \\
text
\end{minipage}
\hspace{0.5cm}
% Another minipage
\begin{minipage}{.5\textwidth}
\begin{flushright}
\textit{A} \href{https://www.google.com/}{This is too far to the right}
\end{flushright}
\end{minipage}
% Draw rule spanning the text width
% Add space (https://tex.stackexchange.com/a/74354/123504)
\enspace
\rule{\textwidth}{1pt}
% Summary section
\section{Summary}
% Multi-column summary section
\begin{multicols}{2}
This will be in a new column, here is some text without a meaning. This text
should show what a printed text will look like at this place.
If you read this text, you will get no information. Really? Is there
no information? Is there...
\end{multicols}
% Other section
\section{Something}
\end{document}
预览
答案1
考虑\hspace{0.5cm}
两个小页面之间的,并%
在行尾添加,以防止一些不需要的\space
,如下所示:
\begin{minipage}{.5\textwidth}
{\Large\textbf{A} \par}
text $\cdot$ text $\cdot$ text $\cdot$ text \\
text
\end{minipage}%
\hspace{0.5cm}%
% Another minipage
\begin{minipage}{\dimexpr.5\textwidth-0.5cm}
\begin{flushright}
\textit{A} \href{https://www.google.com/}{This is too far to the right}
\end{flushright}
\end{minipage}