LyX가 mathcha.io로 만든 이미지를 컴파일하고 렌더링하려면 어떤 패키지를 사용해야 합니까?

LyX가 mathcha.io로 만든 이미지를 컴파일하고 렌더링하려면 어떤 패키지를 사용해야 합니까?

저는 LyX를 사용하고 있는데 최근 mathcha.io를 사용하면 쉽게 생성할 수 있는 이미지와 플롯을 tikz 코드로 변환할 수 있다는 사실을 알게 되었습니다.

사용해 보았지만 컴파일할 때 특정 내용만 표시되었습니다. 예를 들어 일부 논리 게이트 회로를 렌더링하지만 플롯(2D, 3D 등...)을 로드하지 않습니다. (이를 얻으려면 mathcha.io에 추가하겠습니다. 먼저 다이어그램/도면을 입력해야 합니다. 따라서 일부 패키지가 누락된 것 같습니다. 다음은 LyX의 TeX 코드 환경 내에서 작동하지만 렌더링되지 않는 mathcha.io에서 생성된 코드의 예입니다.

\tikzset{every picture/.style={line width=0.75pt}} %set default line width to 0.75pt        
\begin{tikzpicture}[x=0.75pt,y=0.75pt,yscale=-1,xscale=1] %uncomment if require: 
\path (0,300); %set diagram left start at 0, and has height of 300
\end{tikzpicture} 

다음은 올바르게 렌더링되는 코드의 예입니다(LyX 문서와 같이 정확한 위치에 배치하는 쉬운 방법은 모르지만).

\tikzset{every picture/.style={line width=0.75pt}} %set default line width to 0.75pt        
\begin{tikzpicture}[x=0.75pt,y=0.75pt,yscale=-1,xscale=1] %uncomment if require: \path (0,300); %set diagram left start at 0, and has height of 300
%Shape: Axis 2D [id:dp7108345265772975]  
\draw  (50,162) -- (150,162)(60,72) -- (60,172) (143,157) -- (150,162) -- (143,167) (55,79) -- (60,72) -- (65,79)  ; 
%Shape: Parabola [id:dp7278250032221381]  
\draw   (25,122) .. controls (48.33,175.33) and (71.67,175.33) .. (95,122) ; 
%Shape: Wave [id:dp767344400003916]  
\draw   (164.99,135.62) .. controls (161.1,125.31) and (157.38,115.48) .. (152.85,115.4) .. controls (148.33,115.32) and (144.26,125.01) .. (140,135.18) .. controls (135.74,145.35) and (131.67,155.03) .. (127.14,154.95) .. controls (122.62,154.87) and (118.9,145.05) .. (115,134.73) .. controls (111.11,124.42) and (107.38,114.59) .. (102.86,114.51) .. controls (100.2,114.47) and (97.69,117.8) .. (95.21,122.62) ;
\end{tikzpicture} 

나는 mathcha.io의 플롯이 웹사이트 자체를 통해서만 액세스할 수 있는 어떤 방식을 사용하여 생성되었다고 가정합니다. 따라서 Tikz 코드를 복사하려고 하면 내부에 있어야 했던 모든 정보가 손실됩니다.

답변1

\usepackage{tikz}서문에는 한 가지 방법 또는 다른 방법이 있어야 합니다 .

먼저 LaTeX 코드를 살펴보겠습니다. 다음과 같이 두 개의 코드를 복사하면:

\documentclass[10pt,border=3mm,tikz]{standalone}

\begin{document}

\tikzset{every picture/.style={line width=0.75pt}} %set default line width to 0.75pt        
\begin{tikzpicture}[x=0.75pt,y=0.75pt,yscale=-1,xscale=1] %uncomment if require: 
\path (0,300); %set diagram left start at 0, and has height of 300
\end{tikzpicture} 

\tikzset{every picture/.style={line width=0.75pt}} %set default line width to 0.75pt        
\begin{tikzpicture}[x=0.75pt,y=0.75pt,yscale=-1,xscale=1] %uncomment if require: \path (0,300); %set diagram left start at 0, and has height of 300
%Shape: Axis 2D [id:dp7108345265772975]  
\draw  (50,162) -- (150,162)(60,72) -- (60,172) (143,157) -- (150,162) -- (143,167) (55,79) -- (60,72) -- (65,79)  ; 
%Shape: Parabola [id:dp7278250032221381]  
\draw   (25,122) .. controls (48.33,175.33) and (71.67,175.33) .. (95,122) ; 
%Shape: Wave [id:dp767344400003916]  
\draw   (164.99,135.62) .. controls (161.1,125.31) and (157.38,115.48) .. (152.85,115.4) .. controls (148.33,115.32) and (144.26,125.01) .. (140,135.18) .. controls (135.74,145.35) and (131.67,155.03) .. (127.14,154.95) .. controls (122.62,154.87) and (118.9,145.05) .. (115,134.73) .. controls (111.11,124.42) and (107.38,114.59) .. (102.86,114.51) .. controls (100.2,114.47) and (97.69,117.8) .. (95.21,122.62) ;
\end{tikzpicture} 

\end{document}

다음을 렌더링합니다.

  • 수업 standalone은 당 하나의 "페이지"를 넣습니다.tikzpicture
  • 첫 번째 것은 기본적으로 ... 포인트를 포함합니다\path (0,300);
  • 두 번째는 충분히 괜찮아 보이지만

결과

대조적으로 LyX는 이 코드에서 좀 더 완고한 것 같습니다:

  • Documents / Settings / Preamble: \usepackage{tikz}거기에 추가하세요
  • 두 번째 코드를 빨간색 상자에 복사하면 미리보기가 올바르게 렌더링되지 않았습니다.
  • \draw알고 보니 주석 처리된 명령문을 수동으로 "자유롭게" 하기 위해 반환값을 입력해야 했습니다 (??? LyX ...)

불행히도 컴파일할 수는 없지만 참고용으로 여기 있습니다.

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

Lyx 파일: ASCII 편집기에 복사하고, 저장하고, 로드하면 해당 위치에서 컴파일됩니다.

#LyX 2.3 created this file. For more info see http://www.lyx.org/
\lyxformat 544
\begin_document
\begin_header
\save_transient_properties true
\origin unavailable
\textclass article
\begin_preamble
\usepackage{tikz}
\end_preamble
\use_default_options true
\maintain_unincluded_children false
\language english
\language_package default
\inputencoding auto
\fontencoding global
\font_roman "default" "default"
\font_sans "default" "default"
\font_typewriter "default" "default"
\font_math "auto" "auto"
\font_default_family default
\use_non_tex_fonts false
\font_sc false
\font_osf false
\font_sf_scale 100 100
\font_tt_scale 100 100
\use_microtype false
\use_dash_ligatures true
\graphics default
\default_output_format default
\output_sync 0
\bibtex_command default
\index_command default
\paperfontsize default
\spacing single
\use_hyperref false
\papersize default
\use_geometry false
\use_package amsmath 1
\use_package amssymb 1
\use_package cancel 1
\use_package esint 1
\use_package mathdots 1
\use_package mathtools 1
\use_package mhchem 1
\use_package stackrel 1
\use_package stmaryrd 1
\use_package undertilde 1
\cite_engine basic
\cite_engine_type default
\biblio_style plain
\use_bibtopic false
\use_indices false
\paperorientation portrait
\suppress_date false
\justification true
\use_refstyle 1
\use_minted 0
\index Index
\shortcut idx
\color #008000
\end_index
\secnumdepth 3
\tocdepth 3
\paragraph_separation indent
\paragraph_indentation default
\is_math_indent 0
\math_numbering_side default
\quotes_style english
\dynamic_quotes 0
\papercolumns 1
\papersides 1
\paperpagestyle default
\tracking_changes false
\output_changes false
\html_math_output 0
\html_css_as_file 0
\html_be_strict false
\end_header

\begin_body

\begin_layout Standard
\begin_inset ERT
status open

\begin_layout Plain Layout


\backslash
tikzset{every picture/.style={line width=0.75pt}} %set default line width
 to 0.75pt         
\end_layout

\end_inset


\end_layout

\begin_layout Standard
\begin_inset ERT
status open

\begin_layout Plain Layout


\backslash
begin{tikzpicture}[x=0.75pt,y=0.75pt,yscale=-1,xscale=1] %uncomment if require:
 
\backslash
path (0,300); %set diagram left start at 0, and has height of 300 %Shape:
 Axis 2D [id:dp7108345265772975]   
\end_layout

\begin_layout Plain Layout

\end_layout

\begin_layout Plain Layout


\backslash
draw  (50,162) -- (150,162)(60,72) -- (60,172) (143,157) -- (150,162) --
 (143,167) (55,79) -- (60,72) -- (65,79)  ;  %Shape: Parabola [id:dp727825003222
1381]   
\end_layout

\begin_layout Plain Layout

\end_layout

\begin_layout Plain Layout


\backslash
draw   (25,122) ..
 controls (48.33,175.33) and (71.67,175.33) ..
 (95,122) ;  %Shape: Wave [id:dp767344400003916]   
\backslash
draw   (164.99,135.62) ..
 controls (161.1,125.31) and (157.38,115.48) ..
 (152.85,115.4) ..
 controls (148.33,115.32) and (144.26,125.01) ..
 (140,135.18) ..
 controls (135.74,145.35) and (131.67,155.03) ..
 (127.14,154.95) ..
 controls (122.62,154.87) and (118.9,145.05) ..
 (115,134.73) ..
 controls (111.11,124.42) and (107.38,114.59) ..
 (102.86,114.51) ..
 controls (100.2,114.47) and (97.69,117.8) ..
 (95.21,122.62) ; 
\end_layout

\begin_layout Plain Layout


\backslash
end{tikzpicture} 
\end_layout

\end_inset


\end_layout

\end_body
\end_document

관련 정보