ずれや間隔の問題を解決する方法

ずれや間隔の問題を解決する方法

私は数学と英語の両方を含む記事を書いています。以下のコードをご覧ください。

\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、2 番目の列は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}

関連情報