latex 代码调整

This commit is contained in:
chengxl
2026-01-21 13:10:31 +08:00
parent f954c4b772
commit 06308bc319

View File

@@ -7,7 +7,7 @@ use app\common\LatexTable;
*/
class LatexContent{
//期刊相关的信息
private $iYear = 2025;//年
private $iYear = 2026;//年
private $iPeriod = 1;//期
private $sAbbr = 'tmr';//期刊缩写
private $sWebsite = 'https://www.tmrjournals.com/tmr';//期刊官网
@@ -48,7 +48,7 @@ page={{stage_page}},%号
\usepackage[backend=biber]{biblatex}
\usepackage{xcolor}
\usepackage{tabularray}
\addbibresource{references_{{p_article_id}}.bib}
\addbibresource{references_{{article_id}}.bib}
\definecolor{evenRowColor}{RGB}{250,231,232}
\title{{{article_title}}}
@@ -203,7 +203,7 @@ page={{stage_page}},%号
// }
//下载图片
$sImagePath = trim($this->sSubmissionUrl,'/').$this->sArticleIcon.'/'.$sIcon;
$aImageInfo = $this->getImage($sImagePath,$aProductionArticle['p_article_id']);
$aImageInfo = $this->getImage($sImagePath,$aProductionArticle['article_id']);
if(!empty($aImageInfo['data'])){
$aImageInfo['data'] = './image/'.basename($aImageInfo['data']);
$sIcon = '\KeywordImage{'.$aImageInfo['data'].'}';
@@ -213,8 +213,8 @@ page={{stage_page}},%号
}
$aSearch['{{article_icon}}'] = $sIcon;
$aSearch['{{keywords}}'] = $sKeywords;
$aSearch['{{CLSFILEURL}}'] = ROOT_PATH.'public/latex/cls';
$aSearch['{{p_article_id}}'] = $aProductionArticle['p_article_id'];
// $aSearch['{{CLSFILEURL}}'] = ROOT_PATH.'public/latex/cls';
$aSearch['{{article_id}}'] = $aProductionArticle['article_id'];
//模版内容替换
$sTemplateInfo = str_replace(array_keys($aSearch), array_values($aSearch), $sTemplateInfo);
//返回内容
@@ -253,7 +253,6 @@ page={{stage_page}},%号
$aSearch['{{tmr_highlight}}'] = empty($sHighlight) ? '' : '\begin{highlight}'."\n".$sHighlight."\n".'\end{highlight}'."\n";
//查询正文信息
// $aProductionArticle['article_id'] = 4477;
$aWhere = ['article_id' => $aProductionArticle['article_id'],'state' => 0];
$aArticleMain = Db::name('article_main')->field('am_id,article_id,type,content,ami_id,amt_id,is_h1,is_h2,is_h3,sort')->where($aWhere)->order('sort')->select();
if(!empty($aArticleMain)){
@@ -266,10 +265,12 @@ page={{stage_page}},%号
//查询表格
$aAmtId = array_unique(array_column($aArticleMain, 'amt_id'));
$aWhere = ['amt_id' => ['in',$aAmtId],'state' => 0];
$aArticleMainTable = Db::name('article_main_table')->where($aWhere)->select();
$aArticleMainTable = Db::name('article_main_table')->field('amt_id,type,table_data,url,title,note')->where($aWhere)->select();
$aArticleMainTable = empty($aArticleMainTable) ? [] : array_column($aArticleMainTable, null,'amt_id');
//获取图片模版
$sImageTempalte = $this->sImageTempalte;
//长表格ID
$aLongTableId = [];
//数据处理
$iStart = 0;
$sMain = '';
@@ -339,6 +340,13 @@ page={{stage_page}},%号
continue;
}
$sTableInfo = $oProduction->tableCovertLatex($value['amt_id'],$aReferences,$aTableInfo);
if($sTableInfo == 'JSON error'){
continue;
}
if($sTableInfo == 'long table'){
$aLongTableId[] = $value['amt_id'];
continue;
}
$sMain .= $sTableInfo."\\par\n";
}
}
@@ -350,7 +358,7 @@ page={{stage_page}},%号
//模版内容替换
$sTemplateInfo = str_replace(array_keys($aSearch), array_values($aSearch), $sTemplateInfo);
//返回内容
return ['status' => 1,'msg' => 'success','data' => $sTemplateInfo];
return ['status' => 1,'msg' => 'success','data' => $sTemplateInfo,'long_table_id' => $aLongTableId];
}
/**
* 生成初稿-作者信息
@@ -608,9 +616,6 @@ page={{stage_page}},%号
return ['status' => 1,'msg' => 'success','data' => $sImagePath];
}
/**
* @title curl 图片Latex代码封装
*/
/**
* @title curl 图片Latex代码封装
*/