datatool을 통해 처리할 때 CSV의 특수 문자를 다른 문자에 매핑하는 방법

datatool을 통해 처리할 때 CSV의 특수 문자를 다른 문자에 매핑하는 방법

그만큼datatool 사용자 설명서데이터베이스를 로드할 때 특정 특수 문자가 해당 조판 문자에 자동으로 매핑된다는 점을 언급합니다.날것의모드(를 통해 \DTLloadrawdb). 매핑을 변경하려면 (예를 들어)

\DTLrawmap{£}{\pounds}

그런데 어떻게 지도를 작성하나요?활동적인%, $, &, , ... 같은 문자를 _다른 것으로 변환하시겠습니까? 다음 최소 예제는 (명백한 이유로 활성 주석 문자임) %이외의 항목에 매핑하지 못합니다.\%%

\documentclass{article}

\usepackage{filecontents,datatool}
\begin{filecontents*}{scores.csv}
Name, Score
Alpha, 80.2%
Beta, 91.3%
Average, 85.75%
\end{filecontents*}

\begin{document}

\DTLrawmap{%}{\$}% <--- this fails...
\DTLloadrawdb{scores}{scores.csv}
\DTLdisplaydb{scores}

\end{document}

답변1

사용탈출하다<string>부분의 캐릭터 버전입니다 \DTLrawmap{<string>}{<replacement>}. 예를 들어,

\DTLrawmap{\%}{\$}

%소스 CSV를 다음으로 대체합니다 \$.

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

\documentclass{article}

\usepackage{filecontents,datatool}
\begin{filecontents*}{scores.csv}
Name, Score
Alpha, 80.2%
Beta, 91.3%
Average, 85.75%
\end{filecontents*}

\begin{document}

\DTLloadrawdb{scoresA}{scores.csv}
\DTLdisplaydb{scoresA}

\DTLrawmap{\%}{\$}% Map % to \$
\DTLloadrawdb{scoresB}{scores.csv}
\DTLdisplaydb{scoresB}

\end{document}

로부터datatool 사용자 설명서:

당연히 매핑을 설정해야 합니다.이전의를 사용하여 데이터를 로드합니다 \DTLloadrawdb.

관련 정보