요소를 추출하는 방법?

요소를 추출하는 방법?

다음 질문에 대한 정답을 찾을 수 없습니다.

유한한 벡터가 있는 경우 (a_{1},a_{2},...,a_{n})여기서 요소를 추출하는 방법은 무엇입니까 a_{5}?

좀 더 명확하게 말하자면, mathematica에는 list={1,5,8,6,9}, list[3]=8, list[5]=9가 있는 list와 유사한 것이 필요합니다.

벡터는 하나의 객체에 다양한 정보가 포함되어 있음을 표현하는 수학 용어입니다.

예를 들어 코드를 받아

\documentclass{article}
\usepackage{tikz}
\makeatletter
\newcommand{\gettikzxy}[3]{%
  \tikz@scan@one@point\pgfutil@firstofone#1\relax
  \edef#2{\the\pgf@x}%
  \edef#3{\the\pgf@y}%
}
\makeatother
\begin{document}
\begin{tikzpicture}
\def \A {(1,1)};
\draw \A -- (8,8);
\gettikzxy{\A}{\ax}{\ay}
\def \A {(1,1)};
\draw (\ax+10cm,\ay-5) -- (8,8);
\end{tikzpicture}
\end{document}

"A 지점에서 좌표를 추출"하여 이를 조작할 수 있지만 더 많은 "요소"에 대해 작업하려면 더 일반화된 형식이 필요합니다.

답변1

listofitems요청한 구문을 사용하더라도 패키지가 수행하는 작업 은 다음과 같습니다 . 목록 구분 기호도 변경할 수 있습니다(기본값은 쉼표). 와 같은 목록의 요소는 \mylist[4]완전히 확장 가능합니다(두 개의 확장은 목록 요소의 토큰을 검색합니다).

\documentclass{article}
\usepackage{listofitems}
\begin{document}
\readlist\mylist{1,5,8,6,9}
The third element is \mylist[3] and the 5th element is \mylist[5].
\end{document}

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

관련 정보