정렬 불량 및 간격 문제를 해결하는 방법

정렬 불량 및 간격 문제를 해결하는 방법

저는 수학과 영어를 모두 포함하는 기사를 쓰고 있습니다. 아래 내 코드를 참조하십시오.

\documentclass[11pt]{article}
\usepackage[T1]{fontenc}
\usepackage{graphicx}
\usepackage[tracking]{microtype}
\usepackage{color}
\usepackage[sc,osf]{mathpazo}   % With old-style figures and real smallcaps.
\linespread{1.025}              % Palatino leads a little more leading



\usepackage[margin=0.8cm]{geometry}% http://ctan.org/pkg/geometry
\usepackage{blindtext}

% Euler for math and numbers
\usepackage[euler-digits,small]{eulervm}
\AtBeginDocument{\renewcommand{\hbar}{\hslash}}


\usepackage{tabularx,lipsum,environ,amsmath,amssymb}

\makeatletter
\newcommand{\problemtitle}[1]{\gdef\@problemtitle{#1}}% Store problem title
\newcommand{\probleminput}[1]{\gdef\@probleminput{#1}}% Store problem input
\newcommand{\problemquestion}[1]{\gdef\@problemquestion{#1}}% Store problem question
\NewEnviron{problem}{
  \problemtitle{}\probleminput{}\problemquestion{}% Default input is empty
  \BODY% Parse input
  \par\addvspace{.5\baselineskip}
  \noindent
  \begin{tabularx}{\textwidth}{@{\hspace{\parindent}} l X c}
    \multicolumn{2}{@{\hspace{\parindent}}l}{\@problemtitle} \\% Title
    \textbf{Input:} & \@probleminput \\% Input
    \textbf{Question:} & \@problemquestion% Question
  \end{tabularx}
  \par\addvspace{.5\baselineskip}
}


\usepackage{ntheorem}

% No easy way of putting the theorem description in italics?
% It seems I need to define a new style...
\makeatletter
\newtheoremstyle{mystyle}% 
   {\item[\hskip\labelsep \theorem@headerfont ##1\ ##2\theorem@separator]}% 
   {\item[\hskip\labelsep \theorem@headerfont ##1\ ##2\ \textit{(##3)}\theorem@separator]}




\makeatother
\theoremstyle{mystyle}
\theoremheaderfont{\scshape}
\theorembodyfont{\upshape}

\newtheorem{theorem}{theorem}
\usepackage{amsmath}
\DeclareMathOperator{\Res}{Res}

\title{Computing Prime Set In  $\mathcal{O}(k)$ Time}
\author{She ssrma\\~\\ [email protected] \\~\\ IIdd Gandagar}

\date {Jan-2018}

\begin{document}
\maketitle

\textbf{Prime Set} \\
\textbf{Input : } An array $N$ such that $N[i] = i, 2\le i \le k-1$.\\
\textbf{Find : } $Q_{k-1} = \{p \in [k-1] \mid p \text { \hspace*{0.001cm} is \hspace*{0.001cm} prime}\}$ \\

컴파일된 문서는 다음과 같습니다.

여기에 이미지 설명을 입력하세요

질문 :잘못된 정렬(프라임 세트가 잘못 정렬됨)을 수정하는 방법과 $p$가 소수라고 쓴 곳에 공백 문제가 있습니까?

답변1

전용 2열 환경을 설정해야 한다고 생각합니다 tabular. 아래 예에서 첫 번째 열은 유형 l이고 두 번째 열은 p필요한 경우 줄 바꿈을 허용하는 유형입니다.

교체를 권장한다는 점도 확인하세요.

p \text { \hspace*{0.001cm} is \hspace*{0.001cm} prime}

~와 함께

\text{$p$ is prime}

좀 더 간단하지 않나요?

여기에 이미지 설명을 입력하세요

\documentclass[11pt]{article}
%% I've simplified the preamble to the bare essentials
\usepackage[T1]{fontenc}
\usepackage[tracking]{microtype}
\usepackage[margin=0.8cm]{geometry}
\usepackage{amsmath} % for "\text" macro

\usepackage{newpxtext,newpxmath} % 'mathpazo' is obsolete
\useosf  
\linespread{1.025} %Palatino needs a little more leading
\usepackage[euler-digits,small]{eulervm}
\AtBeginDocument{\renewcommand{\hbar}{\hslash}}

\begin{document}

\noindent
\begin{tabular}{@{}lp{12cm}@{}}
\multicolumn{2}{@{}l}{\textbf{Prime Set}}\\
\textbf{Input} & An array $N$ such that $N[i] = i$, $2\le i \le k-1$\\
\textbf{Find}  & $Q_{k-1} = \{\, p \in [k-1] \mid \text{$p$ is prime} \,\}$
\end{tabular}

\end{document}

관련 정보