我们如何在项目符号(itemize)内两边对齐文本(与 word 中的对齐相同)?

我们如何在项目符号(itemize)内两边对齐文本(与 word 中的对齐相同)?

这是我的确切代码和输出(见下图)。我正在为我的简历写这个。如果点内的文本在两侧对齐,它会看起来好得多。例如,如果您看到,在最后的单词“placerat”、“using”和“words”中,也没有在右侧对齐。(我只是在解释我所说的“Justify”的意思)我尝试过使用 \justifying 标签和 \justifying{...text...},但仍然没有效果。我已粘贴整个代码,以便您也可以在您的系统上运行它。另外要说的是,我使用 overleaf。

\documentclass[11pt, a4paper]{article}
\usepackage[utf8]{inputenc}
\usepackage[parfill]{parskip}
\usepackage{ragged2e}
\usepackage{fancyhdr}
\usepackage[headsep=0.5cm, headheight=2cm]{geometry}
\usepackage{xcolor}
\usepackage{amsmath}
\usepackage{array}
\usepackage{lipsum}
\usepackage{titlesec}
\usepackage{tabularx}
\usepackage{enumitem}

\definecolor{ultrablue}{RGB}{0,0,130}
\geometry{top=10mm, left = 14.11mm, right=14.11mm, bottom = 6.4mm}
% \pagestyle{} 
% \fancyhf{}

\begin{document}

\section*{\Large\textcolor{ultrablue}{KEY PROJECTS }\hrulefill}
\vspace{-0.5em}
\textbf{Justifying the texts } $\vert$ \textbf{Summer Research Project}
\raggedleft \hfill \textit{(Jun'22 - Present)}\RaggedRight\\
\textit{Prof. ABCD XYZW} $\vert$ \textit{XYZ Dept.} 
\vspace{-0.25em}
\begin{itemize}[leftmargin = *,label=\raisebox{0.25ex}{\tiny$\bullet$}]
    \item Lorem ipsum dolor sit amet, placerat, consectetuer adipiscing elit. Ut purus elit, vestibulum ut, placerat ac, adipiscing vitae, felis. Curabitur dictum gravida mauris. Nam 
    \vspace{-0.4em}
    \item \justifying This is a nice text and I hope to fit it in the justified format, but it is somehow not working inspite of using 'justifed' tag
    \vspace{-0.4em}
    \item This is comparatively a shorter sentence but I want it to align by just adding some spaces between words
    \vspace{-0.4em}
    \item \justifying{This text is written inside 'justifying' tag but still as it is visible, it has no effect on the alignment, even if I have used "justifying"}
\end{itemize}


\end{document}

在此处输入图片描述

另外,你知道为什么水平线(在关键项目之后)没有走到最后,而是停在中间吗?

答案1

您正在将其应用于\RaggedRight第一行之后的整个文档。

在此处输入图片描述

\documentclass[11pt, a4paper]{article}
\usepackage[utf8]{inputenc}
\usepackage[parfill]{parskip}
\usepackage{ragged2e}
\usepackage{fancyhdr}
\usepackage[headsep=0.5cm, headheight=2cm]{geometry}
\usepackage{xcolor}
\usepackage{amsmath}
\usepackage{array}
\usepackage{lipsum}
\usepackage{titlesec}
\usepackage{tabularx}
\usepackage{enumitem}

\definecolor{ultrablue}{RGB}{0,0,130}
\geometry{top=10mm, left = 14.11mm, right=14.11mm, bottom = 6.4mm}
% \pagestyle{} 
% \fancyhf{}

\begin{document}

\section*{\Large\textcolor{ultrablue}{KEY PROJECTS }\hrulefill\parfillskip=0pt }

\textbf{Justifying the texts } $\vert$ \textbf{Summer Research Project}
\hfill \textit{(Jun'22 - Present)}\\
\textit{Prof. ABCD XYZW} $\vert$ \textit{XYZ Dept.} 


\begin{itemize}[leftmargin = *,label=\raisebox{0.25ex}{\tiny$\bullet$}]
    \item Lorem ipsum dolor sit amet, placerat, consectetuer adipiscing elit. Ut purus elit, vestibulum ut, placerat ac, adipiscing vitae, felis. Curabitur dictum gravida mauris. Nam 

    \item This is a nice text and I hope to fit it in the justified format, but it is somehow not working inspite of using 'justifed' tag
    \item This is comparatively a shorter sentence but I want it to align by just adding some spaces between words

    \item This text is written inside 'justifying' tag but still as it is visible, it has no effect on the alignment, even if I have used "justifying"
\end{itemize}


\end{document}

相关内容